Commit 381cf8f2 authored by Matthias Braun's avatar Matthias Braun
Browse files

be: expose be_options variable globally

parent 2c4b8df2
......@@ -248,7 +248,7 @@ static void amd64_init_graph(ir_graph *irg)
{
struct obstack *obst = be_get_be_obst(irg);
amd64_irg_data_t *irg_data = OALLOCZ(obst, amd64_irg_data_t);
irg_data->dump = (be_get_irg_options(irg)->dump_flags & DUMP_BE) ? 1 : 0;
irg_data->dump = (be_options.dump_flags & DUMP_BE) ? 1 : 0;
be_birg_from_irg(irg)->isa_link = irg_data;
}
......
......@@ -71,11 +71,11 @@ struct be_options_t {
int statev; /**< enable stat event dumping */
char filtev[128]; /**< filter mask for stat events */
};
extern be_options_t be_options;
struct be_main_env_t {
arch_env_t *arch_env;
FILE *file_handle;
be_options_t *options; /**< backend options */
const char *cup_name; /**< name of the compilation unit */
pmap *ent_trampoline_map; /**< A map containing PIC trampolines for methods. */
ir_type *pic_trampolines_type; /**< Class type containing all trampolines */
......
......@@ -1834,7 +1834,6 @@ void be_abi_introduce(ir_graph *irg)
{
be_abi_irg_t *env = XMALLOCZ(be_abi_irg_t);
ir_node *old_frame = get_irg_frame(irg);
be_options_t *options = be_get_irg_options(irg);
const arch_env_t *arch_env = be_get_irg_arch_env(irg);
ir_entity *entity = get_irg_entity(irg);
ir_type *method_type = get_entity_type(entity);
......@@ -1860,7 +1859,7 @@ void be_abi_introduce(ir_graph *irg)
*/
be_set_irg_abi(irg, env);
be_omit_fp = options->omit_fp;
be_omit_fp = be_options.omit_fp;
env->keep_map = pmap_create();
env->call = be_abi_call_new(arch_env->sp->reg_class);
......@@ -1871,7 +1870,7 @@ void be_abi_introduce(ir_graph *irg)
edges_assure(irg);
if (options->pic) {
if (be_options.pic) {
irg_walk_graph(irg, fix_pic_symconsts, NULL, env);
}
......
......@@ -616,7 +616,6 @@ static void collect_egde_frequency_ilp(ir_node *block, void *data)
static void coalesce_blocks_ilp(blocksched_ilp_env_t *env)
{
int edge_count = ARR_LEN(env->ilpedges);
be_options_t *options = be_get_irg_options(env->env.irg);
int i;
/* complete out constraints */
......@@ -638,7 +637,7 @@ static void coalesce_blocks_ilp(blocksched_ilp_env_t *env)
lpp_set_factor_fast(env->lpp, entry->out_cst, edge->ilpvar, 1.0);
}
lpp_solve_net(env->lpp, options->ilp_server, options->ilp_solver);
lpp_solve_net(env->lpp, be_options.ilp_server, be_options.ilp_solver);
assert(lpp_is_sol_valid(env->lpp));
/* Apply results to edges */
......
......@@ -254,8 +254,7 @@ ilp_env_t *new_ilp_env(copy_opt_t *co, ilp_callback build, ilp_callback apply, v
lpp_sol_state_t ilp_go(ilp_env_t *ienv)
{
ir_graph *irg = ienv->co->irg;
be_options_t *options = be_get_irg_options(irg);
ir_graph *irg = ienv->co->irg;
sr_remove(ienv->sr);
......@@ -279,7 +278,7 @@ lpp_sol_state_t ilp_go(ilp_env_t *ienv)
if (solve_log)
lpp_set_log(ienv->lp, stdout);
lpp_solve(ienv->lp, options->ilp_server, options->ilp_solver);
lpp_solve(ienv->lp, be_options.ilp_server, be_options.ilp_solver);
//be_stat_ev_dbl("co_ilp_objval", ienv->lp->objval);
//be_stat_ev_dbl("co_ilp_best_bound", ienv->lp->best_bound);
......
......@@ -136,11 +136,6 @@ static inline void be_set_irg_abi(ir_graph *irg, be_abi_irg_t *abi)
be_birg_from_irg(irg)->abi = abi;
}
static inline be_options_t *be_get_irg_options(const ir_graph *irg)
{
return be_birg_from_irg(irg)->main_env->options;
}
/** deprecated */
static inline ir_graph *be_get_birg_irg(const be_irg_t *birg)
{
......
......@@ -77,7 +77,7 @@
#define NEW_ID(s) new_id_from_chars(s, sizeof(s) - 1)
/* options visible for anyone */
static be_options_t be_options = {
be_options_t be_options = {
DUMP_NONE, /* dump flags */
BE_TIME_OFF, /* no timing */
false, /* profile_generate */
......@@ -370,7 +370,6 @@ static be_main_env_t *be_init_env(be_main_env_t *env, FILE *file_handle,
const char *compilation_unit_name)
{
memset(env, 0, sizeof(*env));
env->options = &be_options;
env->file_handle = file_handle;
env->ent_trampoline_map = pmap_create();
env->pic_trampolines_type = new_type_class(NEW_ID("$PIC_TRAMPOLINE_TYPE"));
......
......@@ -1210,10 +1210,8 @@ static void solve_lpp(ir_nodeset_t *live_nodes, ir_node *node,
/* solve lpp */
{
ir_graph *irg = get_irn_irg(node);
be_options_t *options = be_get_irg_options(irg);
unsigned *assignment;
lpp_solve(lpp, options->ilp_server, options->ilp_solver);
unsigned *assignment;
lpp_solve(lpp, be_options.ilp_server, be_options.ilp_solver);
if (!lpp_is_sol_valid(lpp))
panic("ilp solution not valid!");
......@@ -2034,7 +2032,7 @@ static void be_pref_alloc_cls(void)
static void dump(int mask, ir_graph *irg, const char *suffix)
{
if (be_get_irg_options(irg)->dump_flags & mask)
if (be_options.dump_flags & mask)
dump_ir_graph(irg, suffix);
}
......@@ -2094,10 +2092,10 @@ static void be_pref_alloc(ir_graph *new_irg)
/* verify schedule and register pressure */
be_timer_push(T_VERIFY);
if (be_get_irg_options(irg)->verify_option == BE_VERIFY_WARN) {
if (be_options.verify_option == BE_VERIFY_WARN) {
be_verify_schedule(irg);
be_verify_register_pressure(irg, cls);
} else if (be_get_irg_options(irg)->verify_option == BE_VERIFY_ASSERT) {
} else if (be_options.verify_option == BE_VERIFY_ASSERT) {
assert(be_verify_schedule(irg) && "Schedule verification failed");
assert(be_verify_register_pressure(irg, cls)
&& "Register pressure verification failed");
......@@ -2121,9 +2119,9 @@ static void be_pref_alloc(ir_graph *new_irg)
be_timer_pop(T_RA_SPILL_APPLY);
be_timer_push(T_VERIFY);
if (be_get_irg_options(irg)->verify_option == BE_VERIFY_WARN) {
if (be_options.verify_option == BE_VERIFY_WARN) {
be_verify_register_allocation(irg);
} else if (be_get_irg_options(irg)->verify_option == BE_VERIFY_ASSERT) {
} else if (be_options.verify_option == BE_VERIFY_ASSERT) {
assert(be_verify_register_allocation(irg)
&& "Register allocation invalid");
}
......
......@@ -1378,11 +1378,11 @@ static void ia32_init_graph(ir_graph *irg)
struct obstack *obst = be_get_be_obst(irg);
ia32_irg_data_t *irg_data = OALLOCZ(obst, ia32_irg_data_t);
irg_data->dump = (be_get_irg_options(irg)->dump_flags & DUMP_BE) ? 1 : 0;
irg_data->dump = (be_options.dump_flags & DUMP_BE) ? 1 : 0;
if (gprof) {
/* Linux gprof implementation needs base pointer */
be_get_irg_options(irg)->omit_fp = 0;
be_options.omit_fp = 0;
}
be_birg_from_irg(irg)->isa_link = irg_data;
......
......@@ -1926,8 +1926,8 @@ void ia32_gen_routine(ir_graph *irg)
parameter_dbg_info_t *infos;
int i, n;
isa = (ia32_isa_t*) arch_env;
do_pic = be_get_irg_options(irg)->pic;
isa = (ia32_isa_t*) arch_env;
do_pic = be_options.pic;
be_gas_elf_type_char = '@';
......
......@@ -187,7 +187,7 @@ static ir_node *get_symconst_base(void)
{
ir_graph *irg = current_ir_graph;
if (be_get_irg_options(irg)->pic) {
if (be_options.pic) {
const arch_env_t *arch_env = be_get_irg_arch_env(irg);
return arch_env->impl->get_pic_base(irg);
}
......@@ -4778,7 +4778,7 @@ static ir_node *gen_be_Call(ir_node *node)
/* special case for PIC trampoline calls */
old_no_pic_adjust = ia32_no_pic_adjust;
ia32_no_pic_adjust = be_get_irg_options(current_ir_graph)->pic;
ia32_no_pic_adjust = be_options.pic;
match_arguments(&am, src_block, NULL, src_ptr, src_mem,
match_am | match_immediate);
......
......@@ -193,8 +193,7 @@ calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
unsigned *caller_saves;
if (irg != NULL) {
const be_options_t *options = be_get_irg_options(irg);
omit_fp = options->omit_fp;
omit_fp = be_options.omit_fp;
/* our current vaarg handling needs the standard space to store the
* args 0-5 in it */
if (get_method_variadicity(function_type) == variadicity_variadic)
......
Supports Markdown
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