aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <merrill@gnu.org>1995-02-22 17:35:09 +0000
committerJason Merrill <merrill@gnu.org>1995-02-22 17:35:09 +0000
commit56c98e5b32112e3f52778822083a7a53fc348aa1 (patch)
treecf8b725ea0343425837214ab8ee19a9138f35759 /gcc
parenta092957f9680754e1a4a6303f6e31029072e5915 (diff)
downloadgcc-56c98e5b32112e3f52778822083a7a53fc348aa1.zip
gcc-56c98e5b32112e3f52778822083a7a53fc348aa1.tar.gz
gcc-56c98e5b32112e3f52778822083a7a53fc348aa1.tar.bz2
Support CLEANUP_POINT_EXPRs.
From-SVN: r9034
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fold-const.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 75bba1f..a432397 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4980,6 +4980,32 @@ fold (expr)
TREE_OPERAND (arg0, 1)))));
return t;
+ /* Pull arithmetic ops out of the CLEANUP_POINT_EXPR where
+ appropriate. */
+ case CLEANUP_POINT_EXPR:
+ if (! TREE_SIDE_EFFECTS (arg0))
+ return arg0;
+
+ {
+ enum tree_code code0 = TREE_CODE (arg0);
+ int kind0 = TREE_CODE_CLASS (code0);
+ tree arg00 = TREE_OPERAND (arg0, 0);
+ tree arg01;
+
+ if (kind0 == '1')
+ return fold (build1 (code0, type,
+ fold (build1 (CLEANUP_POINT_EXPR,
+ TREE_TYPE (arg00), arg00))));
+ if ((kind0 == '<' || kind0 == '2')
+ && ! TREE_SIDE_EFFECTS (arg01 = TREE_OPERAND (arg0, 1)))
+ return fold (build (code0, type,
+ fold (build1 (CLEANUP_POINT_EXPR,
+ TREE_TYPE (arg00), arg00)),
+ arg01));
+
+ return t;
+ }
+
default:
return t;
} /* switch (code) */