diff options
-rw-r--r-- | gcc/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/builtins.c | 3 | ||||
-rw-r--r-- | gcc/config/alpha/alpha.c | 12 | ||||
-rw-r--r-- | gcc/config/picochip/picochip.c | 67 | ||||
-rw-r--r-- | gcc/config/rx/rx.c | 2 | ||||
-rw-r--r-- | gcc/config/sparc/sparc.c | 18 | ||||
-rw-r--r-- | gcc/config/xtensa/xtensa.c | 6 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 6 | ||||
-rw-r--r-- | gcc/tree.c | 16 | ||||
-rw-r--r-- | gcc/tree.h | 2 |
10 files changed, 82 insertions, 76 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87f27e7246b..0d1f713793e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,29 @@ +2010-05-17 Nathan Froyd <froydnj@codesourcery.com> + + * tree.h (CALL_EXPR_ARGS): Delete. + (call_expr_arglist): Delete. + * tree.c (call_expr_arglist): Delete. + * builtins.c (fold_call_expr): Pass the whole CALL_EXPR to + targetm.fold_builtin. + * config/alpha/alpha.c (alpha_fold_builtin): Rename arglist parameter. + Rewrite iteration to work on call_expr_nargs rather than TREE_CHAIN. + * config/picochip/picochip.c (picochip_expand_builtin_2op): Rename + arglist parameter. Use CALL_EXPR_ARG. + (picochip_expand_builtin_3op): Likewise. + (picochip_expand_builtin_2opvoid): Likewise. + (picochip_expand_array_get): Likewise. + (picochip_expand_array_put): Likewise. + (picochip_expand_array_testport): Likewise. + (picochip_expand_builtin): Don't call CALL_EXPR_ARGS. Pass exp + rather than arglist. + * config/rx/rx.c (rx_expand_builtin): Call call_expr_nargs instead of + CALL_EXPR_ARGS. + * config/sparc/sparc.c (sparc_fold_builtin): Use CALL_EXPR_ARG rather + than TREE_VALUE and TREE_CHAIN. + * config/xtensa/xtensa.c (xtensa_fold_builtin): Likewise. + * doc/tm.texi (TARGET_FOLD_BUILTIN): Pass CALL_EXPR tree instead of + the arglist. + 2010-05-17 Jakub Jelinek <jakub@redhat.com> PR bootstrap/42347 diff --git a/gcc/builtins.c b/gcc/builtins.c index 5f4b7176155..8541b829801 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -10701,9 +10701,8 @@ fold_call_expr (location_t loc, tree exp, 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) - return targetm.fold_builtin (fndecl, CALL_EXPR_ARGS (exp), ignore); + return targetm.fold_builtin (fndecl, exp, ignore); else { if (nargs <= MAX_ARGS_TO_FOLD_BUILTIN) diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index a123b117b40..764326728e7 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -7138,21 +7138,21 @@ 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 arglist, bool ignore ATTRIBUTE_UNUSED) +alpha_fold_builtin (tree fndecl, tree call, bool ignore ATTRIBUTE_UNUSED) { - tree op[MAX_ARGS], t; + tree *op = CALL_EXPR_ARGP (call); unsigned HOST_WIDE_INT opint[MAX_ARGS]; - long op_const = 0, arity = 0; + long op_const = 0; + int arity; - for (t = arglist; t ; t = TREE_CHAIN (t), ++arity) + for (i = 0; i < call_expr_nargs (call); i++) { - tree arg = TREE_VALUE (t); + tree arg = CALL_EXPR_ARG (call, i); if (arg == error_mark_node) return NULL; if (arity >= MAX_ARGS) return NULL; - op[arity] = arg; opint[arity] = 0; if (TREE_CODE (arg) == INTEGER_CST) { diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c index 0d6db586b38..bed06e619c4 100644 --- a/gcc/config/picochip/picochip.c +++ b/gcc/config/picochip/picochip.c @@ -3773,14 +3773,14 @@ picochip_final_prescan_insn (rtx insn, rtx * opvec ATTRIBUTE_UNUSED, /* Given a builtin function taking 2 operands (i.e., target + source), emit the RTL for the underlying instruction. */ static rtx -picochip_expand_builtin_2op (enum insn_code icode, tree arglist, rtx target) +picochip_expand_builtin_2op (enum insn_code icode, tree call, rtx target) { tree arg0; rtx op0, pat; enum machine_mode tmode, mode0; /* Grab the incoming argument and emit its RTL. */ - arg0 = TREE_VALUE (arglist); + arg0 = CALL_EXPR_ARG (call, 0); op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0); /* Determine the modes of the instruction operands. */ @@ -3811,15 +3811,15 @@ picochip_expand_builtin_2op (enum insn_code icode, tree arglist, rtx target) /* Given a builtin function taking 3 operands (i.e., target + two source), emit the RTL for the underlying instruction. */ static rtx -picochip_expand_builtin_3op (enum insn_code icode, tree arglist, rtx target) +picochip_expand_builtin_3op (enum insn_code icode, tree call, rtx target) { tree arg0, arg1; rtx op0, op1, pat; enum machine_mode tmode, mode0, mode1; /* Grab the function's arguments. */ - arg0 = TREE_VALUE (arglist); - arg1 = TREE_VALUE (TREE_CHAIN (arglist)); + arg0 = CALL_EXPR_ARG (call, 0); + arg1 = CALL_EXPR_ARG (call, 1); /* Emit rtl sequences for the function arguments. */ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0); @@ -3855,15 +3855,15 @@ picochip_expand_builtin_3op (enum insn_code icode, tree arglist, rtx target) /* Expand a builtin function which takes two arguments, and returns a void. */ static rtx -picochip_expand_builtin_2opvoid (enum insn_code icode, tree arglist) +picochip_expand_builtin_2opvoid (enum insn_code icode, tree call) { tree arg0, arg1; rtx op0, op1, pat; enum machine_mode mode0, mode1; /* Grab the function's arguments. */ - arg0 = TREE_VALUE (arglist); - arg1 = TREE_VALUE (TREE_CHAIN (arglist)); + arg0 = CALL_EXPR_ARG (call, 0); + arg1 = CALL_EXPR_ARG (call, 1); /* Emit rtl sequences for the function arguments. */ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0); @@ -3892,15 +3892,15 @@ picochip_expand_builtin_2opvoid (enum insn_code icode, tree arglist) /* Expand an array get into the corresponding RTL. */ static rtx -picochip_expand_array_get (tree arglist, rtx target) +picochip_expand_array_get (tree call, rtx target) { tree arg0, arg1, arg2; rtx op0, op1, op2, pat; /* Grab the function's arguments. */ - arg0 = TREE_VALUE (arglist); - arg1 = TREE_VALUE (TREE_CHAIN (arglist)); - arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + arg0 = CALL_EXPR_ARG (call, 0); + arg1 = CALL_EXPR_ARG (call, 1); + arg2 = CALL_EXPR_ARG (call, 2) ; /* Emit rtl sequences for the function arguments. */ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0); @@ -3936,16 +3936,16 @@ picochip_expand_array_get (tree arglist, rtx target) /* Expand an array put into the corresponding RTL. */ static rtx -picochip_expand_array_put (tree arglist, rtx target) +picochip_expand_array_put (tree call, rtx target) { tree arg0, arg1, arg2, arg3; rtx op0, op1, op2, op3, pat; /* Grab the function's arguments. */ - arg0 = TREE_VALUE (arglist); - arg1 = TREE_VALUE (arglist->common.chain); - arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); - arg3 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (arglist)))); + arg0 = CALL_EXPR_ARG (call, 0); + arg1 = CALL_EXPR_ARG (call, 1); + arg2 = CALL_EXPR_ARG (call, 2); + arg3 = CALL_EXPR_ARG (call, 3); /* Emit rtl sequences for the function arguments. */ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0); @@ -3980,15 +3980,15 @@ picochip_expand_array_put (tree arglist, rtx target) /* Expand an array testport into the corresponding RTL. */ static rtx -picochip_expand_array_testport (tree arglist, rtx target) +picochip_expand_array_testport (tree call, rtx target) { tree arg0, arg1, arg2; rtx op0, op1, op2, pat; /* Grab the function's arguments. */ - arg0 = TREE_VALUE (arglist); - arg1 = TREE_VALUE (TREE_CHAIN (arglist)); - arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + arg0 = CALL_EXPR_ARG (call, 0); + arg1 = CALL_EXPR_ARG (call, 1); + arg2 = CALL_EXPR_ARG (call, 2); /* Emit rtl sequences for the function arguments. */ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0); @@ -4214,50 +4214,49 @@ picochip_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, int ignore ATTRIBUTE_UNUSED) { tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0); - tree arglist = CALL_EXPR_ARGS(exp); int fcode = DECL_FUNCTION_CODE (fndecl); switch (fcode) { case PICOCHIP_BUILTIN_ASRI: - return picochip_expand_builtin_3op (CODE_FOR_builtin_asri, arglist, + return picochip_expand_builtin_3op (CODE_FOR_builtin_asri, exp, target); case PICOCHIP_BUILTIN_ADDS: - return picochip_expand_builtin_3op (CODE_FOR_sataddhi3, arglist, + return picochip_expand_builtin_3op (CODE_FOR_sataddhi3, exp, target); case PICOCHIP_BUILTIN_SUBS: - return picochip_expand_builtin_3op (CODE_FOR_satsubhi3, arglist, + return picochip_expand_builtin_3op (CODE_FOR_satsubhi3, exp, target); case PICOCHIP_BUILTIN_SBC: - return picochip_expand_builtin_2op (CODE_FOR_sbc, arglist, target); + return picochip_expand_builtin_2op (CODE_FOR_sbc, exp, target); case PICOCHIP_BUILTIN_BREV: - return picochip_expand_builtin_2op (CODE_FOR_brev, arglist, target); + return picochip_expand_builtin_2op (CODE_FOR_brev, exp, target); case PICOCHIP_BUILTIN_BYTESWAP: - return picochip_expand_builtin_2op (CODE_FOR_bswaphi2, arglist, target); + return picochip_expand_builtin_2op (CODE_FOR_bswaphi2, exp, target); case PICOCHIP_BUILTIN_GET: - return picochip_expand_builtin_2op (CODE_FOR_commsGet, arglist, target); + return picochip_expand_builtin_2op (CODE_FOR_commsGet, exp, target); case PICOCHIP_BUILTIN_PUT: - return picochip_expand_builtin_2opvoid (CODE_FOR_commsPut, arglist); + return picochip_expand_builtin_2opvoid (CODE_FOR_commsPut, exp); case PICOCHIP_BUILTIN_TESTPORT: - return picochip_expand_builtin_2op (CODE_FOR_commsTestPort, arglist, + return picochip_expand_builtin_2op (CODE_FOR_commsTestPort, exp, target); case PICOCHIP_BUILTIN_PUT_ARRAY: - return picochip_expand_array_put (arglist, target); + return picochip_expand_array_put (exp, target); case PICOCHIP_BUILTIN_GET_ARRAY: - return picochip_expand_array_get (arglist, target); + return picochip_expand_array_get (exp, target); case PICOCHIP_BUILTIN_TESTPORT_ARRAY: - return picochip_expand_array_testport (arglist, target); + return picochip_expand_array_testport (exp, target); case PICOCHIP_BUILTIN_HALT: return picochip_generate_halt (); diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c index 43099984948..ad43791013a 100644 --- a/gcc/config/rx/rx.c +++ b/gcc/config/rx/rx.c @@ -1995,7 +1995,7 @@ rx_expand_builtin (tree exp, int ignore ATTRIBUTE_UNUSED) { tree fndecl = TREE_OPERAND (CALL_EXPR_FN (exp), 0); - tree arg = CALL_EXPR_ARGS (exp) ? CALL_EXPR_ARG (exp, 0) : NULL_TREE; + tree arg = call_expr_nargs (exp) >= 1 ? CALL_EXPR_ARG (exp, 0) : NULL_TREE; rtx op = arg ? expand_normal (arg) : NULL_RTX; unsigned int fcode = DECL_FUNCTION_CODE (fndecl); diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c index 38711d3d72e..856431285df 100644 --- a/gcc/config/sparc/sparc.c +++ b/gcc/config/sparc/sparc.c @@ -8372,7 +8372,7 @@ 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 arglist, bool ignore) +sparc_fold_builtin (tree fndecl, tree call, bool ignore) { tree arg0, arg1, arg2; tree rtype = TREE_TYPE (TREE_TYPE (fndecl)); @@ -8386,7 +8386,7 @@ sparc_fold_builtin (tree fndecl, tree arglist, bool ignore) switch (icode) { case CODE_FOR_fexpand_vis: - arg0 = TREE_VALUE (arglist); + arg0 = CALL_EXPR_ARG (call, 0); STRIP_NOPS (arg0); if (TREE_CODE (arg0) == VECTOR_CST) @@ -8409,8 +8409,8 @@ sparc_fold_builtin (tree fndecl, tree arglist, bool ignore) case CODE_FOR_fmul8x16_vis: case CODE_FOR_fmul8x16au_vis: case CODE_FOR_fmul8x16al_vis: - arg0 = TREE_VALUE (arglist); - arg1 = TREE_VALUE (TREE_CHAIN (arglist)); + arg0 = CALL_EXPR_ARG (call, 0); + arg1 = CALL_EXPR_ARG (call, 1); STRIP_NOPS (arg0); STRIP_NOPS (arg1); @@ -8427,8 +8427,8 @@ sparc_fold_builtin (tree fndecl, tree arglist, bool ignore) break; case CODE_FOR_fpmerge_vis: - arg0 = TREE_VALUE (arglist); - arg1 = TREE_VALUE (TREE_CHAIN (arglist)); + arg0 = CALL_EXPR_ARG (call, 0); + arg1 = CALL_EXPR_ARG (call, 1); STRIP_NOPS (arg0); STRIP_NOPS (arg1); @@ -8450,9 +8450,9 @@ sparc_fold_builtin (tree fndecl, tree arglist, bool ignore) break; case CODE_FOR_pdist_vis: - arg0 = TREE_VALUE (arglist); - arg1 = TREE_VALUE (TREE_CHAIN (arglist)); - arg2 = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))); + arg0 = CALL_EXPR_ARG (call, 0); + arg1 = CALL_EXPR_ARG (call, 1); + arg2 = CALL_EXPR_ARG (call, 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 f7b73748b76..fac7e517ad2 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -3000,7 +3000,7 @@ xtensa_init_builtins (void) static tree -xtensa_fold_builtin (tree fndecl, tree arglist, bool ignore ATTRIBUTE_UNUSED) +xtensa_fold_builtin (tree fndecl, tree call, bool ignore ATTRIBUTE_UNUSED) { unsigned int fcode = DECL_FUNCTION_CODE (fndecl); tree arg0, arg1; @@ -3008,8 +3008,8 @@ xtensa_fold_builtin (tree fndecl, tree arglist, bool ignore ATTRIBUTE_UNUSED) switch (fcode) { case XTENSA_BUILTIN_UMULSIDI3: - arg0 = TREE_VALUE (arglist); - arg1 = TREE_VALUE (TREE_CHAIN (arglist)); + arg0 = CALL_EXPR_ARG (call, 0); + arg1 = CALL_EXPR_ARG (call, 1); if ((TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST) || TARGET_MUL32_HIGH) return fold_build2 (MULT_EXPR, unsigned_intDI_type_node, diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 6a998ed71a4..8f9bbe7933a 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -10784,12 +10784,12 @@ another @code{CALL_EXPR}. @var{arglist} really has type @samp{VEC(tree,gc)*} @end deftypefn -@deftypefn {Target Hook} tree TARGET_FOLD_BUILTIN (tree @var{fndecl}, tree @var{arglist}, bool @var{ignore}) +@deftypefn {Target Hook} tree TARGET_FOLD_BUILTIN (tree @var{fndecl}, tree @var{call}, bool @var{ignore}) Fold a call to a machine specific built-in function that was set up by @samp{TARGET_INIT_BUILTINS}. @var{fndecl} is the declaration of the -built-in function. @var{arglist} is the list of arguments passed to -the built-in function. The result is another tree containing a +built-in function. @var{call} is the @code{CALL_EXPR} representing +the call. The result is another tree containing a simplified expression for the call's result. If @var{ignore} is true the value will be ignored. @end deftypefn diff --git a/gcc/tree.c b/gcc/tree.c index 00de313f476..8c0ed4e0e15 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -10376,22 +10376,6 @@ tree_block (tree t) return NULL; } -/* Build and return a TREE_LIST of arguments in the CALL_EXPR exp. - FIXME: don't use this function. It exists for compatibility with - the old representation of CALL_EXPRs where a list was used to hold the - arguments. Places that currently extract the arglist from a CALL_EXPR - ought to be rewritten to use the CALL_EXPR itself. */ -tree -call_expr_arglist (tree exp) -{ - tree arglist = NULL_TREE; - int i; - for (i = call_expr_nargs (exp) - 1; i >= 0; i--) - arglist = tree_cons (NULL_TREE, CALL_EXPR_ARG (exp, i), arglist); - return arglist; -} - - /* Create a nameless artificial label and put it in the current function context. The label has a location of LOC. Returns the newly created label. */ diff --git a/gcc/tree.h b/gcc/tree.h index a37d81a2b12..2b10d9a407b 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1695,7 +1695,6 @@ extern void protected_set_expr_location (tree, location_t); */ #define CALL_EXPR_FN(NODE) TREE_OPERAND (CALL_EXPR_CHECK (NODE), 1) #define CALL_EXPR_STATIC_CHAIN(NODE) TREE_OPERAND (CALL_EXPR_CHECK (NODE), 2) -#define CALL_EXPR_ARGS(NODE) call_expr_arglist (NODE) #define CALL_EXPR_ARG(NODE, I) TREE_OPERAND (CALL_EXPR_CHECK (NODE), (I) + 3) #define call_expr_nargs(NODE) (VL_EXP_OPERAND_LENGTH(NODE) - 3) @@ -4806,7 +4805,6 @@ extern tree lower_bound_in_type (tree, tree); extern int operand_equal_for_phi_arg_p (const_tree, const_tree); extern tree call_expr_arg (tree, int); extern tree *call_expr_argp (tree, int); -extern tree call_expr_arglist (tree); extern tree create_artificial_label (location_t); extern const char *get_name (tree); extern bool stdarg_p (tree); |