bemain: Centrally call be_gas_end_compilation_unit() and be_emit_exit() instead of...
authorChristoph Mallon <christoph.mallon@gmx.de>
Fri, 30 Nov 2012 07:42:56 +0000 (08:42 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Fri, 30 Nov 2012 07:55:11 +0000 (08:55 +0100)
Also remove the now write-only attribute main_env from struct arch_env_t.

ir/be/TEMPLATE/bearch_TEMPLATE.c
ir/be/amd64/bearch_amd64.c
ir/be/arm/bearch_arm.c
ir/be/bearch.c
ir/be/bearch.h
ir/be/bemain.c
ir/be/ia32/bearch_ia32.c
ir/be/sparc/bearch_sparc.c

index 9fc08cb..c6f6b9c 100644 (file)
@@ -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);
 }
 
index c2764d8..3e9332e 100644 (file)
@@ -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);
 }
 
index f365e20..03a6d20 100644 (file)
@@ -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);
 }
 
index 9fc2c56..17b5296 100644 (file)
@@ -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;
 }
 
index d9a875a..b6212ca 100644 (file)
@@ -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
index 494e268..b3aa7d9 100644 (file)
@@ -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);
index f93ba3c..8b5a8ff 100644 (file)
@@ -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);
 }
index 5dd3cb4..30ae039 100644 (file)
@@ -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);
 }