aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-07-21 01:21:11 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2004-07-20 21:21:11 -0400
commit462fdcce48d055b51f7ca5835c4dd43a94ecf767 (patch)
tree208fd606ab7b1ab6d2cca7d8573cb5dd006033d8
parent0e28378a9a0becf189130f49c34ac8622d0f806b (diff)
downloadgcc-462fdcce48d055b51f7ca5835c4dd43a94ecf767.zip
gcc-462fdcce48d055b51f7ca5835c4dd43a94ecf767.tar.gz
gcc-462fdcce48d055b51f7ca5835c4dd43a94ecf767.tar.bz2
fold-const.c (operand_equal_p): Temporarily support NULL args.
* 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. From-SVN: r84990
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/fold-const.c28
2 files changed, 31 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index babc470..f581fcd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index df397f7..946a2fb 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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),