reorganize beabi - save wether we are using omit_fp in the stack_layout structure
[libfirm] / ir / be / ia32 / bearch_ia32.c
index 171497a..f7bbde8 100644 (file)
@@ -188,16 +188,6 @@ static ir_node *ia32_get_admissible_noreg(ia32_code_gen_t *cg, ir_node *irn, int
        }
 }
 
-/**************************************************
- *                         _ _              _  __
- *                        | | |            (_)/ _|
- *  _ __ ___  __ _    __ _| | | ___   ___   _| |_
- * | '__/ _ \/ _` |  / _` | | |/ _ \ / __| | |  _|
- * | | |  __/ (_| | | (_| | | | (_) | (__  | | |
- * |_|  \___|\__, |  \__,_|_|_|\___/ \___| |_|_|
- *            __/ |
- *           |___/
- **************************************************/
 
 static const arch_register_req_t *get_ia32_SwitchJmp_out_req(
                const ir_node *node, int pos)
@@ -250,9 +240,9 @@ static void ia32_set_frame_offset(ir_node *irn, int bias)
                return;
 
        if (is_ia32_Pop(irn) || is_ia32_PopMem(irn)) {
-               ia32_code_gen_t *cg = ia32_current_cg;
-               int omit_fp = be_abi_omit_fp(cg->birg->abi);
-               if (omit_fp) {
+               ir_graph          *irg     = get_irn_irg(irn);
+               be_stack_layout_t *layout  = be_get_irg_stack_layout(irg);
+               if (layout->sp_relative) {
                        /* Pop nodes modify the stack pointer before calculating the
                         * destination address, so fix this here
                         */
@@ -829,16 +819,6 @@ static const arch_irn_ops_t ia32_SwitchJmp_irn_ops = {
        ia32_perform_memory_operand,
 };
 
-/**************************************************
- *                _                         _  __
- *               | |                       (_)/ _|
- *   ___ ___   __| | ___  __ _  ___ _ __    _| |_
- *  / __/ _ \ / _` |/ _ \/ _` |/ _ \ '_ \  | |  _|
- * | (_| (_) | (_| |  __/ (_| |  __/ | | | | | |
- *  \___\___/ \__,_|\___|\__, |\___|_| |_| |_|_|
- *                        __/ |
- *                       |___/
- **************************************************/
 
 static ir_entity *mcount = NULL;
 
@@ -1019,7 +999,7 @@ static void ia32_before_ra(void *self)
        ia32_setup_fpu_mode(cg);
 
        /* fixup flags */
-       be_sched_fix_flags(cg->birg, &ia32_reg_classes[CLASS_ia32_flags],
+       be_sched_fix_flags(cg->irg, &ia32_reg_classes[CLASS_ia32_flags],
                           &flags_remat);
 
        ia32_add_missing_keeps(cg);
@@ -1199,7 +1179,7 @@ static ir_node* create_spproj(ir_node *node, ir_node *pred, int pos)
 static void transform_MemPerm(ia32_code_gen_t *cg, ir_node *node)
 {
        ir_node         *block = get_nodes_block(node);
-       ir_node         *sp    = be_abi_get_ignore_irn(cg->birg->abi, &ia32_gp_regs[REG_ESP]);
+       ir_node         *sp    = be_abi_get_ignore_irn(be_get_irg_abi(cg->irg), &ia32_gp_regs[REG_ESP]);
        int              arity = be_get_MemPerm_entity_arity(node);
        ir_node        **pops  = ALLOCAN(ir_node*, arity);
        ir_node         *in[1];
@@ -1389,7 +1369,7 @@ static void ia32_after_ra(void *self)
 {
        ia32_code_gen_t *cg = self;
        ir_graph *irg = cg->irg;
-       be_fec_env_t *fec_env = be_new_frame_entity_coalescer(cg->birg);
+       be_fec_env_t *fec_env = be_new_frame_entity_coalescer(cg->irg);
 
        /* create and coalesce frame entities */
        irg_walk_graph(irg, NULL, ia32_collect_frame_entity_nodes, fec_env);
@@ -1413,7 +1393,7 @@ static void ia32_finish(void *self)
 
        /* we might have to rewrite x87 virtual registers */
        if (cg->do_x87_sim) {
-               x87_simulate_graph(cg->birg);
+               x87_simulate_graph(cg->irg);
        }
 
        /* do peephole optimisations */
@@ -1468,7 +1448,7 @@ static ir_node *ia32_get_pic_base(void *self)
        return get_eip;
 }
 
-static void *ia32_cg_init(be_irg_t *birg);
+static void *ia32_cg_init(ir_graph *irg);
 
 static const arch_code_generator_if_t ia32_code_gen_if = {
        ia32_cg_init,
@@ -1485,22 +1465,21 @@ static const arch_code_generator_if_t ia32_code_gen_if = {
 /**
  * Initializes a IA32 code generator.
  */
-static void *ia32_cg_init(be_irg_t *birg)
+static void *ia32_cg_init(ir_graph *irg)
 {
-       ia32_isa_t      *isa = (ia32_isa_t *)birg->main_env->arch_env;
+       ia32_isa_t      *isa = (ia32_isa_t *)be_get_irg_arch_env(irg);
        ia32_code_gen_t *cg  = XMALLOCZ(ia32_code_gen_t);
 
        cg->impl      = &ia32_code_gen_if;
-       cg->irg       = birg->irg;
+       cg->irg       = irg;
        cg->isa       = isa;
-       cg->birg      = birg;
        cg->blk_sched = NULL;
-       cg->dump      = (birg->main_env->options->dump_flags & DUMP_BE) ? 1 : 0;
-       cg->gprof     = (birg->main_env->options->gprof) ? 1 : 0;
+       cg->dump      = (be_get_irg_options(irg)->dump_flags & DUMP_BE) ? 1 : 0;
+       cg->gprof     = (be_get_irg_options(irg)->gprof) ? 1 : 0;
 
        if (cg->gprof) {
                /* Linux gprof implementation needs base pointer */
-               birg->main_env->options->omit_fp = 0;
+               be_get_irg_options(irg)->omit_fp = 0;
        }
 
        /* enter it */
@@ -1520,17 +1499,6 @@ static void *ia32_cg_init(be_irg_t *birg)
 }
 
 
-
-/*****************************************************************
- *  ____             _                  _   _____  _____
- * |  _ \           | |                | | |_   _|/ ____|  /\
- * | |_) | __ _  ___| | _____ _ __   __| |   | | | (___   /  \
- * |  _ < / _` |/ __| |/ / _ \ '_ \ / _` |   | |  \___ \ / /\ \
- * | |_) | (_| | (__|   <  __/ | | | (_| |  _| |_ ____) / ____ \
- * |____/ \__,_|\___|_|\_\___|_| |_|\__,_| |_____|_____/_/    \_\
- *
- *****************************************************************/
-
 /**
  * Set output modes for GCC
  */
@@ -1573,6 +1541,7 @@ static ia32_isa_t ia32_isa_template = {
                NULL,                    /* main environment */
                7,                       /* costs for a spill instruction */
                5,                       /* costs for a reload instruction */
+               false,                   /* no custom abi handling */
        },
        NULL,                    /* 16bit register names */
        NULL,                    /* 8bit register names */