diff options
| author | gingerBill <bill@gingerbill.org> | 2019-11-21 19:36:07 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-11-21 19:36:07 +0000 |
| commit | 9b58781122aaed23f3952eff6ba749e62a04a2ae (patch) | |
| tree | 823b1cc1d758c1ad93e2497f40cf490b7da3efdd /src/ir.cpp | |
| parent | b74f8f204776c7cacc22fcbb44898ea496e02645 (diff) | |
#soa[dynamic]Type (Experimental)
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 89f570659..877979c4f 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -8011,8 +8011,19 @@ irAddr ir_build_addr(irProcedure *proc, Ast *expr) { irValue *new_len = ir_emit_arith(proc, Token_Sub, high, low, t_int); ir_emit_store(proc, len_dst, new_len); } - } else { - GB_PANIC("TODO #soa[dynamic]T"); + } else if (type->Struct.soa_kind == StructSoa_Dynamic) { + i32 field_count = cast(i32)type->Struct.fields.count - 3; + for (i32 i = 0; i < field_count; i++) { + irValue *field_dst = ir_emit_struct_ep(proc, dst, i); + irValue *field_src = ir_emit_struct_ev(proc, base, i); + field_src = ir_emit_ptr_offset(proc, field_src, low); + ir_emit_store(proc, field_dst, field_src); + } + + + irValue *len_dst = ir_emit_struct_ep(proc, dst, field_count); + irValue *new_len = ir_emit_arith(proc, Token_Sub, high, low, t_int); + ir_emit_store(proc, len_dst, new_len); } return ir_addr(dst); |