aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorNathan Froyd <froydnj@codesourcery.com>2010-07-13 18:46:25 +0000
committerNathan Froyd <froydnj@gcc.gnu.org>2010-07-13 18:46:25 +0000
commit3bb06db415181f6027ac0f99520ced47069d6499 (patch)
tree435ae90e4b6eed76766475f3f0c7083b8c6f6502 /gcc/builtins.c
parent3f34855a08b426c05d3c462fd4563c649ad15476 (diff)
downloadgcc-3bb06db415181f6027ac0f99520ced47069d6499.zip
gcc-3bb06db415181f6027ac0f99520ced47069d6499.tar.gz
gcc-3bb06db415181f6027ac0f99520ced47069d6499.tar.bz2
tree.h (build_function_call_expr): Delete.
gcc/ * tree.h (build_function_call_expr): Delete. (build_call_expr_loc_array): New function. (build_call_expr_loc_vec): New function. * tree-flow.h (struct omp_region): Change type of ws_args field to a VEC. * builtins.c (build_function_call_expr): Delete. (build_call_expr_loc_array): New function. (build_call_expr_loc): Call it. Use XALLOCAVEC. (build_call_expr): Likewise. (build_call_expr_loc_vec): New function. * cgraphunit.c (build_cdtor): Call build_call_expr instead of build_function_call_expr. * expr.c (emutls_var_address): Likewise. * varasm.c (emutls_common_1): Likewise. * omp-low.c (expand_omp_atomic_mutex): Likewise. (expand_omp_taskreg): Adjust for new type of region->ws_args. (get_ws_args_for): Return a VEC instead of a tree. (expand_parallel_call): Call build_call_expr_loc_vec instead of build_function_call_expr. * stor-layout.c (self_referential_size): Likewise. gcc/fortran/ * trans-decl.c (build_entry_thunks): Call build_call_expr_loc_vec instead of build_function_call_expr. * trans-intrinsic.c (gfc_conv_intrinsic_sr_kind): Likewise. From-SVN: r162148
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 73a70f2..b94e056 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -10673,23 +10673,31 @@ fold_call_expr (location_t loc, tree exp, bool ignore)
}
/* Conveniently construct a function call expression. FNDECL names the
- function to be called and ARGLIST is a TREE_LIST of arguments. */
+ function to be called and N arguments are passed in the array
+ ARGARRAY. */
tree
-build_function_call_expr (location_t loc, tree fndecl, tree arglist)
+build_call_expr_loc_array (location_t loc, tree fndecl, int n, tree *argarray)
{
tree fntype = TREE_TYPE (fndecl);
tree fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
- int n = list_length (arglist);
- tree *argarray = (tree *) alloca (n * sizeof (tree));
- int i;
-
- for (i = 0; i < n; i++, arglist = TREE_CHAIN (arglist))
- argarray[i] = TREE_VALUE (arglist);
+
return fold_builtin_call_array (loc, TREE_TYPE (fntype), fn, n, argarray);
}
/* Conveniently construct a function call expression. FNDECL names the
+ function to be called and the arguments are passed in the vector
+ VEC. */
+
+tree
+build_call_expr_loc_vec (location_t loc, tree fndecl, VEC(tree,gc) *vec)
+{
+ return build_call_expr_loc_array (loc, fndecl, VEC_length (tree, vec),
+ VEC_address (tree, vec));
+}
+
+
+/* Conveniently construct a function call expression. FNDECL names the
function to be called, N is the number of arguments, and the "..."
parameters are the argument expressions. */
@@ -10697,16 +10705,14 @@ tree
build_call_expr_loc (location_t loc, tree fndecl, int n, ...)
{
va_list ap;
- tree fntype = TREE_TYPE (fndecl);
- tree fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
- tree *argarray = (tree *) alloca (n * sizeof (tree));
+ tree *argarray = XALLOCAVEC (tree, n);
int i;
va_start (ap, n);
for (i = 0; i < n; i++)
argarray[i] = va_arg (ap, tree);
va_end (ap);
- return fold_builtin_call_array (loc, TREE_TYPE (fntype), fn, n, argarray);
+ return build_call_expr_loc_array (loc, fndecl, n, argarray);
}
/* Like build_call_expr_loc (UNKNOWN_LOCATION, ...). Duplicated because
@@ -10716,17 +10722,14 @@ tree
build_call_expr (tree fndecl, int n, ...)
{
va_list ap;
- tree fntype = TREE_TYPE (fndecl);
- tree fn = build1 (ADDR_EXPR, build_pointer_type (fntype), fndecl);
- tree *argarray = (tree *) alloca (n * sizeof (tree));
+ tree *argarray = XALLOCAVEC (tree, n);
int i;
va_start (ap, n);
for (i = 0; i < n; i++)
argarray[i] = va_arg (ap, tree);
va_end (ap);
- return fold_builtin_call_array (UNKNOWN_LOCATION, TREE_TYPE (fntype),
- fn, n, argarray);
+ return build_call_expr_loc_array (UNKNOWN_LOCATION, fndecl, n, argarray);
}
/* Construct a CALL_EXPR with type TYPE with FN as the function expression.