This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Remove immediate_size_expand


This variable controled emitting rtl during type layout.
In the modern world, this is *always* wrong.  We spent a
good deal of effort trying to prevent it.


r~


        * tree.h (immediate_size_expand): Delete.
        * stor-layout.c (immediate_size_expand): Delete.
        (variable_size): Don't look at it.
        * c-decl.c (push_parm_decl): Don't frob immediate_size_expand.
        (start_function): Likewise.
        * cfgexpand.c (construct_exit_block): Likewise.
        * function.c (init_function_start, expand_function_end): Likewise.
        * tree-optimize.c (tree_rest_of_compilation): Likewise.
cp/
        * decl.c (start_preparsed_function): Don't set immediate_size_expand.
        * method.c (use_thunk): Likewise.
fortran/
        * trans-decl.c (gfc_generate_function_code): Don't set
        immediate_size_expand.
        (gfc_generate_constructors): Likewise.

Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.521
diff -c -p -d -u -r1.521 c-decl.c
--- c-decl.c	30 Jun 2004 18:05:00 -0000	1.521
+++ c-decl.c	1 Jul 2004 00:30:28 -0000
@@ -3028,11 +3028,6 @@ push_parm_decl (tree parm)
 {
   tree decl;
 
-  /* Don't attempt to expand sizes while parsing this decl.
-     (We can get here with i_s_e 1 somehow from Objective-C.)  */
-  int save_immediate_size_expand = immediate_size_expand;
-  immediate_size_expand = 0;
-
   decl = grokdeclarator (TREE_VALUE (TREE_PURPOSE (parm)),
 			 TREE_PURPOSE (TREE_PURPOSE (parm)),
 			 PARM, 0, NULL);
@@ -3041,8 +3036,6 @@ push_parm_decl (tree parm)
   decl = pushdecl (decl);
 
   finish_decl (decl, NULL_TREE, NULL_TREE);
-
-  immediate_size_expand = save_immediate_size_expand;
 }
 
 /* Mark all the parameter declarations to date as forward decls.
@@ -5589,7 +5582,6 @@ start_function (tree declspecs, tree dec
 {
   tree decl1, old_decl;
   tree restype;
-  int old_immediate_size_expand = immediate_size_expand;
 
   current_function_returns_value = 0;  /* Assume, until we see it does.  */
   current_function_returns_null = 0;
@@ -5603,18 +5595,12 @@ start_function (tree declspecs, tree dec
      error message in c_finish_bc_stmt.  */
   c_break_label = c_cont_label = size_zero_node;
 
-  /* Don't expand any sizes in the return type of the function.  */
-  immediate_size_expand = 0;
-
   decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL);
 
   /* If the declarator is not suitable for a function definition,
      cause a syntax error.  */
   if (decl1 == 0)
-    {
-      immediate_size_expand = old_immediate_size_expand;
-      return 0;
-    }
+    return 0;
 
   decl_attributes (&decl1, attributes, 0);
 
@@ -5793,8 +5779,6 @@ start_function (tree declspecs, tree dec
   DECL_RESULT (current_function_decl)
     = build_decl (RESULT_DECL, NULL_TREE, restype);
 
-  immediate_size_expand = old_immediate_size_expand;
-
   start_fname_decls ();
 
   return 1;
@@ -6174,7 +6158,6 @@ store_parm_decls (void)
      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.  */
-  immediate_size_expand = 0;
   cfun->x_dont_save_pending_sizes_p = 1;
 }
 
Index: cfgexpand.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgexpand.c,v
retrieving revision 2.3
diff -c -p -d -u -r2.3 cfgexpand.c
--- cfgexpand.c	30 Jun 2004 18:17:48 -0000	2.3
+++ cfgexpand.c	1 Jul 2004 00:30:28 -0000
@@ -311,12 +311,6 @@ construct_exit_block (void)
   basic_block exit_block;
   edge e, e2, next;
 
