Typo fixed.
[libfirm] / ir / ir / iropt.c
index 8f2875c..b6a07b5 100644 (file)
@@ -21,7 +21,7 @@
 # include "tv.h"
 # include "tune.h"
 # include "dbginfo_t.h"
-# include "iropt_dbg.c"
+# include "iropt_dbg.h"
 
 /* Make types visible to allow most efficient access */
 # include "entity_t.h"
@@ -44,7 +44,7 @@ value_of (ir_node *n)
     return tarval_bad;
 }
 
-/* if n can be computed, return the value, else NULL. Performs
+/* if n can be computed, return the value, else tarval_bad. Performs
    constant folding. GL: Only if n is arithmetic operator? */
 tarval *
 computed_value (ir_node *n)
@@ -240,23 +240,23 @@ computed_value (ir_node *n)
             ir_node *aba = skip_nop(skip_Proj(ab));
            if (   (   (/* aa is ProjP and aaa is Alloc */
                            (get_irn_op(aa) == op_Proj)
-                       && (get_irn_mode(aa) == mode_P)
+                       && (mode_is_reference(get_irn_mode(aa)))
                         && (get_irn_op(aaa) == op_Alloc))
                     && (   (/* ab is constant void */
                                (get_irn_op(ab) == op_Const)
-                            && (get_irn_mode(ab) == mode_P)
-                            && (get_Const_tarval(ab) == get_mode_null(mode_P)))
+                            && (mode_is_reference(get_irn_mode(ab)))
+                            && (get_Const_tarval(ab) == get_mode_null(get_irn_mode(ab))))
                        || (/* ab is other Alloc */
                                (get_irn_op(ab) == op_Proj)
-                           && (get_irn_mode(ab) == mode_P)
+                           && (mode_is_reference(get_irn_mode(ab)))
                             && (get_irn_op(aba) == op_Alloc)
                            && (aaa != aba))))
                || (/* aa is void and aba is Alloc */
                        (get_irn_op(aa) == op_Const)
-                    && (get_irn_mode(aa) == mode_P)
-                    && (get_Const_tarval(aa) == get_mode_null(mode_P))
+                    && (mode_is_reference(get_irn_mode(aa)))
+                    && (get_Const_tarval(aa) == get_mode_null(get_irn_mode(aa)))
                     && (get_irn_op(ab) == op_Proj)
-                   && (get_irn_mode(ab) == mode_P)
+                   && (mode_is_reference(get_irn_mode(ab)))
                     && (get_irn_op(aba) == op_Alloc)))
              /* 3.: */
              res = new_tarval_from_long (get_Proj_proj(n) & Ne, mode_b);
@@ -287,8 +287,8 @@ computed_value (ir_node *n)
 static bool
 different_identity (ir_node *a, ir_node *b)
 {
-  assert (get_irn_mode (a) == mode_P
-          && get_irn_mode (b) == mode_P);
+  assert (mode_is_reference(get_irn_mode (a))
+          && mode_is_reference(get_irn_mode (b)));
 
   if (get_irn_op (a) == op_Proj && get_irn_op(b) == op_Proj) {
     ir_node *a1 = get_Proj_pred (a);
@@ -389,9 +389,9 @@ equivalent_node (ir_node *n)
     ir_node *on;
     /* After running compute_node there is only one constant predecessor.
        Find this predecessors value and remember the other node: */
-    if ((tv = computed_value (a))) {
+    if ((tv = computed_value (a)) != tarval_bad) {
       on = b;
-    } else if ((tv = computed_value (b))) {
+    } else if ((tv = computed_value (b)) != tarval_bad) {
       on = a;
     } else break;
 
@@ -900,6 +900,8 @@ vt_cmp (const void *elt, const void *key)
       || (get_irn_sel_attr(a).ent->type != get_irn_sel_attr(b).ent->type);
   case iro_Phi:
     return get_irn_phi_attr (a) != get_irn_phi_attr (b);
+  case iro_Cast:
+    return get_Cast_type(a) != get_Cast_type(b);
   default: ;
   }