Optimized field ptr ir for hot path and fix assignment bug

This commit is contained in:
Jimmi Holst Christensen
2018-04-19 21:34:18 +02:00
parent 6b4f6ebd89
commit 1b91478bff
4 changed files with 176 additions and 92 deletions

View File

@@ -358,10 +358,18 @@ static void ir_print_ptr_type_child(IrPrint *irp, IrInstructionPtrTypeChild *ins
}
static void ir_print_field_ptr(IrPrint *irp, IrInstructionFieldPtr *instruction) {
fprintf(irp->f, "fieldptr ");
ir_print_other_instruction(irp, instruction->container_ptr);
fprintf(irp->f, ".");
ir_print_other_instruction(irp, instruction->field_name_expr);
if (instruction->field_name_buffer) {
fprintf(irp->f, "fieldptr ");
ir_print_other_instruction(irp, instruction->container_ptr);
fprintf(irp->f, ".%s", buf_ptr(instruction->field_name_buffer));
} else {
assert(instruction->field_name_expr);
fprintf(irp->f, "@field(");
ir_print_other_instruction(irp, instruction->container_ptr);
fprintf(irp->f, ", ");
ir_print_other_instruction(irp, instruction->field_name_expr);
fprintf(irp->f, ")");
}
}
static void ir_print_struct_field_ptr(IrPrint *irp, IrInstructionStructFieldPtr *instruction) {