add enumTagName builtin function

closes #299
This commit is contained in:
Andrew Kelley
2017-04-08 17:45:22 -04:00
parent 7611ed3484
commit 095591f0b0
10 changed files with 192 additions and 142 deletions

View File

@@ -816,15 +816,18 @@ static void ir_print_check_switch_prongs(IrPrint *irp, IrInstructionCheckSwitchP
}
static void ir_print_test_type(IrPrint *irp, IrInstructionTestType *instruction) {
fprintf(irp->f, "@testType(");
fprintf(irp->f, "testtype ");
ir_print_other_instruction(irp, instruction->type_value);
fprintf(irp->f, ")");
}
static void ir_print_type_name(IrPrint *irp, IrInstructionTypeName *instruction) {
fprintf(irp->f, "@typeName(");
fprintf(irp->f, "typename ");
ir_print_other_instruction(irp, instruction->type_value);
fprintf(irp->f, ")");
}
static void ir_print_enum_tag_name(IrPrint *irp, IrInstructionEnumTagName *instruction) {
fprintf(irp->f, "enumtagname ");
ir_print_other_instruction(irp, instruction->target);
}
static void ir_print_can_implicit_cast(IrPrint *irp, IrInstructionCanImplicitCast *instruction) {
@@ -1131,6 +1134,9 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
case IrInstructionIdTypeName:
ir_print_type_name(irp, (IrInstructionTypeName *)instruction);
break;
case IrInstructionIdEnumTagName:
ir_print_enum_tag_name(irp, (IrInstructionEnumTagName *)instruction);
break;
case IrInstructionIdCanImplicitCast:
ir_print_can_implicit_cast(irp, (IrInstructionCanImplicitCast *)instruction);
break;