#include "debug.h"
#include "tree.h"
#include "ggc.h"
+#include "varray.h"
static GTY(()) tree anonymous_types;
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"
/* 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. */
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. */
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.
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 */