aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2010-05-19 16:23:27 +0000
committerNathan Froyd <froydnj@gcc.gnu.org>2010-05-19 16:23:27 +0000
commitf311c3b4a64ad8752904a0261a306bf191e5fcdc (patch)
treef15a40f5a1f4ab9b11dec139b4555f2ba5f385f7 /gcc/config
parent40f1bdd962209529dff65187a9407656577b31b1 (diff)
downloadgcc-f311c3b4a64ad8752904a0261a306bf191e5fcdc.zip
gcc-f311c3b4a64ad8752904a0261a306bf191e5fcdc.tar.gz
gcc-f311c3b4a64ad8752904a0261a306bf191e5fcdc.tar.bz2
hooks.h (hook_tree_tree_tree_bool_null): Rename to...
* 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. From-SVN: r159585
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/alpha/alpha.c21
-rw-r--r--gcc/config/sparc/sparc.c21
-rw-r--r--gcc/config/xtensa/xtensa.c9
3 files changed, 27 insertions, 24 deletions
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 7643267..2cc173f5 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -7138,26 +7138,27 @@ alpha_fold_builtin_ctpop (unsigned HOST_WIDE_INT opint[], long op_const)
/* Fold one of our builtin functions. */
static tree
-alpha_fold_builtin (tree fndecl, tree call, bool ignore ATTRIBUTE_UNUSED)
+alpha_fold_builtin (tree fndecl, int n_args, tree *op,
+ bool ignore ATTRIBUTE_UNUSED)
{
- tree *op = CALL_EXPR_ARGP (call);
unsigned HOST_WIDE_INT opint[MAX_ARGS];
long op_const = 0;
- int arity;
+ int i;
- for (i = 0; i < call_expr_nargs (call); i++)
+ if (n_args >= MAX_ARGS)
+ return NULL;
+
+ for (i = 0; i < n_args; i++)
{
- tree arg = CALL_EXPR_ARG (call, i);
+ tree arg = op[i];
if (arg == error_mark_node)
return NULL;
- if (arity >= MAX_ARGS)
- return NULL;
- opint[arity] = 0;
+ opint[i] = 0;
if (TREE_CODE (arg) == INTEGER_CST)
{
- op_const |= 1L << arity;
- opint[arity] = int_cst_value (arg);
+ op_const |= 1L << i;
+ opint[i] = int_cst_value (arg);
}
}
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 8564312..9f9e20b 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -386,7 +386,7 @@ static void sparc_init_libfuncs (void);
static void sparc_init_builtins (void);
static void sparc_vis_init_builtins (void);
static rtx sparc_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
-static tree sparc_fold_builtin (tree, tree, bool);
+static tree sparc_fold_builtin (tree, int, tree *, bool);
static int sparc_vis_mul8x16 (int, int);
static tree sparc_handle_vis_mul8x16 (int, tree, tree, tree);
static void sparc_output_mi_thunk (FILE *, tree, HOST_WIDE_INT,
@@ -8372,7 +8372,8 @@ sparc_handle_vis_mul8x16 (int fncode, tree inner_type, tree elts0, tree elts1)
function could not be folded. */
static tree
-sparc_fold_builtin (tree fndecl, tree call, bool ignore)
+sparc_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED,
+ tree *args, bool ignore)
{
tree arg0, arg1, arg2;
tree rtype = TREE_TYPE (TREE_TYPE (fndecl));
@@ -8386,7 +8387,7 @@ sparc_fold_builtin (tree fndecl, tree call, bool ignore)
switch (icode)
{
case CODE_FOR_fexpand_vis:
- arg0 = CALL_EXPR_ARG (call, 0);
+ arg0 = args[0];
STRIP_NOPS (arg0);
if (TREE_CODE (arg0) == VECTOR_CST)
@@ -8409,8 +8410,8 @@ sparc_fold_builtin (tree fndecl, tree call, bool ignore)
case CODE_FOR_fmul8x16_vis:
case CODE_FOR_fmul8x16au_vis:
case CODE_FOR_fmul8x16al_vis:
- arg0 = CALL_EXPR_ARG (call, 0);
- arg1 = CALL_EXPR_ARG (call, 1);
+ arg0 = args[0];
+ arg1 = args[1];
STRIP_NOPS (arg0);
STRIP_NOPS (arg1);
@@ -8427,8 +8428,8 @@ sparc_fold_builtin (tree fndecl, tree call, bool ignore)
break;
case CODE_FOR_fpmerge_vis:
- arg0 = CALL_EXPR_ARG (call, 0);
- arg1 = CALL_EXPR_ARG (call, 1);
+ arg0 = args[0];
+ arg1 = args[1];
STRIP_NOPS (arg0);
STRIP_NOPS (arg1);
@@ -8450,9 +8451,9 @@ sparc_fold_builtin (tree fndecl, tree call, bool ignore)
break;
case CODE_FOR_pdist_vis:
- arg0 = CALL_EXPR_ARG (call, 0);
- arg1 = CALL_EXPR_ARG (call, 1);
- arg2 = CALL_EXPR_ARG (call, 2);
+ arg0 = args[0];
+ arg1 = args[1];
+ arg2 = args[2];
STRIP_NOPS (arg0);
STRIP_NOPS (arg1);
STRIP_NOPS (arg2);
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index fac7e51..97b941d 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -142,7 +142,7 @@ static tree xtensa_gimplify_va_arg_expr (tree, tree, gimple_seq *,
gimple_seq *);
static rtx xtensa_function_value (const_tree, const_tree, bool);
static void xtensa_init_builtins (void);
-static tree xtensa_fold_builtin (tree, tree, bool);
+static tree xtensa_fold_builtin (tree, int, tree *, bool);
static rtx xtensa_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
static void xtensa_va_start (tree, rtx);
static bool xtensa_frame_pointer_required (void);
@@ -3000,7 +3000,8 @@ xtensa_init_builtins (void)
static tree
-xtensa_fold_builtin (tree fndecl, tree call, bool ignore ATTRIBUTE_UNUSED)
+xtensa_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *args,
+ bool ignore ATTRIBUTE_UNUSED)
{
unsigned int fcode = DECL_FUNCTION_CODE (fndecl);
tree arg0, arg1;
@@ -3008,8 +3009,8 @@ xtensa_fold_builtin (tree fndecl, tree call, bool ignore ATTRIBUTE_UNUSED)
switch (fcode)
{
case XTENSA_BUILTIN_UMULSIDI3:
- arg0 = CALL_EXPR_ARG (call, 0);
- arg1 = CALL_EXPR_ARG (call, 1);
+ arg0 = args[0];
+ arg1 = args[1];
if ((TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
|| TARGET_MUL32_HIGH)
return fold_build2 (MULT_EXPR, unsigned_intDI_type_node,