dwarf2out.c (dwarf2out_frame_debug): Add cast to silence warning.
authorJason Merrill <jason@gcc.gnu.org>
Sat, 4 Mar 2000 00:48:46 +0000 (19:48 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 4 Mar 2000 00:48:46 +0000 (19:48 -0500)
        * dwarf2out.c (dwarf2out_frame_debug): Add cast to silence warning.
        (dwarf2out_decl): Functions can now have DECL_IGNORED_P.
        (gen_decl_die): Likewise.
        * dwarfout.c (dwarfout_file_scope_decl): Likewise.
        (output_decl): Likewise.

        * varasm.c (make_function_rtl): If we change the name used in the
        rtl, update DECL_ASSEMBLER_NAME accordingly.
        (make_decl_rtl): Likewise.

        * toplev.c (rest_of_compilation): Tweak formatting.

        * toplev.c (rest_of_compilation): find_loop_tree_blocks before
        remove_unnecessary_notes.
        (debug_ignore_block): New fn.
        * toplev.h: Declare it.
        * emit-rtl.c (remove_unncessary_notes): Call it.
        * dwarf2out.c (dwarf2out_ignore_block): New fn.
        * dwarf2out.h: Declare it.
        * final.c (final_start_function): Don't call remove_unnecessary_notes
        if we did insn scheduling.

From-SVN: r32320

gcc/ChangeLog
gcc/dwarf2out.c
gcc/dwarfout.c
gcc/emit-rtl.c
gcc/final.c
gcc/toplev.c
gcc/toplev.h
gcc/varasm.c

index 68b870c..6cf650d 100644 (file)
@@ -1,3 +1,27 @@
+2000-03-03  Jason Merrill  <jason@casey.cygnus.com>
+
+       * dwarf2out.c (dwarf2out_frame_debug): Add cast to silence warning.
+       (dwarf2out_decl): Functions can now have DECL_IGNORED_P.
+       (gen_decl_die): Likewise.
+       * dwarfout.c (dwarfout_file_scope_decl): Likewise.
+       (output_decl): Likewise.
+
+       * varasm.c (make_function_rtl): If we change the name used in the
+       rtl, update DECL_ASSEMBLER_NAME accordingly.
+       (make_decl_rtl): Likewise.
+
+       * toplev.c (rest_of_compilation): Tweak formatting.
+
+       * toplev.c (rest_of_compilation): find_loop_tree_blocks before
+       remove_unnecessary_notes.
+       (debug_ignore_block): New fn.
+       * toplev.h: Declare it.
+       * emit-rtl.c (remove_unncessary_notes): Call it.
+       * dwarf2out.c (dwarf2out_ignore_block): New fn.
+       * dwarf2out.h: Declare it.
+       * final.c (final_start_function): Don't call remove_unnecessary_notes
+       if we did insn scheduling.
+
 2000-03-03  Zack Weinberg  <zack@wolery.cumb.org>
 
        * cppinit.c (cpp_handle_option): Set opts->pedantic directly.
@@ -10,7 +34,7 @@ Fri Mar  3 14:56:12 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
 2000-03-03  Jonathan Larmour  <jlarmour@cygnus.co.uk>
 
-       * config/mips/elf.h (CTOR_LISTS_DEFINED_EXTERNALLY): Added.
+       * mips/elf.h (CTOR_LISTS_DEFINED_EXTERNALLY): Added.
 
 2000-03-03  Richard Henderson  <rth@cygnus.com>
 
index d3b84cd..cb8b723 100644 (file)
@@ -1355,7 +1355,7 @@ dwarf2out_frame_debug (insn)
     {
       /* Set up state for generating call frame debug info.  */
       lookup_cfa (&cfa_reg, &cfa_offset);
-      if (cfa_reg != DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM))
+      if (cfa_reg != (unsigned long) DWARF_FRAME_REGNUM (STACK_POINTER_REGNUM))
        abort ();
       cfa_reg = STACK_POINTER_REGNUM;
       cfa_store_reg = cfa_reg;
@@ -9296,12 +9296,8 @@ gen_decl_die (decl, context_die)
   if (TREE_CODE (decl) == ERROR_MARK)
     return;
 
-  /* If this ..._DECL node is marked to be ignored, then ignore it. But don't 
-     ignore a function definition, since that would screw up our count of
-     blocks, and that in turn will completely screw up the labels we will 
-     reference in subsequent DW_AT_low_pc and DW_AT_high_pc attributes (for
-     subsequent blocks).  */
-  if (DECL_IGNORED_P (decl) && TREE_CODE (decl) != FUNCTION_DECL)
+  /* If this ..._DECL node is marked to be ignored, then ignore it.  */
+  if (DECL_IGNORED_P (decl))
     return;
 
   switch (TREE_CODE (decl))
@@ -9460,21 +9456,9 @@ dwarf2out_decl (decl)
   if (TREE_CODE (decl) == ERROR_MARK)
     return;
 
-  /* If this ..._DECL node is marked to be ignored, then ignore it.  We gotta 
-     hope that the node in question doesn't represent a function definition.
-     If it does, then totally ignoring it is bound to screw up our count of
-     blocks, and that in turn will completely screw up the labels we will 
-     reference in subsequent DW_AT_low_pc and DW_AT_high_pc attributes (for
-     subsequent blocks).  (It's too bad that BLOCK nodes don't carry their
-     own sequence numbers with them!) */
+  /* If this ..._DECL node is marked to be ignored, then ignore it.  */
   if (DECL_IGNORED_P (decl))
-    {
-      if (TREE_CODE (decl) == FUNCTION_DECL
-          && DECL_INITIAL (decl) != NULL)
-       abort ();
-
-      return;
-    }
+    return;
 
   switch (TREE_CODE (decl))
     {
@@ -9594,6 +9578,33 @@ dwarf2out_end_block (blocknum)
   ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, BLOCK_END_LABEL, blocknum);
 }
 
