diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-06-25 22:15:30 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-06-25 22:15:30 +0100 |
| commit | 1ced92be473ef6f1c6aa0058bcf89c4ded684379 (patch) | |
| tree | a111c9aae3b74619b3cf27a2a17ebed0100af7f5 /src/ir_print.cpp | |
| parent | 15dbea6899fd1e918f4ea0dc91045e0dc460657e (diff) | |
Rudimentary para-poly procedures
Diffstat (limited to 'src/ir_print.cpp')
| -rw-r--r-- | src/ir_print.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 29d9fac7d..195e61e84 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -1280,6 +1280,7 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) { } + isize param_index = 0; if (call->arg_count > 0) { TypeTuple *params = &proc_type->Proc.params->Tuple; if (proc_type->Proc.c_vararg) { @@ -1287,8 +1288,9 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) { for (; i < params->variable_count-1; i++) { Entity *e = params->variables[i]; GB_ASSERT(e != NULL); + if (e->kind != Entity_Variable) continue; Type *t = proc_type->Proc.abi_compat_params[i]; - if (i > 0) { + if (param_index > 0) { ir_fprintf(f, ", "); } ir_print_type(f, m, t); @@ -1298,9 +1300,10 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) { ir_fprintf(f, " "); irValue *arg = call->args[i]; ir_print_value(f, m, arg, t); + param_index++; } for (; i < call->arg_count; i++) { - if (i > 0) { + if (param_index > 0) { ir_fprintf(f, ", "); } @@ -1309,6 +1312,7 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) { ir_print_type(f, m, t); ir_fprintf(f, " "); ir_print_value(f, m, arg, t); + param_index++; } } else { GB_ASSERT(call->arg_count == params->variable_count); @@ -1316,9 +1320,10 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) { for (isize i = 0; i < param_count; i++) { Entity *e = params->variables[i]; GB_ASSERT(e != NULL); + if (e->kind != Entity_Variable) continue; irValue *arg = call->args[i]; Type *t = proc_type->Proc.abi_compat_params[i]; - if (i > 0) { + if (param_index > 0) { ir_fprintf(f, ", "); } ir_print_type(f, m, t); @@ -1327,11 +1332,12 @@ void ir_print_instr(irFileBuffer *f, irModule *m, irValue *value) { } ir_fprintf(f, " "); ir_print_value(f, m, arg, t); + param_index++; } } } if (proc_type->Proc.calling_convention == ProcCC_Odin) { - if (proc_type->Proc.param_count > 0) { + if (param_index > 0) { ir_fprintf(f, ", "); } ir_print_type(f, m, t_context_ptr); |