OSDN Git Service

* fold-const.c (operand_equal_p): Temporarily support NULL args.
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Jul 2004 01:21:11 +0000 (01:21 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 21 Jul 2004 01:21:11 +0000 (01:21 +0000)
(operand_equal_p, case ARRAY_REF): Compare args 2 and 3.
(operand_equal_p, case COMPONENT_REF): Likewise, for arg 2.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84990 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/fold-const.c

index babc470..f581fcd 100644 (file)
@@ -2,6 +2,12 @@
 
        * config/arm/arm.c (thumb_expand_prologue): Remove bogus GEN_INT.
 
+2004-07-20  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * fold-const.c (operand_equal_p): Temporarily support NULL args.
+       (operand_equal_p, case ARRAY_REF): Compare args 2 and 3.
+       (operand_equal_p, case COMPONENT_REF): Likewise, for arg 2.
+
 2004-07-20  Zack Weinberg  <zack@codesourcery.com>
 
        * rtl.h (plus_constant): Delete.
index df397f7..946a2fb 100644 (file)
@@ -2348,8 +2348,17 @@ truth_value_p (enum tree_code code)
 int
 operand_equal_p (tree arg0, tree arg1, unsigned int flags)
 {
+  /* If one is specified and the other isn't, they aren't equal and if
+     neither is specified, they are.
+
+     ??? This is temporary and is meant only to handle the cases of the
+     optional operands for COMPONENT_REF and ARRAY_REF.  */
+  if ((arg0 && !arg1) || (!arg0 && arg1))
+    return 0;
+  else if (!arg0 && !arg1)
+    return 1;
   /* If either is ERROR_MARK, they aren't equal.  */
-  if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK)
+  else if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK)
     return 0;
 
   /* If both types don't have the same signedness, then we can't consider
@@ -2483,13 +2492,26 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags)
          return operand_equal_p (TREE_OPERAND (arg0, 0),
                                  TREE_OPERAND (arg1, 0), flags);
 
-       case COMPONENT_REF:
        case ARRAY_REF:
        case ARRAY_RANGE_REF:
          return (operand_equal_p (TREE_OPERAND (arg0, 0),
                                   TREE_OPERAND (arg1, 0), flags)
                  && operand_equal_p (TREE_OPERAND (arg0, 1),
-                                     TREE_OPERAND (arg1, 1), flags));
+                                     TREE_OPERAND (arg1, 1), flags)
+                 && operand_equal_p (TREE_OPERAND (arg0, 2),
+                                     TREE_OPERAND (arg1, 2), flags)
+                 && operand_equal_p (TREE_OPERAND (arg0, 3),
+                                     TREE_OPERAND (arg1, 3), flags));
+
+
+       case COMPONENT_REF:
+         return (operand_equal_p (TREE_OPERAND (arg0, 0),
+                                  TREE_OPERAND (arg1, 0), flags)
+                 && operand_equal_p (TREE_OPERAND (arg0, 1),
+                                     TREE_OPERAND (arg1, 1), flags)
+                 && operand_equal_p (TREE_OPERAND (arg0, 2),
+                                     TREE_OPERAND (arg1, 2), flags));
+
 
        case BIT_FIELD_REF:
          return (operand_equal_p (TREE_OPERAND (arg0, 0),