diff options
author | Ian Lance Taylor <iant@google.com> | 2009-05-21 05:58:39 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2009-05-21 05:58:39 +0000 |
commit | c166b8981f366dfe1ec292221548b05e69c6c384 (patch) | |
tree | a25b2f396979fd0a56ba8a76180aba734398019a /gcc/c-parser.c | |
parent | 40449a90d7701eb70b5ccecb0f05290d442983e9 (diff) | |
download | gcc-c166b8981f366dfe1ec292221548b05e69c6c384.zip gcc-c166b8981f366dfe1ec292221548b05e69c6c384.tar.gz gcc-c166b8981f366dfe1ec292221548b05e69c6c384.tar.bz2 |
tree.c (build_tree_list_vec_stat): New function.
./: * tree.c (build_tree_list_vec_stat): New function.
(ctor_to_vec): New function.
(build_nt_call_vec): New function.
(build_call_array): Change args to be a const pointer.
(build_call_vec): New function.
* tree.h (build_nt_call_vec): Declare.
(build_tree_list_vec_stat): Declare.
(build_tree_list_vec): Define.
(build_call_array): Update declaration.
(build_call_vec): Declare.
(ctor_to_vec): Declare.
* c-common.c (tree_vector_cache): New static variable.
(make_tree_vector): New function.
(release_tree_vector): New function.
(make_tree_vector_single): New function.
(make_tree_vector_copy): New function.
* c-common.h (tree_vector_cache, make_tree_vector): Declare.
(make_tree_vector_single, make_tree_vector_copy): Declare.
* c-parser.c (cached_expr_list_1, cached_expr_list_2): Remove.
(c_parser_expr_list): Don't manage cache here, instead call
make_tree_vector.
(c_parser_release_expr_list): Remove static function.
(c_parser_vec_to_tree_list): Remove static function.
(c_parser_attributes): Call build_tree_list_vec instead of
c_parser_vec_to_tree_list. Call release_tree_vector instead of
c_parser_release_expr_list.
(c_parser_postfix_expression_after_primary): Likewise.
(c_parser_objc_keywordexpr): Likewise.
cp/:
* parser.c (cp_parser_postfix_expression): Change args to a vec.
Release it when done.
(tree_vector): Define typedef. Define VEC functions.
(cp_parser_parenthesized_expression_list): Change return type to
vec. Change all callers.
(cp_parser_new_expression): Change placement and initializer to
vecs. Release them when done.
(cp_parser_new_placement): Change return type to vec. Change all
callers.
(cp_parser_new_initializer): Likewise.
* typeck.c (build_function_call_vec): Just call
cp_build_function_call_vec.
(cp_build_function_call): Just build a vec and call
cp_build_function_call_vec.
(cp_build_function_call_vec): New function based on old
cp_build_function_call.
(convert_arguments): Remove nargs and argarray parameters. Change
values to a vec. Change caller.
(build_x_compound_expr_from_vec): New function.
(cp_build_modify_expr): Build vec to pass to
build_special_member_call.
* call.c (struct z_candidate): Add first_arg field. Change args
field to vec.
(convert_class_to_reference): Handle first argument separately.
(add_candidate): Add first_arg parameter. Change args parameter
to vec. Change all callers.
(add_function_candidate, add_conv_candidate): Likewise.
(add_template_candidate_real, add_template_candidate): Likewise.
(add_template_conv_candidate): Likewise.
(build_user_type_conversion_1): Handle first argument separately.
(resolve_args): Change return type and parameter type to vecs.
Change all callers.
(perform_overload_resolution): Change args parameter to vec.
Change all callers.
(build_new_function_call, build_operator_new_call): Likewise.
(add_candidates): Likewise.
(build_op_call): New globally visible function, built from and
replacing static function build_object_call.
(build_new_op): Don't handle CALL_EXPR. Build vec, not tree_list,
of arguments.
(build_op_delete_call): Build vec to pass to
cp_build_function_call_vec.
(build_temp): Build vec to pass to build_special_member_call.
(convert_like_real): Likewise.
(perform_direct_initialization_if_possible): Likewise.
(build_over_call): Handle first_arg field. Use build_call_array
rather than build_call_list.
(build_special_member_call): Change args parameter to vec. Change
all callers.
(build_new_method_call): Likewise.
* init.c (expand_default_init): Change parms to vec.
(build_raw_new_expr): Change placement and init to vecs. Change
all callers.
(build_new_1, build_new): Likewise.
* class.c (resolve_address_of_overloaded_function): Build array to
pass to fn_type_unification.
* pt.c (tsubst_copy_and_build): For NEW_EXPR build vecs to pass to
build_new. For CALL_EXPR create a vec rather than a tree_list;
expand a pack if necessary.
(fn_type_unification): Change args parameter to const tree *. Add
nargs parameter. Change all callers.
(type_unification_real): Likewise.
(unify): Build array to pass to type_unification_real.
(get_bindings): Build array to pass to fn_type_unification.
(any_type_dependent_arguments_p): Change args parameter to a vec.
Change all callers.
(make_args_non_dependent): Renamed from build_non_dependent_args.
Change return type to void. Change parameter type to vec. Change
all callers.
(do_auto_deduction): Pass an array to type_unification_real.
* semantics.c (perform_koenig_lookup): Change args to vec. Change
all callers.
(finish_call_expr): Change args to vec. Change all callers. Call
build_op_call instead of passing CALL_EXPR to build_new_op.
(cxx_omp_create_clause_info): Allocate vec to pass to
build_special_member_call.
* decl2.c (build_offset_ref_call_from_tree): Change args parameter
to vec. Change all callers.
* name-lookup.c (lookup_function_nonclass): Likewise.
(struct arg_lookup): Change args to vec.
(arg_assoc_namespace): Handle args as a vec.
(arg_assoc_args_vec): New static function.
(lookup_arg_dependent): Change args parameter to vec. Change all
callers.
* method.c (do_build_assign_ref): Allocate vec to pass to
build_special_member_call.
* except.c (build_throw): Likewise.
* typeck2.c (build_functional_cast): Likewise.
* cvt.c (ocp_convert): Likewise.
* tree.c (build_min_non_dep_call_vec): Change last parameter to
vec. Change all callers.
* cp-tree.h: Update declarations.
* name-lookup.h: Update declarations.
objc/:
* objc-act.c (objc_generate_cxx_ctor_or_dtor): Pass NULL rather
than NULL_TREE to build_special_member_call.
From-SVN: r147759
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r-- | gcc/c-parser.c | 80 |
1 files changed, 10 insertions, 70 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c index beda817..0320fee 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -921,8 +921,6 @@ static struct c_expr c_parser_expression (c_parser *); static struct c_expr c_parser_expression_conv (c_parser *); static VEC(tree,gc) *c_parser_expr_list (c_parser *, bool, bool, VEC(tree,gc) **); -static void c_parser_release_expr_list (VEC(tree,gc) *); -static tree c_parser_vec_to_tree_list (VEC(tree,gc) *); static void c_parser_omp_construct (c_parser *); static void c_parser_omp_threadprivate (c_parser *); static void c_parser_omp_barrier (c_parser *); @@ -2889,9 +2887,9 @@ c_parser_attributes (c_parser *parser) tree tree_list; c_parser_consume_token (parser); expr_list = c_parser_expr_list (parser, false, true, NULL); - tree_list = c_parser_vec_to_tree_list (expr_list); + tree_list = build_tree_list_vec (expr_list); attr_args = tree_cons (NULL_TREE, arg1, tree_list); - c_parser_release_expr_list (expr_list); + release_tree_vector (expr_list); } } else @@ -2901,8 +2899,8 @@ c_parser_attributes (c_parser *parser) else { expr_list = c_parser_expr_list (parser, false, true, NULL); - attr_args = c_parser_vec_to_tree_list (expr_list); - c_parser_release_expr_list (expr_list); + attr_args = build_tree_list_vec (expr_list); + release_tree_vector (expr_list); } } attr = build_tree_list (attr_name, attr_args); @@ -5719,8 +5717,8 @@ c_parser_postfix_expression_after_primary (c_parser *parser, expr.original_type = NULL; if (exprlist != NULL) { - c_parser_release_expr_list (exprlist); - c_parser_release_expr_list (origtypes); + release_tree_vector (exprlist); + release_tree_vector (origtypes); } break; case CPP_DOT: @@ -5853,10 +5851,6 @@ c_parser_expression_conv (c_parser *parser) nonempty-expr-list , assignment-expression */ -/* We cache two vectors, to save most allocation and deallocation. */ -static GTY((deletable)) VEC(tree,gc) *cached_expr_list_1; -static GTY((deletable)) VEC(tree,gc) *cached_expr_list_2; - static VEC(tree,gc) * c_parser_expr_list (c_parser *parser, bool convert_p, bool fold_p, VEC(tree,gc) **p_orig_types) @@ -5865,34 +5859,11 @@ c_parser_expr_list (c_parser *parser, bool convert_p, bool fold_p, VEC(tree,gc) *orig_types; struct c_expr expr; - if (cached_expr_list_1 != NULL) - { - ret = cached_expr_list_1; - cached_expr_list_1 = NULL; - VEC_truncate (tree, ret, 0); - } - else if (cached_expr_list_2 != NULL) - { - ret = cached_expr_list_2; - cached_expr_list_2 = NULL; - VEC_truncate (tree, ret, 0); - } - else - ret = VEC_alloc (tree, gc, 16); - + ret = make_tree_vector (); if (p_orig_types == NULL) orig_types = NULL; else - { - if (cached_expr_list_2 != NULL) - { - orig_types = cached_expr_list_2; - cached_expr_list_2 = NULL; - VEC_truncate (tree, orig_types, 0); - } - else - orig_types = VEC_alloc (tree, gc, 16); - } + orig_types = make_tree_vector (); expr = c_parser_expr_no_commas (parser, NULL); if (convert_p) @@ -5918,37 +5889,6 @@ c_parser_expr_list (c_parser *parser, bool convert_p, bool fold_p, *p_orig_types = orig_types; return ret; } - -/* Release a vector returned by c_parser_expr_list. */ - -static void -c_parser_release_expr_list (VEC(tree,gc) *vec) -{ - if (cached_expr_list_1 == NULL) - cached_expr_list_1 = vec; - else if (cached_expr_list_2 == NULL) - cached_expr_list_2 = vec; - else - VEC_free (tree, gc, vec); -} - -/* Convert a vector, as returned by c_parser_expr_list, to a - tree_list. */ - -static tree -c_parser_vec_to_tree_list (VEC(tree,gc) *vec) -{ - tree ret = NULL_TREE; - tree *pp = &ret; - unsigned int i; - tree t; - for (i = 0; VEC_iterate (tree, vec, i, t); ++i) - { - *pp = build_tree_list (NULL, t); - pp = &TREE_CHAIN (*pp); - } - return ret; -} /* Parse Objective-C-specific constructs. */ @@ -6830,9 +6770,9 @@ c_parser_objc_keywordexpr (c_parser *parser) else { /* We have a comma expression, we will collapse later. */ - ret = c_parser_vec_to_tree_list (expr_list); + ret = build_tree_list_vec (expr_list); } - c_parser_release_expr_list (expr_list); + release_tree_vector (expr_list); return ret; } |