Commit 69849fc8 authored by Matthias Braun's avatar Matthias Braun
Browse files

- change various be_get_birg_XXX functions to be_get_irg_XXX functions.

[r27690]
parent 696520d4
......@@ -178,7 +178,7 @@ static const arch_code_generator_if_t TEMPLATE_code_gen_if = {
*/
static void *TEMPLATE_cg_init(be_irg_t *birg)
{
const arch_env_t *arch_env = be_get_birg_arch_env(birg);
const arch_env_t *arch_env = be_get_irg_arch_env(birg->irg);
TEMPLATE_isa_t *isa = (TEMPLATE_isa_t *) arch_env;
TEMPLATE_code_gen_t *cg = XMALLOC(TEMPLATE_code_gen_t);
......
......@@ -275,7 +275,7 @@ static const arch_code_generator_if_t amd64_code_gen_if = {
*/
static void *amd64_cg_init(be_irg_t *birg)
{
const arch_env_t *arch_env = be_get_birg_arch_env(birg);
const arch_env_t *arch_env = be_get_irg_arch_env(birg->irg);
amd64_isa_t *isa = (amd64_isa_t *) arch_env;
amd64_code_gen_t *cg = XMALLOC(amd64_code_gen_t);
......
......@@ -2428,7 +2428,8 @@ void be_abi_fix_stack_nodes(be_abi_irg_t *env)
int i, len;
ir_node **phis;
be_irg_t *birg = env->birg;
be_lv_t *lv = be_get_birg_liveness(birg);
ir_graph *irg = env->irg;
be_lv_t *lv = be_get_irg_liveness(irg);
fix_stack_walker_env_t walker_env;
walker_env.sp_nodes = NEW_ARR_F(ir_node*, 0);
......
......@@ -747,8 +747,7 @@ void be_init_blocksched(void)
ir_node **be_create_block_schedule(ir_graph *irg)
{
const be_irg_t *birg = be_birg_from_irg(irg);
ir_exec_freq *execfreqs = be_get_birg_exec_freq(birg);
ir_exec_freq *execfreqs = be_get_irg_exec_freq(irg);
switch (algo) {
case BLOCKSCHED_GREEDY:
......
......@@ -538,13 +538,12 @@ void be_ra_chordal_color(be_chordal_env_t *chordal_env)
be_chordal_alloc_env_t env;
char buf[256];
be_lv_t *lv;
be_irg_t *birg = chordal_env->birg;
const arch_register_class_t *cls = chordal_env->cls;
int colors_n = arch_register_class_n_regs(cls);
ir_graph *irg = chordal_env->irg;
lv = be_assure_liveness(birg);
lv = be_assure_liveness(irg);
be_liveness_assure_sets(lv);
be_liveness_assure_chk(lv);
......
......@@ -378,7 +378,7 @@ static void draw_block(ir_node *bl, void *data)
{
static const color_t black = { 0, 0, 0 };
const draw_chordal_env_t *env = data;
const be_lv_t *lv = be_get_birg_liveness(env->chordal_env->birg);
const be_lv_t *lv = be_get_irg_liveness(env->chordal_env->irg);
struct list_head *head = get_block_border_head(env->chordal_env, bl);
ir_node *dom = get_Block_idom(bl);
const draw_chordal_opts_t *opts = env->opts;
......@@ -454,7 +454,7 @@ static void draw(draw_chordal_env_t *env, const rect_t *start_box)
bbox.w = start_box->w + 2 * env->opts->x_margin;
bbox.h = start_box->h + 2 * env->opts->y_margin;
lv = be_assure_liveness(env->chordal_env->birg);
lv = be_assure_liveness(env->chordal_env->irg);
be_liveness_assure_sets(lv);
be_liveness_assure_chk(lv);
......
......@@ -244,17 +244,17 @@ static be_node_stats_t last_node_stats;
*/
static void pre_spill(post_spill_env_t *pse, const arch_register_class_t *cls)
{
be_chordal_env_t *chordal_env = &pse->cenv;
be_irg_t *birg = pse->birg;
ir_graph *irg = be_get_birg_irg(birg);
be_chordal_env_t *chordal_env = &pse->cenv;
be_irg_t *birg = pse->birg;
ir_graph *irg = be_get_birg_irg(birg);
pse->cls = cls;
chordal_env->cls = cls;
chordal_env->border_heads = pmap_create();
chordal_env->ignore_colors = bitset_malloc(chordal_env->cls->n_regs);
be_assure_liveness(birg);
be_liveness_assure_chk(be_get_birg_liveness(birg));
be_assure_liveness(irg);
be_liveness_assure_chk(be_get_irg_liveness(irg));
stat_ev_do(pse->pre_spill_cost = be_estimate_irg_costs(irg, birg->exec_freq));
......@@ -401,7 +401,7 @@ static void be_ra_chordal_main(be_irg_t *birg)
be_timer_push(T_RA_PROLOG);
be_assure_liveness(birg);
be_assure_liveness(irg);
chordal_env.obst = &obst;
chordal_env.opts = &options;
......@@ -499,7 +499,7 @@ static void be_ra_chordal_main(be_irg_t *birg)
dump(BE_CH_DUMP_LOWER, irg, NULL, "belower-after-ra");
obstack_free(&obst, NULL);
be_liveness_invalidate(be_get_birg_liveness(birg));
be_liveness_invalidate(be_get_irg_liveness(irg));
be_timer_pop(T_RA_EPILOG);
be_timer_pop(T_RA_OTHER);
......
......@@ -1159,7 +1159,7 @@ void co_driver(be_chordal_env_t *cenv)
if (selected_copyopt->copyopt == void_algo)
return;
be_liveness_assure_chk(be_get_birg_liveness(cenv->birg));
be_liveness_assure_chk(be_get_irg_liveness(cenv->irg));
co = new_copy_opt(cenv, cost_func);
co_build_ou_structure(co);
......
......@@ -2004,7 +2004,7 @@ void be_ilp_sched(const be_irg_t *birg, be_options_t *be_opts)
{
be_ilpsched_env_t env;
ir_graph *irg = be_get_birg_irg(birg);
const arch_env_t *arch_env = be_get_birg_arch_env(birg);
const arch_env_t *arch_env = be_get_irg_arch_env(irg);
const ilp_sched_selector_t *sel = arch_env->impl->get_ilp_sched_selector(arch_env);
FIRM_DBG_REGISTER(env.dbg, "firm.be.sched.ilp");
......
......@@ -211,7 +211,7 @@ static inline int _strictly_dominates_use(const ir_node *irn, const ir_edge_t *e
*/
static inline int _be_lv_chk_before_irn(const be_irg_t *birg, const ir_node *irn, const ir_node *where)
{
const be_lv_t *lv = be_get_birg_liveness(birg);
const be_lv_t *lv = be_get_irg_liveness(birg->irg);
const ir_edge_t *edge;
/* the node must strictly dominate the location, else it cannot be live there. */
......@@ -246,7 +246,7 @@ static inline int _be_lv_chk_before_irn(const be_irg_t *birg, const ir_node *irn
*/
static inline int _be_lv_chk_after_irn(const be_irg_t *birg, const ir_node *irn, const ir_node *where)
{
const be_lv_t *lv = be_get_birg_liveness(birg);
const be_lv_t *lv = be_get_irg_liveness(birg->irg);
const ir_edge_t *edge;
if (!_value_dominates(irn, where))
......
......@@ -32,24 +32,27 @@
#include "belive.h"
#include "bedomfront.h"
be_lv_t *be_assure_liveness(be_irg_t *birg)
be_lv_t *be_assure_liveness(ir_graph *irg)
{
be_irg_t *birg = be_birg_from_irg(irg);
if (birg->lv != NULL)
return birg->lv;
return birg->lv = be_liveness(birg->irg);
}
void be_assure_dom_front(be_irg_t *birg)
void be_assure_dom_front(ir_graph *irg)
{
be_irg_t *birg = be_birg_from_irg(irg);
if (birg->dom_front != NULL)
return;
birg->dom_front = be_compute_dominance_frontiers(birg->irg);
}
void be_invalidate_dom_front(be_irg_t *birg)
void be_invalidate_dom_front(ir_graph *irg)
{
be_irg_t *birg = be_birg_from_irg(irg);
if (birg->dom_front == NULL)
return;
......@@ -57,8 +60,9 @@ void be_invalidate_dom_front(be_irg_t *birg)
birg->dom_front = NULL;
}
void be_free_birg(be_irg_t *birg)
void be_free_birg(ir_graph *irg)
{
be_irg_t *birg = be_birg_from_irg(irg);
free_execfreq(birg->exec_freq);
birg->exec_freq = NULL;
......@@ -72,5 +76,5 @@ void be_free_birg(be_irg_t *birg)
}
obstack_free(&birg->obst, NULL);
birg->irg->be_data = NULL;
irg->be_data = NULL;
}
......@@ -32,16 +32,16 @@
#include "be_t.h"
#include "irtypes.h"
be_lv_t *be_assure_liveness(be_irg_t *birg);
be_lv_t *be_assure_liveness(ir_graph *irg);
void be_assure_dom_front(be_irg_t *birg);
void be_invalidate_dom_front(be_irg_t *birg);
void be_assure_dom_front(ir_graph *irg);
void be_invalidate_dom_front(ir_graph *irg);
/**
* frees all memory allocated by birg structures (liveness, dom_front, ...).
* The memory of the birg structure itself is not freed.
*/
void be_free_birg(be_irg_t *birg);
void be_free_birg(ir_graph *irg);
/**
* An ir_graph with additional analysis data about this irg. Also includes some
......@@ -61,34 +61,35 @@ struct be_irg_t {
during code selection) */
};
static inline be_lv_t *be_get_birg_liveness(const be_irg_t *birg)
static inline be_irg_t *be_birg_from_irg(const ir_graph *irg)
{
return birg->lv;
return (be_irg_t*) irg->be_data;
}
static inline ir_exec_freq *be_get_birg_exec_freq(const be_irg_t *birg)
static inline be_lv_t *be_get_irg_liveness(const ir_graph *irg)
{
return birg->exec_freq;
return be_birg_from_irg(irg)->lv;
}
static inline be_dom_front_info_t *be_get_birg_dom_front(const be_irg_t *birg)
static inline ir_exec_freq *be_get_irg_exec_freq(const ir_graph *irg)
{
return birg->dom_front;
return be_birg_from_irg(irg)->exec_freq;
}
static inline ir_graph *be_get_birg_irg(const be_irg_t *birg)
static inline be_dom_front_info_t *be_get_irg_dom_front(const ir_graph *irg)
{
return birg->irg;
return be_birg_from_irg(irg)->dom_front;
}
static inline const arch_env_t *be_get_birg_arch_env(const be_irg_t *birg)
/** deprecated */
static inline ir_graph *be_get_birg_irg(const be_irg_t *birg)
{
return birg->main_env->arch_env;
return birg->irg;
}
static inline be_irg_t *be_birg_from_irg(const ir_graph *irg)
static inline const arch_env_t *be_get_irg_arch_env(const ir_graph *irg)
{
return (be_irg_t*) irg->be_data;
return be_birg_from_irg(irg)->main_env->arch_env;
}
static inline struct obstack *be_get_birg_obst(const ir_graph *irg)
......
......@@ -74,7 +74,7 @@ static int cmp_loop_info(const void *a, const void *b, size_t size)
static unsigned be_compute_block_pressure(const be_irg_t *birg,
ir_node *block, const arch_register_class_t *cls)
{
be_lv_t *lv = be_get_birg_liveness(birg);
be_lv_t *lv = be_get_irg_liveness(birg->irg);
ir_nodeset_t live_nodes;
ir_node *irn;
int max_live;
......@@ -186,7 +186,7 @@ be_loopana_t *be_new_loop_pressure(be_irg_t *birg,
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_birg_arch_env(birg);
const arch_env_t *arch_env = be_get_irg_arch_env(irg);
int i;
loop_ana->data = new_set(cmp_loop_info, 16);
......
......@@ -839,7 +839,7 @@ void assure_constraints(be_irg_t *birg)
ir_nodemap_destroy(&cenv.op_set);
obstack_free(&cenv.obst, NULL);
be_liveness_invalidate(be_get_birg_liveness(birg));
be_liveness_invalidate(be_get_irg_liveness(irg));
}
......@@ -1032,8 +1032,8 @@ void lower_nodes_after_ra(be_irg_t *birg, int do_copy)
env.do_copy = do_copy;
/* we will need interference */
be_liveness_assure_chk(be_get_birg_liveness(birg));
irg = be_get_birg_irg(birg);
be_liveness_assure_chk(be_get_irg_liveness(irg));
irg_walk_graph(irg, NULL, lower_nodes_after_ra_walker, &env);
}
......@@ -842,7 +842,7 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
}
}
be_free_birg(birg);
be_free_birg(irg);
stat_ev_ctx_pop("bemain_irg");
}
ir_profile_free();
......
......@@ -521,7 +521,7 @@ static void be_pbqp_coloring(be_chordal_env_t *env)
printf("#### ----- === Allocating registers of %s (%s) ===\n", cls->name, get_entity_name(get_irg_entity(irg)));
#endif
lv = be_assure_liveness(birg);
lv = be_assure_liveness(irg);
be_liveness_assure_sets(lv);
be_liveness_assure_chk(lv);
......
......@@ -411,9 +411,9 @@ ir_node *be_peephole_IncSP_IncSP(ir_node *node)
void be_peephole_opt(be_irg_t *birg)
{
ir_graph *irg = be_get_birg_irg(birg);
unsigned n_classes;
unsigned i;
ir_graph *irg = be_get_birg_irg(birg);
unsigned n_classes;
unsigned i;
/* barrier nodes are used for register allocations. They hinders
* peephole optimizations, so remove them here. */
......@@ -422,10 +422,10 @@ void be_peephole_opt(be_irg_t *birg)
/* we sometimes find BadE nodes in float apps like optest_float.c or
* kahansum.c for example... */
be_liveness_invalidate(birg->lv);
be_liveness_assure_sets(be_assure_liveness(birg));
be_liveness_assure_sets(be_assure_liveness(irg));
arch_env = be_get_birg_arch_env(birg);
lv = be_get_birg_liveness(birg);
arch_env = be_get_irg_arch_env(irg);
lv = be_get_irg_liveness(irg);
n_classes = arch_env_get_n_reg_class(arch_env);
register_values = XMALLOCN(ir_node**, n_classes);
......
......@@ -1900,7 +1900,7 @@ static void be_pref_alloc_cls(void)
{
int i;
lv = be_assure_liveness(birg);
lv = be_assure_liveness(irg);
be_liveness_assure_sets(lv);
ir_reserve_resources(irg, IR_RESOURCE_IRN_LINK);
......
......@@ -162,7 +162,7 @@ void be_remove_dead_nodes_from_schedule(be_irg_t *birg)
remove_dead_nodes_env_t env;
env.reachable = bitset_alloca(get_irg_last_idx(irg));
env.lv = be_get_birg_liveness(birg);
env.lv = be_get_irg_liveness(irg);
env.irg = irg;
// mark all reachable nodes
......
......@@ -2200,7 +2200,7 @@ void rss_schedule_preparation(be_irg_t *birg)
init_rss_special_nodes(irg);
rss.irg = irg;
rss.arch_env = be_get_birg_arch_env(birg);
rss.arch_env = be_get_irg_arch_env(irg);
rss.abi = birg->abi;
rss.h = heights_new(irg);
rss.nodes = plist_new();
......
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