Commit e6623006 authored by Sebastian Hack's avatar Sebastian Hack
Browse files

Changed API of listscheduler

init_graph now gets a birg not a arch_env/irg

[r15559]
parent 4e23143a
......@@ -602,7 +602,7 @@ void list_sched(be_irg_t *birg, be_options_t *be_opts)
memset(env.sched_info, 0, num_nodes * sizeof(env.sched_info[0]));
if (env.selector->init_graph)
env.selector_env = env.selector->init_graph(env.selector, arch_env, irg);
env.selector_env = env.selector->init_graph(env.selector, birg);
/* Schedule each single block. */
irg_block_walk_graph(irg, list_sched_block, NULL, &env);
......@@ -667,7 +667,7 @@ void list_sched_single_block(const be_irg_t *birg, ir_node *block,
memset(env.sched_info, 0, num_nodes * sizeof(env.sched_info[0]));
if (env.selector->init_graph)
env.selector_env = env.selector->init_graph(env.selector, arch_env, irg);
env.selector_env = env.selector->init_graph(env.selector, birg);
/* Schedule block. */
list_sched_block(block, &env);
......
......@@ -45,11 +45,11 @@ struct _list_sched_selector_t {
/**
* Called before a graph is being scheduled.
* @param arch_env The architecture environment.
* @param irg The graph.
* @param vtab The selector vtab.
* @param birg The backend graph.
* @return The environment pointer that is passed to all other functions in this struct.
*/
void *(*init_graph)(const list_sched_selector_t *vtab, const arch_env_t *arch_env, ir_graph *irg);
void *(*init_graph)(const list_sched_selector_t *vtab, const be_irg_t *birg);
/**
* Called before scheduling starts on a block.
......
......@@ -77,16 +77,14 @@ static ir_node *random_select(void *block_env, ir_nodeset_t *ready_set,
return irn;
}
static void *random_init_graph(const list_sched_selector_t *vtab,
const arch_env_t *arch_env, ir_graph *irg)
static void *random_init_graph(const list_sched_selector_t *vtab, const be_irg_t *birg)
{
(void) vtab;
(void) irg;
/* Using time(NULL) as a seed here gives really random results,
but is NOT deterministic which makes debugging impossible.
Moreover no-one want non-deterministic compilers ... */
srand(0x4711);
return (void *)arch_env;
return (void *) be_get_birg_arch_env(birg);
}
static void *random_init_block(void *graph_env, ir_node *block)
......
......@@ -174,13 +174,13 @@ static int compute_max_hops(reg_pressure_selector_env_t *env, ir_node *irn)
return res;
}
static void *reg_pressure_graph_init(const list_sched_selector_t *vtab, const arch_env_t *arch_env, ir_graph *irg)
static void *reg_pressure_graph_init(const list_sched_selector_t *vtab, const be_irg_t *birg)
{
reg_pressure_main_env_t *main_env = xmalloc(sizeof(main_env[0]));
main_env->arch_env = arch_env;
main_env->arch_env = be_get_birg_arch_env(birg);
main_env->vtab = vtab;
irg_walk_graph(irg, firm_clear_link, NULL, NULL);
irg_walk_graph(be_get_birg_irg(birg), firm_clear_link, NULL, NULL);
return main_env;
}
......
......@@ -2148,7 +2148,7 @@ BE_REGISTER_MODULE_CONSTRUCTOR(be_init_schedrss);
/**
* Preprocess the irg for scheduling.
*/
void rss_schedule_preparation(const be_irg_t *birg) {
void rss_schedule_preparation(be_irg_t *birg) {
ir_graph *irg = be_get_birg_irg(birg);
rss_t rss;
......@@ -2164,7 +2164,7 @@ void rss_schedule_preparation(const be_irg_t *birg) {
rss.h = heights_new(irg);
rss.nodes = plist_new();
rss.opts = &rss_options;
rss.liveness = be_liveness(irg);
rss.liveness = be_liveness(birg);
be_liveness_assure_sets(rss.liveness);
irg_block_walk_graph(irg, NULL, process_block, &rss);
heights_free(rss.h);
......
......@@ -37,6 +37,6 @@
* Perform RSS schedule preprocessing for the given irg.
* @param birg The backend irg object
*/
void rss_schedule_preparation(const be_irg_t *birg);
void rss_schedule_preparation(be_irg_t *birg);
#endif /* FIRM_BE_BESCHEDRSS_H */
......@@ -484,14 +484,15 @@ static void trace_update_time(void *data, ir_node *irn) {
* @param birg The backend irg object
* @return The environment
*/
static trace_env_t *trace_init(const arch_env_t *arch_env, ir_graph *irg) {
static trace_env_t *trace_init(const be_irg_t *birg) {
trace_env_t *env = xcalloc(1, sizeof(*env));
ir_graph *irg = be_get_birg_irg(birg);
int nn = get_irg_last_idx(irg);
env->arch_env = arch_env;
env->arch_env = be_get_birg_arch_env(birg);
env->curr_time = 0;
env->sched_info = NEW_ARR_F(trace_irn_t, nn);
env->liveness = be_liveness(irg);
env->liveness = be_liveness(birg);
FIRM_DBG_REGISTER(env->dbg, "firm.be.sched.trace");
be_liveness_assure_chk(env->liveness);
......@@ -592,11 +593,11 @@ force_mcands:
return irn;
}
static void *muchnik_init_graph(const list_sched_selector_t *vtab, const arch_env_t *arch_env, ir_graph *irg)
static void *muchnik_init_graph(const list_sched_selector_t *vtab, const be_irg_t *birg)
{
trace_env_t *env = trace_init(arch_env, irg);
trace_env_t *env = trace_init(birg);
env->selector = vtab;
env->selector_env = (void*) arch_env;
env->selector_env = (void*) be_get_birg_arch_env(birg);
return (void *)env;
}
......
......@@ -64,12 +64,10 @@ static ir_node *trivial_select(void *block_env, ir_nodeset_t *ready_set,
return irn;
}
static void *trivial_init_graph(const list_sched_selector_t *vtab,
const arch_env_t *arch_env, ir_graph *irg)
static void *trivial_init_graph(const list_sched_selector_t *vtab, const be_irg_t *birg)
{
(void) vtab;
(void) irg;
return (void *)arch_env;
return (void *) be_get_birg_arch_env(birg);
}
static void *trivial_init_block(void *graph_env, ir_node *block)
......
......@@ -416,6 +416,6 @@ void be_transform_graph(be_irg_t *birg, arch_pretrans_nodes *func, void *cg)
if (birg->lv) {
be_liveness_free(birg->lv);
birg->lv = be_liveness(birg->irg);
birg->lv = be_liveness(birg);
}
}
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