Commit 5353f882 authored by Matthias Braun's avatar Matthias Braun
Browse files

no need for kill_dead_nodes, use edges_deactivate; edges_activate if you need...

no need for kill_dead_nodes, use edges_deactivate; edges_activate if you need this functionality (but better fix your code)
parent f75f88c1
......@@ -722,55 +722,3 @@ int be_remove_empty_blocks(ir_graph *irg) {
}
return changed;
}
typedef struct _be_dead_out_env_t {
ir_graph *irg;
bitset_t *reachable;
DEBUG_ONLY(firm_dbg_module_t *dbg);
} be_dead_out_env_t;
/**
* Check all block out edges and kill all unreachable nodes.
*/
static void kill_dead_outs(ir_node *block, void *wenv) {
be_dead_out_env_t *env = wenv;
ir_graph *irg = env->irg;
ir_node *globs = get_irg_globals(irg);
ir_node *tls = get_irg_tls(irg);
const ir_edge_t *edge, *tmp_edge;
/* check all out edges */
foreach_out_edge_safe(block, edge, tmp_edge) {
ir_node *src = get_edge_src_irn(edge);
if (! bitset_is_set(env->reachable, get_irn_idx(src))) {
/* BEWARE: do not kill anchors or TLS */
if (src != globs && src != tls) {
DBG((env->dbg, LEVEL_1, "killing %+F, only reachable from %+F\n", src, block));
be_kill_node(src);
}
}
}
}
static void set_reachable(ir_node *node, void *data) {
bitset_t *reachable = data;
bitset_set(reachable, get_irn_idx(node));
}
/**
* Set input of all nodes only reachable via out edges to BAD.
*/
void be_kill_dead_nodes(ir_graph *irg) {
be_dead_out_env_t env;
env.irg = irg;
env.reachable = bitset_alloca(get_irg_last_idx(irg));
FIRM_DBG_REGISTER(env.dbg, "firm.be.killdead");
/* collect all reachable nodes */
irg_walk_in_or_dep_graph(irg, set_reachable, NULL, env.reachable);
/* go over out edges of block and kill all unreachable nodes */
irg_block_walk_graph(irg, kill_dead_outs, NULL, &env);
}
......@@ -136,10 +136,4 @@ void extreme_liverange_splitting(struct _be_chordal_env_t *cenv);
*/
int be_remove_empty_blocks(ir_graph *irg);
/**
* Set input of all nodes only reachable via out edges to BAD.
* @param irg The irg to check.
*/
void be_kill_dead_nodes(ir_graph *irg);
#endif /* _BEIRGMOD_H */
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