diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-12-11 16:30:01 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-12-11 16:30:01 -0500 |
| commit | 9b17c0ff7fa7a3981697f4239afb5c66c609cd42 (patch) | |
| tree | 96c2ae36609632900b8342387b181cecec31a6e1 /src/ir_print.cpp | |
| parent | 3429639e848a9ffa9ff9fbd940d3fc2d348e10e7 (diff) | |
| download | zig-9b17c0ff7fa7a3981697f4239afb5c66c609cd42.tar.gz zig-9b17c0ff7fa7a3981697f4239afb5c66c609cd42.zip | |
IR: implement intType builtin
and int type field access
and fix compile time bool not
Diffstat (limited to 'src/ir_print.cpp')
| -rw-r--r-- | src/ir_print.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 3226e04ad3..b4bb0ee7c6 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -279,8 +279,6 @@ static const char *ir_un_op_id_str(IrUnOp op_id) { switch (op_id) { case IrUnOpInvalid: zig_unreachable(); - case IrUnOpBoolNot: - return "!"; case IrUnOpBinNot: return "~"; case IrUnOpNegation: @@ -755,6 +753,19 @@ static void ir_print_truncate(IrPrint *irp, IrInstructionTruncate *instruction) fprintf(irp->f, ")"); } +static void ir_print_int_type(IrPrint *irp, IrInstructionIntType *instruction) { + fprintf(irp->f, "@intType("); + ir_print_other_instruction(irp, instruction->is_signed); + fprintf(irp->f, ", "); + ir_print_other_instruction(irp, instruction->bit_count); + fprintf(irp->f, ")"); +} + +static void ir_print_bool_not(IrPrint *irp, IrInstructionBoolNot *instruction) { + 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) { @@ -931,6 +942,12 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { case IrInstructionIdTruncate: ir_print_truncate(irp, (IrInstructionTruncate *)instruction); break; + case IrInstructionIdIntType: + ir_print_int_type(irp, (IrInstructionIntType *)instruction); + break; + case IrInstructionIdBoolNot: + ir_print_bool_not(irp, (IrInstructionBoolNot *)instruction); + break; } fprintf(irp->f, "\n"); } |
