diff options
| author | gingerBill <bill@gingerbill.org> | 2020-01-12 13:53:57 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-01-12 13:53:57 +0000 |
| commit | f0c6f29f829b2ec2dda7e54d2a630f574c28dd72 (patch) | |
| tree | 71965fc8c5494c7fa75cf5057f17fc43373a5d52 | |
| parent | 7d9a9a2283c6c0cbd1e1034b2496d4898335beb0 (diff) | |
| parent | ba85e432e77eec502a00a0bfc3c4b8b30dfb8f32 (diff) | |
Merge branch 'master' of https://github.com/odin-lang/Odin
| -rw-r--r-- | src/ir.cpp | 1 | ||||
| -rw-r--r-- | src/ir_print.cpp | 63 | ||||
| -rw-r--r-- | src/types.cpp | 2 |
3 files changed, 51 insertions, 15 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 8af0b85bd..de7bfef82 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -1713,6 +1713,7 @@ irValue *ir_add_local(irProcedure *proc, Entity *e, Ast *expr, bool zero_initial if (zero_initialized) { ir_emit_zero_init(proc, instr, expr); } + set_procedure_abi_types(heap_allocator(), e->type); // if (proc->module->generate_debug_info && expr != nullptr && proc->entity != nullptr) { // if (proc->module->generate_debug_info && proc->entity != nullptr) { diff --git a/src/ir_print.cpp b/src/ir_print.cpp index f3840fce8..2baf1c2a0 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -354,7 +354,22 @@ void ir_print_proc_type_without_pointer(irFileBuffer *f, irModule *m, Type *t) { if (i+1 == param_count && t->Proc.c_vararg) { ir_write_string(f, str_lit("...")); } else { - ir_print_type(f, m, t->Proc.abi_compat_params[i]); + Type *et = t->Proc.abi_compat_params[i]; + if (is_type_tuple(et)) { + for_array(j, et->Tuple.variables) { + if (j > 0) ir_write_str_lit(f, ", "); + + ir_print_type(f, m, et->Tuple.variables[j]->type); + if (e->flags&EntityFlag_NoAlias) { + ir_write_str_lit(f, " noalias"); + } + ir_write_byte(f, ' '); + param_index++; + } + continue; + } else { + ir_print_type(f, m, et); + } } param_index++; @@ -2111,30 +2126,50 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) { TypeTuple *params = &proc_type->Proc.params->Tuple; if (proc_type->Proc.c_vararg) { isize i = 0; + isize arg_index = 0; for (; i < params->variables.count-1; i++) { Entity *e = params->variables[i]; GB_ASSERT(e != nullptr); - if (e->kind != Entity_Variable) continue; + if (e->kind != Entity_Variable) { + arg_index++; + continue; + } if (param_index > 0) ir_write_str_lit(f, ", "); Type *t = proc_type->Proc.abi_compat_params[i]; - ir_print_type(f, m, t); - if (e->flags&EntityFlag_NoAlias) { - ir_write_str_lit(f, " noalias"); - } - if (e->flags&EntityFlag_ImplicitReference) { - ir_write_str_lit(f, " nonnull dereferenceable"); + if (is_type_tuple(t)) { + for_array(j, t->Tuple.variables) { + if (j > 0) ir_write_str_lit(f, ", "); + + irValue *arg = call->args[arg_index++]; + + ir_print_type(f, m, t->Tuple.variables[j]->type); + if (e->flags&EntityFlag_NoAlias) { + ir_write_str_lit(f, " noalias"); + } + ir_write_byte(f, ' '); + ir_print_value(f, m, arg, t); + param_index++; + } + } else { + ir_print_type(f, m, t); + if (e->flags&EntityFlag_NoAlias) { + ir_write_str_lit(f, " noalias"); + } + if (e->flags&EntityFlag_ImplicitReference) { + ir_write_str_lit(f, " nonnull dereferenceable"); + } + ir_write_byte(f, ' '); + irValue *arg = call->args[arg_index++]; + ir_print_value(f, m, arg, t); + param_index++; } - ir_write_byte(f, ' '); - irValue *arg = call->args[i]; - ir_print_value(f, m, arg, t); - param_index++; } - for (; i < call->args.count; i++) { + while (arg_index < call->args.count) { if (param_index > 0) ir_write_str_lit(f, ", "); - irValue *arg = call->args[i]; + irValue *arg = call->args[arg_index]; Type *t = ir_type(arg); ir_print_type(f, m, t); ir_write_byte(f, ' '); diff --git a/src/types.cpp b/src/types.cpp index b4d42d67a..cf8e603ba 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -3394,7 +3394,7 @@ gbString write_type_to_string(gbString str, Type *type) { case Type_SimdVector: if (type->SimdVector.is_x86_mmx) { - return "intrinsics.x86_mmx"; + return gb_string_appendc(str, "intrinsics.x86_mmx"); } else { str = gb_string_append_fmt(str, "#simd[%d]", cast(int)type->SimdVector.count); str = write_type_to_string(str, type->SimdVector.elem); |