added verbosity stuff
[libfirm] / ir / ir / iropt.c
index 28c5950..2d222b5 100644 (file)
@@ -692,10 +692,11 @@ static ir_node *equivalent_node_left_zero(ir_node *n)
 static ir_node *equivalent_node_symmetric_unop(ir_node *n)
 {
   ir_node *oldn = n;
+  ir_node *pred = get_unop_op(n);
 
   /* optimize symmetric unop */
-  if (get_irn_op(get_unop_op(n)) == get_irn_op(n)) {
-    n = get_unop_op(get_unop_op(n));                                    DBG_OPT_ALGSIM2;
+  if (get_irn_op(pred) == get_irn_op(n)) {
+    n = get_unop_op(pred);                                             DBG_OPT_ALGSIM2;
   }
   return n;
 }
@@ -1527,6 +1528,23 @@ static int node_cmp_attr_Cast(ir_node *a, ir_node *b)
     return get_Cast_type(a) != get_Cast_type(b);
 }
 
+static int node_cmp_attr_Load(ir_node *a, ir_node *b)
+{
+  if (get_Load_volatility(a) == volatility_is_volatile ||
+      get_Load_volatility(b) == volatility_is_volatile)
+    /* NEVER do CSE on volatile Loads */
+    return 1;
+
+  return get_Load_mode(a) != get_Load_mode(b);
+}
+
+static int node_cmp_attr_Store(ir_node *a, ir_node *b)
+{
+  /* NEVER do CSE on volatile Stores */
+  return (get_Store_volatility(a) == volatility_is_volatile ||
+      get_Load_volatility(b) == volatility_is_volatile);
+}
+
 /**
  * set the default node attribute compare operation
  */
@@ -1549,6 +1567,8 @@ static ir_op *firm_set_default_node_cmp_attr(ir_op *op)
   CASE(Sel);
   CASE(Phi);
   CASE(Cast);
+  CASE(Load);
+  CASE(Store);
   default:
     op->node_cmp_attr  = NULL;
   }