aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index b5f5a16983..8365aec050 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -849,6 +849,13 @@ static void ir_print_set_global_section(IrPrint *irp, IrInstructionSetGlobalSect
fprintf(irp->f, ")");
}
+static void ir_print_decl_ref(IrPrint *irp, IrInstructionDeclRef *instruction) {
+ const char *ptr_str = instruction->lval.is_ptr ? "ptr " : "";
+ const char *const_str = instruction->lval.is_const ? "const " : "";
+ const char *volatile_str = instruction->lval.is_volatile ? "volatile " : "";
+ fprintf(irp->f, "declref %s%s%s%s", const_str, volatile_str, ptr_str, buf_ptr(instruction->tld->name));
+}
+
static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
ir_print_prefix(irp, instruction);
switch (instruction->id) {
@@ -1121,6 +1128,9 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
case IrInstructionIdSetGlobalSection:
ir_print_set_global_section(irp, (IrInstructionSetGlobalSection *)instruction);
break;
+ case IrInstructionIdDeclRef:
+ ir_print_decl_ref(irp, (IrInstructionDeclRef *)instruction);
+ break;
}
fprintf(irp->f, "\n");
}