From 9b58781122aaed23f3952eff6ba749e62a04a2ae Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 21 Nov 2019 19:36:07 +0000 Subject: #soa[dynamic]Type (Experimental) --- src/ir.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/ir.cpp') 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); -- cgit v1.2.3