diff options
| author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-08 18:57:32 +0000 |
|---|---|---|
| committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-08 18:57:32 +0000 |
| commit | 9e6f4cc98a1eeac2fdb3e256bedda55b20472fb4 (patch) | |
| tree | 6c1bd00354a27f7741f4fc070bef38a17e4f1531 | |
| parent | b1ea83f465e14deee3ee10aed15d9cb12f914484 (diff) | |
| download | ppe42-gcc-9e6f4cc98a1eeac2fdb3e256bedda55b20472fb4.tar.gz ppe42-gcc-9e6f4cc98a1eeac2fdb3e256bedda55b20472fb4.zip | |
* fold-const.c (operand_equal_p): Clarify documentation.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71214 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 4 | ||||
| -rw-r--r-- | gcc/fold-const.c | 18 |
2 files changed, 20 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index af01922a75e..1c8268104da 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2003-09-08 Roger Sayle <roger@eyesopen.com> + + * fold-const.c (operand_equal_p): Clarify documentation. + 2003-09-08 Richard Henderson <rth@redhat.com> * c-decl.c (c_expand_body_1): Push and pop function context here. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 27a3da15e4c..d5b98fe488d 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1822,13 +1822,27 @@ truth_value_p (enum tree_code code) || code == TRUTH_XOR_EXPR || code == TRUTH_NOT_EXPR); } -/* Return nonzero if two operands are necessarily equal. +/* Return nonzero if two operands (typically of the same tree node) + are necessarily equal. If either argument has side-effects this + function returns zero. + If ONLY_CONST is nonzero, only return nonzero for constants. This function tests whether the operands are indistinguishable; it does not test whether they are equal using C's == operation. The distinction is important for IEEE floating point, because (1) -0.0 and 0.0 are distinguishable, but -0.0==0.0, and - (2) two NaNs may be indistinguishable, but NaN!=NaN. */ + (2) two NaNs may be indistinguishable, but NaN!=NaN. + + If ONLY_CONST is zero, a VAR_DECL is considered equal to itself + even though it may hold multiple values during a function. + This is because a GCC tree node guarantees that nothing else is + executed between the evaluation of its "operands" (which may often + be evaluated in arbitrary order). Hence if the operands themselves + don't side-effect, the VAR_DECLs, PARM_DECLs etc... must hold the + same value in each operand/subexpression. Hence a zero value for + ONLY_CONST assumes isochronic (or instantaneous) tree equivalence. + If comparing arbitrary expression trees, such as from different + statements, ONLY_CONST must usually be non-zero. */ int operand_equal_p (tree arg0, tree arg1, int only_const) |

