/* Output sdb-format symbol table information from GNU compiler.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001 Free Software Foundation, Inc.
+ 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GCC.
*/
#include "config.h"
+#include "system.h"
+#include "debug.h"
+#include "tree.h"
+#include "ggc.h"
+
+static GTY(()) tree anonymous_types;
#ifdef SDB_DEBUGGING_INFO
-#include "system.h"
-#include "tree.h"
#include "rtl.h"
#include "regs.h"
#include "flags.h"
#include "reload.h"
#include "output.h"
#include "toplev.h"
-#include "ggc.h"
#include "tm_p.h"
#include "gsyms.h"
-#include "debug.h"
+#include "langhooks.h"
/* 1 if PARM is passed to this function in memory. */
static void sdbout_begin_block PARAMS ((unsigned int, unsigned int));
static void sdbout_end_block PARAMS ((unsigned int, unsigned int));
static void sdbout_source_line PARAMS ((unsigned int, const char *));
-static void sdbout_end_epilogue PARAMS ((void));
+static void sdbout_end_epilogue PARAMS ((unsigned int, const char *));
static void sdbout_global_decl PARAMS ((tree));
#ifndef MIPS_DEBUGGING_INFO
static void sdbout_begin_prologue PARAMS ((unsigned int, const char *));
#endif
-static void sdbout_end_prologue PARAMS ((unsigned int));
+static void sdbout_end_prologue PARAMS ((unsigned int, const char *));
static void sdbout_begin_function PARAMS ((tree));
static void sdbout_end_function PARAMS ((unsigned int));
static void sdbout_toplevel_data PARAMS ((tree));
#define PUT_SDB_INT_VAL(a) \
do { \
fputs ("\t.val\t", asm_out_file); \
- fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(a)); \
+ fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) (a)); \
fprintf (asm_out_file, "%s", SDB_DELIM); \
} while (0)
#define PUT_SDB_SIZE(a) \
do { \
fputs ("\t.size\t", asm_out_file); \
- fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)(a)); \
+ fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) (a)); \
fprintf (asm_out_file, "%s", SDB_DELIM); \
} while(0)
#endif
#endif
/* Return the sdb tag identifier string for TYPE
- if TYPE has already been defined; otherwise return a null pointer. */
+ if TYPE has already been defined; otherwise return a null pointer. */
#define KNOWN_TYPE_TAG(type) TYPE_SYMTAB_POINTER (type)
#endif /* MIPS_DEBUGGING_INFO */
\f
/* The debug hooks structure. */
-struct gcc_debug_hooks sdb_debug_hooks =
+const struct gcc_debug_hooks sdb_debug_hooks =
{
sdbout_init, /* init */
sdbout_finish, /* finish */
sdbout_end_prologue, /* end_prologue */
#else
sdbout_begin_prologue, /* begin_prologue */
- debug_nothing_int, /* end_prologue */
+ debug_nothing_int_charstar, /* end_prologue */
#endif
sdbout_end_epilogue, /* end_epilogue */
sdbout_begin_function, /* begin_function */
char *labelstr;
SDB_GENERATE_FAKE (label, unnamed_struct_number);
unnamed_struct_number++;
- labelstr = (char *) permalloc (strlen (label) + 1);
- strcpy (labelstr, label);
+ labelstr = xstrdup (label);
return labelstr;
}
\f
PREV is the number describing the target, value or element type.
DT_type describes how to transform that type. */
#define PUSH_DERIVED_LEVEL(DT_type,PREV) \
- ((((PREV) & ~(int)N_BTMASK) << (int)N_TSHIFT) \
- | ((int)DT_type << (int)N_BTSHFT) \
- | ((PREV) & (int)N_BTMASK))
+ ((((PREV) & ~(int) N_BTMASK) << (int) N_TSHIFT) \
+ | ((int) DT_type << (int) N_BTSHFT) \
+ | ((PREV) & (int) N_BTMASK))
/* Number of elements used in sdb_dims. */
static int sdb_n_dims = 0;
template_name_p (name)
tree name;
{
- register const char *ptr = IDENTIFIER_POINTER (name);
+ const char *ptr = IDENTIFIER_POINTER (name);
while (*ptr && *ptr != '<')
ptr++;
sdbout_record_type_name (type)
tree type;
{
- char *name = 0;
+ const char *name = 0;
int no_name;
if (KNOWN_TYPE_TAG (type))
if (TYPE_NAME (type) != 0)
{
tree t = 0;
+
/* Find the IDENTIFIER_NODE for the type name. */
if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
t = TYPE_NAME (type);
static void
sdbout_block (block)
- register tree block;
+ tree block;
{
while (block)
{
if (!DECL_RTL_SET_P (decl))
return;
- SET_DECL_RTL (decl,
+ SET_DECL_RTL (decl,
eliminate_regs (DECL_RTL (decl), 0, NULL_RTX));
#ifdef LEAF_REG_REMAP
if (current_function_uses_only_leaf_regs)
particular compilation. */
if (GET_CODE (value) == REG)
{
- regno = REGNO (DECL_RTL (decl));
+ regno = REGNO (value);
if (regno >= FIRST_PSEUDO_REGISTER)
return;
}
if (REGNO (value) >= FIRST_PSEUDO_REGISTER)
return;
}
- regno = REGNO (alter_subreg (DECL_RTL (decl)));
- value = DECL_RTL (decl);
+ regno = REGNO (alter_subreg (&value));
+ SET_DECL_RTL (decl, value);
}
/* Don't output anything if an auto variable
gets RTL that is static.
if (TREE_PUBLIC (decl))
{
PUT_SDB_VAL (XEXP (value, 0));
- PUT_SDB_SCL (C_EXT);
+ PUT_SDB_SCL (C_EXT);
}
else
{
PUT_SDB_VAL (XEXP (value, 0));
- PUT_SDB_SCL (C_STAT);
+ PUT_SDB_SCL (C_STAT);
}
}
else if (regno >= 0)
/* Machinery to record and output anonymous types. */
-static tree anonymous_types;
-
static void
sdbout_queue_anonymous_type (type)
tree type;
static void
sdbout_dequeue_anonymous_types ()
{
- register tree types, link;
+ tree types, link;
while (anonymous_types)
{
for (link = types; link; link = TREE_CHAIN (link))
{
- register tree type = TREE_VALUE (link);
+ tree type = TREE_VALUE (link);
if (type && ! TREE_ASM_WRITTEN (type))
sdbout_one_type (type);
void
sdbout_types (types)
- register tree types;
+ tree types;
{
- register tree link;
+ tree link;
for (link = types; link; link = TREE_CHAIN (link))
sdbout_one_type (link);
/* Print out the base class information with fields
named after the types they hold. */
- /* This is only relevent to aggregate types. TYPE_BINFO is used
+ /* This is only relevant to aggregate types. TYPE_BINFO is used
for other purposes in an ENUMERAL_TYPE, so we must exclude that
case. */
if (TREE_CODE (type) != ENUMERAL_TYPE)
sdbout_finish (main_filename)
const char *main_filename ATTRIBUTE_UNUSED;
{
- tree decl = getdecls ();
+ tree decl = (*lang_hooks.decls.getdecls) ();
unsigned int len = list_length (decl);
tree *vec = (tree *) xmalloc (sizeof (tree) * len);
unsigned int i;
unsigned int line;
const char *file ATTRIBUTE_UNUSED;
{
- sdbout_end_prologue (line);
+ sdbout_end_prologue (line, file);
}
#endif
static void
-sdbout_end_prologue (line)
+sdbout_end_prologue (line, file)
unsigned int line;
+ const char *file ATTRIBUTE_UNUSED;
{
sdb_begin_function_line = line - 1;
PUT_SDB_FUNCTION_START (line);
Called after the epilogue is output. */
static void
-sdbout_end_epilogue ()
+sdbout_end_epilogue (line, file)
+ unsigned int line ATTRIBUTE_UNUSED;
+ const char *file ATTRIBUTE_UNUSED;
{
- const char *const name
+ const char *const name ATTRIBUTE_UNUSED
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (current_function_decl));
#ifdef PUT_SDB_EPILOGUE_END
static void
sdbout_label (insn)
- register rtx insn;
+ rtx insn;
{
PUT_SDB_DEF (LABEL_NAME (insn));
PUT_SDB_VAL (insn);
#ifdef RMS_QUICK_HACK_1
tree t;
- for (t = getdecls (); t; t = TREE_CHAIN (t))
+ for (t = (*lang_hooks.decls.getdecls) (); t; t = TREE_CHAIN (t))
if (DECL_NAME (t) && IDENTIFIER_POINTER (DECL_NAME (t)) != 0
&& !strcmp (IDENTIFIER_POINTER (DECL_NAME (t)), "__vtbl_ptr_type"))
sdbout_symbol (t, 0);
#endif
-
-#ifdef SDB_ALLOW_FORWARD_REFERENCES
- ggc_add_tree_root (&anonymous_types, 1);
-#endif
}
+#else /* SDB_DEBUGGING_INFO */
+
+/* This should never be used, but its address is needed for comparisons. */
+const struct gcc_debug_hooks sdb_debug_hooks;
+
#endif /* SDB_DEBUGGING_INFO */
+
+#include "gt-sdbout.h"