Cleanup varasm.c

Neil Booth neil@daikokuya.demon.co.uk
Sun Jul 22 13:22:00 GMT 2001


Richard Henderson wrote:-

> Ok.

Thanks, Richard.  I've just noticed we can do even better, so I'm
restarting my bootstrap.  I consider the incremental change "obvious",
so I won't wait for approval.

We had, on consecutive lines,

  /* Record current section so we can restore it if dbxout.c clobbers it.  */
  saved_in_section = in_section;

  /* If the debugging output changed sections, reselect the section
     that's supposed to be selected.  */
  if (in_section != saved_in_section)
    variable_section (decl, reloc);

which is obviously now redundant, and further makes saved_in_section
an unused variable which I have also removed.  It's nice how
simplifications cascade.

Neil.

	* varasm.c: Don't inlcude dbxout.h, sdbout.h or xcoffout.h.
	(asm_out_file): Remove redundant declaration.
	(assemble_asm): Remove old #if 0 block.
	(assemble_variable): Remove end of function; debug output is
	now handled with global_decl.  Remove old #if 0 block.  Update.
	Remove saved_in_section and associated no-op code.
	* Makefile.in (varasm.o): Correct dependencies.

Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.181
diff -u -p -r1.181 varasm.c
--- varasm.c	2001/07/22 17:02:53	1.181
+++ varasm.c	2001/07/22 20:17:08
@@ -40,8 +40,6 @@ Boston, MA 02111-1307, USA.  */
 #include "output.h"
 #include "real.h"
 #include "toplev.h"
-#include "dbxout.h"
-#include "sdbout.h"
 #include "obstack.h"
 #include "hashtab.h"
 #include "c-pragma.h"
@@ -49,10 +47,6 @@ Boston, MA 02111-1307, USA.  */
 #include "tm_p.h"
 #include "debug.h"
 
-#ifdef XCOFF_DEBUGGING_INFO
-#include "xcoffout.h"
-#endif
-
 #ifndef TRAMPOLINE_ALIGNMENT
 #define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
 #endif
@@ -65,10 +59,6 @@ Boston, MA 02111-1307, USA.  */
 #define CHKR_PREFIX "_CHKR_"
 #define CHKR_PREFIX_SIZE (sizeof (CHKR_PREFIX) - 1)
 
-/* File in which assembler code is being written.  */
-
-extern FILE *asm_out_file;
-
 /* The (assembler) name of the first globally-visible object output.  */
 const char *first_global_object_name;
 const char *weak_global_object_name;
@@ -807,20 +797,6 @@ assemble_asm (string)
   fprintf (asm_out_file, "\t%s\n", TREE_STRING_POINTER (string));
 }
 
-#if 0 /* This should no longer be needed, because
-	 flag_gnu_linker should be 0 on these systems,
-	 which should prevent any output
-	 if ASM_OUTPUT_CONSTRUCTOR and ASM_OUTPUT_DESTRUCTOR are absent.  */
-#if !(defined(DBX_DEBUGGING_INFO) && !defined(FASCIST_ASSEMBLER))
-#ifndef ASM_OUTPUT_CONSTRUCTOR
-#define ASM_OUTPUT_CONSTRUCTOR(file, name)
-#endif
-#ifndef ASM_OUTPUT_DESTRUCTOR
-#define ASM_OUTPUT_DESTRUCTOR(file, name)
-#endif
-#endif
-#endif /* 0 */
-
 /* Record an element in the table of global destructors.
    How this is done depends on what sort of assembler and linker
    are in use.
@@ -1228,7 +1204,6 @@ assemble_variable (decl, top_level, at_e
   register const char *name;
   unsigned int align;
   int reloc = 0;
-  enum in_section saved_in_section;
 
   last_assemble_variable_decl = 0;
 
@@ -1291,7 +1266,7 @@ assemble_variable (decl, top_level, at_e
       && ! host_integerp (DECL_SIZE_UNIT (decl), 1))
     {
       error_with_decl (decl, "size of variable `%s' is too large");
-      goto finish;
+      return;
     }
 
   name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
@@ -1380,14 +1355,9 @@ assemble_variable (decl, top_level, at_e
            (decl, "requested alignment for %s is greater than implemented alignment of %d.",rounded);
 #endif
        
-#if 0 /* ??? We should either delete this or add a comment describing what
-	 it was intended to do and why we shouldn't delete it.  */
-      if (flag_shared_data)
-	data_section ();
-#endif
       asm_emit_uninitialised (decl, name, size, rounded);
 
