summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-01 17:02:45 +0000
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-01 17:02:45 +0000
commit650e4c9413309684e6c9c1b8a885e49ecb2f3704 (patch)
tree134205e79f38779f813ba6a5e2125ad69cafdd53 /gcc/fold-const.c
parent3b653a71f8a9df17ca147173a6ecae85a4b561e3 (diff)
downloadgcc-650e4c9413309684e6c9c1b8a885e49ecb2f3704.tar.gz
Constant folding for builtins
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37191 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index c5b29a47242..25fd4964519 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -7168,6 +7168,19 @@ fold (expr)
return t;
}
+ case CALL_EXPR:
+ /* Check for a built-in function. */
+ if (TREE_CODE (TREE_OPERAND (expr, 0)) == ADDR_EXPR
+ && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (expr, 0), 0))
+ == FUNCTION_DECL)
+ && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (expr, 0), 0)))
+ {
+ tree tmp = fold_builtin (expr);
+ if (tmp)
+ return tmp;
+ }
+ return t;
+
default:
return t;
} /* switch (code) */