From 907a08d9b1d7516357bee7ab19e3c4f1673d467a Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 5 May 2011 11:49:05 +0000 Subject: [PATCH] tree.h (get_pending_sizes): Remove prototype. * tree.h (get_pending_sizes): Remove prototype. (put_pending_size): Likewise. (put_pending_sizes): Likewise. * stor-layout.c (pending_sizes): Delete. (get_pending_sizes): Likewise. (put_pending_size): Likewise. (put_pending_sizes): Likewise. (variable_size): Do not call put_pending_size and tidy up. * function.h (struct function): Remove dont_save_pending_sizes_p. * lto-streamer-in.c (input_function): Do not stream it. * lto-streamer-out.c (output_function): Likewise. * tree-inline.c (initialize_cfun): Do not copy it. * c-decl.c (store_parm_decls): Do not set it. * omp-low.c (create_task_copyfn): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. cp/ * decl.c (start_preparsed_function): Likewise. fortran/ * trans-decl.c (trans_function_start): Likewise. ada/ * gcc-interface/utils.c (begin_subprog_body): Do not call get_pending_sizes. (end_subprog_body): Likewise. From-SVN: r173424 --- gcc/ChangeLog | 18 +++++++++++ gcc/ada/ChangeLog | 6 ++++ gcc/ada/gcc-interface/utils.c | 9 ------ gcc/c-decl.c | 6 ---- gcc/cp/ChangeLog | 5 +++ gcc/cp/decl.c | 6 ---- gcc/fortran/ChangeLog | 5 +++ gcc/fortran/trans-decl.c | 6 ---- gcc/function.h | 9 ------ gcc/lto-streamer-in.c | 1 - gcc/lto-streamer-out.c | 1 - gcc/omp-low.c | 1 - gcc/stor-layout.c | 61 +---------------------------------- gcc/tree-inline.c | 1 - gcc/tree-optimize.c | 6 ---- gcc/tree.h | 3 -- 16 files changed, 35 insertions(+), 109 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 838f6b04e74..88b6008244f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2011-05-05 Eric Botcazou + + * tree.h (get_pending_sizes): Remove prototype. + (put_pending_size): Likewise. + (put_pending_sizes): Likewise. + * stor-layout.c (pending_sizes): Delete. + (get_pending_sizes): Likewise. + (put_pending_size): Likewise. + (put_pending_sizes): Likewise. + (variable_size): Do not call put_pending_size and tidy up. + * function.h (struct function): Remove dont_save_pending_sizes_p. + * lto-streamer-in.c (input_function): Do not stream it. + * lto-streamer-out.c (output_function): Likewise. + * tree-inline.c (initialize_cfun): Do not copy it. + * c-decl.c (store_parm_decls): Do not set it. + * omp-low.c (create_task_copyfn): Likewise. + * tree-optimize.c (tree_rest_of_compilation): Likewise. + 2011-05-05 Uros Bizjak * config/i386/i386.md (*movdf_internal_rex64): Simplify nested "if" diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5f234a2fb54..315472e8081 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2011-05-05 Eric Botcazou + + * gcc-interface/utils.c (begin_subprog_body): Do not call + get_pending_sizes. + (end_subprog_body): Likewise. + 2011-05-04 Richard Guenther * gcc-interface/trans.c (gnat_to_gnu): Remove zero notrunc argument to diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 2e81c185bf2..57a62ab9bb6 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -1954,11 +1954,6 @@ begin_subprog_body (tree subprog_decl) DECL_CONTEXT (param_decl) = subprog_decl; make_decl_rtl (subprog_decl); - - /* We handle pending sizes via the elaboration of types, so we don't need to - save them. This causes them to be marked as part of the outer function - and then discarded. */ - get_pending_sizes (); } /* Finish the definition of the current subprogram BODY and finalize it. */ @@ -1973,10 +1968,6 @@ end_subprog_body (tree body) DECL_INITIAL (fndecl) = current_binding_level->block; gnat_poplevel (); - /* We handle pending sizes via the elaboration of types, so we don't - need to save them. */ - get_pending_sizes (); - /* Mark the RESULT_DECL as being in this subprogram. */ DECL_CONTEXT (DECL_RESULT (fndecl)) = fndecl; diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 6bc09489214..cea26052a9e 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -8173,12 +8173,6 @@ store_parm_decls (void) other pending sizes would be handled by gimplify_parameters. */ if (arg_info->pending_sizes) add_stmt (arg_info->pending_sizes); - - /* Even though we're inside a function body, we still don't want to - call expand_expr to calculate the size of a variable-sized array. - We haven't necessarily assigned RTL to all variables yet, so it's - not safe to try to expand expressions involving them. */ - cfun->dont_save_pending_sizes_p = 1; } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7586ea61b39..856e8c762b4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-05-05 Eric Botcazou + + * decl.c (start_preparsed_function): Do not set + dont_save_pending_sizes_p. + 2011-05-05 Joseph Myers * parser.c (cp_parser_objc_method_definition_list): Update call to diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e489caefd0b..c5184e06773 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12494,12 +12494,6 @@ start_preparsed_function (tree decl1, tree attrs, int flags) current_stmt_tree ()->stmts_are_full_exprs_p = 1; current_binding_level = bl; - /* Even though we're inside a function body, we still don't want to - call expand_expr to calculate the size of a variable-sized array. - We haven't necessarily assigned RTL to all variables yet, so it's - not safe to try to expand expressions involving them. */ - cfun->dont_save_pending_sizes_p = 1; - /* Start the statement-tree, start the tree now. */ DECL_SAVED_TREE (decl1) = push_stmt_list (); diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 382f1aae156..00774f4f779 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2011-05-05 Eric Botcazou + + * trans-decl.c (trans_function_start): Do not set + dont_save_pending_sizes_p. + 2011-05-04 Nathan Froyd * trans.h (gfc_chainon_list): Delete. diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index e597eb3179c..2452927628e 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -2116,12 +2116,6 @@ trans_function_start (gfc_symbol * sym) init_function_start (fndecl); - /* Even though we're inside a function body, we still don't want to - call expand_expr to calculate the size of a variable-sized array. - We haven't necessarily assigned RTL to all variables yet, so it's - not safe to try to expand expressions involving them. */ - cfun->dont_save_pending_sizes_p = 1; - /* function.c requires a push at the start of the function. */ pushlevel (0); } diff --git a/gcc/function.h b/gcc/function.h index fa449585a42..0e8bc74aaa5 100644 --- a/gcc/function.h +++ b/gcc/function.h @@ -597,15 +597,6 @@ struct GTY(()) function { /* Nonzero if current function uses stdarg.h or equivalent. */ unsigned int stdarg : 1; - /* Nonzero if the back-end should not keep track of expressions that - determine the size of variable-sized objects. Normally, such - expressions are saved away, and then expanded when the next - function is started. For example, if a parameter has a - variable-sized type, then the size of the parameter is computed - when the function body is entered. However, some front-ends do - not desire this behavior. */ - unsigned int dont_save_pending_sizes_p : 1; - unsigned int after_inlining : 1; unsigned int always_inline_functions_inlined : 1; diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c index 63fa5c0292b..4070299f46c 100644 --- a/gcc/lto-streamer-in.c +++ b/gcc/lto-streamer-in.c @@ -1251,7 +1251,6 @@ input_function (tree fn_decl, struct data_in *data_in, fn->can_throw_non_call_exceptions = bp_unpack_value (&bp, 1); fn->always_inline_functions_inlined = bp_unpack_value (&bp, 1); fn->after_inlining = bp_unpack_value (&bp, 1); - fn->dont_save_pending_sizes_p = bp_unpack_value (&bp, 1); fn->stdarg = bp_unpack_value (&bp, 1); fn->has_nonlocal_label = bp_unpack_value (&bp, 1); fn->calls_alloca = bp_unpack_value (&bp, 1); diff --git a/gcc/lto-streamer-out.c b/gcc/lto-streamer-out.c index 61ca69a1a0a..858bbf07462 100644 --- a/gcc/lto-streamer-out.c +++ b/gcc/lto-streamer-out.c @@ -1929,7 +1929,6 @@ output_function (struct cgraph_node *node) bp_pack_value (&bp, fn->can_throw_non_call_exceptions, 1); bp_pack_value (&bp, fn->always_inline_functions_inlined, 1); bp_pack_value (&bp, fn->after_inlining, 1); - bp_pack_value (&bp, fn->dont_save_pending_sizes_p, 1); bp_pack_value (&bp, fn->stdarg, 1); bp_pack_value (&bp, fn->has_nonlocal_label, 1); bp_pack_value (&bp, fn->calls_alloca, 1); diff --git a/gcc/omp-low.c b/gcc/omp-low.c index bc7bf4a15e1..fc2cff85488 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -6230,7 +6230,6 @@ create_task_copyfn (gimple task_stmt, omp_context *ctx) child_fn = gimple_omp_task_copy_fn (task_stmt); child_cfun = DECL_STRUCT_FUNCTION (child_fn); gcc_assert (child_cfun->cfg == NULL); - child_cfun->dont_save_pending_sizes_p = 1; DECL_SAVED_TREE (child_fn) = alloc_stmt_list (); /* Reset DECL_CONTEXT on function arguments. */ diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 88c090b4681..9ad0d0ae2f3 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -65,10 +65,6 @@ static int excess_unit_span (HOST_WIDE_INT, HOST_WIDE_INT, HOST_WIDE_INT, #endif extern void debug_rli (record_layout_info); -/* SAVE_EXPRs for sizes of types and decls, waiting to be expanded. */ - -static GTY(()) VEC(tree,gc) *pending_sizes; - /* Show that REFERENCE_TYPES are internal and should use address_mode. Called only by front end. */ @@ -78,48 +74,12 @@ internal_reference_types (void) reference_types_internal = 1; } -/* Get a VEC of all the objects put on the pending sizes list. */ - -VEC(tree,gc) * -get_pending_sizes (void) -{ - VEC(tree,gc) *chain = pending_sizes; - - pending_sizes = 0; - return chain; -} - -/* Add EXPR to the pending sizes list. */ - -void -put_pending_size (tree expr) -{ - /* Strip any simple arithmetic from EXPR to see if it has an underlying - SAVE_EXPR. */ - expr = skip_simple_arithmetic (expr); - - if (TREE_CODE (expr) == SAVE_EXPR) - VEC_safe_push (tree, gc, pending_sizes, expr); -} - -/* Put a chain of objects into the pending sizes list, which must be - empty. */ - -void -put_pending_sizes (VEC(tree,gc) *chain) -{ - gcc_assert (!pending_sizes); - pending_sizes = chain; -} - /* Given a size SIZE that may not be a constant, return a SAVE_EXPR to serve as the actual size-expression for a type or decl. */ tree variable_size (tree size) { - tree save; - /* Obviously. */ if (TREE_CONSTANT (size)) return size; @@ -135,26 +95,7 @@ variable_size (tree size) if (lang_hooks.decls.global_bindings_p () < 0) return size; - size = save_expr (size); - - /* If an array with a variable number of elements is declared, and - the elements require destruction, we will emit a cleanup for the - array. That cleanup is run both on normal exit from the block - and in the exception-handler for the block. Normally, when code - is used in both ordinary code and in an exception handler it is - `unsaved', i.e., all SAVE_EXPRs are recalculated. However, we do - not wish to do that here; the array-size is the same in both - places. */ - save = skip_simple_arithmetic (size); - - if (cfun && cfun->dont_save_pending_sizes_p) - /* The front-end doesn't want us to keep a list of the expressions - that determine sizes for variable size objects. Trust it. */ - return size; - - put_pending_size (save); - - return size; + return save_expr (size); } /* An array of functions used for self-referential size computation. */ diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 37776753ca3..49488d4158b 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -2080,7 +2080,6 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count) cfun->va_list_fpr_size = src_cfun->va_list_fpr_size; cfun->has_nonlocal_label = src_cfun->has_nonlocal_label; cfun->stdarg = src_cfun->stdarg; - cfun->dont_save_pending_sizes_p = src_cfun->dont_save_pending_sizes_p; cfun->after_inlining = src_cfun->after_inlining; cfun->can_throw_non_call_exceptions = src_cfun->can_throw_non_call_exceptions; diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index e277277e7d5..c46cf6c5458 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -403,12 +403,6 @@ tree_rest_of_compilation (tree fndecl) input_location = DECL_SOURCE_LOCATION (fndecl); init_function_start (fndecl); - /* Even though we're inside a function body, we still don't want to - call expand_expr to calculate the size of a variable-sized array. - We haven't necessarily assigned RTL to all variables yet, so it's - not safe to try to expand expressions involving them. */ - cfun->dont_save_pending_sizes_p = 1; - gimple_register_cfg_hooks (); bitmap_obstack_initialize (®_obstack); /* FIXME, only at RTL generation*/ diff --git a/gcc/tree.h b/gcc/tree.h index 5034b58545a..ef427606cde 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -4638,9 +4638,6 @@ extern tree size_diffop_loc (location_t, tree, tree); extern tree round_up_loc (location_t, tree, int); #define round_down(T,N) round_down_loc (UNKNOWN_LOCATION, T, N) extern tree round_down_loc (location_t, tree, int); -extern VEC(tree,gc) *get_pending_sizes (void); -extern void put_pending_size (tree); -extern void put_pending_sizes (VEC(tree,gc) *); extern void finalize_size_functions (void); /* Type for sizes of data-type. */ -- 2.30.2