From 7d0fb281fee16d9c99f61c5bce090018228ae6df Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 8 Dec 2016 01:52:57 -0500 Subject: IR: a bunch of fixes and some additions * add errorName builtin function * add assertion for generated memcopy being on correct types * respect handle_is_ptr for constant values * fix return codegen to respect sret semantics * remove ArrayLen IR instruction; we already have StructFieldPtr with "len" field * fix gen_const_val for pointers inside aggregates --- src/ir_print.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/ir_print.cpp') diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 69df7d42cf..55ae7d3143 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -676,6 +676,12 @@ static void ir_print_compile_err(IrPrint *irp, IrInstructionCompileErr *instruct fprintf(irp->f, ")"); } +static void ir_print_err_name(IrPrint *irp, IrInstructionErrName *instruction) { + fprintf(irp->f, "@errorName("); + ir_print_other_instruction(irp, instruction->value); + fprintf(irp->f, ")"); +} + static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { ir_print_prefix(irp, instruction); switch (instruction->id) { @@ -822,6 +828,9 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { case IrInstructionIdCompileErr: ir_print_compile_err(irp, (IrInstructionCompileErr *)instruction); break; + case IrInstructionIdErrName: + ir_print_err_name(irp, (IrInstructionErrName *)instruction); + break; } fprintf(irp->f, "\n"); } -- cgit v1.2.3