From 94a0dd7b599e1d83b81f007258af2b16e7cbc4c5 Mon Sep 17 00:00:00 2001 From: Sandra Loosemore Date: Wed, 28 Feb 2007 14:21:20 -0500 Subject: builtins.c (fold_builtin_call_list, [...]): Delete, and replace with... 2007-02-28 Sandra Loosemore * gcc/builtins.c (fold_builtin_call_list, fold_builtin_call_valist): Delete, and replace with... (fold_builtin_call_array): This. Update callers to use it. * gcc/fold-const.c (fold_build_call_list): Delete, and replace with... (fold_build_call_array): This. (fold_build_call_list_initializer): Delete, and replace with... (fold_build_call_array_initializer): This. * gcc/tree.h: Update declarations to reflect above changes. * gcc/c-typeck.c (build_function_call): Store converted arguments in a stack-allocated array instead of building a list. (convert_arguments): Store arguments in the array passed in as an argument, and return the actual number of arguments. * gcc/c-format.c: (check_function_format): Pass arguments in an array instead of a list. * gcc/c-common.c (check_function_nonnull): Likewise. (check_function_sentinel): Likewise. (check_function_arguments): Likewise. * gcc/c-common.h: Update declarations to reflect above changes. * gcc/cp/typeck.c (build_function_call): Store converted arguments in a stack-allocated array instead of building a list. (convert_arguments): Store arguments in the array passed in as an argument, and return the actual number of arguments. * gcc/cp/call.c (build_call): Delete, and replace with... (build_call_n, build_call_a): New. (build_op_delete_call): Rewrite to avoid constructing argument lists. (build_over_call): Store converted arguments in a stack-allocated array instead of building a list. (build_cxx_call): Pass arguments in an array instead of as a list. (build_java_interface_fn_ref): Rewrite to avoid constructing argument lists. * gcc/cp/tree.h: Update declarations to reflect above changes. * gcc/cp/method.c (use_thunk): Use a stack-allocated array to hold the arguments instead of a list. * gcc/cp/rtti.c (throw_bad_cast): Update call to cxx_call. (throw_bad_typeid): Likewise. (build_dynamic_cast_1): Likewise. * gcc/cp/init.c (build_builtin_delete_call): Use build_call_n. * gcc/cp/decl.c (expand_static_init): Likewise. * gcc/cp/except.c (cp_protect_cleanup_actions): Likewise. * gcc/cp/cp-gimplify.c (genericize_eh_spec_block): Likewise. (gimplify_must_not_throw_expr): Likewise. (cxx_omp_apply_fn): Use build_call_a. From-SVN: r122411 --- gcc/cp/method.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'gcc/cp/method.c') diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 7d5c4e8..4dff5b9 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -452,6 +452,8 @@ use_thunk (tree thunk_fndecl, bool emit_p) } else { + int i; + tree *argarray = (tree *) alloca (list_length (a) * sizeof (tree)); /* If this is a covariant thunk, or we don't have the necessary code for efficient thunks, generate a thunk function that just makes a call to the real function. Unfortunately, this @@ -475,11 +477,10 @@ use_thunk (tree thunk_fndecl, bool emit_p) fixed_offset, virtual_offset); /* Build up the call to the real function. */ - t = tree_cons (NULL_TREE, t, NULL_TREE); - for (a = TREE_CHAIN (a); a; a = TREE_CHAIN (a)) - t = tree_cons (NULL_TREE, a, t); - t = nreverse (t); - t = build_call (alias, t); + argarray[0] = t; + for (i = 1, a = TREE_CHAIN (a); a; a = TREE_CHAIN (a), i++) + argarray[i] = a; + t = build_call_a (alias, i, argarray); CALL_FROM_THUNK_P (t) = 1; if (VOID_TYPE_P (TREE_TYPE (t))) @@ -1191,4 +1192,25 @@ skip_artificial_parms_for (tree fn, tree list) return list; } +/* Given a FUNCTION_DECL FN and a chain LIST, return the number of + artificial parms in FN. */ + +int +num_artificial_parms_for (tree fn) +{ + int count = 0; + + if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)) + count++; + else + return 0; + + if (DECL_HAS_IN_CHARGE_PARM_P (fn)) + count++; + if (DECL_HAS_VTT_PARM_P (fn)) + count++; + return count; +} + + #include "gt-cp-method.h" -- cgit v1.1