diff options
Diffstat (limited to 'src/ir_print.cpp')
| -rw-r--r-- | src/ir_print.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp index c65334d0d7..fffe33588a 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -497,6 +497,20 @@ static void ir_print_size_of(IrPrint *irp, IrInstructionSizeOf *instruction) { fprintf(irp->f, ")"); } +static void ir_print_test_null(IrPrint *irp, IrInstructionTestNull *instruction) { + fprintf(irp->f, "*"); + ir_print_other_instruction(irp, instruction->value); + fprintf(irp->f, " == null"); +} + +static void ir_print_unwrap_maybe(IrPrint *irp, IrInstructionUnwrapMaybe *instruction) { + fprintf(irp->f, "&??*"); + ir_print_other_instruction(irp, instruction->value); + if (!instruction->safety_check_on) { + fprintf(irp->f, " // no safety"); + } +} + static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { ir_print_prefix(irp, instruction); switch (instruction->id) { @@ -592,6 +606,12 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { case IrInstructionIdSizeOf: ir_print_size_of(irp, (IrInstructionSizeOf *)instruction); break; + case IrInstructionIdTestNull: + ir_print_test_null(irp, (IrInstructionTestNull *)instruction); + break; + case IrInstructionIdUnwrapMaybe: + ir_print_unwrap_maybe(irp, (IrInstructionUnwrapMaybe *)instruction); + break; case IrInstructionIdSwitchBr: zig_panic("TODO print more IR instructions"); } |