+/* We've decided not to emit any debugging information for BLOCK; make
+   sure that we don't end up with orphans as a result.  */
+
+void
+dwarf2out_ignore_block (block)
+     tree block;
+{
+  tree decl;
+  for (decl = BLOCK_VARS (block); decl; decl = TREE_CHAIN (decl))
+    {
+      dw_die_ref die;
+
+      if (TREE_CODE (decl) == FUNCTION_DECL)
+       die = lookup_decl_die (decl);
+      else if (TREE_CODE (decl) == TYPE_DECL && TYPE_DECL_IS_STUB (decl))
+       die = lookup_type_die (TREE_TYPE (decl));
+      else
+       die = NULL;
+
+      /* Just give them a dummy value for parent so dwarf2out_finish
+        doesn't blow up; we would use add_child_die if we really
+        wanted to add them to comp_unit_die's children.  */
+      if (die && die->die_parent == 0)
+       die->die_parent = comp_unit_die;
+    }
+}
+
 /* Output a marker (i.e. a label) at a point in the assembly code which
    corresponds to a given source level label.  */
 
index 153c684..d639eb9 100644 (file)
@@ -4787,13 +4787,9 @@ output_decl (decl, containing_scope)
              && (TREE_CODE (TYPE_FIELDS (TREE_TYPE (decl))) == ERROR_MARK))))
     return;
   
-  /* If this ..._DECL node is marked to be ignored, then ignore it.
-     But don't ignore a function definition, since that would screw
-     up our count of blocks, and that it turn will completely screw up the
-     labels we will reference in subsequent AT_low_pc and AT_high_pc
-     attributes (for subsequent blocks).  */
+  /* If this ..._DECL node is marked to be ignored, then ignore it.  */
 
-  if (DECL_IGNORED_P (decl) && TREE_CODE (decl) != FUNCTION_DECL)
+  if (DECL_IGNORED_P (decl))
     return;
 
   switch (TREE_CODE (decl))
@@ -5133,20 +5129,10 @@ dwarfout_file_scope_decl (decl, set_finalizing)
   if (TREE_CODE (decl) == ERROR_MARK)
     return;
 
-  /* If this ..._DECL node is marked to be ignored, then ignore it.  We
-     gotta hope that the node in question doesn't represent a function
-     definition.  If it does, then totally ignoring it is bound to screw
-     up our count of blocks, and that it turn will completely screw up the
-     labels we will reference in subsequent AT_low_pc and AT_high_pc
-     attributes (for subsequent blocks).  (It's too bad that BLOCK nodes
-     don't carry their own sequence numbers with them!)  */
+  /* If this ..._DECL node is marked to be ignored, then ignore it.  */
 
   if (DECL_IGNORED_P (decl))
