From 18814151f8c0ea17b2a7bf84c82ee3c2e66d6a6b Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Fri, 2 Jul 2010 16:58:17 +0000 Subject: [PATCH] change spiller and related interface to use ir_graph* instead of be_irg_t* [r27691] --- ir/be/be_t.h | 6 +++--- ir/be/beabi.c | 2 +- ir/be/bechordal_main.c | 13 +++++++------ ir/be/becopyheur2.c | 2 +- ir/be/becopyheur4.c | 2 +- ir/be/beflags.c | 2 +- ir/be/beirgmod.c | 2 +- ir/be/beloopana.c | 30 +++++++++++++++--------------- ir/be/beloopana.h | 14 ++++++++------ ir/be/belower.c | 2 +- ir/be/bemain.c | 7 ++++--- ir/be/beprefalloc.c | 8 ++++---- ir/be/besched.c | 8 +++----- ir/be/besched.h | 2 +- ir/be/bespill.c | 17 ++++++++--------- ir/be/bespill.h | 10 +++++----- ir/be/bespillbelady.c | 9 ++++----- ir/be/bespillbelady2.c | 9 ++++----- ir/be/bespilldaemel.c | 7 +++---- ir/be/bespillutil.c | 15 ++++++--------- ir/be/bespillutil.h | 6 +++--- ir/be/bessaconstr.c | 3 +-- ir/be/bessaconstr.h | 2 +- ir/be/bestate.c | 4 ++-- ir/be/beverify.c | 6 +++--- ir/be/beverify.h | 6 +++--- ir/be/ia32/ia32_fpu.c | 2 +- 27 files changed, 95 insertions(+), 101 deletions(-) diff --git a/ir/be/be_t.h b/ir/be/be_t.h index 705509a4f..1fddd8ac2 100644 --- a/ir/be/be_t.h +++ b/ir/be/be_t.h @@ -98,13 +98,13 @@ void be_init_default_asm_constraint_flags(void); /** * Put the registers to be ignored in this IRG into a bitset. - * @param birg The backend IRG data structure. + * @param irg The graph * @param cls The register class. * @param bs The bitset (may be NULL). * @return The number of registers to be ignored. */ -unsigned be_put_ignore_regs(const be_irg_t *birg, - const arch_register_class_t *cls, bitset_t *bs); +unsigned be_put_ignore_regs(const ir_graph *irg, + const arch_register_class_t *cls, bitset_t *bs); /** diff --git a/ir/be/beabi.c b/ir/be/beabi.c index 229062b17..2930ab5e4 100644 --- a/ir/be/beabi.c +++ b/ir/be/beabi.c @@ -2446,7 +2446,7 @@ void be_abi_fix_stack_nodes(be_abi_irg_t *env) return; } - be_ssa_construction_init(&senv, birg); + be_ssa_construction_init(&senv, irg); be_ssa_construction_add_copies(&senv, walker_env.sp_nodes, ARR_LEN(walker_env.sp_nodes)); be_ssa_construction_fix_users_array(&senv, walker_env.sp_nodes, diff --git a/ir/be/bechordal_main.c b/ir/be/bechordal_main.c index 94f2b948f..4fe1672bb 100644 --- a/ir/be/bechordal_main.c +++ b/ir/be/bechordal_main.c @@ -259,10 +259,10 @@ static void pre_spill(post_spill_env_t *pse, const arch_register_class_t *cls) stat_ev_do(pse->pre_spill_cost = be_estimate_irg_costs(irg, birg->exec_freq)); /* put all ignore registers into the ignore register set. */ - be_put_ignore_regs(birg, pse->cls, chordal_env->ignore_colors); + be_put_ignore_regs(irg, pse->cls, chordal_env->ignore_colors); be_timer_push(T_RA_CONSTR); - be_pre_spill_prepare_constr(chordal_env->birg, chordal_env->cls); + be_pre_spill_prepare_constr(irg, chordal_env->cls); be_timer_pop(T_RA_CONSTR); dump(BE_CH_DUMP_CONSTR, birg->irg, pse->cls, "constr-pre"); @@ -277,7 +277,8 @@ static void post_spill(post_spill_env_t *pse, int iteration) be_irg_t *birg = pse->birg; ir_graph *irg = birg->irg; int colors_n = arch_register_class_n_regs(chordal_env->cls); - int allocatable_regs = colors_n - be_put_ignore_regs(birg, chordal_env->cls, NULL); + int allocatable_regs + = colors_n - be_put_ignore_regs(irg, chordal_env->cls, NULL); /* some special classes contain only ignore regs, no work to be done */ if (allocatable_regs > 0) { @@ -300,10 +301,10 @@ static void post_spill(post_spill_env_t *pse, int iteration) be_timer_push(T_VERIFY); if (chordal_env->opts->vrfy_option == BE_CH_VRFY_WARN) { be_verify_schedule(birg); - be_verify_register_pressure(birg, pse->cls, irg); + be_verify_register_pressure(irg, pse->cls); } else if (chordal_env->opts->vrfy_option == BE_CH_VRFY_ASSERT) { assert(be_verify_schedule(birg) && "Schedule verification failed"); - assert(be_verify_register_pressure(birg, pse->cls, irg) + assert(be_verify_register_pressure(irg, pse->cls) && "Register pressure verification failed"); } be_timer_pop(T_VERIFY); @@ -443,7 +444,7 @@ static void be_ra_chordal_main(be_irg_t *birg) pre_spill(&pse, cls); be_timer_push(T_RA_SPILL); - be_do_spill(birg, cls); + be_do_spill(irg, cls); be_timer_pop(T_RA_SPILL); dump(BE_CH_DUMP_SPILL, irg, pse.cls, "spill"); diff --git a/ir/be/becopyheur2.c b/ir/be/becopyheur2.c index 684d7d7e2..3a6487aaf 100644 --- a/ir/be/becopyheur2.c +++ b/ir/be/becopyheur2.c @@ -1233,7 +1233,7 @@ int co_solve_heuristic_new(copy_opt_t *co) env.co = co; env.n_regs = co->cls->n_regs; env.ignore_regs = bitset_alloca(co->cls->n_regs); - be_put_ignore_regs(co->cenv->birg, co->cls, env.ignore_regs); + be_put_ignore_regs(co->cenv->irg, co->cls, env.ignore_regs); FIRM_DBG_REGISTER(env.dbg, "firm.be.co2"); INIT_LIST_HEAD(&env.cloud_head); diff --git a/ir/be/becopyheur4.c b/ir/be/becopyheur4.c index c7c1c7545..a2ae60d21 100644 --- a/ir/be/becopyheur4.c +++ b/ir/be/becopyheur4.c @@ -1428,7 +1428,7 @@ static int co_solve_heuristic_mst(copy_opt_t *co) phase_init(&mst_env.ph, co->irg, co_mst_irn_init); phase_set_private(&mst_env.ph, &mst_env); - k = be_put_ignore_regs(co->cenv->birg, co->cls, ignore_regs); + k = be_put_ignore_regs(co->cenv->irg, co->cls, ignore_regs); k = n_regs - k; mst_env.n_regs = n_regs; diff --git a/ir/be/beflags.c b/ir/be/beflags.c index 4d308620d..4c752e8d8 100644 --- a/ir/be/beflags.c +++ b/ir/be/beflags.c @@ -303,6 +303,6 @@ void be_sched_fix_flags(be_irg_t *birg, const arch_register_class_t *flag_cls, ir_free_resources(irg, IR_RESOURCE_IRN_LINK); if (changed) { - be_remove_dead_nodes_from_schedule(birg); + be_remove_dead_nodes_from_schedule(irg); } } diff --git a/ir/be/beirgmod.c b/ir/be/beirgmod.c index 0005b7b90..5cfad5a21 100644 --- a/ir/be/beirgmod.c +++ b/ir/be/beirgmod.c @@ -129,7 +129,7 @@ ir_node *insert_Perm_after(be_irg_t *birg, curr = proj; - be_ssa_construction_init(&senv, birg); + be_ssa_construction_init(&senv, birg->irg); be_ssa_construction_add_copy(&senv, perm_op); be_ssa_construction_add_copy(&senv, proj); be_ssa_construction_fix_users(&senv, perm_op); diff --git a/ir/be/beloopana.c b/ir/be/beloopana.c index 6b7ee74ee..bd3c86705 100644 --- a/ir/be/beloopana.c +++ b/ir/be/beloopana.c @@ -52,7 +52,7 @@ typedef struct _be_loop_info_t { struct _be_loopana_t { set *data; - be_irg_t *birg; + ir_graph *irg; }; static int cmp_loop_info(const void *a, const void *b, size_t size) @@ -66,15 +66,16 @@ static int cmp_loop_info(const void *a, const void *b, size_t size) /** * Compute the highest register pressure in a block. - * @param birg The graph. + * @param irg The graph. * @param block The block to compute pressure for. * @param cls The register class to compute pressure for. * @return The highest register pressure in the given block. */ -static unsigned be_compute_block_pressure(const be_irg_t *birg, - ir_node *block, const arch_register_class_t *cls) +static unsigned be_compute_block_pressure(const ir_graph *irg, + ir_node *block, + const arch_register_class_t *cls) { - be_lv_t *lv = be_get_irg_liveness(birg->irg); + be_lv_t *lv = be_get_irg_liveness(irg); ir_nodeset_t live_nodes; ir_node *irn; int max_live; @@ -110,7 +111,8 @@ static unsigned be_compute_block_pressure(const be_irg_t *birg, * @param cls The register class to compute pressure for. * @return The highest register pressure in the given loop. */ -static unsigned be_compute_loop_pressure(be_loopana_t *loop_ana, ir_loop *loop, const arch_register_class_t *cls) +static unsigned be_compute_loop_pressure(be_loopana_t *loop_ana, ir_loop *loop, + const arch_register_class_t *cls) { int i, max; unsigned pressure; @@ -126,7 +128,7 @@ static unsigned be_compute_loop_pressure(be_loopana_t *loop_ana, ir_loop *loop, loop_element elem = get_loop_element(loop, i); if (*elem.kind == k_ir_node) - son_pressure = be_compute_block_pressure(loop_ana->birg, elem.node, cls); + son_pressure = be_compute_block_pressure(loop_ana->irg, elem.node, cls); else { assert(*elem.kind == k_ir_loop); son_pressure = be_compute_loop_pressure(loop_ana, elem.son, cls); @@ -147,19 +149,18 @@ static unsigned be_compute_loop_pressure(be_loopana_t *loop_ana, ir_loop *loop, } /** - * Compute the register pressure for a class of all loops in the birg. - * @param birg The backend irg object + * Compute the register pressure for a class of all loops in a graph + * @param irg The graph * @param cls The register class to compute the pressure for * @return The loop analysis object. */ -be_loopana_t *be_new_loop_pressure_cls(be_irg_t *birg, +be_loopana_t *be_new_loop_pressure_cls(ir_graph *irg, const arch_register_class_t *cls) { - ir_graph *irg = be_get_birg_irg(birg); be_loopana_t *loop_ana = XMALLOC(be_loopana_t); loop_ana->data = new_set(cmp_loop_info, 16); - loop_ana->birg = birg; + loop_ana->irg = irg; DBG((dbg, LEVEL_1, "\n=====================================================\n", cls->name)); DBG((dbg, LEVEL_1, " Computing register pressure for class %s:\n", cls->name)); @@ -180,17 +181,16 @@ be_loopana_t *be_new_loop_pressure_cls(be_irg_t *birg, * @param birg The backend irg object * @return The loop analysis object. */ -be_loopana_t *be_new_loop_pressure(be_irg_t *birg, +be_loopana_t *be_new_loop_pressure(ir_graph *irg, const arch_register_class_t *cls) { - ir_graph *irg = be_get_birg_irg(birg); be_loopana_t *loop_ana = XMALLOC(be_loopana_t); ir_loop *irg_loop = get_irg_loop(irg); const arch_env_t *arch_env = be_get_irg_arch_env(irg); int i; loop_ana->data = new_set(cmp_loop_info, 16); - loop_ana->birg = birg; + loop_ana->irg = irg; /* construct control flow loop tree */ if (! (get_irg_loopinfo_state(irg) & loopinfo_cf_consistent)) { diff --git a/ir/be/beloopana.h b/ir/be/beloopana.h index 29778f24d..e7a368868 100644 --- a/ir/be/beloopana.h +++ b/ir/be/beloopana.h @@ -36,31 +36,33 @@ typedef struct _be_loopana_t be_loopana_t; /** * Compute the register pressure for a class of all loops in the birg. - * @param birg The backend irg object + * @param irg The graph * @param cls The register class to compute the pressure for * @return The loop analysis object. */ -be_loopana_t *be_new_loop_pressure_cls(be_irg_t *birg, const arch_register_class_t *cls); +be_loopana_t *be_new_loop_pressure_cls(ir_graph *irg, + const arch_register_class_t *cls); /** * Compute the register pressure of all loops in the birg. - * @param birg The backend irg object + * @param irg The graph * @param cls register class to compute loop pressure for, * if NULL computes for all classes * @return The loop analysis object. */ -be_loopana_t *be_new_loop_pressure(be_irg_t *birg, +be_loopana_t *be_new_loop_pressure(ir_graph *irg, const arch_register_class_t *cls); /** * Returns the computed register pressure for the given class and loop. * @return The pressure or INT_MAX if not found */ -unsigned be_get_loop_pressure(be_loopana_t *loop_ana, const arch_register_class_t *cls, ir_loop *loop); +unsigned be_get_loop_pressure(be_loopana_t *loop_ana, + const arch_register_class_t *cls, ir_loop *loop); /** * Frees loop analysis object. */ void be_free_loop_pressure(be_loopana_t *loop_ana); -#endif /* FIRM_BE_BELOOPANA_H */ +#endif diff --git a/ir/be/belower.c b/ir/be/belower.c index 2941eb4bf..3bb1119ab 100644 --- a/ir/be/belower.c +++ b/ir/be/belower.c @@ -812,7 +812,7 @@ void assure_constraints(be_irg_t *birg) DB((dbg_constr, LEVEL_1, "\n")); /* introduce the copies for the operand and it's copies */ - be_ssa_construction_init(&senv, birg); + be_ssa_construction_init(&senv, irg); be_ssa_construction_add_copy(&senv, map_entry.node); be_ssa_construction_add_copies(&senv, nodes, n); be_ssa_construction_fix_users(&senv, map_entry.node); diff --git a/ir/be/bemain.c b/ir/be/bemain.c index 967712844..63ddd8db3 100644 --- a/ir/be/bemain.c +++ b/ir/be/bemain.c @@ -770,7 +770,7 @@ static void be_main_loop(FILE *file_handle, const char *cup_name) /* fix stack offsets */ be_timer_push(T_ABI); be_abi_fix_stack_nodes(birg->abi); - be_remove_dead_nodes_from_schedule(birg); + be_remove_dead_nodes_from_schedule(irg); be_abi_fix_stack_bias(birg->abi); be_timer_pop(T_ABI); @@ -916,7 +916,8 @@ void be_main(FILE *file_handle, const char *cup_name) #endif } -unsigned be_put_ignore_regs(const be_irg_t *birg, const arch_register_class_t *cls, bitset_t *bs) +unsigned be_put_ignore_regs(const ir_graph *irg, + const arch_register_class_t *cls, bitset_t *bs) { if (bs == NULL) bs = bitset_alloca(cls->n_regs); @@ -926,7 +927,7 @@ unsigned be_put_ignore_regs(const be_irg_t *birg, const arch_register_class_t *c assert(bitset_size(bs) == cls->n_regs); arch_put_non_ignore_regs(cls, bs); bitset_flip_all(bs); - be_abi_put_ignore_regs(birg->abi, cls, bs); + be_abi_put_ignore_regs(be_birg_from_irg(irg)->abi, cls, bs); return bitset_popcount(bs); } diff --git a/ir/be/beprefalloc.c b/ir/be/beprefalloc.c index 5609f8e23..ed0435c1d 100644 --- a/ir/be/beprefalloc.c +++ b/ir/be/beprefalloc.c @@ -1934,14 +1934,14 @@ static void spill(void) { /* make sure all nodes show their real register pressure */ be_timer_push(T_RA_CONSTR); - be_pre_spill_prepare_constr(birg, cls); + be_pre_spill_prepare_constr(irg, cls); be_timer_pop(T_RA_CONSTR); dump(DUMP_RA, irg, "-spillprepare"); /* spill */ be_timer_push(T_RA_SPILL); - be_do_spill(birg, cls); + be_do_spill(irg, cls); be_timer_pop(T_RA_SPILL); be_timer_push(T_RA_SPILL_APPLY); @@ -1987,10 +1987,10 @@ static void be_pref_alloc(be_irg_t *new_birg) be_timer_push(T_VERIFY); if (birg->main_env->options->vrfy_option == BE_VRFY_WARN) { be_verify_schedule(birg); - be_verify_register_pressure(birg, cls, irg); + be_verify_register_pressure(irg, cls); } else if (birg->main_env->options->vrfy_option == BE_VRFY_ASSERT) { assert(be_verify_schedule(birg) && "Schedule verification failed"); - assert(be_verify_register_pressure(birg, cls, irg) + assert(be_verify_register_pressure(irg, cls) && "Register pressure verification failed"); } be_timer_pop(T_VERIFY); diff --git a/ir/be/besched.c b/ir/be/besched.c index ef64e3912..6fa533e50 100644 --- a/ir/be/besched.c +++ b/ir/be/besched.c @@ -156,14 +156,12 @@ static void remove_dead_nodes_walker(ir_node *block, void *data) } } -void be_remove_dead_nodes_from_schedule(be_irg_t *birg) +void be_remove_dead_nodes_from_schedule(ir_graph *irg) { - ir_graph *irg = be_get_birg_irg(birg); - remove_dead_nodes_env_t env; env.reachable = bitset_alloca(get_irg_last_idx(irg)); - env.lv = be_get_irg_liveness(irg); - env.irg = irg; + env.lv = be_get_irg_liveness(irg); + env.irg = irg; // mark all reachable nodes irg_walk_graph(irg, mark_dead_nodes_walker, NULL, &env); diff --git a/ir/be/besched.h b/ir/be/besched.h index 0cbe71d42..7d7ef3888 100644 --- a/ir/be/besched.h +++ b/ir/be/besched.h @@ -93,7 +93,7 @@ void sched_remove(ir_node *irn); * Removes dead nodes from schedule * @param irg the graph */ -void be_remove_dead_nodes_from_schedule(be_irg_t *birg); +void be_remove_dead_nodes_from_schedule(ir_graph *irg); #define SCHED_INITIAL_GRANULARITY (1 << 14) #define get_irn_sched_info(irn) (&be_get_info(skip_Proj_const(irn))->sched_info) diff --git a/ir/be/bespill.c b/ir/be/bespill.c index 0bbb445e8..de71ea8f6 100644 --- a/ir/be/bespill.c +++ b/ir/be/bespill.c @@ -50,7 +50,7 @@ DEBUG_ONLY(static firm_dbg_module_t *dbg = NULL;) typedef struct be_pre_spill_env_t { - be_irg_t *birg; + ir_graph *irg; const arch_register_class_t *cls; } be_pre_spill_env_t; @@ -58,8 +58,8 @@ static void prepare_constr_insn(be_pre_spill_env_t *env, ir_node *node) { const arch_register_class_t *cls = env->cls; ir_node *block = get_nodes_block(node); - const be_irg_t *birg = env->birg; - be_lv_t *lv = birg->lv; + const ir_graph *irg = env->irg; + be_lv_t *lv = be_get_irg_liveness(irg); unsigned *tmp = NULL; unsigned *def_constr = NULL; int arity = get_irn_arity(node); @@ -239,14 +239,13 @@ static void pre_spill_prepare_constr_walker(ir_node *block, void *data) } } -void be_pre_spill_prepare_constr(be_irg_t *birg, +void be_pre_spill_prepare_constr(ir_graph *irg, const arch_register_class_t *cls) { - ir_graph *irg = birg->irg; be_pre_spill_env_t env; memset(&env, 0, sizeof(env)); - env.birg = birg; - env.cls = cls; + env.irg = irg; + env.cls = cls; be_assure_liveness(irg); @@ -274,11 +273,11 @@ void be_register_spiller(const char *name, be_spiller_t *spiller) be_add_module_to_list(&spillers, name, spiller); } -void be_do_spill(be_irg_t *birg, const arch_register_class_t *cls) +void be_do_spill(ir_graph *irg, const arch_register_class_t *cls) { assert(selected_spiller != NULL); - selected_spiller->spill(birg, cls); + selected_spiller->spill(irg, cls); } BE_REGISTER_MODULE_CONSTRUCTOR(be_init_spilloptions); diff --git a/ir/be/bespill.h b/ir/be/bespill.h index 52551132c..61a92d88d 100644 --- a/ir/be/bespill.h +++ b/ir/be/bespill.h @@ -40,10 +40,10 @@ typedef struct be_spiller_t { /** * The spill function. * - * @param birg the graph to spill on + * @param irg the graph to spill on * @param cls the register class to spill */ - void (*spill)(be_irg_t *birg, const arch_register_class_t *cls); + void (*spill)(ir_graph *irg, const arch_register_class_t *cls); } be_spiller_t; /** @@ -58,16 +58,16 @@ void be_register_spiller(const char *name, be_spiller_t *spiller); /** * Execute the selected spill algorithm * - * @param birg the graph to spill on + * @param irg the graph to spill on * @param cls the register class to spill */ -void be_do_spill(be_irg_t *birg, const arch_register_class_t *cls); +void be_do_spill(ir_graph *irg, const arch_register_class_t *cls); /** * Adds additional copies, so constraints needing additional registers to be * solved correctly induce the additional register pressure. */ -void be_pre_spill_prepare_constr(be_irg_t *birg, +void be_pre_spill_prepare_constr(ir_graph *irg, const arch_register_class_t *cls); #endif diff --git a/ir/be/bespillbelady.c b/ir/be/bespillbelady.c index 32fccbefb..7667fc85b 100644 --- a/ir/be/bespillbelady.c +++ b/ir/be/bespillbelady.c @@ -927,10 +927,9 @@ static void fix_block_borders(ir_node *block, void *data) } } -static void be_spill_belady(be_irg_t *birg, const arch_register_class_t *rcls) +static void be_spill_belady(ir_graph *irg, const arch_register_class_t *rcls) { int i; - ir_graph *irg = be_get_birg_irg(birg); be_liveness_assure_sets(be_assure_liveness(irg)); @@ -952,11 +951,11 @@ static void be_spill_belady(be_irg_t *birg, const arch_register_class_t *rcls) obstack_init(&obst); cls = rcls; lv = be_get_irg_liveness(irg); - n_regs = cls->n_regs - be_put_ignore_regs(birg, cls, NULL); + n_regs = cls->n_regs - be_put_ignore_regs(irg, cls, NULL); ws = new_workset(); uses = be_begin_uses(irg, lv); - loop_ana = be_new_loop_pressure(birg, cls); - senv = be_new_spill_env(birg); + loop_ana = be_new_loop_pressure(irg, cls); + senv = be_new_spill_env(irg); blocklist = be_get_cfgpostorder(irg); stat_ev_tim_pop("belady_time_init"); diff --git a/ir/be/bespillbelady2.c b/ir/be/bespillbelady2.c index bbc1de2c6..48d677caa 100644 --- a/ir/be/bespillbelady2.c +++ b/ir/be/bespillbelady2.c @@ -1468,17 +1468,16 @@ static void collect_blocks(ir_node *bl, void *data) * In the transformed graph, the register pressure never exceeds the number * of available registers. * - * @param birg The backend graph + * @param irg The graph * @param cls The register class to spill */ -static void be_spill_belady(be_irg_t *birg, const arch_register_class_t *cls) +static void be_spill_belady(ir_graph *irg, const arch_register_class_t *cls) { - ir_graph *irg = be_get_birg_irg(birg); belady_env_t env; int i, n_regs; /* some special classes contain only ignore regs, nothing to do then */ - n_regs = cls->n_regs - be_put_ignore_regs(birg, cls, NULL); + n_regs = cls->n_regs - be_put_ignore_regs(irg, cls, NULL); if (n_regs == 0) return; @@ -1493,7 +1492,7 @@ static void be_spill_belady(be_irg_t *birg, const arch_register_class_t *cls) env.dfs = env.lv->dfs; env.n_regs = n_regs; env.ws = new_workset(&env, &env.ob); - env.senv = be_new_spill_env(birg); + env.senv = be_new_spill_env(irg); env.ef = be_get_irg_exec_freq(irg); env.spilled = bitset_irg_obstack_alloc(&env.ob, irg); env.extra_spilled = ir_nodeset_new(64); diff --git a/ir/be/bespilldaemel.c b/ir/be/bespilldaemel.c index e364601a9..c9ef9dbb4 100644 --- a/ir/be/bespilldaemel.c +++ b/ir/be/bespilldaemel.c @@ -377,17 +377,16 @@ static void spill_block(ir_node *block, void *data) ir_nodeset_destroy(&live_nodes); } -static void be_spill_daemel(be_irg_t *birg, const arch_register_class_t *new_cls) +static void be_spill_daemel(ir_graph *irg, const arch_register_class_t *new_cls) { - ir_graph *irg = be_get_birg_irg(birg); - n_regs = new_cls->n_regs - be_put_ignore_regs(birg, new_cls, NULL); + n_regs = new_cls->n_regs - be_put_ignore_regs(irg, new_cls, NULL); if (n_regs == 0) return; be_liveness_assure_sets(be_assure_liveness(irg)); - spill_env = be_new_spill_env(birg); + spill_env = be_new_spill_env(irg); cls = new_cls; lv = be_get_irg_liveness(irg); spilled_nodes = bitset_malloc(get_irg_last_idx(irg)); diff --git a/ir/be/bespillutil.c b/ir/be/bespillutil.c index 86eef3e9b..96ec7b38e 100644 --- a/ir/be/bespillutil.c +++ b/ir/be/bespillutil.c @@ -98,7 +98,6 @@ struct spill_env_t { const arch_env_t *arch_env; ir_graph *irg; struct obstack obst; - be_irg_t *birg; int spill_cost; /**< the cost of a single spill node */ int reload_cost; /**< the cost of a reload node */ set *spills; /**< all spill_info_t's, which must be @@ -148,15 +147,13 @@ static spill_info_t *get_spillinfo(const spill_env_t *env, ir_node *value) return res; } -spill_env_t *be_new_spill_env(be_irg_t *birg) +spill_env_t *be_new_spill_env(ir_graph *irg) { - const arch_env_t *arch_env = birg->main_env->arch_env; - ir_graph *irg = be_get_birg_irg(birg); + const arch_env_t *arch_env = be_get_irg_arch_env(irg); spill_env_t *env = XMALLOC(spill_env_t); env->spills = new_set(cmp_spillinfo, 1024); env->irg = irg; - env->birg = birg; env->arch_env = arch_env; ir_nodeset_init(&env->mem_phis); env->spill_cost = arch_env->spill_cost; @@ -994,7 +991,7 @@ void be_insert_spills_reloads(spill_env_t *env) be_ssa_construction_env_t senv; /* be_lv_t *lv = be_get_irg_liveness(env->irg); */ - be_ssa_construction_init(&senv, env->birg); + be_ssa_construction_init(&senv, env->irg); be_ssa_construction_add_copy(&senv, to_spill); be_ssa_construction_add_copies(&senv, copies, ARR_LEN(copies)); be_ssa_construction_fix_users(&senv, to_spill); @@ -1018,7 +1015,7 @@ void be_insert_spills_reloads(spill_env_t *env) be_ssa_construction_env_t senv; - be_ssa_construction_init(&senv, env->birg); + be_ssa_construction_init(&senv, env->irg); spill = si->spills; for ( ; spill != NULL; spill = spill->next) { /* maybe we rematerialized the value and need no spill */ @@ -1046,9 +1043,9 @@ void be_insert_spills_reloads(spill_env_t *env) /* Matze: In theory be_ssa_construction should take care of the liveness... * try to disable this again in the future */ - be_liveness_invalidate(env->birg->lv); + be_liveness_invalidate(be_get_irg_liveness(env->irg)); - be_remove_dead_nodes_from_schedule(env->birg); + be_remove_dead_nodes_from_schedule(env->irg); be_timer_pop(T_RA_SPILL_APPLY); } diff --git a/ir/be/bespillutil.h b/ir/be/bespillutil.h index 0e73d1f5e..db4359e2a 100644 --- a/ir/be/bespillutil.h +++ b/ir/be/bespillutil.h @@ -39,7 +39,7 @@ typedef struct spill_env_t spill_env_t; /** * Creates a new spill environment. */ -spill_env_t *be_new_spill_env(be_irg_t *birg); +spill_env_t *be_new_spill_env(ir_graph *irg); /** * Deletes a spill environment. @@ -160,10 +160,10 @@ void make_spill_locations_dominate_irn(spill_env_t *env, ir_node *irn); /** * Collect spill/reload cost statistics for a graph. - * @param birg The backend graph. + * @param irg The graph. * @param costs A struct which will be filled with the costs. */ -void be_get_total_spill_costs(be_irg_t *birg, be_total_spill_costs_t *costs); +void be_get_total_spill_costs(ir_graph *irg, be_total_spill_costs_t *costs); /** * Check, if a node is rematerializable. diff --git a/ir/be/bessaconstr.c b/ir/be/bessaconstr.c index 6cae3f2a0..605cf5876 100644 --- a/ir/be/bessaconstr.c +++ b/ir/be/bessaconstr.c @@ -241,9 +241,8 @@ static void introduce_def_at_block(ir_node *block, ir_node *def) } } -void be_ssa_construction_init(be_ssa_construction_env_t *env, be_irg_t *birg) +void be_ssa_construction_init(be_ssa_construction_env_t *env, ir_graph *irg) { - ir_graph *irg = be_get_birg_irg(birg); ir_node *sb = get_irg_start_block(irg); int n_blocks = get_Block_dom_max_subtree_pre_num(sb); diff --git a/ir/be/bessaconstr.h b/ir/be/bessaconstr.h index d7baeeeae..343b21382 100644 --- a/ir/be/bessaconstr.h +++ b/ir/be/bessaconstr.h @@ -74,7 +74,7 @@ typedef struct be_ssa_construction_env_t { * @param env an SSA empty construction environment * @param birg */ -void be_ssa_construction_init(be_ssa_construction_env_t *env, be_irg_t *birg); +void be_ssa_construction_init(be_ssa_construction_env_t *env, ir_graph *irg); void be_ssa_construction_add_copy(be_ssa_construction_env_t *env, ir_node *value); diff --git a/ir/be/bestate.c b/ir/be/bestate.c index 1b2c72fe0..823dec9a2 100644 --- a/ir/be/bestate.c +++ b/ir/be/bestate.c @@ -560,7 +560,7 @@ void be_assure_state(be_irg_t *birg, const arch_register_t *reg, void *func_env, int i, len; ir_node **phis; - be_ssa_construction_init(&senv, birg); + be_ssa_construction_init(&senv, irg); if (sched_is_scheduled(info->value)) be_ssa_construction_add_copy(&senv, info->value); be_ssa_construction_add_copies(&senv, @@ -592,7 +592,7 @@ void be_assure_state(be_irg_t *birg, const arch_register_t *reg, void *func_env, } /* some nodes might be dead now. */ - be_remove_dead_nodes_from_schedule(birg); + be_remove_dead_nodes_from_schedule(irg); ir_nodemap_destroy(&env.spill_infos); be_end_uses(env.uses); diff --git a/ir/be/beverify.c b/ir/be/beverify.c index db35228b8..48eea5f6b 100644 --- a/ir/be/beverify.c +++ b/ir/be/beverify.c @@ -119,15 +119,15 @@ static void verify_liveness_walker(ir_node *block, void *data) /** * Start a walk over the irg and check the register pressure. */ -int be_verify_register_pressure(const be_irg_t *birg, - const arch_register_class_t *cls, ir_graph *irg) +int be_verify_register_pressure(ir_graph *irg, const arch_register_class_t *cls) { be_verify_register_pressure_env_t env; env.lv = be_liveness(irg); env.irg = irg; env.cls = cls; - env.registers_available = env.cls->n_regs - be_put_ignore_regs(birg, env.cls, NULL); + env.registers_available + = env.cls->n_regs - be_put_ignore_regs(irg, env.cls, NULL); env.problem_found = 0; be_liveness_assure_sets(env.lv); diff --git a/ir/be/beverify.h b/ir/be/beverify.h index 8117f5f0d..6683085e6 100644 --- a/ir/be/beverify.h +++ b/ir/be/beverify.h @@ -36,12 +36,12 @@ * Verifies, that the register pressure for a given register class doesn't exceed the limit * of available registers. * - * @param birg The backend IRG. - * @param cls The register class to check. * @param irg The irg to check. + * @param cls The register class to check. * @return 1 if the pressure is valid, 0 otherwise. */ -int be_verify_register_pressure(const be_irg_t *birg, const arch_register_class_t* cls, ir_graph *irg); +int be_verify_register_pressure(ir_graph *irg, + const arch_register_class_t* cls); /** * Does some sanity checks on the schedule. diff --git a/ir/be/ia32/ia32_fpu.c b/ir/be/ia32/ia32_fpu.c index f03b2a430..076cfcc9a 100644 --- a/ir/be/ia32/ia32_fpu.c +++ b/ir/be/ia32/ia32_fpu.c @@ -263,7 +263,7 @@ static void rewire_fpu_mode_nodes(be_irg_t *birg) return; } - be_ssa_construction_init(&senv, birg); + be_ssa_construction_init(&senv, irg); be_ssa_construction_add_copies(&senv, env.state_nodes, ARR_LEN(env.state_nodes)); be_ssa_construction_fix_users(&senv, initial_value); -- 2.20.1