-  /* We hard-wired immediate_size_expand to zero above.
-     expand_function_end will decrement this variable.  So, we set the
-     variable to one here, so that after the decrement it will remain
-     zero.  */
-  immediate_size_expand = 1;
-
   /* Make sure the locus is set to the end of the function, so that 
      epilogue line numbers and warnings are set properly.  */
 #ifdef USE_MAPPED_LOCATION
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.533
diff -c -p -d -u -r1.533 function.c
--- function.c	30 Jun 2004 23:58:17 -0000	1.533
+++ function.c	1 Jul 2004 00:30:28 -0000
@@ -6288,9 +6288,6 @@ init_function_start (tree subr)
 {
   prepare_function_start (subr);
 
-  /* Within function body, compute a type's size as soon it is laid out.  */
-  immediate_size_expand++;
-
   /* Prevent ever trying to delete the first instruction of a
      function.  Also tell final how to output a linenum before the
      function prologue.  Note linenums could be missing, e.g. when
@@ -6709,10 +6706,6 @@ expand_function_end (void)
   while (in_sequence_p ())
     end_sequence ();
 
-  /* Outside function body, can't compute type's actual size
-     until next function's body starts.  */
-  immediate_size_expand--;
-
   clear_pending_stack_adjust ();
   do_pending_stack_adjust ();
 
Index: stor-layout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stor-layout.c,v
retrieving revision 1.192
diff -c -p -d -u -r1.192 stor-layout.c
--- stor-layout.c	22 Jun 2004 03:06:40 -0000	1.192
+++ stor-layout.c	1 Jul 2004 00:30:28 -0000
@@ -73,11 +73,6 @@ extern void debug_rli (record_layout_inf
 
 static GTY(()) tree pending_sizes;
 
-/* Nonzero means cannot safely call expand_expr now,
-   so put variable sizes onto `pending_sizes' instead.  */
-
-int immediate_size_expand;
-
 /* Show that REFERENCE_TYPES are internal and should be Pmode.  Called only
    by front end.  */
 
@@ -154,7 +149,7 @@ variable_size (tree size)
   if (TREE_CODE (save) == SAVE_EXPR)
     SAVE_EXPR_PERSISTENT_P (save) = 1;
 
-  if (!immediate_size_expand && cfun && cfun->x_dont_save_pending_sizes_p)
+  if (cfun && cfun->x_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;
@@ -169,10 +164,7 @@ variable_size (tree size)
       return size_one_node;
     }
 
-  if (immediate_size_expand)
-    expand_expr (save, const0_rtx, VOIDmode, 0);
-  else
-    put_pending_size (save);
+  put_pending_size (save);
 
   return size;
 }
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 2.23
diff -c -p -d -u -r2.23 tree-optimize.c
--- tree-optimize.c	30 Jun 2004 21:28:59 -0000	2.23
+++ tree-optimize.c	1 Jul 2004 00:30:28 -0000
@@ -474,7 +474,6 @@ tree_rest_of_compilation (tree fndecl, b
      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.  */
-  immediate_size_expand = 0;
   cfun->x_dont_save_pending_sizes_p = 1;
 
   node = cgraph_node (fndecl);
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.534
diff -c -p -d -u -r1.534 tree.h
--- tree.h	30 Jun 2004 21:11:28 -0000	1.534
+++ tree.h	1 Jul 2004 00:30:28 -0000
@@ -3295,11 +3295,6 @@ extern int real_zerop (tree);
 
 extern int pedantic_lvalues;
 
-/* Nonzero means can safely call expand_expr now;
-   otherwise layout_type puts variable sizes onto `pending_sizes' instead.  */
-
-extern int immediate_size_expand;
-
 /* Points to the FUNCTION_DECL of the function whose body we are reading.  */
 
 extern GTY(()) tree current_function_decl;
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1231
diff -c -p -d -u -r1.1231 decl.c
--- cp/decl.c	30 Jun 2004 18:23:33 -0000	1.1231
+++ cp/decl.c	1 Jul 2004 00:30:29 -0000
@@ -9733,7 +9733,6 @@ start_preparsed_function (tree decl1, tr
      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.  */
-  immediate_size_expand = 0;
   cfun->x_dont_save_pending_sizes_p = 1;
 
   /* Start the statement-tree, start the tree now.  */
Index: cp/method.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/method.c,v
retrieving revision 1.290
diff -c -p -d -u -r1.290 method.c
--- cp/method.c	28 Jun 2004 10:34:42 -0000	1.290
+++ cp/method.c	1 Jul 2004 00:30:29 -0000
@@ -430,9 +430,6 @@ use_thunk (tree thunk_fndecl, bool emit_
       assemble_end_function (thunk_fndecl, fnname);
       current_function_decl = 0;
       cfun = 0;
-      /* Because init_function_start increments this, we must
-	 decrement it.  */
-      immediate_size_expand--;
       TREE_ASM_WRITTEN (thunk_fndecl) = 1;
     }
   else
Index: fortran/trans-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-decl.c,v
retrieving revision 1.15
diff -c -p -d -u -r1.15 trans-decl.c
--- fortran/trans-decl.c	29 Jun 2004 18:56:47 -0000	1.15
+++ fortran/trans-decl.c	1 Jul 2004 00:30:29 -0000
@@ -2035,7 +2035,6 @@ gfc_generate_function_code (gfc_namespac
      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.  */
-  immediate_size_expand = 0;
   cfun->x_dont_save_pending_sizes_p = 1;
 
   /* Will be created as needed.  */
@@ -2191,8 +2190,6 @@ gfc_generate_constructors (void)
 
   cfun->x_whole_function_mode_p = 1;
 
-  immediate_size_expand = 0;
-
   pushlevel (0);
 
   for (; gfc_static_ctors; gfc_static_ctors = TREE_CHAIN (gfc_static_ctors))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]