Commit 1d488e74 authored by Matthias Braun's avatar Matthias Braun
Browse files

- compute liveness for (nearly) all nodes

- place memperm projs into the same block as the memperm
- schedule all projs of memperm
parent a6d00519
......@@ -25,7 +25,7 @@
static INLINE int is_liveness_node(const ir_node *irn)
{
return is_Phi(irn) || is_data_node(irn);
return !is_Block(irn) && !is_Bad(irn);
}
int (be_lv_next_irn)(const struct _be_lv_t *lv, const ir_node *bl, unsigned flags, int i)
......
......@@ -20,7 +20,10 @@
static sched_timestep_t get_time_step(const ir_node *irn)
{
return is_Phi(irn) ? 0 : sched_get_time_step(irn);
if(is_Phi(irn))
return 0;
return sched_get_time_step(irn);
}
int value_dominates(const ir_node *a, const ir_node *b)
......@@ -95,7 +98,7 @@ int values_interfere(const be_lv_t *lv, const ir_node *a, const ir_node *b)
* performed.
*/
foreach_out_edge(a, edge) {
const ir_node *user = edge->src;
const ir_node *user = get_edge_src_irn(edge);
if(get_nodes_block(user) == bb && !is_Phi(user) && b != user && value_dominates(b, user))
return 1;
}
......
......@@ -40,6 +40,16 @@ typedef struct _sched_info_t {
*/
void be_sched_init(void);
/**
* Check, if the node is scheduled.
* @param irn The node.
* @return 1, if the node is scheduled, 0 if not.
*/
static INLINE int _sched_is_scheduled(const ir_node *irn)
{
return get_irn_sched_info(irn)->scheduled;
}
/**
* Get the time step of an irn in a schedule.
* @param irn The node.
......@@ -47,6 +57,7 @@ void be_sched_init(void);
*/
static INLINE int _sched_get_time_step(const ir_node *irn)
{
assert(_sched_is_scheduled(irn));
return get_irn_sched_info(irn)->time_step;
}
......@@ -216,16 +227,6 @@ static INLINE void _sched_remove(ir_node *irn)
info->scheduled = 0;
}
/**
* Check, if the node is scheduled.
* @param irn The node.
* @return 1, if the node is scheduled, 0 if not.
*/
static INLINE int _sched_is_scheduled(const ir_node *irn)
{
return get_irn_sched_info(irn)->scheduled;
}
/**
* Compare two nodes according to their position in the schedule.
* @param a The first node.
......
......@@ -528,9 +528,6 @@ void be_spill_morgan(be_chordal_env_t *chordal_env) {
/* construct control flow loop tree */
construct_cf_backedges(chordal_env->irg);
//dump_looptree(0, get_irg_loop(env.irg));
//dump_execfreqs(env.irg);
/* construct loop out edges and livethrough_unused sets for loops and blocks */
irg_block_walk_graph(chordal_env->irg, NULL, construct_loop_edges, &env);
construct_loop_livethrough_unused(&env, get_irg_loop(env.irg));
......
......@@ -652,18 +652,21 @@ static void create_memperms(ss_env_t *env) {
mempermnode = be_new_MemPerm(env->chordal_env->birg->main_env->arch_env, env->chordal_env->irg, memperm->block,
memperm->entrycount, nodes);
// insert node into schedule
sched_add_before(sched_last(memperm->block), mempermnode);
for(entry = memperm->entries, i = 0; entry != NULL; entry = entry->next, ++i) {
ir_node *proj;
ir_node* arg = get_irn_n(entry->node, entry->pos);
be_set_MemPerm_in_entity(mempermnode, i, entry->in);
be_set_MemPerm_out_entity(mempermnode, i, entry->out);
set_irg_current_block(env->chordal_env->irg, memperm->block);
proj = new_Proj(mempermnode, get_irn_mode(arg), i);
sched_add_before(sched_last(memperm->block), proj);
set_irn_n(entry->node, entry->pos, proj);
}
// insert node into schedule
sched_add_before(sched_last(memperm->block), mempermnode);
}
}
......
......@@ -403,6 +403,14 @@ int be_verify_spillslots(ir_graph *irg)
static sched_timestep_t get_time_step(const ir_node *irn)
{
if(is_Phi(irn))
return 0;
return sched_get_time_step(irn);
}
static int my_value_dominates(const ir_node *a, const ir_node *b)
{
int res = 0;
......@@ -420,8 +428,8 @@ static int my_value_dominates(const ir_node *a, const ir_node *b)
* Dominance is determined by the time steps of the schedule.
*/
} else {
sched_timestep_t as = sched_get_time_step(a);
sched_timestep_t bs = sched_get_time_step(b);
sched_timestep_t as = get_time_step(a);
sched_timestep_t bs = get_time_step(b);
res = as <= bs;
}
......
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