This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] builtins.c: Change the prototype of targetm.fold_builtin.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 20 Mar 2005 09:47:53 -0500 (EST)
- Subject: [patch] builtins.c: Change the prototype of targetm.fold_builtin.
Hi,
Attached is a patch to change the prototype of targetm.fold_builtin.
once this patch is in, the only remaining uses of EXP in
fold_builtin_1 are
tree fndecl = get_callee_fndecl (exp);
tree arglist = TREE_OPERAND (exp, 1);
Then it's easy to change fold_builtin_1 to take decomposed arguments
of CALL_EXPR, which in turns allows us to similarly change
fold_builtin.
Built cc1 for alpha-linux. Tested on i686-pc-linux-gnu. OK to apply?
Kazu Hirata
2005-03-20 Kazu Hirata <kazu@cs.umass.edu>
* builtins.c (fold_builtin_1): Update a call to
targetm.fold_builtin.
* hooks.c (hook_tree_tree_bool_null): Rename to
hook_tree_tree_tree_bool_null. Take one more argument of type
tree.
* hooks.h: Update the prototype of hook_tree_tree_bool_null.
* target-def.h (TARGET_FOLD_BUILTIN): Define it as
hook_tree_tree_tree_bool_null.
* target.h (gcc_target): Update the prototype of fold_builtin.
* config/alpha/alpha.c (alpha_fold_builtin): Take decomposed
arguments of CALL_EXPR.
Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.441
diff -u -d -p -r1.441 builtins.c
--- builtins.c 19 Mar 2005 18:01:19 -0000 1.441
+++ builtins.c 19 Mar 2005 23:26:50 -0000
@@ -7959,7 +7959,7 @@ fold_builtin_1 (tree exp, bool ignore)
enum built_in_function fcode;
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
- return targetm.fold_builtin (exp, ignore);
+ return targetm.fold_builtin (fndecl, arglist, ignore);
fcode = DECL_FUNCTION_CODE (fndecl);
switch (fcode)
Index: hooks.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/hooks.c,v
retrieving revision 1.38
diff -u -d -p -r1.38 hooks.c
--- hooks.c 18 Mar 2005 15:24:19 -0000 1.38
+++ hooks.c 19 Mar 2005 23:26:59 -0000
@@ -243,7 +243,8 @@ hook_constcharptr_tree_null (tree t ATTR
}
tree
-hook_tree_tree_bool_null (tree t ATTRIBUTE_UNUSED, bool ignore ATTRIBUTE_UNUSED)
+hook_tree_tree_tree_bool_null (tree t0 ATTRIBUTE_UNUSED, tree t1 ATTRIBUTE_UNUSED,
+ bool ignore ATTRIBUTE_UNUSED)
{
return NULL;
}
Index: hooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/hooks.h,v
retrieving revision 1.38
diff -u -d -p -r1.38 hooks.h
--- hooks.h 18 Mar 2005 15:24:19 -0000 1.38
+++ hooks.h 19 Mar 2005 23:26:59 -0000
@@ -64,5 +64,5 @@ extern rtx hook_rtx_rtx_null (rtx);
extern rtx hook_rtx_tree_int_null (tree, int);
extern tree hook_tree_tree_identity (tree a);
extern const char *hook_constcharptr_tree_null (tree);
-extern tree hook_tree_tree_bool_null (tree, bool);
+extern tree hook_tree_tree_tree_bool_null (tree, tree, bool);
#endif
Index: target-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target-def.h,v
retrieving revision 1.115
diff -u -d -p -r1.115 target-def.h
--- target-def.h 14 Mar 2005 20:18:36 -0000 1.115
+++ target-def.h 19 Mar 2005 23:27:00 -0000
@@ -296,7 +296,7 @@ Foundation, 59 Temple Place - Suite 330,
/* In builtins.c. */
#define TARGET_INIT_BUILTINS hook_void_void
#define TARGET_EXPAND_BUILTIN default_expand_builtin
-#define TARGET_FOLD_BUILTIN hook_tree_tree_bool_null
+#define TARGET_FOLD_BUILTIN hook_tree_tree_tree_bool_null
/* In varasm.c. */
#ifndef TARGET_SECTION_TYPE_FLAGS
Index: target.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/target.h,v
retrieving revision 1.127
diff -u -d -p -r1.127 target.h
--- target.h 14 Mar 2005 20:18:36 -0000 1.127
+++ target.h 19 Mar 2005 23:27:01 -0000
@@ -344,7 +344,7 @@ struct gcc_target
enum machine_mode mode, int ignore);
/* Fold a target-specific builtin. */
- tree (* fold_builtin) (tree exp, bool ignore);
+ tree (* fold_builtin) (tree fndecl, tree arglist, bool ignore);
/* For a vendor-specific fundamental TYPE, return a pointer to
a statically-allocated string containing the C++ mangling for
Index: config/alpha/alpha.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/alpha/alpha.c,v
retrieving revision 1.411
diff -u -d -p -r1.411 alpha.c
--- config/alpha/alpha.c 17 Mar 2005 10:43:17 -0000 1.411
+++ config/alpha/alpha.c 19 Mar 2005 23:27:05 -0000
@@ -6499,14 +6499,13 @@ alpha_fold_builtin_ctpop (unsigned HOST_
/* Fold one of our builtin functions. */
static tree
-alpha_fold_builtin (tree exp, bool ignore ATTRIBUTE_UNUSED)
+alpha_fold_builtin (tree fndecl, tree arglist, bool ignore ATTRIBUTE_UNUSED)
{
- tree fndecl = get_callee_fndecl (exp);
tree op[MAX_ARGS], t;
unsigned HOST_WIDE_INT opint[MAX_ARGS];
long op_const = 0, arity = 0;
- for (t = TREE_OPERAND (exp, 1); t ; t = TREE_CHAIN (t), ++arity)
+ for (t = arglist; t ; t = TREE_CHAIN (t), ++arity)
{
tree arg = TREE_VALUE (t);
if (arg == error_mark_node)