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 defer_addressed_constants()


defer_addressed_constants() and the associated machinery are not used
anywhere.  There was a vestige of a use in the C front end, but a
little spelunking suggests that it hasn't been relevant since we
stopped using obstacks to store trees.

For clarity, this is a diff with -b; part of output_constant_def got
reindented by several levels.  I took the opportunity to squelch an
assignment nested in subclause four of a conditional.

Bootstrapped i686-linux.

zw

        * varasm.c (struct deferred_constant, defer_addressed_constants_flag)
        (defer_addressed_constants, output_deferred_addressed_constants): Kill. 
        (output_constant_def): Remove code predicated on
        defer_addressed_constants_flag.

        * output.h: Remove prototypes of deleted functions.
        * c-typeck.c (constructor_subconstants_deferred): Kill.
        (struct initializer_stack): Remove 'deferred' field.
        (start_init): Remove all references to the above.
        (finish_init): Likewise. Also remove never-executed call to
        output_deferred_addressed_constants.  Pull assignment to
        defstr out of if expression.

===================================================================
Index: c-typeck.c
--- c-typeck.c	18 Apr 2003 06:45:12 -0000	1.233
+++ c-typeck.c	20 Apr 2003 22:37:36 -0000
@@ -4931,9 +4931,6 @@ static int constructor_simple;
 /* 1 if this constructor is erroneous so far.  */
 static int constructor_erroneous;
 
-/* 1 if have called defer_addressed_constants.  */
-static int constructor_subconstants_deferred;
-
 /* Structure for managing pending initializer elements, organized as an
    AVL tree.  */
 
@@ -5051,7 +5048,6 @@ struct initializer_stack
   char top_level;
   char require_constant_value;
   char require_constant_elements;
-  char deferred;
 };
 
 struct initializer_stack *initializer_stack;
