From: David Given Date: Tue, 4 Oct 2016 19:58:31 +0000 (+0200) Subject: Bodge in enough phi support to let the instruction generator complete on basic X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=c6f576f758246e6bfa9df873fe1fc7f05d9fc1e5;p=ack.git Bodge in enough phi support to let the instruction generator complete on basic programs. --- diff --git a/mach/proto/mcg/basicblock.h b/mach/proto/mcg/basicblock.h index 8f36e5eee..7fb654a6d 100644 --- a/mach/proto/mcg/basicblock.h +++ b/mach/proto/mcg/basicblock.h @@ -12,6 +12,8 @@ struct basicblock ARRAYOF(struct basicblock) nexts; int order; /* used by SSA code */ + ARRAYOF(struct vreg) liveins; + bool is_fake : 1; bool is_root : 1; bool is_terminated : 1; diff --git a/mach/proto/mcg/pass_instructionselection.c b/mach/proto/mcg/pass_instructionselection.c index 48ede30df..5f965c9bc 100644 --- a/mach/proto/mcg/pass_instructionselection.c +++ b/mach/proto/mcg/pass_instructionselection.c @@ -191,15 +191,30 @@ static void select_instructions(void) int insnno; current_ir = current_bb->irs.item[i]; - shadow = build_shadow_tree(current_ir, current_ir); - burm_label(shadow); - insnno = burm_rule(shadow->state_label, 1); - if (!insnno) - burm_panic_cannot_match(shadow); + if (current_ir->opcode == IR_PHI) + { + int j; + + current_ir->result = new_vreg(); + array_append(¤t_bb->liveins, current_ir->result); + tracef('I', "I: %d is phi:", current_ir->result->id); + for (j=0; ju.phivalue.count; j++) + tracef('I', " $%d", current_ir->u.phivalue.item[j]->id); + tracef('I', "\n"); + } + else + { + shadow = build_shadow_tree(current_ir, current_ir); + burm_label(shadow); - ir_print('I', current_ir); - walk_instructions(shadow, 1); + insnno = burm_rule(shadow->state_label, 1); + if (!insnno) + burm_panic_cannot_match(shadow); + + ir_print('I', current_ir); + walk_instructions(shadow, 1); + } } } diff --git a/mach/proto/mcg/table b/mach/proto/mcg/table index 4d892c069..c333a6310 100644 --- a/mach/proto/mcg/table +++ b/mach/proto/mcg/table @@ -62,6 +62,7 @@ PATTERNS SETRET4(in:reg) with ret reg + emit "mov r0, %in" cost 4; STACKADJUST4(delta:aluparam)