-      goto finish;
+      return;
     }
 
   /* Handle initialized definitions.
@@ -1410,15 +1380,6 @@ assemble_variable (decl, top_level, at_e
 #endif
       ASM_GLOBALIZE_LABEL (asm_out_file, name);
     }
-#if 0
-  for (d = equivalents; d; d = TREE_CHAIN (d))
-    {
-      tree e = TREE_VALUE (d);
-      if (TREE_PUBLIC (e) && DECL_NAME (e))
-	ASM_GLOBALIZE_LABEL (asm_out_file,
-			     XSTR (XEXP (DECL_RTL (e), 0), 0));
-    }
-#endif
 
   /* Output any data that we will need to use the address of.  */
   if (DECL_INITIAL (decl) == error_mark_node)
@@ -1439,14 +1400,6 @@ assemble_variable (decl, top_level, at_e
   if (in_text_section ())
     DECL_IN_TEXT_SECTION (decl) = 1;
 
-  /* Record current section so we can restore it if dbxout.c clobbers it.  */
-  saved_in_section = in_section;
-
-  /* If the debugging output changed sections, reselect the section
-     that's supposed to be selected.  */
-  if (in_section != saved_in_section)
-    variable_section (decl, reloc);
-
   /* Output the alignment of this data.  */
   if (align > BITS_PER_UNIT)
     ASM_OUTPUT_ALIGN (asm_out_file,
@@ -1471,29 +1424,6 @@ assemble_variable (decl, top_level, at_e
 	/* Leave space for it.  */
 	assemble_zeros (tree_low_cst (DECL_SIZE_UNIT (decl), 1));
     }
-
- finish:
-#ifdef XCOFF_DEBUGGING_INFO
-  /* Unfortunately, the IBM assembler cannot handle stabx before the actual
-     declaration.  When something like ".stabx  "aa:S-2",aa,133,0" is emitted 
-     and `aa' hasn't been output yet, the assembler generates a stab entry with
-     a value of zero, in addition to creating an unnecessary external entry
-     for `aa'.  Hence, we must postpone dbxout_symbol to here at the end.  */
-
-  /* File-scope global variables are output here.  */
-  if (write_symbols == XCOFF_DEBUG && top_level)
-    {
-      saved_in_section = in_section;
-
-      dbxout_symbol (decl, 0);
-
-      if (in_section != saved_in_section)
-	variable_section (decl, reloc);
-    }
-#else
-  /* There must be a statement after a label.  */
-  ;
-#endif
 }
 
 /* Return 1 if type TYPE contains any pointers.  */
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.701
diff -u -p -r1.701 Makefile.in
--- Makefile.in	2001/07/19 21:17:07	1.701
+++ Makefile.in	2001/07/22 20:17:29
@@ -1361,8 +1361,8 @@ errors.o : errors.c $(GCONFIG_H) $(SYSTE
 	$(CC) -c $(ALL_CFLAGS) -DGENERATOR_FILE $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
 varasm.o : varasm.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \
-   function.h $(EXPR_H) hard-reg-set.h $(REGS_H) \
-   xcoffout.h output.h c-pragma.h toplev.h dbxout.h sdbout.h $(GGC_H) $(TM_P_H)
+   function.h $(EXPR_H) hard-reg-set.h $(REGS_H) $(OBSTACK_H) \
+   output.h c-pragma.h toplev.h debug.h $(GGC_H) $(TM_P_H) $(HASHTAB_H)
 function.o : function.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \
    function.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
    insn-config.h $(RECOG_H) output.h toplev.h except.h hash.h $(GGC_H) $(TM_P_H)



More information about the Gcc-patches mailing list