summaryrefslogtreecommitdiffstats
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-19 16:23:27 +0000
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-19 16:23:27 +0000
commit97d6714632dc69c9f1341966666a141497221d24 (patch)
treef15a40f5a1f4ab9b11dec139b4555f2ba5f385f7 /gcc/builtins.c
parent4e7c6e48dfe17ad5b13cb03d56db746892ec0458 (diff)
downloadppe42-gcc-97d6714632dc69c9f1341966666a141497221d24.tar.gz
ppe42-gcc-97d6714632dc69c9f1341966666a141497221d24.zip
* hooks.h (hook_tree_tree_tree_bool_null): Rename to...
(hook_tree_tree_int_treep_bool_null): ...this. Update signature. * hooks.c: Likewise. * target-def.h (TARGET_FOLD_BUILTIN): Define to hook_tree_tree_int_treep_bool_null. * target.h: (struct gcc_target): Update signature of fold_builtin field. * doc/tm.texi (TARGET_FOLD_BUILTIN): Update description and signature. * builtins.c (fold_call_expr): Pass call_expr_nargs and CALL_EXPR_ARGP instead of the call expression. (fold_builtin_call_array): Pass n and argarray directly. (fold_call_stmt): Pass nargs and gimple_call_arg_ptr instead of consing a list. * config/alpha/alpha.c (alpha_fold_builtin): Update signature. Lift MAX_ARGS check out of the loop. Delete declaration of `arity', declare `i' and use it in place of `arity'. * config/sparc/sparc.c (sparc_fold_builtin): Update signature. Dereference `args' directly. * config/xtensa/xtensa (xtensa_fold_builtin): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159585 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 8541b829801..6ad95adbc00 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -10702,7 +10702,8 @@ fold_call_expr (location_t loc, tree exp, bool ignore)
return NULL_TREE;
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
- return targetm.fold_builtin (fndecl, exp, ignore);
+ return targetm.fold_builtin (fndecl, call_expr_nargs (exp),
+ CALL_EXPR_ARGP (exp), ignore);
else
{
if (nargs <= MAX_ARGS_TO_FOLD_BUILTIN)
@@ -10766,7 +10767,6 @@ fold_builtin_call_array (location_t loc, tree type,
tree *argarray)
{
tree ret = NULL_TREE;
- int i;
tree exp;
if (TREE_CODE (fn) == ADDR_EXPR)
@@ -10790,12 +10790,10 @@ fold_builtin_call_array (location_t loc, tree type,
return build_call_array_loc (loc, type, fn, n, argarray);
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
{
- tree arglist = NULL_TREE;
- for (i = n - 1; i >= 0; i--)
- arglist = tree_cons (NULL_TREE, argarray[i], arglist);
- ret = targetm.fold_builtin (fndecl, arglist, false);
- if (ret)
- return ret;
+ ret = targetm.fold_builtin (fndecl, n, argarray, false);
+ if (ret)
+ return ret;
+
return build_call_array_loc (loc, type, fn, n, argarray);
}
else if (n <= MAX_ARGS_TO_FOLD_BUILTIN)
@@ -13698,14 +13696,10 @@ fold_call_stmt (gimple stmt, bool ignore)
if (avoid_folding_inline_builtin (fndecl))
return NULL_TREE;
- /* FIXME: Don't use a list in this interface. */
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
{
- tree arglist = NULL_TREE;
- int i;
- for (i = nargs - 1; i >= 0; i--)
- arglist = tree_cons (NULL_TREE, gimple_call_arg (stmt, i), arglist);
- return targetm.fold_builtin (fndecl, arglist, ignore);
+ return targetm.fold_builtin (fndecl, nargs,
+ gimple_call_arg_ptr (stmt, 0), ignore);
}
else
{
OpenPOWER on IntegriCloud