aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-12-11 15:31:07 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-12-11 15:31:07 -0500
commit3429639e848a9ffa9ff9fbd940d3fc2d348e10e7 (patch)
tree67ff12dd3c9a578d443f46be232db38b49b08b7f /src/ir_print.cpp
parent433c17aeb192740053b1b9aea6220dca760303e2 (diff)
downloadzig-3429639e848a9ffa9ff9fbd940d3fc2d348e10e7.tar.gz
zig-3429639e848a9ffa9ff9fbd940d3fc2d348e10e7.zip
IR: implement truncate builtin
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp11
1 files changed, 11 insertions, 0 deletions
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");
}