diff options
| author | gingerBill <bill@gingerbill.org> | 2019-11-03 00:32:22 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-11-03 00:32:22 +0000 |
| commit | ebf7926fa495a7a2d400f44beb4c27888bda33e5 (patch) | |
| tree | 231fe45243a069904c98c03acae05751625d7f71 /src/ir.cpp | |
| parent | dfb3101ecf59797884cb959b3bfeda49ccfa3223 (diff) | |
SOA support of Structures and Arrays; Runtime information for SOA structs; fmt printing support for SOA structs
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 74ddaf262..fb10e946f 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -4553,6 +4553,8 @@ irValue *ir_emit_struct_ep(irProcedure *proc, irValue *s, i32 index) { case 0: result_type = alloc_type_pointer(gst->Struct.fields[0]->type); break; case 1: result_type = alloc_type_pointer(gst->Struct.fields[1]->type); break; } + } else if (is_type_array(t)) { + return ir_emit_array_epi(proc, s, index); } else { GB_PANIC("TODO(bill): struct_gep type: %s, %d", type_to_string(ir_type(s)), index); } @@ -4632,15 +4634,20 @@ irValue *ir_emit_struct_ev(irProcedure *proc, irValue *s, i32 index) { } break; - case Type_Map: { - init_map_internal_types(t); - Type *gst = t->Map.generated_struct_type; - switch (index) { - case 0: result_type = gst->Struct.fields[0]->type; break; - case 1: result_type = gst->Struct.fields[1]->type; break; + case Type_Map: + { + init_map_internal_types(t); + Type *gst = t->Map.generated_struct_type; + switch (index) { + case 0: result_type = gst->Struct.fields[0]->type; break; + case 1: result_type = gst->Struct.fields[1]->type; break; + } } break; - } + + case Type_Array: + result_type = t->Array.elem; + break; default: GB_PANIC("TODO(bill): struct_ev type: %s, %d", type_to_string(ir_type(s)), index); @@ -10849,6 +10856,13 @@ void ir_setup_type_info_data(irProcedure *proc) { // NOTE(bill): Setup type_info ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 5), is_packed); ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 6), is_raw_union); ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 7), is_custom_align); + + if (t->Struct.is_soa) { + irValue *soa_type = ir_type_info(proc, t->Struct.soa_elem); + irValue *soa_len = ir_const_int(t->Struct.soa_count); + ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 8), soa_type); + ir_emit_store(proc, ir_emit_struct_ep(proc, tag, 9), soa_len); + } } isize count = t->Struct.fields.count; |