OSDN Git Service

* config/s390/s390.md ("divmodtidi3"): Use canonical RTL.
[pf3gnuchains/gcc-fork.git] / gcc / sdbout.c
index 3d62047..ed6b468 100644 (file)
@@ -48,6 +48,7 @@ AT&T C compiler.  From the example below I would conclude the following:
 #include "debug.h"
 #include "tree.h"
 #include "ggc.h"
+#include "varray.h"
 
 static GTY(()) tree anonymous_types;
 
@@ -59,6 +60,10 @@ static GTY(()) int sdbout_source_line_counter;
 
 static GTY(()) int unnamed_struct_number;
 
+/* Declarations whose debug info was deferred till end of compilation.  */
+
+static GTY(()) varray_type deferred_global_decls;
+
 #ifdef SDB_DEBUGGING_INFO
 
 #include "rtl.h"
@@ -307,34 +312,37 @@ static struct sdb_file *current_file;
 /* The debug hooks structure.  */
 const struct gcc_debug_hooks sdb_debug_hooks =
 {
-  sdbout_init,                 /* init */
-  sdbout_finish,               /* finish */
-  debug_nothing_int_charstar,  /* define */
-  debug_nothing_int_charstar,  /* undef */
-  sdbout_start_source_file,    /* start_source_file */
-  sdbout_end_source_file,      /* end_source_file */
-  sdbout_begin_block,          /* begin_block */
-  sdbout_end_block,            /* end_block */
-  debug_true_tree,             /* ignore_block */
-  sdbout_source_line,          /* source_line */
+  sdbout_init,                          /* init */
+  sdbout_finish,                        /* finish */
+  debug_nothing_int_charstar,           /* define */
+  debug_nothing_int_charstar,           /* undef */
+  sdbout_start_source_file,             /* start_source_file */
+  sdbout_end_source_file,               /* end_source_file */
+  sdbout_begin_block,                   /* begin_block */
+  sdbout_end_block,                     /* end_block */
+  debug_true_tree,                      /* ignore_block */
+  sdbout_source_line,                   /* source_line */
 #ifdef MIPS_DEBUGGING_INFO
   /* Defer on MIPS systems so that parameter descriptions follow
      function entry.  */
-  debug_nothing_int_charstar,  /* begin_prologue */
-  sdbout_end_prologue,         /* end_prologue */
+  debug_nothing_int_charstar,           /* begin_prologue */
+  sdbout_end_prologue,                  /* end_prologue */
 #else
-  sdbout_begin_prologue,       /* begin_prologue */
-  debug_nothing_int_charstar,  /* end_prologue */
+  sdbout_begin_prologue,                /* begin_prologue */
+  debug_nothing_int_charstar,           /* end_prologue */
 #endif
-  sdbout_end_epilogue,         /* end_epilogue */
-  sdbout_begin_function,       /* begin_function */
-  sdbout_end_function,         /* end_function */
-  debug_nothing_tree,          /* function_decl */
-  sdbout_global_decl,          /* global_decl */
-  debug_nothing_tree,          /* deferred_inline_function */
-  debug_nothing_tree,          /* outlining_inline_function */
-  sdbout_label,                        /* label */
-  debug_nothing_int            /* handle_pch */
+  sdbout_end_epilogue,                  /* end_epilogue */
+  sdbout_begin_function,                /* begin_function */
+  sdbout_end_function,                  /* end_function */
+  debug_nothing_tree,                   /* function_decl */
+  sdbout_global_decl,                   /* global_decl */
+  sdbout_symbol,                        /* type_decl */
+  debug_nothing_tree_tree,               /* imported_module_or_decl */
+  debug_nothing_tree,                   /* deferred_inline_function */
+  debug_nothing_tree,                   /* outlining_inline_function */
+  sdbout_label,                                 /* label */
+  debug_nothing_int,                    /* handle_pch */
+  debug_nothing_rtx                     /* var_location */
 };
 
 /* Return a unique string to name an anonymous type.  */
@@ -1436,6 +1444,8 @@ sdbout_global_decl (tree decl)
         sdbout_finish ().  */
       if (!DECL_INITIAL (decl) || !TREE_PUBLIC (decl))
        sdbout_symbol (decl, 0);
+      else
+       VARRAY_PUSH_TREE (deferred_global_decls, decl);
 
       /* Output COFF information for non-global file-scope initialized
         variables.  */
@@ -1450,29 +1460,12 @@ sdbout_global_decl (tree decl)
 static void
 sdbout_finish (const char *main_filename ATTRIBUTE_UNUSED)
 {
-  tree decl = (*lang_hooks.decls.getdecls) ();
-  unsigned int len = list_length (decl);
-  tree *vec = xmalloc (sizeof (tree) * len);
-  unsigned int i;
+  int i;
 
-  /* Process the decls in reverse order--earliest first.  Put them
-     into VEC from back to front, then take out from front.  */
+  for (i = 0; i < VARRAY_ACTIVE_SIZE (deferred_global_decls); i++)
+    sdbout_symbol (VARRAY_TREE (deferred_global_decls, i), 0);
 
-  for (i = 0; i < len; i++, decl = TREE_CHAIN (decl))
-    vec[len - i - 1] = decl;
-
-  for (i = 0; i < len; i++)
-    {
-      decl = vec[i];
-      if (TREE_CODE (decl) == VAR_DECL
-         && ! DECL_EXTERNAL (decl)
-         && DECL_INITIAL (decl)
-         && TREE_PUBLIC (decl)
-         && DECL_RTL_SET_P (decl))
-       sdbout_symbol (decl, 0);
-    }
-
-  free (vec);
+  VARRAY_FREE (deferred_global_decls);
 }
 
 /* Describe the beginning of an internal block within a function.
@@ -1675,6 +1668,8 @@ sdbout_init (const char *input_file_name ATTRIBUTE_UNUSED)
   current_file->next = NULL;
   current_file->name = input_file_name;
 #endif
+
+  VARRAY_TREE_INIT (deferred_global_decls, 12, "deferred_global_decls");
 }
 
 #else  /* SDB_DEBUGGING_INFO */