bemain: Centrally call be_gas_end_compilation_unit() and be_emit_exit() instead of...
[libfirm] / ir / be / ia32 / bearch_ia32.c
index 72f0fc2..8b5a8ff 100644 (file)
@@ -53,6 +53,7 @@
 #include "lower_calls.h"
 #include "lower_mode_b.h"
 #include "lower_softfloat.h"
+#include "firmstat_t.h"
 
 #include "beabi.h"
 #include "benode.h"
@@ -108,8 +109,6 @@ static ir_entity *omit_fp_ret_addr_ent = NULL;
  * The environment for the intrinsic mapping.
  */
 static ia32_intrinsic_env_t intrinsic_env = {
-       NULL,    /* the isa */
-       NULL,    /* the irg, these entities belong to */
        NULL,    /* entity for __divdi3 library call */
        NULL,    /* entity for __moddi3 library call */
        NULL,    /* entity for __udivdi3 library call */
@@ -404,15 +403,13 @@ static int ia32_possible_memory_operand(const ir_node *irn, unsigned int i)
                case ia32_am_binary:
                        switch (i) {
                                case n_ia32_binary_left: {
-                                       const arch_register_req_t *req;
                                        if (!is_ia32_commutative(irn))
                                                return 0;
 
                                        /* we can't swap left/right for limited registers
-                                        * (As this (currently) breaks constraint handling copies)
-                                        */
-                                       req = arch_get_irn_register_req_in(irn, n_ia32_binary_left);
-                                       if (req->type & arch_register_req_type_limited)
+                                        * (As this (currently) breaks constraint handling copies) */
+                                       arch_register_req_t const *const req = arch_get_irn_register_req_in(irn, n_ia32_binary_left);
+                                       if (arch_register_req_is(req, limited))
                                                return 0;
                                        break;
                                }
@@ -485,12 +482,12 @@ static const arch_irn_ops_t ia32_irn_ops = {
        ia32_perform_memory_operand,
 };
 
-static ir_entity *mcount = NULL;
 static int gprof = 0;
 
 static void ia32_before_abi(ir_graph *irg)
 {
        if (gprof) {
+               static ir_entity *mcount = NULL;
                if (mcount == NULL) {
                        ir_type *tp = new_type_method(0, 0);
                        ident   *id = new_id_from_str("mcount");
@@ -1643,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 */
@@ -1652,7 +1648,7 @@ static ia32_isa_t ia32_isa_template = {
        IA32_FPU_ARCH_X87,          /* FPU architecture */
 };
 
-static arch_env_t *ia32_begin_codegeneration(const be_main_env_t *env)
+static arch_env_t *ia32_begin_codegeneration(void)
 {
        ia32_isa_t *isa = XMALLOC(ia32_isa_t);
 
@@ -1661,12 +1657,6 @@ static arch_env_t *ia32_begin_codegeneration(const be_main_env_t *env)
        *isa        = ia32_isa_template;
        isa->tv_ent = pmap_create();
 
-       /* enter the ISA object into the intrinsic environment */
-       intrinsic_env.isa = isa;
-
-       be_emit_init(env->file_handle);
-       be_gas_begin_compilation_unit(env);
-
        return &isa->base;
 }
 
@@ -1676,12 +1666,6 @@ static arch_env_t *ia32_begin_codegeneration(const be_main_env_t *env)
 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);
 }