-    {
-      if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl) != NULL)
-       abort ();
-      return;
-    }
+    return;
 
   switch (TREE_CODE (decl))
     {
index c6e5cb1..f43a181 100644 (file)
@@ -2710,6 +2710,8 @@ remove_unncessary_notes ()
                     nesting structure.  */
                  if (NOTE_BLOCK (prev) != NOTE_BLOCK (insn))
                    abort ();
+
+                 debug_ignore_block (NOTE_BLOCK (insn));
                  
                  remove_insn (prev);
                  remove_insn (insn);
index 948ecd3..d5a1a30 100644 (file)
@@ -1644,7 +1644,10 @@ final_start_function (first, file, optimize)
   if (write_symbols)
     {
       number_blocks (current_function_decl);
-      remove_unncessary_notes ();
+      /* Scheduling packs block notes together at the top of a basic block,
+        so we can't learn anything from them.  */
+      if (! flag_schedule_insns && ! flag_schedule_insns_after_reload)
+       remove_unncessary_notes ();
       /* We never actually put out begin/end notes for the top-level
         block in the function.  But, conceptually, that block is
         always needed.  */
index 209fd09..05b1577 100644 (file)
@@ -2845,14 +2845,15 @@ rest_of_compilation (decl)
      have been run to re-initialize it.  */
   cse_not_expected = ! optimize;
 
-  /* First, remove any notes we don't need.  That will make iterating
+  /* First, make sure that NOTE_BLOCK is set correctly for each
+     NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note.  */
+  find_loop_tree_blocks ();
+
+  /* Then remove any notes we don't need.  That will make iterating
      over the instruction sequence faster, and allow the garbage
      collector to reclaim the memory used by the notes.  */
   remove_unncessary_notes ();
 
-  /* We need to make sure that NOTE_BLOCK is set correctly
-     for each NOTE_INSN_BLOCK_BEG/NOTE_INSN_BLOCK_END note.  */
-  find_loop_tree_blocks ();
   /* In function-at-a-time mode, we do not attempt to keep the BLOCK
      tree in sensible shape.  So, we just recalculate it here.  */
   if (cfun->x_whole_function_mode_p)
@@ -2928,17 +2929,15 @@ rest_of_compilation (decl)
         for those functions that need to be output.  Also defer those
         functions that we are supposed to defer.  */
 
-      if (inlinable)
-       DECL_DEFER_OUTPUT (decl) = 1;
-
-      if (DECL_DEFER_OUTPUT (decl)
+      if (inlinable
          || (DECL_INLINE (decl)
              && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
                   && ! flag_keep_inline_functions)
                  || DECL_EXTERNAL (decl))))
-       {
-         DECL_DEFER_OUTPUT (decl) = 1;
+       DECL_DEFER_OUTPUT (decl) = 1;
 
+      if (DECL_DEFER_OUTPUT (decl))
+       {
          /* If -Wreturn-type, we have to do a bit of compilation.
             However, if we just fall through we will call
             save_for_inline_copying() which results in excessive
@@ -5160,3 +5159,17 @@ debug_undef (lineno, buffer)
     dwarf2out_undef (lineno, buffer);
 #endif /* DWARF2_DEBUGGING_INFO */
 }
+
+/* Tell the debugging backend that we've decided not to emit any
+   debugging information for BLOCK, so it can clean up after any local
+   classes or nested functions.  */
+
+void
+debug_ignore_block (block)
+     tree block;
+{
+#ifdef DWARF2_DEBUGGING_INFO
+  if (write_symbols == DWARF2_DEBUG)
+    dwarf2out_ignore_block (block);
+#endif
+}
index 74300b4..49990a8 100644 (file)
@@ -35,6 +35,7 @@ extern void debug_start_source_file   PARAMS ((char *));
 extern void debug_end_source_file      PARAMS ((unsigned));
 extern void debug_define               PARAMS ((unsigned, char *));
 extern void debug_undef                        PARAMS ((unsigned, char *));
+extern void debug_ignore_block         PARAMS ((union tree_node *));
 extern void fatal                      PARAMS ((const char *, ...))
   ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
 extern void fatal_io_error             PARAMS ((const char *))
index c84affc..751ce82 100644 (file)
@@ -553,6 +553,7 @@ make_function_rtl (decl)
 
   if (DECL_RTL (decl) == 0)
     {
+      DECL_ASSEMBLER_NAME (decl) = get_identifier (name);
       DECL_RTL (decl)
        = gen_rtx_MEM (DECL_MODE (decl),
                       gen_rtx_SYMBOL_REF (Pmode, name));
@@ -792,6 +793,7 @@ make_decl_rtl (decl, asmspec, top_level)
              name = new_name;
            }
 
+         DECL_ASSEMBLER_NAME (decl) = get_identifier (name);
          DECL_RTL (decl) = gen_rtx_MEM (DECL_MODE (decl),
                                         gen_rtx_SYMBOL_REF (Pmode, name));
          MEM_ALIAS_SET (DECL_RTL (decl)) = get_alias_set (decl);