aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-10-23 01:33:23 -0400
committerAndrew Kelley <superjoe30@gmail.com>2016-10-23 01:33:23 -0400
commit44d6f8ffd8eac02747fa0f915b925bb2112570dd (patch)
treec639d5e548cf25e01255226821dc0245509e71de /src/ir_print.cpp
parentd7a2b05a813a7badf0606726c9a4b1423befd437 (diff)
downloadzig-44d6f8ffd8eac02747fa0f915b925bb2112570dd.tar.gz
zig-44d6f8ffd8eac02747fa0f915b925bb2112570dd.zip
IR supports variable assignment
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index 7c334a4c0c..ffc06d841d 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -326,6 +326,13 @@ static void ir_print_load_ptr(IrPrint *irp, IrInstructionLoadPtr *instruction) {
ir_print_other_instruction(irp, instruction->ptr);
}
+static void ir_print_store_ptr(IrPrint *irp, IrInstructionStorePtr *instruction) {
+ fprintf(irp->f, "*");
+ ir_print_other_instruction(irp, instruction->ptr);
+ fprintf(irp->f, " = ");
+ ir_print_other_instruction(irp, instruction->value);
+}
+
static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
ir_print_prefix(irp, instruction);
switch (instruction->id) {
@@ -382,8 +389,10 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
case IrInstructionIdLoadPtr:
ir_print_load_ptr(irp, (IrInstructionLoadPtr *)instruction);
break;
- case IrInstructionIdSwitchBr:
case IrInstructionIdStorePtr:
+ ir_print_store_ptr(irp, (IrInstructionStorePtr *)instruction);
+ break;
+ case IrInstructionIdSwitchBr:
case IrInstructionIdFieldPtr:
zig_panic("TODO print more IR instructions");
}