This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] builtins.c: Change fold_builtin_1 to take decomposedarguments of CALL_EXPR.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 21 Mar 2005 08:36:20 -0500 (EST)
- Subject: [patch] builtins.c: Change fold_builtin_1 to take decomposedarguments of CALL_EXPR.
Hi,
Attached is a patch to change fold_builtin_1 to take decomposed
arguments of CALL_EXPR.
Once this patch is in, we can change fold_builtin in a similar way,
which allows us to finally provide fold_buildN.
Tested on i686-pc-linux-gnu. OK to apply?
Kazu Hirata
2005-03-21 Kazu Hirata <kazu@cs.umass.edu>
* builtins.c (fold_builtin_1): Take decomposed arguments of
CALL_EXPR.
Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.443
diff -u -d -p -r1.443 builtins.c
--- builtins.c 20 Mar 2005 15:54:32 -0000 1.443
+++ builtins.c 21 Mar 2005 03:44:38 -0000
@@ -178,7 +178,7 @@ static tree fold_builtin_fabs (tree, tre
static tree fold_builtin_abs (tree, tree);
static tree fold_builtin_unordered_cmp (tree, tree, enum tree_code,
enum tree_code);
-static tree fold_builtin_1 (tree, bool);
+static tree fold_builtin_1 (tree, tree, bool);
static tree fold_builtin_strpbrk (tree, tree);
static tree fold_builtin_strstr (tree, tree);
@@ -7939,10 +7939,8 @@ fold_builtin_complex_div (tree type, tre
if no simplification was possible. */
static tree
-fold_builtin_1 (tree exp, bool ignore)
+fold_builtin_1 (tree fndecl, tree arglist, bool ignore)
{
- tree fndecl = get_callee_fndecl (exp);
- tree arglist = TREE_OPERAND (exp, 1);
tree type = TREE_TYPE (TREE_TYPE (fndecl));
enum built_in_function fcode;
@@ -8300,7 +8298,10 @@ fold_builtin_1 (tree exp, bool ignore)
tree
fold_builtin (tree exp, bool ignore)
{
- exp = fold_builtin_1 (exp, ignore);
+ tree fndecl = get_callee_fndecl (exp);
+ tree arglist = TREE_OPERAND (exp, 1);
+
+ exp = fold_builtin_1 (fndecl, arglist, ignore);
if (exp)
{
/* ??? Don't clobber shared nodes such as integer_zero_node. */