Commit 7cf06579 authored by Matthias Braun's avatar Matthias Braun
Browse files

rename edges_assure to assure_edges

This makes it consistent with other firm analyse functions. Also removes
the unnecessary return value.
parent b2008e0b
......@@ -235,20 +235,16 @@ FIRM_API void edges_deactivate(ir_graph *irg);
* Ensures that edges are activated.
*
* @param irg the IR graph
*
* @return 0 if edges was deactivated before the call, 1 else
*/
FIRM_API int edges_assure(ir_graph *irg);
FIRM_API void assure_edges(ir_graph *irg);
/**
* Ensures that edges of a given kind are activated.
*
* @param irg the IR graph
* @param kind the edge kind
*
* @return 0 if edges was deactivated before the call, 1 else
*/
FIRM_API int edges_assure_kind(ir_graph *irg, ir_edge_kind_t kind);
FIRM_API void assure_edges_kind(ir_graph *irg, ir_edge_kind_t kind);
/**
* Walks only over Block nodes in the graph. Uses the block visited
......
......@@ -34,7 +34,7 @@
static void *irg_cfg_succ_get_root(void *self)
{
ir_graph *irg = (ir_graph*) self;
edges_assure_kind(irg, EDGE_KIND_BLOCK);
assure_edges_kind(irg, EDGE_KIND_BLOCK);
return get_irg_start_block(irg);
}
......
......@@ -286,7 +286,7 @@ ir_exec_freq *compute_execfreq(ir_graph *irg, double loop_weight)
irg_block_walk_graph(irg, collect_blocks, NULL, freqs);
construct_cf_backedges(irg);
edges_assure(irg);
assure_edges(irg);
size = dfs_get_n_nodes(dfs);
mat = gs_new_matrix(size, size);
......
......@@ -226,7 +226,7 @@ unsigned heights_recompute_block(ir_heights_t *h, ir_node *block)
ir_graph *irg = get_irn_irg(block);
const ir_edge_t *edge;
edges_assure(irg);
assure_edges(irg);
/* reset phase data for all nodes in the block */
foreach_out_edge(block, edge) {
......@@ -246,7 +246,7 @@ ir_heights_t *heights_new(ir_graph *irg)
obstack_init(&res->obst);
res->dump_handle = dump_add_node_info_callback(height_dump_cb, res);
edges_assure(irg);
assure_edges(irg);
irg_block_walk_graph(irg, compute_heights_in_block_walker, NULL, res);
return res;
......
......@@ -1868,7 +1868,7 @@ void be_abi_introduce(ir_graph *irg)
env->init_sp = dummy;
env->calls = NEW_ARR_F(ir_node*, 0);
edges_assure(irg);
assure_edges(irg);
if (be_options.pic) {
irg_walk_graph(irg, fix_pic_symconsts, NULL, env);
......
......@@ -112,7 +112,7 @@ be_dom_front_info_t *be_compute_dominance_frontiers(ir_graph *irg)
{
be_dom_front_info_t *info = XMALLOC(be_dom_front_info_t);
edges_assure(irg);
assure_edges(irg);
obstack_init(&info->obst);
info->df_map = pmap_create();
assure_doms(irg);
......
......@@ -449,7 +449,7 @@ static void initialize_birg(be_irg_t *birg, ir_graph *irg, be_main_env_t *env)
remove_bads(irg);
/* Ensure, that the ir_edges are computed. */
edges_assure(irg);
assure_edges(irg);
set_irg_phase_state(irg, phase_backend);
be_info_init_irg(irg);
......
......@@ -385,7 +385,7 @@ be_uses_t *be_begin_uses(ir_graph *irg, const be_lv_t *lv)
{
be_uses_t *env = XMALLOC(be_uses_t);
edges_assure(irg);
assure_edges(irg);
//set_using_irn_link(irg);
......
......@@ -663,7 +663,7 @@ static void ia32_prepare_graph(ir_graph *irg)
/* do local optimizations (mainly CSE) */
optimize_graph_df(irg);
/* backend code expects that outedges are always enabled */
edges_assure(irg);
assure_edges(irg);
if (irg_data->dump)
dump_ir_graph(irg, "transformed");
......@@ -674,7 +674,7 @@ static void ia32_prepare_graph(ir_graph *irg)
/* do code placement, to optimize the position of constants */
place_code(irg);
/* backend code expects that outedges are always enabled */
edges_assure(irg);
assure_edges(irg);
if (irg_data->dump)
dump_ir_graph(irg, "place");
......
......@@ -2589,7 +2589,7 @@ void sparc_transform_graph(ir_graph *irg)
/* do code placement, to optimize the position of constants */
place_code(irg);
/* backend expects outedges to be always on */
edges_assure(irg);
assure_edges(irg);
}
void sparc_init_transform(void)
......
......@@ -42,7 +42,7 @@ void instrument_initcall(ir_graph *irg, ir_entity *ent)
int i, idx, need_new_block;
symconst_symbol sym;
edges_assure(irg);
assure_edges(irg);
/* find the first block */
initial_exec = get_irg_initial_exec(irg);
......
......@@ -913,32 +913,16 @@ void edges_deactivate(ir_graph *irg)
edges_deactivate_kind(irg, EDGE_KIND_NORMAL);
}
int edges_assure(ir_graph *irg)
void assure_edges(ir_graph *irg)
{
int activated = 0;
if (edges_activated_kind(irg, EDGE_KIND_BLOCK)) {
activated = 1;
} else {
edges_activate_kind(irg, EDGE_KIND_BLOCK);
}
if (edges_activated_kind(irg, EDGE_KIND_NORMAL)) {
activated = 1;
} else {
edges_activate_kind(irg, EDGE_KIND_NORMAL);
}
return activated;
assure_edges_kind(irg, EDGE_KIND_BLOCK);
assure_edges_kind(irg, EDGE_KIND_NORMAL);
}
int edges_assure_kind(ir_graph *irg, ir_edge_kind_t kind)
void assure_edges_kind(ir_graph *irg, ir_edge_kind_t kind)
{
int activated = edges_activated_kind(irg, kind);
if (!activated)
if (!edges_activated_kind(irg, kind))
edges_activate_kind(irg, kind);
return activated;
}
void edges_node_deleted(ir_node *irn)
......
......@@ -203,7 +203,7 @@ int optimize_graph_df(ir_graph *irg)
add_irg_constraints(irg, IR_GRAPH_CONSTRAINT_OPTIMIZE_UNREACHABLE_CODE);
new_identities(irg);
edges_assure(irg);
assure_edges(irg);
assure_doms(irg);
......
......@@ -2987,7 +2987,7 @@ static void lower_irg(ir_graph *irg)
/* just here for debugging */
current_ir_graph = irg;
edges_assure(irg);
assure_edges(irg);
n_idx = get_irg_last_idx(irg);
n_idx = n_idx + (n_idx >> 2); /* add 25% */
......
......@@ -275,7 +275,7 @@ void ir_lower_mode_b(ir_graph *const irg, ir_mode *const nlowered_mode)
lowered_mode = nlowered_mode;
/* edges are used by part_block_edges in the ir_create_cond_set variant. */
edges_assure(irg);
assure_edges(irg);
/* part_block_edges can go wrong with tuples present */
remove_tuples(irg);
......
......@@ -1075,7 +1075,7 @@ void lower_floating_point(void)
ir_nodeset_init(&created_mux_nodes);
edges_assure(irg);
assure_edges(irg);
irg_walk_graph(irg, NULL, lower_node, NULL);
......
......@@ -761,7 +761,7 @@ static mtp_additional_properties check_stored_result(ir_graph *irg)
ir_node *end_blk = get_irg_end_block(irg);
int i;
mtp_additional_properties res = ~mtp_no_property;
int old_edges = edges_assure_kind(irg, EDGE_KIND_NORMAL);
assure_edges_kind(irg, EDGE_KIND_NORMAL);
for (i = get_Block_n_cfgpreds(end_blk) - 1; i >= 0; --i) {
ir_node *pred = get_Block_cfgpred(end_blk, i);
......@@ -780,8 +780,7 @@ static mtp_additional_properties check_stored_result(ir_graph *irg)
}
}
finish:
if (! old_edges)
edges_deactivate_kind(irg, EDGE_KIND_NORMAL);
edges_deactivate_kind(irg, EDGE_KIND_NORMAL);
return res;
}
......
......@@ -37,7 +37,7 @@ void perform_irg_optimization(ir_graph *irg, optdesc_t *opt)
PREPARE(IR_GRAPH_PROPERTY_NO_BADS, remove_bads)
PREPARE(IR_GRAPH_PROPERTY_CONSISTENT_DOMINANCE, assure_doms)
PREPARE(IR_GRAPH_PROPERTY_CONSISTENT_POSTDOMINANCE, assure_postdoms)
PREPARE(IR_GRAPH_PROPERTY_CONSISTENT_OUT_EDGES, edges_assure)
PREPARE(IR_GRAPH_PROPERTY_CONSISTENT_OUT_EDGES, assure_edges)
PREPARE(IR_GRAPH_PROPERTY_CONSISTENT_OUTS, assure_irg_outs)
PREPARE(IR_GRAPH_PROPERTY_CONSISTENT_LOOPINFO, assure_loopinfo)
PREPARE(IR_GRAPH_PROPERTY_CONSISTENT_ENTITY_USAGE, assure_irg_entity_usage_computed)
......
......@@ -1418,8 +1418,7 @@ static void fix_adds_and_subs(ir_node *irn, void *ctx)
/* Performs Operator Strength Reduction for the passed graph. */
void opt_osr(ir_graph *irg, unsigned flags)
{
iv_env env;
int edges;
iv_env env;
FIRM_DBG_REGISTER(dbg, "firm.opt.osr");
......@@ -1447,7 +1446,7 @@ void opt_osr(ir_graph *irg, unsigned flags)
/* we need dominance */
assure_doms(irg);
edges = edges_assure(irg);
assure_edges(irg);
/* calculate the post order number for blocks by walking the out edges. */
assure_irg_outs(irg);
......@@ -1474,9 +1473,8 @@ void opt_osr(ir_graph *irg, unsigned flags)
DEL_ARR_F(env.stack);
obstack_free(&env.obst, NULL);
if (! edges)
edges_deactivate(irg);
} /* opt_osr */
edges_deactivate(irg);
}
typedef struct pass_t {
ir_graph_pass_t pass;
......
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