Bodge in enough phi support to let the instruction generator complete on basic
programs.
This commit is contained in:
parent
8d4186130d
commit
c6f576f758
3 changed files with 25 additions and 7 deletions
|
@ -12,6 +12,8 @@ struct basicblock
|
||||||
ARRAYOF(struct basicblock) nexts;
|
ARRAYOF(struct basicblock) nexts;
|
||||||
int order; /* used by SSA code */
|
int order; /* used by SSA code */
|
||||||
|
|
||||||
|
ARRAYOF(struct vreg) liveins;
|
||||||
|
|
||||||
bool is_fake : 1;
|
bool is_fake : 1;
|
||||||
bool is_root : 1;
|
bool is_root : 1;
|
||||||
bool is_terminated : 1;
|
bool is_terminated : 1;
|
||||||
|
|
|
@ -191,15 +191,30 @@ static void select_instructions(void)
|
||||||
int insnno;
|
int insnno;
|
||||||
|
|
||||||
current_ir = current_bb->irs.item[i];
|
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 (current_ir->opcode == IR_PHI)
|
||||||
if (!insnno)
|
{
|
||||||
burm_panic_cannot_match(shadow);
|
int j;
|
||||||
|
|
||||||
ir_print('I', current_ir);
|
current_ir->result = new_vreg();
|
||||||
walk_instructions(shadow, 1);
|
array_append(¤t_bb->liveins, current_ir->result);
|
||||||
|
tracef('I', "I: %d is phi:", current_ir->result->id);
|
||||||
|
for (j=0; j<current_ir->u.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);
|
||||||
|
|
||||||
|
insnno = burm_rule(shadow->state_label, 1);
|
||||||
|
if (!insnno)
|
||||||
|
burm_panic_cannot_match(shadow);
|
||||||
|
|
||||||
|
ir_print('I', current_ir);
|
||||||
|
walk_instructions(shadow, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ PATTERNS
|
||||||
|
|
||||||
SETRET4(in:reg)
|
SETRET4(in:reg)
|
||||||
with ret reg
|
with ret reg
|
||||||
|
emit "mov r0, %in"
|
||||||
cost 4;
|
cost 4;
|
||||||
|
|
||||||
STACKADJUST4(delta:aluparam)
|
STACKADJUST4(delta:aluparam)
|
||||||
|
|
Loading…
Reference in a new issue