fix fucompp emitter when no register is needed
[libfirm] / ir / be / ia32 / bearch_ia32.c
index 3715368..64dc573 100644 (file)
@@ -261,10 +261,13 @@ static arch_irn_flags_t ia32_get_flags(const void *self, const ir_node *irn) {
 
        if(is_Proj(irn)) {
                ir_node *pred = get_Proj_pred(irn);
-               if(is_ia32_Push(pred) && get_Proj_proj(irn) == 0) {
+               if(is_ia32_Push(pred) && get_Proj_proj(irn) == pn_ia32_Push_stack) {
                        return arch_irn_flags_modify_sp;
                }
-               if(is_ia32_Pop(pred) && get_Proj_proj(irn) == 1) {
+               if(is_ia32_Pop(pred) && get_Proj_proj(irn) == pn_ia32_Pop_stack) {
+                       return arch_irn_flags_modify_sp;
+               }
+               if(is_ia32_AddSP(pred) && get_Proj_proj(irn) == pn_ia32_AddSP_stack) {
                        return arch_irn_flags_modify_sp;
                }
        }
@@ -430,7 +433,8 @@ static void ia32_abi_epilogue(void *self, ir_node *bl, ir_node **mem, pmap *reg_
 
        if (env->flags.try_omit_fp) {
                /* simply remove the stack frame here */
-               curr_sp = be_new_IncSP(env->isa->sp, env->irg, bl, curr_sp, *mem, BE_STACK_FRAME_SIZE_SHRINK);
+               curr_sp = be_new_IncSP(env->isa->sp, env->irg, bl, curr_sp, BE_STACK_FRAME_SIZE_SHRINK);
+               add_irn_dep(curr_sp, *mem);
        }
        else {
                const ia32_isa_t *isa     = (ia32_isa_t *)env->isa;
@@ -441,7 +445,7 @@ static void ia32_abi_epilogue(void *self, ir_node *bl, ir_node **mem, pmap *reg_
                        ir_node *leave;
 
                        /* leave */
-                       leave   = new_rd_ia32_Leave(NULL, env->irg, bl, curr_sp, *mem);
+                       leave   = new_rd_ia32_Leave(NULL, env->irg, bl, curr_sp, curr_bp);
                        set_ia32_flags(leave, arch_irn_flags_ignore);
                        curr_bp = new_r_Proj(current_ir_graph, bl, leave, mode_bp, pn_ia32_Leave_frame);
                        curr_sp = new_r_Proj(current_ir_graph, bl, leave, get_irn_mode(curr_sp), pn_ia32_Leave_stack);
@@ -703,7 +707,7 @@ static int ia32_possible_memory_operand(const void *self, const ir_node *irn, un
                get_irn_arity(irn) != 5                       ||  /* must be a binary operation */
                get_ia32_op_type(irn) != ia32_Normal          ||  /* must not already be a addressmode irn */
                ! (get_ia32_am_support(irn) & ia32_am_Source) ||  /* must be capable of source addressmode */
-        (i != 2 && i != 3)                            ||  /* a "real" operand position must be requested */
+               (i != 2 && i != 3)                            ||  /* a "real" operand position must be requested */
                (i == 2 && ! is_ia32_commutative(irn))        ||  /* if first operand requested irn must be commutative */
                is_ia32_use_frame(irn))                           /* must not already use frame */
                return 0;
@@ -724,11 +728,12 @@ static void ia32_perform_memory_operand(const void *self, ir_node *irn, ir_node
        set_ia32_op_type(irn, ia32_AddrModeS);
        set_ia32_am_flavour(irn, ia32_B);
        set_ia32_ls_mode(irn, get_irn_mode(get_irn_n(irn, i)));
+       //TODO this will fail, if spill is a PhiM (give PhiMs entities?)
        set_ia32_frame_ent(irn, be_get_frame_entity(spill));
        set_ia32_use_frame(irn);
        set_ia32_got_reload(irn);
 
-       set_irn_n(irn, 0, be_get_Spill_frame(spill));
+       set_irn_n(irn, 0, get_irg_frame(get_irn_irg(irn)));
        set_irn_n(irn, 4, spill);
 
        /*
@@ -1640,9 +1645,8 @@ list_sched_selector_t ia32_sched_selector;
 /**
  * Returns the reg_pressure scheduler with to_appear_in_schedule() overloaded
  */
-static const list_sched_selector_t *ia32_get_list_sched_selector(const void *self) {
-//     memcpy(&ia32_sched_selector, reg_pressure_selector, sizeof(list_sched_selector_t));
-       memcpy(&ia32_sched_selector, trivial_selector, sizeof(list_sched_selector_t));
+static const list_sched_selector_t *ia32_get_list_sched_selector(const void *self, list_sched_selector_t *selector) {
+       memcpy(&ia32_sched_selector, selector, sizeof(ia32_sched_selector));
        ia32_sched_selector.exectime              = ia32_sched_exectime;
        ia32_sched_selector.to_appear_in_schedule = ia32_to_appear_in_schedule;
        return &ia32_sched_selector;