Commit 32a7a4ee authored by Christoph Mallon's avatar Christoph Mallon
Browse files

be: Determine mode of new Phi0 from the given register requirement.

parent e9a97113
......@@ -395,10 +395,10 @@ ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode,
return optimize_node(phi);
}
ir_node *be_new_Phi0(ir_node *const block, ir_mode *const mode, arch_register_req_t const *const req)
ir_node *be_new_Phi0(ir_node *const block, arch_register_req_t const *const req)
{
ir_graph *const irg = get_irn_irg(block);
ir_node *const phi = new_ir_node(NULL, irg, block, op_Phi, mode, 0, NULL);
ir_node *const phi = new_ir_node(NULL, irg, block, op_Phi, req->cls->mode, 0, NULL);
struct obstack *const obst = be_get_be_obst(irg);
backend_info_t *const info = be_get_info(phi);
info->out_infos = NEW_ARR_DZ(reg_out_info_t, obst, 1);
......
......@@ -176,7 +176,7 @@ ir_node *be_new_Phi(ir_node *block, int n_ins, ir_node **ins, ir_mode *mode,
* Create a new Phi with backend info and without inputs.
* Inputs are added later with @see be_complete_Phi().
*/
ir_node *be_new_Phi0(ir_node *block, ir_mode *mode, arch_register_req_t const *req);
ir_node *be_new_Phi0(ir_node *block, arch_register_req_t const *req);
/**
* Add inputs to a inputless Phi created by @see be_new_Phi0().
......
......@@ -281,7 +281,7 @@ static void spill_phi(spill_env_t *env, spill_info_t *spillinfo)
/* build a new PhiM */
ir_node *const block = get_nodes_block(phi);
ir_node *const phim = be_new_Phi0(block, mode_M, arch_memory_req);
ir_node *const phim = be_new_Phi0(block, arch_memory_req);
sched_add_after(block, phim);
/* override or replace spills list... */
......
......@@ -201,7 +201,7 @@ static ir_node *insert_dummy_phi(be_ssa_construction_env_t *env, ir_node *block)
{
DBG((dbg, LEVEL_3, "\t...create phi at block %+F\n", block));
ir_node *const phi = be_new_Phi0(block, env->mode, env->phi_req);
ir_node *const phi = be_new_Phi0(block, env->phi_req);
sched_add_after(block, phi);
ARR_APP1(ir_node*, env->new_phis, phi);
......@@ -396,11 +396,10 @@ void be_ssa_construction_destroy(be_ssa_construction_env_t *env)
static void determine_phi_req(be_ssa_construction_env_t *env, ir_node *value)
{
if (env->mode)
if (env->phi_req)
return;
const arch_register_req_t *req = arch_get_irn_register_req(value);
env->mode = get_irn_mode(value);
if (req->width == 1) {
env->phi_req = req->cls->class_req;
} else {
......
......@@ -43,7 +43,6 @@
typedef struct be_ssa_construction_env_t {
ir_graph *irg;
ir_mode *mode;
const arch_register_req_t *phi_req;
pdeq *worklist;
ir_node **new_phis;
......
......@@ -146,7 +146,7 @@ static void spill_phi(minibelady_env_t *env, ir_node *phi)
/* create a Phi-M */
ir_node *const block = get_nodes_block(phi);
ir_node *const phim = be_new_Phi0(block, mode_M, arch_memory_req);
ir_node *const phim = be_new_Phi0(block, arch_memory_req);
spill_info->spill = phim;
sched_add_after(block, phim);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment