Test case for historical reasons
[libfirm] / ir / be / ia32 / ia32_transform.c
index 59a2ac1..d73e848 100644 (file)
@@ -48,6 +48,7 @@
 #include "irdom.h"
 #include "archop.h"
 #include "error.h"
+#include "array_t.h"
 #include "height.h"
 
 #include "../benode_t.h"
@@ -432,44 +433,6 @@ ir_entity *ia32_gen_fp_known_const(ia32_known_const_t kct) {
        return ent_cache[kct];
 }
 
-static int prevents_AM(ir_node *const block, ir_node *const am_candidate,
-                       ir_node *const other)
-{
-       if (get_nodes_block(other) != block)
-               return 0;
-
-       if (is_Sync(other)) {
-               int i;
-
-               for (i = get_Sync_n_preds(other) - 1; i >= 0; --i) {
-                       ir_node *const pred = get_Sync_pred(other, i);
-
-                       if (get_nodes_block(pred) != block)
-                               continue;
-
-                       /* Do not block ourselves from getting eaten */
-                       if (is_Proj(pred) && get_Proj_pred(pred) == am_candidate)
-                               continue;
-
-                       if (!heights_reachable_in_block(heights, pred, am_candidate))
-                               continue;
-
-                       return 1;
-               }
-
-               return 0;
-       } else {
-               /* Do not block ourselves from getting eaten */
-               if (is_Proj(other) && get_Proj_pred(other) == am_candidate)
-                       return 0;
-
-               if (!heights_reachable_in_block(heights, other, am_candidate))
-                       return 0;
-
-               return 1;
-       }
-}
-
 /**
  * return true if the node is a Proj(Load) and could be used in source address
  * mode for another node. Will return only true if the @p other node is not
@@ -801,6 +764,12 @@ static void match_arguments(ia32_address_mode_t *am, ir_node *block,
        am->commutative = commutative;
 }
 
+static void set_transformed_and_mark(ir_node *const old_node, ir_node *const new_node)
+{
+       mark_irn_visited(old_node);
+       be_set_transformed_node(old_node, new_node);
+}
+
 static ir_node *fix_mem_proj(ir_node *node, ia32_address_mode_t *am)
 {
        ir_mode  *mode;
@@ -813,8 +782,7 @@ static ir_node *fix_mem_proj(ir_node *node, ia32_address_mode_t *am)
        mode = get_irn_mode(node);
        load = get_Proj_pred(am->mem_proj);
 
-       mark_irn_visited(load);
-       be_set_transformed_node(load, node);
+       set_transformed_and_mark(load, node);
 
        if (mode != mode_T) {
                set_irn_mode(node, mode_T);
@@ -2024,12 +1992,6 @@ static int use_dest_am(ir_node *block, ir_node *node, ir_node *mem,
        return 1;
 }
 
-static void set_transformed_and_mark(ir_node *const old_node, ir_node *const new_node)
-{
-       mark_irn_visited(old_node);
-       be_set_transformed_node(old_node, new_node);
-}
-
 static ir_node *dest_am_binop(ir_node *node, ir_node *op1, ir_node *op2,
                               ir_node *mem, ir_node *ptr, ir_mode *mode,
                               construct_binop_dest_func *func,
@@ -2829,13 +2791,12 @@ static ir_node *gen_Cmp(ir_node *node)
                /* Test(and_left, and_right) */
                ir_node *and_left  = get_And_left(left);
                ir_node *and_right = get_And_right(left);
-               ir_mode *mode      = get_irn_mode(and_left);
 
                /* matze: code here used mode instead of cmd_mode, I think it is always
                 * the same as cmp_mode, but I leave this here to see if this is really
                 * true...
                 */
-               assert(mode == cmp_mode);
+               assert(get_irn_mode(and_left) == cmp_mode);
 
                match_arguments(&am, block, and_left, and_right, NULL,
                                                                                match_commutative |
@@ -3596,8 +3557,7 @@ static ir_node *gen_be_Return(ir_node *node) {
                                  arity, in);
        copy_node_attr(barrier, new_barrier);
        be_duplicate_deps(barrier, new_barrier);
-       be_set_transformed_node(barrier, new_barrier);
-       mark_irn_visited(barrier);
+       set_transformed_and_mark(barrier, new_barrier);
 
        /* transform normally */
        return be_duplicate_node(node);