@@ -5082,14 +5078,12 @@ start_init (decl, asmspec_tree, top_leve
   p->spelling = spelling;
   p->spelling_base = spelling_base;
   p->spelling_size = spelling_size;
-  p->deferred = constructor_subconstants_deferred;
   p->top_level = constructor_top_level;
   p->next = initializer_stack;
   initializer_stack = p;
 
   constructor_decl = decl;
   constructor_asmspec = asmspec;
-  constructor_subconstants_deferred = 0;
   constructor_designated = 0;
   constructor_top_level = top_level;
 
@@ -5131,12 +5125,6 @@ finish_init ()
 {
   struct initializer_stack *p = initializer_stack;
 
-  /* Output subconstants (string constants, usually)
-     that were referenced within this initializer and saved up.
-     Must do this if and only if we called defer_addressed_constants.  */
-  if (constructor_subconstants_deferred)
-    output_deferred_addressed_constants ();
-
   /* Free the whole constructor stack of this initializer.  */
   while (constructor_stack)
     {
@@ -5159,7 +5147,6 @@ finish_init ()
   spelling = p->spelling;
   spelling_base = p->spelling_base;
   spelling_size = p->spelling_size;
-  constructor_subconstants_deferred = p->deferred;
   constructor_top_level = p->top_level;
   initializer_stack = p->next;
   free (p);
===================================================================
Index: output.h
--- output.h	20 Apr 2003 18:20:36 -0000	1.121
+++ output.h	20 Apr 2003 22:37:36 -0000
@@ -334,13 +334,6 @@ extern void assemble_real		PARAMS ((REAL
 						 unsigned));
 #endif
 
-/* Start deferring output of subconstants.  */
-extern void defer_addressed_constants	PARAMS ((void));
-
-/* Stop deferring output of subconstants,
-   and output now all those that have been deferred.  */
-extern void output_deferred_addressed_constants PARAMS ((void));
-
 /* Return the size of the constant pool.  */
 extern int get_pool_size		PARAMS ((void));
 
===================================================================
Index: varasm.c
--- varasm.c	20 Apr 2003 18:20:36 -0000	1.341
+++ varasm.c	20 Apr 2003 22:37:37 -0000
@@ -2465,54 +2465,6 @@ compare_constant (t1, t2)
   abort ();
 }
 
-/* Record a list of constant expressions that were passed to
-   output_constant_def but that could not be output right away.  */
-
-struct deferred_constant
-{
-  struct deferred_constant *next;
-  tree exp;
-  int reloc;
-  int labelno;
-};
-
-static struct deferred_constant *deferred_constants;
-
-/* Nonzero means defer output of addressed subconstants
-   (i.e., those for which output_constant_def is called.)  */
-static int defer_addressed_constants_flag;
-
-/* Start deferring output of subconstants.  */
-
-void
-defer_addressed_constants ()
-{
-  defer_addressed_constants_flag++;
-}
-
-/* Stop deferring output of subconstants,
-   and output now all those that have been deferred.  */
-
-void
-output_deferred_addressed_constants ()
-{
-  struct deferred_constant *p, *next;
-
-  defer_addressed_constants_flag--;
-
-  if (defer_addressed_constants_flag > 0)
-    return;
-
-  for (p = deferred_constants; p; p = next)
-    {
-      output_constant_def_contents (p->exp, p->reloc, p->labelno);
-      next = p->next;
-      free (p);
-    }
-
-  deferred_constants = 0;
-}
-
 /* Make a copy of the whole tree structure for a constant.  This
    handles the same types of nodes that compare_constant handles.  */
 
@@ -2586,7 +2538,7 @@ copy_constant (exp)
 
    If assembler code for such a constant has already been output,
    return an rtx to refer to it.
-   Otherwise, output such a constant in memory (or defer it for later)
+   Otherwise, output such a constant in memory
    and generate an rtx for it.
 
    If DEFER is nonzero, the output of string constants can be deferred
@@ -2680,9 +2632,7 @@ output_constant_def (exp, defer)
       desc->label = XSTR (XEXP (desc->rtl, 0), 0);
     }
 
-  if (found
-      && STRING_POOL_ADDRESS_P (XEXP (rtl, 0))
-      && (!defer || defer_addressed_constants_flag))
+  if (found && !defer && STRING_POOL_ADDRESS_P (XEXP (rtl, 0)))
     {
       defstr = (struct deferred_string **)
 	htab_find_slot_with_hash (const_str_htab, desc->label,
@@ -2699,34 +2649,18 @@ output_constant_def (exp, defer)
     }
 
   /* If this is the first time we've seen this particular constant,
-     output it (or defer its output for later).  */
-  if (! found)
+     output it.  Do no output if -fsyntax-only.  */
+  if (! found && ! flag_syntax_only)
     {
-      if (defer_addressed_constants_flag)
-	{
-	  struct deferred_constant *p
-	    = (struct deferred_constant *)
-	      xmalloc (sizeof (struct deferred_constant));
-
-	  p->exp = desc->value;
-	  p->reloc = reloc;
-	  p->labelno = labelno;
-	  p->next = deferred_constants;
-	  deferred_constants = p;
-	}
+      if (!defer || TREE_CODE (exp) != STRING_CST
+	  || flag_writable_strings)
+	output_constant_def_contents (exp, reloc, labelno);
       else
 	{
-	  /* Do no output if -fsyntax-only.  */
-	  if (! flag_syntax_only)
-	    {
-	      if (TREE_CODE (exp) != STRING_CST
-		  || !defer
-		  || flag_writable_strings
-		  || (defstr = (struct deferred_string **)
-			       htab_find_slot_with_hash (const_str_htab,
-							 desc->label,
-							 STRHASH (desc->label),
-							 INSERT)) == NULL)
+	  defstr = (struct deferred_string **)
+	    htab_find_slot_with_hash (const_str_htab, desc->label,
+				      STRHASH (desc->label), INSERT);
+	  if (!defstr)
 		output_constant_def_contents (exp, reloc, labelno);
 	      else
 		{
@@ -2740,7 +2674,6 @@ output_constant_def (exp, defer)
 		  p->labelno = labelno;
 		  *defstr = p;
 		  STRING_POOL_ADDRESS_P (XEXP (rtl, 0)) = 1;
-		}
 	    }
 	}
     }



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