fixed debug output of unary x87 nodes
[libfirm] / ir / be / ia32 / ia32_optimize.c
index 54c9f43..46d529a 100644 (file)
@@ -295,15 +295,6 @@ static void ia32_set_modes(ir_node *irn, void *env) {
        if (mode_is_reference(get_irn_mode(irn))) {
                set_irn_mode(irn, mode_Iu);
        }
-
-       /*
-               Annotate mode of stored value to link field of the Store
-               as floating point converts might be optimized and we would
-               loose the mode.
-       */
-       if (get_irn_opcode(irn) == iro_Store) {
-               set_irn_link(irn, get_irn_mode(get_Store_value(irn)));
-       }
 }
 
 /**
@@ -497,7 +488,7 @@ static void ia32_create_Push(ir_node *irn, ia32_code_gen_t *cg) {
 
        /* do not create push if IncSp doesn't expand stack or expand size is different from register size */
        if (be_get_IncSP_direction(sp) != be_stack_dir_expand ||
-               be_get_IncSP_offset(sp) != get_mode_size_bytes(ia32_reg_classes[CLASS_ia32_gp].mode))
+               be_get_IncSP_offset(sp) != (unsigned) get_mode_size_bytes(ia32_reg_classes[CLASS_ia32_gp].mode))
                return;
 
        /* do not create push, if there is a path (inside the block) from the push value to IncSP */
@@ -789,7 +780,8 @@ static ia32_am_cand_t is_am_candidate(ia32_code_gen_t *cg, heights_t *h, const i
        ir_node *in, *load, *other, *left, *right;
        int      n, is_cand = 0, cand;
 
-       if (is_ia32_Ld(irn) || is_ia32_St(irn) || is_ia32_Store8Bit(irn) || is_ia32_vfild(irn) || is_ia32_vfist(irn))
+       if (is_ia32_Ld(irn) || is_ia32_St(irn) || is_ia32_Store8Bit(irn) || is_ia32_vfild(irn) || is_ia32_vfist(irn) ||
+               is_ia32_GetST0(irn) || is_ia32_SetST0(irn) || is_ia32_xStoreSimple(irn))
                return 0;
 
        left  = get_irn_n(irn, 2);
@@ -1049,6 +1041,7 @@ static ir_node *fold_addr(ia32_code_gen_t *cg, ir_node *irn, ir_node *noreg) {
        entity     *lea_ent    = NULL;
        ir_node    *left, *right, *temp;
        ir_node    *base, *index;
+       int consumed_left_shift;
        ia32_am_flavour_t am_flav;
        DEBUG_ONLY(firm_dbg_module_t *mod = cg->mod;)
 
@@ -1134,8 +1127,9 @@ static ir_node *fold_addr(ia32_code_gen_t *cg, ir_node *irn, ir_node *noreg) {
 
        if (isadd) {
                /* default for add -> make right operand to index */
-               index = right;
-               dolea = 1;
+               index               = right;
+               dolea               = 1;
+               consumed_left_shift = -1;
 
                DBG((mod, LEVEL_1, "\tgot LEA candidate with index %+F\n", index));
 
@@ -1143,6 +1137,7 @@ static ir_node *fold_addr(ia32_code_gen_t *cg, ir_node *irn, ir_node *noreg) {
                temp = left;
                if (is_ia32_Lea(left)) {
                        temp = right;
+                       consumed_left_shift = 0;
                }
 
                /* check for SHL 1,2,3 */
@@ -1154,7 +1149,8 @@ static ir_node *fold_addr(ia32_code_gen_t *cg, ir_node *irn, ir_node *noreg) {
                                scale = get_tarval_long(get_ia32_Immop_tarval(temp));
 
                                if (scale <= 3) {
-                                       index = get_irn_n(temp, 2);
+                                       index               = get_irn_n(temp, 2);
+                                       consumed_left_shift = consumed_left_shift < 0 ? 1 : 0;
 
                                        DBG((mod, LEVEL_1, "\tgot scaled index %+F\n", index));
                                }
@@ -1171,10 +1167,8 @@ static ir_node *fold_addr(ia32_code_gen_t *cg, ir_node *irn, ir_node *noreg) {
                        if (left == right) {
                                base = noreg;
                        }
-                       else if (! is_ia32_Lea(left) && (index != right)) {
-                               /* index != right -> we found a good Shl           */
-                               /* left  != LEA   -> this Shl was the left operand */
-                               /* -> base is right operand                        */
+                       else if (consumed_left_shift == 1) {
+                               /* -> base is right operand  */
                                base = (right == lea_o) ? noreg : right;
                        }
                }