Planning for multi-valued expressions in the tilde backend

This commit is contained in:
gingerBill
2023-07-17 23:16:50 +01:00
parent 988926b59d
commit 55733171c1
5 changed files with 45 additions and 5 deletions

View File

@@ -333,7 +333,7 @@ gb_internal cgProcedure *cg_procedure_create(cgModule *m, Entity *entity, bool i
size_t out_param_count = 0;
p->debug_type = cg_debug_type_for_proc(m, p->type);
TB_Node **params = tb_function_set_prototype_from_dbg(p->func, p->debug_type, arena, &out_param_count);
gb_unused(params);
p->param_nodes = {params, cast(isize)out_param_count};
p->proto = tb_function_get_prototype(p->func);
p->symbol = cast(TB_Symbol *)p->func;
@@ -387,7 +387,7 @@ gb_internal cgProcedure *cg_procedure_create_dummy(cgModule *m, String const &li
size_t out_param_count = 0;
p->debug_type = cg_debug_type_for_proc(m, p->type);
TB_Node **params = tb_function_set_prototype_from_dbg(p->func, p->debug_type, arena, &out_param_count);
gb_unused(params);
p->param_nodes = {params, cast(isize)out_param_count};
p->proto = tb_function_get_prototype(p->func);
@@ -420,12 +420,11 @@ gb_internal void cg_procedure_begin(cgProcedure *p) {
continue;
}
if (param_index >= p->proto->param_count) {
if (param_index >= p->param_nodes.count) {
break;
}
// TB_Node *ptr = tb_inst_param_addr(p->func, param_index);
TB_Node *param = tb_inst_param(p->func, param_index++);
TB_Node *param = p->param_nodes[param_index++];
TB_Node *ptr = tb_inst_local(p->func, cast(TB_CharUnits)type_size_of(e->type), cast(TB_CharUnits)type_align_of(e->type));
TB_DataType dt = cg_data_type(e->type);
tb_inst_store(p->func, dt, ptr, param, cast(TB_CharUnits)type_align_of(e->type), false);