diff mbox

Remove support for pending sizes

Message ID 201105050938.47035.ebotcazou@adacore.com
State New
Headers show

Commit Message

Eric Botcazou May 5, 2011, 7:38 a.m. UTC
Hi,

this entirely removes the support for pending sizes from the compiler.  The 
prerequisite is Joseph's patch from yesterday.

Bootstrapped/regtested on x86_64-suse-linux, OK for the mainline?


2011-05-05  Eric Botcazou  <ebotcazou@adacore.com>

	* 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.

Comments

Bernd Schmidt May 5, 2011, 9:21 a.m. UTC | #1
On 05/05/2011 09:38 AM, Eric Botcazou wrote:
> Hi,
> 
> this entirely removes the support for pending sizes from the compiler.  The 
> prerequisite is Joseph's patch from yesterday.
> 
> Bootstrapped/regtested on x86_64-suse-linux, OK for the mainline?

OK.


Bernd
diff mbox

Patch

Index: tree.h
===================================================================
--- tree.h	(revision 173386)
+++ tree.h	(working copy)
@@ -4638,9 +4638,6 @@  extern tree size_diffop_loc (location_t,
 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.  */
Index: omp-low.c
===================================================================
--- omp-low.c	(revision 173386)
+++ omp-low.c	(working copy)
@@ -6230,7 +6230,6 @@  create_task_copyfn (gimple task_stmt, om
   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.  */
Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 173386)
+++ cp/decl.c	(working copy)
@@ -12494,12 +12494,6 @@  start_preparsed_function (tree decl1, tr
   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 ();
 
Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c	(revision 173386)
+++ lto-streamer-out.c	(working copy)
@@ -1929,7 +1929,6 @@  output_function (struct cgraph_node *nod
   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);
Index: ada/gcc-interface/utils.c
===================================================================
--- ada/gcc-interface/utils.c	(revision 173386)
+++ ada/gcc-interface/utils.c	(working copy)
@@ -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;
 
Index: lto-streamer-in.c
===================================================================
--- lto-streamer-in.c	(revision 173386)
+++ lto-streamer-in.c	(working copy)
@@ -1251,7 +1251,6 @@  input_function (tree fn_decl, struct dat
   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);
Index: c-decl.c
===================================================================
--- c-decl.c	(revision 173386)
+++ c-decl.c	(working copy)
@@ -8199,12 +8171,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;
 }
 
 
Index: fortran/trans-decl.c
===================================================================
--- fortran/trans-decl.c	(revision 173386)
+++ fortran/trans-decl.c	(working copy)
@@ -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);
 }
Index: function.h
===================================================================
--- function.h	(revision 173386)
+++ function.h	(working copy)
@@ -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;
 
Index: stor-layout.c
===================================================================
--- stor-layout.c	(revision 173386)
+++ stor-layout.c	(working copy)
@@ -65,10 +65,6 @@  static int excess_unit_span (HOST_WIDE_I
 #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.  */
Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 173386)
+++ tree-inline.c	(working copy)
@@ -2080,7 +2080,6 @@  initialize_cfun (tree new_fndecl, tree c
   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;
Index: tree-optimize.c
===================================================================
--- tree-optimize.c	(revision 173386)
+++ tree-optimize.c	(working copy)
@@ -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 (&reg_obstack); /* FIXME, only at RTL generation*/