From 7cf06579801b69086b3b8ee2aee61b4a5606b660 Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Fri, 15 Jun 2012 02:02:39 +0200 Subject: [PATCH] rename edges_assure to assure_edges This makes it consistent with other firm analyse functions. Also removes the unnecessary return value. --- include/libfirm/iredges.h | 8 ++------ ir/ana/absgraph.c | 2 +- ir/ana/execfreq.c | 2 +- ir/ana/heights.c | 4 ++-- ir/be/beabi.c | 2 +- ir/be/bedomfront.c | 2 +- ir/be/bemain.c | 2 +- ir/be/beuses.c | 2 +- ir/be/ia32/bearch_ia32.c | 4 ++-- ir/be/sparc/sparc_transform.c | 2 +- ir/ir/instrument.c | 2 +- ir/ir/iredges.c | 26 +++++--------------------- ir/ir/irgopt.c | 2 +- ir/lower/lower_dw.c | 2 +- ir/lower/lower_mode_b.c | 2 +- ir/lower/lower_softfloat.c | 2 +- ir/opt/funccall.c | 5 ++--- ir/opt/opt_manage.c | 2 +- ir/opt/opt_osr.c | 10 ++++------ 19 files changed, 30 insertions(+), 53 deletions(-) diff --git a/include/libfirm/iredges.h b/include/libfirm/iredges.h index 7c522ec21..2819722fe 100644 --- a/include/libfirm/iredges.h +++ b/include/libfirm/iredges.h @@ -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 diff --git a/ir/ana/absgraph.c b/ir/ana/absgraph.c index eb90570ad..225aebb43 100644 --- a/ir/ana/absgraph.c +++ b/ir/ana/absgraph.c @@ -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); } diff --git a/ir/ana/execfreq.c b/ir/ana/execfreq.c index 6ac89df8f..0c62c1255 100644 --- a/ir/ana/execfreq.c +++ b/ir/ana/execfreq.c @@ -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); diff --git a/ir/ana/heights.c b/ir/ana/heights.c index 7ccb233ca..7b8b8c266 100644 --- a/ir/ana/heights.c +++ b/ir/ana/heights.c @@ -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; diff --git a/ir/be/beabi.c b/ir/be/beabi.c index b04712b05..e734e7fa2 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -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); diff --git a/ir/be/bedomfront.c b/ir/be/bedomfront.c index bee65117d..60ec228a0 100644 --- a/ir/be/bedomfront.c +++ b/ir/be/bedomfront.c @@ -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); diff --git a/ir/be/bemain.c b/ir/be/bemain.c index acff68d20..9686ae9d8 100644 --- a/ir/be/bemain.c +++ b/ir/be/bemain.c @@ -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); diff --git a/ir/be/beuses.c b/ir/be/beuses.c index 56108d3b3..87be07833 100644 --- a/ir/be/beuses.c +++ b/ir/be/beuses.c @@ -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); diff --git a/ir/be/ia32/bearch_ia32.c b/ir/be/ia32/bearch_ia32.c index dba183ae1..d7186476d 100644 --- a/ir/be/ia32/bearch_ia32.c +++ b/ir/be/ia32/bearch_ia32.c @@ -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"); diff --git a/ir/be/sparc/sparc_transform.c b/ir/be/sparc/sparc_transform.c index 3392271ef..b87792cff 100644 --- a/ir/be/sparc/sparc_transform.c +++ b/ir/be/sparc/sparc_transform.c @@ -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) diff --git a/ir/ir/instrument.c b/ir/ir/instrument.c index e626955f7..d740f1c28 100644 --- a/ir/ir/instrument.c +++ b/ir/ir/instrument.c @@ -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); diff --git a/ir/ir/iredges.c b/ir/ir/iredges.c index 7f625d9d8..1e6fe6ceb 100644 --- a/ir/ir/iredges.c +++ b/ir/ir/iredges.c @@ -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) diff --git a/ir/ir/irgopt.c b/ir/ir/irgopt.c index 72caa1984..f793fb96a 100644 --- a/ir/ir/irgopt.c +++ b/ir/ir/irgopt.c @@ -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); diff --git a/ir/lower/lower_dw.c b/ir/lower/lower_dw.c index eb081083b..1ae267bbb 100644 --- a/ir/lower/lower_dw.c +++ b/ir/lower/lower_dw.c @@ -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% */ diff --git a/ir/lower/lower_mode_b.c b/ir/lower/lower_mode_b.c index d8276b375..f698441d8 100644 --- a/ir/lower/lower_mode_b.c +++ b/ir/lower/lower_mode_b.c @@ -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); diff --git a/ir/lower/lower_softfloat.c b/ir/lower/lower_softfloat.c index 036dde855..b353e9abb 100644 --- a/ir/lower/lower_softfloat.c +++ b/ir/lower/lower_softfloat.c @@ -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); diff --git a/ir/opt/funccall.c b/ir/opt/funccall.c index 3d3601149..214260b98 100644 --- a/ir/opt/funccall.c +++ b/ir/opt/funccall.c @@ -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; } diff --git a/ir/opt/opt_manage.c b/ir/opt/opt_manage.c index 36254e0c1..5b5905c9a 100644 --- a/ir/opt/opt_manage.c +++ b/ir/opt/opt_manage.c @@ -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) diff --git a/ir/opt/opt_osr.c b/ir/opt/opt_osr.c index 6fb836a3b..89d5f81fd 100644 --- a/ir/opt/opt_osr.c +++ b/ir/opt/opt_osr.c @@ -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; -- 2.20.1