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)
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)
* 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;
}
*/
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.
*/
static INLINE int _sched_get_time_step(const ir_node *irn)
{
+ assert(_sched_is_scheduled(irn));
return get_irn_sched_info(irn)->time_step;
}
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.
/* 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));
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);
}
}
+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;
* 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;
}