added DivMod to constant evaluation.
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 20 Jun 2001 18:02:58 +0000 (18:02 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 20 Jun 2001 18:02:58 +0000 (18:02 +0000)
[r190]

ir/ir/iropt.c

index 6aae09f..4d1cde6 100644 (file)
@@ -123,6 +123,7 @@ computed_value (ir_node *n)
       res = tarval_mod(ta, tb);
     }
     break;
+  /* for iro_DivMod see iro_Proj */
   case iro_Abs:
     if (ta)
       res = tarval_abs (ta);
@@ -221,6 +222,16 @@ computed_value (ir_node *n)
              res = tarval_from_long (mode_b, get_Proj_proj(n) & irpn_Ne);
          }
        }
+      } else if (get_irn_op(a) == op_DivMod) {
+        ta = value_of(get_DivMod_left(a));
+        tb = value_of(get_DivMod_right(a));
+       if (ta && tb  && (get_irn_mode(a) == get_irn_mode(b))) {
+         if (tarval_classify(tb) == 0) {res = NULL; break;}
+         if (get_Proj_proj(n)== 0) /* Div */
+           res = tarval_div(ta, tb);
+         else /* Mod */
+           res = tarval_mod(ta, tb);
+       }
       } else {
         /* printf(" # comp_val: Proj node, not optimized\n"); */
       }