aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-11-07 18:58:01 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-11-07 18:58:01 -0500
commit05de70017d8bf15a37f1d1be4e23f5d3f3f9b146 (patch)
tree434ef9d14ed874f72231ccd734d8d618ca91affb /src/ir_print.cpp
parenta2e32939305e470ce3d32c9d2667d3083158ddb3 (diff)
downloadzig-05de70017d8bf15a37f1d1be4e23f5d3f3f9b146.tar.gz
zig-05de70017d8bf15a37f1d1be4e23f5d3f3f9b146.zip
IR: support slice types
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index 5a0f33b317..f3d030519e 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -394,6 +394,19 @@ static void ir_print_set_fn_test(IrPrint *irp, IrInstructionSetFnTest *instructi
fprintf(irp->f, ")");
}
+static void ir_print_array_type(IrPrint *irp, IrInstructionArrayType *instruction) {
+ fprintf(irp->f, "[");
+ ir_print_other_instruction(irp, instruction->size);
+ fprintf(irp->f, "]");
+ ir_print_other_instruction(irp, instruction->child_type);
+}
+
+static void ir_print_slice_type(IrPrint *irp, IrInstructionSliceType *instruction) {
+ const char *const_kw = instruction->is_const ? "const " : "";
+ fprintf(irp->f, "[]%s", const_kw);
+ ir_print_other_instruction(irp, instruction->child_type);
+}
+
static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
ir_print_prefix(irp, instruction);
switch (instruction->id) {
@@ -471,6 +484,12 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
case IrInstructionIdSetFnTest:
ir_print_set_fn_test(irp, (IrInstructionSetFnTest *)instruction);
break;
+ case IrInstructionIdArrayType:
+ ir_print_array_type(irp, (IrInstructionArrayType *)instruction);
+ break;
+ case IrInstructionIdSliceType:
+ ir_print_slice_type(irp, (IrInstructionSliceType *)instruction);
+ break;
case IrInstructionIdSwitchBr:
zig_panic("TODO print more IR instructions");
}