Commit d96cf3cb authored by Christoph Mallon's avatar Christoph Mallon
Browse files

bemain: Centrally call be_gas_end_compilation_unit() and be_emit_exit()...

bemain: Centrally call be_gas_end_compilation_unit() and be_emit_exit() instead of doing it per backend.

Also remove the now write-only attribute main_env from struct arch_env_t.
parent 880f870d
......@@ -139,7 +139,6 @@ static TEMPLATE_isa_t TEMPLATE_isa_template = {
&TEMPLATE_registers[REG_SP], /* stack pointer register */
&TEMPLATE_registers[REG_BP], /* base pointer register */
2, /* power of two stack alignment for calls, 2^2 == 4 */
NULL, /* main environment */
7, /* costs for a spill instruction */
5, /* costs for a reload instruction */
true, /* no custom abi handling */
......@@ -170,12 +169,6 @@ static arch_env_t *TEMPLATE_begin_codegeneration(void)
*/
static void TEMPLATE_end_codegeneration(void *self)
{
TEMPLATE_isa_t *isa = (TEMPLATE_isa_t*)self;
/* emit now all global declarations */
be_gas_end_compilation_unit(isa->base.main_env);
be_emit_exit();
free(self);
}
......
......@@ -252,7 +252,6 @@ static amd64_isa_t amd64_isa_template = {
&amd64_registers[REG_RSP], /* stack pointer register */
&amd64_registers[REG_RBP], /* base pointer register */
3, /* power of two stack alignment for calls, 2^2 == 4 */
NULL, /* main environment */
7, /* costs for a spill instruction */
5, /* costs for a reload instruction */
false, /* no custom abi handling */
......@@ -283,12 +282,6 @@ static arch_env_t *amd64_begin_codegeneration(void)
*/
static void amd64_end_codegeneration(void *self)
{
amd64_isa_t *isa = (amd64_isa_t*)self;
/* emit now all global declarations */
be_gas_end_compilation_unit(isa->base.main_env);
be_emit_exit();
free(self);
}
......
......@@ -407,7 +407,6 @@ static arm_isa_t arm_isa_template = {
&arm_registers[REG_SP], /* stack pointer */
&arm_registers[REG_R11], /* base pointer */
2, /* power of two stack alignment for calls, 2^2 == 4 */
NULL, /* main environment */
7, /* spill costs */
5, /* reload costs */
true, /* we do have custom abi handling */
......@@ -442,11 +441,6 @@ static arch_env_t *arm_begin_codegeneration(void)
*/
static void arm_end_codegeneration(void *self)
{
arm_isa_t *isa = (arm_isa_t*)self;
be_gas_end_compilation_unit(isa->base.main_env);
be_emit_exit();
free(self);
}
......
......@@ -49,11 +49,9 @@ arch_register_req_t const arch_no_requirement = {
};
/* Initialize the architecture environment struct. */
arch_env_t *arch_env_begin_codegeneration(const arch_isa_if_t *isa_if,
be_main_env_t *main_env)
arch_env_t *arch_env_begin_codegeneration(const arch_isa_if_t *isa_if)
{
arch_env_t *arch_env = isa_if->begin_codegeneration();
arch_env->main_env = main_env;
return arch_env;
}
......
......@@ -215,8 +215,7 @@ static inline unsigned arch_get_irn_n_outs(const ir_node *node)
/**
* Start codegeneration
*/
arch_env_t *arch_env_begin_codegeneration(const arch_isa_if_t *isa,
be_main_env_t *main_env);
arch_env_t *arch_env_begin_codegeneration(const arch_isa_if_t *isa);
/**
* Register an instruction set architecture
......@@ -547,7 +546,6 @@ struct arch_env_t {
const arch_register_t *sp; /**< The stack pointer register. */
const arch_register_t *bp; /**< The base pointer register. */
int stack_alignment; /**< power of 2 stack alignment */
const be_main_env_t *main_env; /**< the be main environment */
int spill_cost; /**< cost for a be_Spill node */
int reload_cost; /**< cost for a be_Reload node */
bool custom_abi : 1; /**< backend does all abi handling
......
......@@ -411,7 +411,7 @@ static be_main_env_t *be_init_env(be_main_env_t *const env, char const *const co
set_class_final(env->pic_trampolines_type, 1);
memset(asm_constraint_flags, 0, sizeof(asm_constraint_flags));
env->arch_env = arch_env_begin_codegeneration(isa_if, env);
env->arch_env = arch_env_begin_codegeneration(isa_if);
return env;
}
......@@ -820,6 +820,9 @@ static void be_main_loop(FILE *file_handle, const char *cup_name)
stat_ev_ctx_pop("bemain_irg");
}
be_gas_end_compilation_unit(&env);
be_emit_exit();
arch_env_end_codegeneration(arch_env);
be_done_env(&env);
......
......@@ -1640,7 +1640,6 @@ static ia32_isa_t ia32_isa_template = {
&ia32_registers[REG_ESP], /* stack pointer register */
&ia32_registers[REG_EBP], /* base pointer register */
2, /* power of two stack alignment, 2^2 == 4 */
NULL, /* main environment */
7, /* costs for a spill instruction */
5, /* costs for a reload instruction */
false, /* no custom abi handling */
......@@ -1667,12 +1666,6 @@ static arch_env_t *ia32_begin_codegeneration(void)
static void ia32_end_codegeneration(void *self)
{
ia32_isa_t *isa = (ia32_isa_t*)self;
/* emit now all global declarations */
be_gas_end_compilation_unit(isa->base.main_env);
be_emit_exit();
pmap_destroy(isa->tv_ent);
free(self);
}
......
......@@ -178,7 +178,6 @@ static sparc_isa_t sparc_isa_template = {
&sparc_registers[REG_FRAME_POINTER], /* base pointer register */
3, /* power of two stack alignment
for calls */
NULL, /* main environment */
7, /* costs for a spill instruction */
5, /* costs for a reload instruction */
true, /* custom abi handling */
......@@ -442,12 +441,7 @@ static arch_env_t *sparc_begin_codegeneration(void)
static void sparc_end_codegeneration(void *self)
{
sparc_isa_t *isa = (sparc_isa_t*)self;
/* emit now all global declarations */
be_gas_end_compilation_unit(isa->base.main_env);
pmap_destroy(isa->constants);
be_emit_exit();
free(isa);
}
......
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