0, /* create PIC code */
BE_VERIFY_WARN, /* verification level: warn */
"", /* ilp server */
- "cplex", /* ilp solver */
+ "", /* ilp solver */
0, /* enable statistic event dumping */
"", /* print stat events */
};
* @param env an empty environment
* @param file_handle the file handle where the output will be written to
*/
-static be_main_env_t *be_init_env(be_main_env_t *env, FILE *file_handle)
+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"));
env->ent_pic_symbol_map = pmap_create();
env->pic_symbols_type = new_type_struct(NEW_ID("$PIC_SYMBOLS_TYPE"));
+ env->cup_name = compilation_unit_name;
remove_irp_type(env->pic_trampolines_type);
remove_irp_type(env->pic_symbols_type);
set_class_final(env->pic_trampolines_type, 1);
memset(asm_constraint_flags, 0, sizeof(asm_constraint_flags));
- env->arch_env = arch_env_init(isa_if, file_handle, env);
+ env->arch_env = arch_env_init(isa_if, env);
return env;
}
/* Remove critical edges */
remove_critical_cf_edges_ex(irg, /*ignore_exception_edges=*/0);
+ /* For code generation all unreachable code and Bad nodes should be gone */
+ remove_unreachable_code(irg);
+ remove_bads(irg);
+
/* Ensure, that the ir_edges are computed. */
edges_assure(irg);
set_irp_phase_state(phase_low);
}
-static void emit_global_asms(void)
-{
- size_t n = get_irp_n_asms();
- size_t i;
- for (i = 0; i < n; ++i) {
- be_emit_cstring("#APP\n");
- be_emit_ident(get_irp_asm(i));
- be_emit_cstring("\n#NO_APP\n");
- }
-}
-
/**
* The Firm backend main loop.
* Do architecture specific lowering for all graphs
}
}
- be_init_env(&env, file_handle);
- env.cup_name = cup_name;
-
- be_dbg_open();
- be_dbg_unit_begin(cup_name);
- be_dbg_types();
-
- emit_global_asms();
+ be_init_env(&env, file_handle, cup_name);
arch_env = env.arch_env;
dump(DUMP_RA, irg, "ra");
- /* let the code generator prepare the graph for emitter */
- be_timer_push(T_FINISH);
- if (arch_env->impl->after_ra != NULL)
- arch_env->impl->after_ra(irg);
- be_timer_pop(T_FINISH);
-
- /* fix stack offsets */
- be_timer_push(T_ABI);
- be_abi_fix_stack_nodes(irg);
- be_remove_dead_nodes_from_schedule(irg);
- be_abi_fix_stack_bias(irg);
- be_timer_pop(T_ABI);
-
- dump(DUMP_SCHED, irg, "fix_stack_after_ra");
-
be_timer_push(T_FINISH);
if (arch_env->impl->finish != NULL)
arch_env->impl->finish(irg);
arch_env_done(arch_env);
- be_dbg_unit_end();
- be_dbg_close();
-
ir_profile_free();
be_done_env(&env);