From 5234016561ab4a771e908fdff78b2871850626c6 Mon Sep 17 00:00:00 2001 From: Raul Leal Date: Thu, 20 Apr 2017 11:36:59 +0000 Subject: Add @offsetOf builtin function --- src/ir_print.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/ir_print.cpp') diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 569f038895..fa8a9fe3b0 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -885,6 +885,14 @@ static void ir_print_field_parent_ptr(IrPrint *irp, IrInstructionFieldParentPtr fprintf(irp->f, ")"); } +static void ir_print_offset_of(IrPrint *irp, IrInstructionOffsetOf *instruction) { + fprintf(irp->f, "@offset_of("); + ir_print_other_instruction(irp, instruction->type_value); + fprintf(irp->f, ","); + ir_print_other_instruction(irp, instruction->field_name); + fprintf(irp->f, ")"); +} + static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { ir_print_prefix(irp, instruction); switch (instruction->id) { @@ -1175,6 +1183,9 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { case IrInstructionIdFieldParentPtr: ir_print_field_parent_ptr(irp, (IrInstructionFieldParentPtr *)instruction); break; + case IrInstructionIdOffsetOf: + ir_print_offset_of(irp, (IrInstructionOffsetOf *)instruction); + break; } fprintf(irp->f, "\n"); } -- cgit v1.2.3