From 3429639e848a9ffa9ff9fbd940d3fc2d348e10e7 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 11 Dec 2016 15:31:07 -0500 Subject: IR: implement truncate builtin --- src/ir_print.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/ir_print.cpp') diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 0019753123..3226e04ad3 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -747,6 +747,14 @@ static void ir_print_div_exact(IrPrint *irp, IrInstructionDivExact *instruction) fprintf(irp->f, ")"); } +static void ir_print_truncate(IrPrint *irp, IrInstructionTruncate *instruction) { + fprintf(irp->f, "@truncate("); + ir_print_other_instruction(irp, instruction->dest_type); + fprintf(irp->f, ", "); + ir_print_other_instruction(irp, instruction->target); + fprintf(irp->f, ")"); +} + static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { ir_print_prefix(irp, instruction); switch (instruction->id) { @@ -920,6 +928,9 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { case IrInstructionIdDivExact: ir_print_div_exact(irp, (IrInstructionDivExact *)instruction); break; + case IrInstructionIdTruncate: + ir_print_truncate(irp, (IrInstructionTruncate *)instruction); + break; } fprintf(irp->f, "\n"); } -- cgit v1.2.3