tree.h (CALL_EXPR_ARGS): Delete.
authorNathan Froyd <froydnj@codesourcery.com>
Mon, 17 May 2010 18:16:27 +0000 (18:16 +0000)
committerNathan Froyd <froydnj@gcc.gnu.org>
Mon, 17 May 2010 18:16:27 +0000 (18:16 +0000)
* 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.

From-SVN: r159502

gcc/ChangeLog
gcc/builtins.c
gcc/config/alpha/alpha.c
gcc/config/picochip/picochip.c
gcc/config/rx/rx.c
gcc/config/sparc/sparc.c
gcc/config/xtensa/xtensa.c
gcc/doc/tm.texi
gcc/tree.c
gcc/tree.h

index 87f27e7246b25e3d8933bfc4627c4d5fb0bfb4c5..0d1f713793ea11e005424893b157564679bda7e5 100644 (file)
@@ -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
index 5f4b7176155485cd53604361eee28baa924543fa..8541b829801f7de3647bbb48fb0c1f23f843030d 100644 (file)
@@ -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)
index a123b117b4006810bb28e5ec0ce0d366425ac63e..764326728e74f42bc30784557083db74a6514534 100644 (file)
@@ -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)
        {
index 0d6db586b38b364dce916cccce8b99db3fd717f6..bed06e619c479da3d631a1356245732e1b324c44 100644 (file)
@@ -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 ();
index 43099984948c5aaeefb88c662eeddeca8ce632b0..ad43791013a1130cc0a6090984a7b76680d02991 100644 (file)
@@ -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);
 
index 38711d3d72efc4e3f67abb1e0ddfb581cdc69b75..856431285df8962101d0acc10e4239cced7eafbb 100644 (file)
@@ -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);
index f7b73748b7627c8f93d120e75e10c154f112da8e..fac7e517ad25d9cfc7042bbd5a0ec52068379a49 100644 (file)
@@ -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,
index 6a998ed71a48fb4bdeb8ec10f0c73ffdcdf1e050..8f9bbe7933a2cf77a4e723fbd3baace7f90ae724 100644 (file)
@@ -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
index 00de313f476e459c4054c06944db26deb58570e1..8c0ed4e0e15661891f69e924553b50462b95437f 100644 (file)
@@ -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.  */
index a37d81a2b124782d8aa6b1be258ab8c0c73c1f99..2b10d9a407bb768b8402e8370bdbefa000d7677d 100644 (file)
@@ -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);