From 2b85879e637df70ff99b3d7bbea2dd0997cc907f Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Thu, 19 Jul 2001 06:22:04 +0000 Subject: [PATCH] Makefile.in (toplev.o, [...]): Don't depend on dwarfout.h. * Makefile.in (toplev.o, dwarfout.o, final.o): Don't depend on dwarfout.h. * dbxout.c (dbxout_function): Rename dbxout_funciton_decl, move to conditionally compiled block. (dbx_debug_hooks, xcoff_debug_hooks): Update. * dbxout.h (dbxout_function): Remove. * debug.c (do_nothing_debug_hooks): Update. * debug.h (struct gcc_debug_hooks): New hooks function_decl, global_decl, deferred_inline_function. * dwarf2out.c (dwarf2_debug_hooks): Update. (dwarf2out_global_decl): New. * dwarfout.c: Don't include dwarfout.h. (dwarfout_global_decl, dwarfout_function_decl, dwarfout_deferred_inline_function): New. (dwarf_debug_hooks): Update. * dwarfout.h: Remove. * final.c: Don't include dwarfout.h. * sdbout.c (sdbout_global_decl): New. (sdbout_debug_hooks): Update. * toplev.c: Don't include dwarfout.h. (check_global_declarations, rest_of_compilation): Use new debug hooks. (note_deferral_of_defined_inline_function): Remove. * toplev.h (note_deferral_of_defined_inline_function): Remove. * ch/Makefile.in (lex.o): No dependence on dwarfout.h. * ch/lex.c: Don't include dwarfout.h. * cp/Make-lang.in (decl2.o): No dependence on dwarfout.h, dwarf2out.h. (semantics.o, optimize.o): Depend on debug.h not dwarfout.h. * cp/decl2.c: Don't include dwarfout.h and dwarf2out.h. * cp/optimize.c: Include debug.h. (maybe_clone_body): Use debug hook. * cp/semantics.c: Include debug.h. (expand_body): Use debug hook. * po/POTFILES.in: Remove dwarfout.h. From-SVN: r44145 --- gcc/ChangeLog | 36 ++++++++++++++++ gcc/Makefile.in | 6 +-- gcc/ch/ChangeLog | 5 +++ gcc/ch/Makefile.in | 2 +- gcc/ch/lex.c | 4 -- gcc/cp/ChangeLog | 8 ++++ gcc/cp/Make-lang.in | 6 +-- gcc/cp/decl2.c | 2 - gcc/cp/optimize.c | 3 +- gcc/cp/semantics.c | 3 +- gcc/dbxout.c | 64 +++++++++++++++------------ gcc/dbxout.h | 1 - gcc/debug.c | 5 ++- gcc/debug.h | 14 ++++++ gcc/dwarf2out.c | 21 ++++++++- gcc/dwarfout.c | 69 +++++++++++++++++++++++++++-- gcc/dwarfout.h | 21 --------- gcc/final.c | 4 -- gcc/po/POTFILES.in | 1 - gcc/sdbout.c | 32 +++++++++++++- gcc/toplev.c | 103 ++------------------------------------------ gcc/toplev.h | 2 - 22 files changed, 233 insertions(+), 179 deletions(-) delete mode 100644 gcc/dwarfout.h diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 27678b43138..c24d83eac13 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,39 @@ +2001-07-19 Neil Booth + + * Makefile.in (toplev.o, dwarfout.o, final.o): Don't depend on + dwarfout.h. + * dbxout.c (dbxout_function): Rename dbxout_funciton_decl, move + to conditionally compiled block. + (dbx_debug_hooks, xcoff_debug_hooks): Update. + * dbxout.h (dbxout_function): Remove. + * debug.c (do_nothing_debug_hooks): Update. + * debug.h (struct gcc_debug_hooks): New hooks function_decl, + global_decl, deferred_inline_function. + * dwarf2out.c (dwarf2_debug_hooks): Update. + (dwarf2out_global_decl): New. + * dwarfout.c: Don't include dwarfout.h. + (dwarfout_global_decl, dwarfout_function_decl, + dwarfout_deferred_inline_function): New. + (dwarf_debug_hooks): Update. + * dwarfout.h: Remove. + * final.c: Don't include dwarfout.h. + * sdbout.c (sdbout_global_decl): New. + (sdbout_debug_hooks): Update. + * toplev.c: Don't include dwarfout.h. + (check_global_declarations, rest_of_compilation): Use new debug hooks. + (note_deferral_of_defined_inline_function): Remove. + * toplev.h (note_deferral_of_defined_inline_function): Remove. + * ch/Makefile.in (lex.o): No dependence on dwarfout.h. + * ch/lex.c: Don't include dwarfout.h. + * cp/Make-lang.in (decl2.o): No dependence on dwarfout.h, dwarf2out.h. + (semantics.o, optimize.o): Depend on debug.h not dwarfout.h. + * cp/decl2.c: Don't include dwarfout.h and dwarf2out.h. + * cp/optimize.c: Include debug.h. + (maybe_clone_body): Use debug hook. + * cp/semantics.c: Include debug.h. + (expand_body): Use debug hook. + * po/POTFILES.in: Remove dwarfout.h. + 2001-07-19 Neil Booth * c-lex.c (c_lex): Remove CPP_INT, CPP_FLOAT cases. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 4fcba9bab0b..5b90382a582 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1340,7 +1340,7 @@ diagnostic.o : diagnostic.c diagnostic.h diagnostic.def \ $(GGC_H) input.h $(INSN_ATTR_H) insn-config.h toplev.h intl.h toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) function.h \ flags.h input.h $(INSN_ATTR_H) xcoffout.h output.h diagnostic.h \ - debug.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h dwarfout.h \ + debug.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h \ dwarf2out.h sdbout.h dbxout.h $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) \ graph.h $(LOOP_H) except.h $(REGS_H) $(TIMEVAR_H) $(lang_options_files) \ ssa.h $(PARAMS_H) $(TM_P_H) reload.h dwarf2asm.h @@ -1401,7 +1401,7 @@ sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \ insn-config.h $(OBSTACK_H) xcoffout.h c-pragma.h ggc.h \ sdbout.h toplev.h $(TM_P_H) except.h debug.h dwarfout.o : dwarfout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf.h \ - flags.h insn-config.h reload.h output.h toplev.h dwarfout.h $(TM_P_H) \ + flags.h insn-config.h reload.h output.h toplev.h $(TM_P_H) \ debug.h dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf2.h \ debug.h flags.h insn-config.h reload.h output.h diagnostic.h \ @@ -1524,7 +1524,7 @@ sched-vis.o : sched-vis.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) sched-int.h \ final.o : final.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h intl.h \ $(REGS_H) $(RECOG_H) conditions.h insn-config.h $(INSN_ATTR_H) function.h \ real.h output.h hard-reg-set.h except.h debug.h \ - xcoffout.h toplev.h reload.h dwarfout.h dwarf2out.h sdbout.h \ + xcoffout.h toplev.h reload.h dwarf2out.h sdbout.h \ dbxout.h $(BASIC_BLOCK_H) $(TM_P_H) $(TARGET_H) recog.o : recog.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) function.h $(BASIC_BLOCK_H) \ $(REGS_H) $(RECOG_H) $(EXPR_H) hard-reg-set.h flags.h insn-config.h \ diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog index 694ecf459e0..d2421059f41 100644 --- a/gcc/ch/ChangeLog +++ b/gcc/ch/ChangeLog @@ -1,3 +1,8 @@ +2001-07-19 Neil Booth + + * Makefile.in (lex.o): No dependence on dwarfout.h. + * lex.c: Don't include dwarfout.h. + 2001-07-10 Jan van Male * ch-tree.h: Remove prototype for combine_parm_decls, unused diff --git a/gcc/ch/Makefile.in b/gcc/ch/Makefile.in index cfaf634141b..05925f60cc2 100644 --- a/gcc/ch/Makefile.in +++ b/gcc/ch/Makefile.in @@ -290,7 +290,7 @@ lang.o : lang.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../input.h lex.h \ $(srcdir)/../diagnostic.h lex.o : lex.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) $(srcdir)/../flags.h \ $(srcdir)/../input.h $(srcdir)/parse.h $(srcdir)/../system.h \ - $(srcdir)/../toplev.h lex.h $(srcdir)/../dwarfout.h hash.h + $(srcdir)/../toplev.h lex.h hash.h loop.o : loop.c $(CONFIG_H) $(RTL_H) $(CHILL_TREE_H) lex.h \ $(srcdir)/../flags.h $(srcdir)/../input.h \ $(srcdir)/../tree.h $(srcdir)/../system.h $(srcdir)/../toplev.h diff --git a/gcc/ch/lex.c b/gcc/ch/lex.c index 1a87025baae..4eae0a5df3d 100644 --- a/gcc/ch/lex.c +++ b/gcc/ch/lex.c @@ -35,10 +35,6 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "tm_p.h" -#ifdef DWARF_DEBUGGING_INFO -#include "dwarfout.h" -#endif - #ifdef MULTIBYTE_CHARS #include #endif diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8d98554e057..0fa3fdb4bc8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2001-07-19 Neil Booth + + * decl2.c: Don't include dwarfout.h and dwarf2out.h. + * optimize.c: Include debug.h. + (maybe_clone_body): Use debug hook. + * semantics.c: Include debug.h. + (expand_body): Use debug hook. + 2001-07-19 Neil Booth * spew.c (read_token, yyerror): Remove CPP_INT, CPP_FLOAT cases. diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 07a2e5bede5..c3070b9c0fa 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -244,7 +244,7 @@ cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \ output.h $(EXPR_H) except.h toplev.h hash.h $(GGC_H) $(RTL_H) \ cp/operators.def $(TM_P_H) cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \ - output.h except.h toplev.h dwarf2out.h dwarfout.h $(GGC_H) $(RTL_H) + output.h except.h toplev.h $(GGC_H) $(RTL_H) cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \ diagnostic.h cp/typeck.o: cp/typeck.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \ @@ -274,10 +274,10 @@ cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h cp/errfn.o: cp/errfn.c $(CXX_TREE_H) toplev.h cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \ - flags.h $(GGC_H) output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) + flags.h $(GGC_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) cp/dump.o: cp/dump.c $(CXX_TREE_H) c-dump.h cp/optimize.o: cp/optimize.c $(CXX_TREE_H) rtl.h integrate.h insn-config.h \ - input.h params.h + input.h params.h debug.h cp/mangle.o: cp/mangle.c $(CXX_TREE_H) toplev.h cp/parse.o: cp/parse.c $(CXX_TREE_H) flags.h cp/lex.h except.h output.h \ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 5a1a1edc667..5723f00479d 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -40,8 +40,6 @@ Boston, MA 02111-1307, USA. */ #include "output.h" #include "except.h" #include "toplev.h" -#include "dwarf2out.h" -#include "dwarfout.h" #include "ggc.h" #include "timevar.h" #include "cpplib.h" diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c index 4e713c3b06f..22e1eec5279 100644 --- a/gcc/cp/optimize.c +++ b/gcc/cp/optimize.c @@ -32,6 +32,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ggc.h" #include "params.h" #include "hashtab.h" +#include "debug.h" /* To Do: @@ -1104,7 +1105,7 @@ maybe_clone_body (fn) return 0; /* Emit the DWARF1 abstract instance. */ - note_deferral_of_defined_inline_function (fn); + (*debug_hooks->deferred_inline_function) (fn); /* We know that any clones immediately follow FN in the TYPE_METHODS list. */ diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 2bb4051affc..94a31fb92b9 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -37,6 +37,7 @@ #include "expr.h" #include "output.h" #include "timevar.h" +#include "debug.h" /* There routines provide a modular interface to perform many parsing operations. They may therefore be used during actual parsing, or @@ -2440,7 +2441,7 @@ expand_body (fn) we actually need to write this function out. */ defer_fn (fn); /* Let the back-end know that this funtion exists. */ - note_deferral_of_defined_inline_function (fn); + (*debug_hooks->deferred_inline_function) (fn); return; } diff --git a/gcc/dbxout.c b/gcc/dbxout.c index e2f21ff88c9..ea05106fb02 100644 --- a/gcc/dbxout.c +++ b/gcc/dbxout.c @@ -317,6 +317,7 @@ static void dbxout_begin_function PARAMS ((tree)); static void dbxout_begin_block PARAMS ((unsigned, unsigned)); static void dbxout_end_block PARAMS ((unsigned, unsigned)); +static void dbxout_function_decl PARAMS ((tree)); struct gcc_debug_hooks dbx_debug_hooks = { @@ -337,7 +338,10 @@ struct gcc_debug_hooks dbx_debug_hooks = #else debug_nothing_tree, /* begin_function */ #endif - debug_nothing_int /* end_function */ + debug_nothing_int, /* end_function */ + dbxout_function_decl, + debug_nothing_tree, /* global_decl */ + debug_nothing_tree /* deferred_inline_function */ }; #endif /* DBX_DEBUGGING_INFO */ @@ -357,7 +361,10 @@ struct gcc_debug_hooks xcoff_debug_hooks = debug_nothing_int, /* end_prologue */ xcoffout_end_epilogue, debug_nothing_tree, /* begin_function */ - xcoffout_end_function + xcoffout_end_function, + debug_nothing_tree, /* function_decl */ + debug_nothing_tree, /* global_decl */ + debug_nothing_tree /* deferred_inline_function */ }; #endif /* XCOFF_DEBUGGING_INFO */ @@ -608,6 +615,33 @@ dbxout_end_block (line, n) ASM_OUTPUT_INTERNAL_LABEL (asmfile, "LBE", n); } +/* Output dbx data for a function definition. + This includes a definition of the function name itself (a symbol), + definitions of the parameters (locating them in the parameter list) + and then output the block that makes up the function's body + (including all the auto variables of the function). */ + +static void +dbxout_function_decl (decl) + tree decl; +{ +#ifndef DBX_FUNCTION_FIRST + dbxout_begin_function (decl); +#endif + dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl)); +#ifdef DBX_OUTPUT_FUNCTION_END + DBX_OUTPUT_FUNCTION_END (asmfile, decl); +#endif +#if defined(ASM_OUTPUT_SECTION_NAME) + if (use_gnu_debug_info_extensions +#if defined(NO_DBX_FUNCTION_END) + && ! NO_DBX_FUNCTION_END +#endif + ) + dbxout_function_end (); +#endif +} + #endif /* DBX_DEBUGGING_INFO */ /* At the end of compilation, finish writing the symbol table. @@ -2733,30 +2767,4 @@ dbxout_begin_function (decl) dbxout_symbol (DECL_RESULT (decl), 1); } -/* Output dbx data for a function definition. - This includes a definition of the function name itself (a symbol), - definitions of the parameters (locating them in the parameter list) - and then output the block that makes up the function's body - (including all the auto variables of the function). */ - -void -dbxout_function (decl) - tree decl; -{ -#ifndef DBX_FUNCTION_FIRST - dbxout_begin_function (decl); -#endif - dbxout_block (DECL_INITIAL (decl), 0, DECL_ARGUMENTS (decl)); -#ifdef DBX_OUTPUT_FUNCTION_END - DBX_OUTPUT_FUNCTION_END (asmfile, decl); -#endif -#if defined(ASM_OUTPUT_SECTION_NAME) - if (use_gnu_debug_info_extensions -#if defined(NO_DBX_FUNCTION_END) - && ! NO_DBX_FUNCTION_END -#endif - ) - dbxout_function_end (); -#endif -} #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */ diff --git a/gcc/dbxout.h b/gcc/dbxout.h index 91bbced930b..988962dc54e 100644 --- a/gcc/dbxout.h +++ b/gcc/dbxout.h @@ -25,4 +25,3 @@ extern int dbxout_symbol PARAMS ((tree, int)); extern void dbxout_parms PARAMS ((tree)); extern void dbxout_reg_parms PARAMS ((tree)); extern int dbxout_syms PARAMS ((tree)); -extern void dbxout_function PARAMS ((tree)); diff --git a/gcc/debug.c b/gcc/debug.c index 0c75909d4ff..4e525d5c449 100644 --- a/gcc/debug.c +++ b/gcc/debug.c @@ -35,7 +35,10 @@ struct gcc_debug_hooks do_nothing_debug_hooks = debug_nothing_int, /* end_prologue */ debug_nothing_void, /* end_epilogue */ debug_nothing_tree, /* begin_function */ - debug_nothing_int /* end_function */ + debug_nothing_int, /* end_function */ + debug_nothing_tree, /* function_decl */ + debug_nothing_tree, /* global_decl */ + debug_nothing_tree /* deferred_inline_function */ }; /* This file contains implementations of each debug hook that do diff --git a/gcc/debug.h b/gcc/debug.h index 56b2e033f22..4a74bee83be 100644 --- a/gcc/debug.h +++ b/gcc/debug.h @@ -73,6 +73,20 @@ struct gcc_debug_hooks /* Record end of function. LINE is highest line number in function. */ void (* end_function) PARAMS ((unsigned int line)); + + /* Debug information for a function DECL. This might include the + function name (a symbol), its parameters, and the block that + makes up the function's body, and the local variables of the + function. */ + void (* function_decl) PARAMS ((union tree_node *decl)); + + /* Debug information for a global DECL. Called from toplev.c after + compilation proper has finished. */ + void (* global_decl) PARAMS ((union tree_node *decl)); + + /* DECL is an inline function, whose body is present, but which is + not being output at this point. */ + void (* deferred_inline_function) PARAMS ((union tree_node *decl)); }; extern struct gcc_debug_hooks *debug_hooks; diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 1dbdae034dd..99fa2208f69 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -3022,6 +3022,7 @@ static void dwarf2out_start_source_file PARAMS ((unsigned, const char *)); static void dwarf2out_end_source_file PARAMS ((unsigned)); static void dwarf2out_begin_block PARAMS ((unsigned, unsigned)); static void dwarf2out_end_block PARAMS ((unsigned, unsigned)); +static void dwarf2out_global_decl PARAMS ((tree)); /* The debug hooks structure. */ @@ -3040,7 +3041,10 @@ struct gcc_debug_hooks dwarf2_debug_hooks = debug_nothing_int, /* end_prologue */ dwarf2out_end_epilogue, debug_nothing_tree, /* begin_function */ - debug_nothing_int /* end_function */ + debug_nothing_int, /* end_function */ + dwarf2out_decl, /* function_decl */ + dwarf2out_global_decl, + debug_nothing_tree /* deferred_inline_function */ }; /* NOTE: In the comments in this file, many references are made to @@ -11011,6 +11015,21 @@ dwarf2out_add_library_unit_info (filename, context_list) } } +/* Debug information for a global DECL. Called from toplev.c after + compilation proper has finished. */ +static void +dwarf2out_global_decl (decl) + tree decl; +{ + /* Output DWARF2 information for file-scope tentative data object + declarations, file-scope (extern) function declarations (which + had no corresponding body) and file-scope tagged type + declarations and definitions which have not yet been forced out. */ + + if (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)) + dwarf2out_decl (decl); +} + /* Write the debugging output for DECL. */ void diff --git a/gcc/dwarfout.c b/gcc/dwarfout.c index 65e324aeef8..1d3644d3b1c 100644 --- a/gcc/dwarfout.c +++ b/gcc/dwarfout.c @@ -574,7 +574,6 @@ Boston, MA 02111-1307, USA. */ #include "insn-config.h" #include "reload.h" #include "output.h" -#include "dwarfout.h" #include "toplev.h" #include "tm_p.h" #include "debug.h" @@ -801,6 +800,10 @@ static void dwarfout_end_epilogue PARAMS ((void)); static void dwarfout_source_line PARAMS ((unsigned int, const char *)); static void dwarfout_end_prologue PARAMS ((unsigned int)); static void dwarfout_end_function PARAMS ((unsigned int)); +static void dwarfout_function_decl PARAMS ((tree)); +static void dwarfout_global_decl PARAMS ((tree)); +static void dwarfout_deferred_inline_function PARAMS ((tree)); +static void dwarfout_file_scope_decl PARAMS ((tree , int)); static const char *dwarf_tag_name PARAMS ((unsigned)); static const char *dwarf_attr_name PARAMS ((unsigned)); static const char *dwarf_stack_op_name PARAMS ((unsigned)); @@ -1389,7 +1392,10 @@ struct gcc_debug_hooks dwarf_debug_hooks = dwarfout_end_prologue, dwarfout_end_epilogue, debug_nothing_tree, /* begin_function */ - dwarfout_end_function + dwarfout_end_function, + dwarfout_function_decl, + dwarfout_global_decl, + dwarfout_deferred_inline_function }; /************************ general utility functions **************************/ @@ -5324,7 +5330,7 @@ output_decl (decl, containing_scope) /* If we're emitting an out-of-line copy of an inline function, set up to refer to the abstract instance emitted from - note_deferral_of_defined_inline_function. */ + dwarfout_deferred_inline_function. */ if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl) && ! (containing_scope && TYPE_P (containing_scope))) set_decl_origin_self (decl); @@ -5631,7 +5637,62 @@ output_decl (decl, containing_scope) } } -void +/* Output debug information for a function. */ +static void +dwarfout_function_decl (decl) + tree decl; +{ + dwarfout_file_scope_decl (decl, 0); +} + +/* Debug information for a global DECL. Called from toplev.c after + compilation proper has finished. */ +static void +dwarfout_global_decl (decl) + tree decl; +{ + /* Output DWARF information for file-scope tentative data object + declarations, file-scope (extern) function declarations (which + had no corresponding body) and file-scope tagged type + declarations and definitions which have not yet been forced out. */ + + if (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)) + dwarfout_file_scope_decl (decl, 1); +} + +/* DECL is an inline function, whose body is present, but which is not + being output at this point. (We're putting that off until we need + to do it.) */ +static void +dwarfout_deferred_inline_function (decl) + tree decl; +{ + /* Generate the DWARF info for the "abstract" instance of a function + which we may later generate inlined and/or out-of-line instances + of. */ + if ((DECL_INLINE (decl) || DECL_ABSTRACT (decl)) + && ! DECL_ABSTRACT_ORIGIN (decl)) + { + /* The front-end may not have set CURRENT_FUNCTION_DECL, but the + DWARF code expects it to be set in this case. Intuitively, + DECL is the function we just finished defining, so setting + CURRENT_FUNCTION_DECL is sensible. */ + tree saved_cfd = current_function_decl; + int was_abstract = DECL_ABSTRACT (decl); + current_function_decl = decl; + + /* Let the DWARF code do its work. */ + set_decl_abstract_flags (decl, 1); + dwarfout_file_scope_decl (decl, 0); + if (! was_abstract) + set_decl_abstract_flags (decl, 0); + + /* Reset CURRENT_FUNCTION_DECL. */ + current_function_decl = saved_cfd; + } +} + +static void dwarfout_file_scope_decl (decl, set_finalizing) register tree decl; register int set_finalizing; diff --git a/gcc/dwarfout.h b/gcc/dwarfout.h deleted file mode 100644 index 973c07e1432..00000000000 --- a/gcc/dwarfout.h +++ /dev/null @@ -1,21 +0,0 @@ -/* dwarfout.h - Various declarations for functions found in dwarfout.c - Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -extern void dwarfout_file_scope_decl PARAMS ((tree , int)); diff --git a/gcc/final.c b/gcc/final.c index 6a8c298b381..b4d25f268c1 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -76,10 +76,6 @@ Boston, MA 02111-1307, USA. */ #include "xcoffout.h" #endif -#ifdef DWARF_DEBUGGING_INFO -#include "dwarfout.h" -#endif - #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO) #include "dwarf2out.h" #endif diff --git a/gcc/po/POTFILES.in b/gcc/po/POTFILES.in index 03f1ae36c76..b19395e8e0d 100644 --- a/gcc/po/POTFILES.in +++ b/gcc/po/POTFILES.in @@ -731,7 +731,6 @@ dwarf2asm.h dwarf2out.c dwarf2out.h dwarfout.c -dwarfout.h emit-rtl.c #enquire.c is used only by GCC maintainers and installers errors.c diff --git a/gcc/sdbout.c b/gcc/sdbout.c index d6bccabdce1..4dc4a65c08d 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -99,6 +99,7 @@ static void sdbout_begin_block PARAMS ((unsigned, unsigned)); static void sdbout_end_block PARAMS ((unsigned, unsigned)); static void sdbout_source_line PARAMS ((unsigned int, const char *)); static void sdbout_end_epilogue PARAMS ((void)); +static void sdbout_global_decl PARAMS ((tree)); #ifndef MIPS_DEBUGGING_INFO static void sdbout_begin_prologue PARAMS ((unsigned int, const char *)); #endif @@ -315,7 +316,10 @@ struct gcc_debug_hooks sdb_debug_hooks = #endif sdbout_end_epilogue, sdbout_begin_function, - sdbout_end_function + sdbout_end_function, + debug_nothing_tree, /* function_decl */ + sdbout_global_decl, + debug_nothing_tree /* deferred_inline_function */ }; #if 0 @@ -1472,6 +1476,32 @@ sdbout_reg_parms (parms) } } +/* Output debug information for a global DECL. Called from toplev.c + after compilation proper has finished. */ + +static void +sdbout_global_decl (decl) + tree decl; +{ + if (TREE_CODE (decl) == VAR_DECL + && DECL_INITIAL (decl) + && ! DECL_EXTERNAL (decl) + && DECL_RTL (decl) != 0) + { + /* The COFF linker can move initialized global vars to the end. + And that can screw up the symbol ordering. By putting the + symbols in that order to begin with, we avoid a problem. + mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */ + if (TREE_PUBLIC (decl)) + sdbout_symbol (decl, 0); + + /* Output COFF information for non-global file-scope initialized + variables. */ + if (GET_CODE (DECL_RTL (decl)) == MEM) + sdbout_toplevel_data (decl); + } +} + /* Describe the beginning of an internal block within a function. Also output descriptions of variables defined in this block. diff --git a/gcc/toplev.c b/gcc/toplev.c index e357d62b6d3..0e510b94f50 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -68,10 +68,6 @@ Boston, MA 02111-1307, USA. */ #include "integrate.h" #include "debug.h" -#ifdef DWARF_DEBUGGING_INFO -#include "dwarfout.h" -#endif - #if defined (DWARF2_UNWIND_INFO) || defined (DWARF2_DEBUGGING_INFO) #include "dwarf2out.h" #endif @@ -2059,47 +2055,7 @@ check_global_declarations (vec, len) warning_with_decl (decl, "`%s' defined but not used"); timevar_push (TV_SYMOUT); -#ifdef SDB_DEBUGGING_INFO - /* The COFF linker can move initialized global vars to the end. - And that can screw up the symbol ordering. - By putting the symbols in that order to begin with, - we avoid a problem. mcsun!unido!fauern!tumuc!pes@uunet.uu.net. */ - if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL - && TREE_PUBLIC (decl) && DECL_INITIAL (decl) - && ! DECL_EXTERNAL (decl) - && DECL_RTL (decl) != 0) - sdbout_symbol (decl, 0); - - /* Output COFF information for non-global - file-scope initialized variables. */ - if (write_symbols == SDB_DEBUG - && TREE_CODE (decl) == VAR_DECL - && DECL_INITIAL (decl) - && ! DECL_EXTERNAL (decl) - && DECL_RTL (decl) != 0 - && GET_CODE (DECL_RTL (decl)) == MEM) - sdbout_toplevel_data (decl); -#endif /* SDB_DEBUGGING_INFO */ -#ifdef DWARF_DEBUGGING_INFO - /* Output DWARF information for file-scope tentative data object - declarations, file-scope (extern) function declarations (which - had no corresponding body) and file-scope tagged type declarations - and definitions which have not yet been forced out. */ - - if (write_symbols == DWARF_DEBUG - && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl))) - dwarfout_file_scope_decl (decl, 1); -#endif -#ifdef DWARF2_DEBUGGING_INFO - /* Output DWARF2 information for file-scope tentative data object - declarations, file-scope (extern) function declarations (which - had no corresponding body) and file-scope tagged type declarations - and definitions which have not yet been forced out. */ - - if (write_symbols == DWARF2_DEBUG - && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl))) - dwarf2out_decl (decl); -#endif + (*debug_hooks->global_decl) (decl); timevar_pop (TV_SYMOUT); } } @@ -2634,46 +2590,6 @@ rest_of_type_compilation (type, toplev) timevar_pop (TV_SYMOUT); } -/* DECL is an inline function, whose body is present, but which is not - being output at this point. (We're putting that off until we need - to do it.) If there are any actions that need to take place, - including the emission of debugging information for the function, - this is where they should go. This function may be called by - language-dependent code for front-ends that do not even generate - RTL for functions that don't need to be put out. */ - -void -note_deferral_of_defined_inline_function (decl) - tree decl ATTRIBUTE_UNUSED; -{ -#ifdef DWARF_DEBUGGING_INFO - /* Generate the DWARF info for the "abstract" instance of a function - which we may later generate inlined and/or out-of-line instances - of. */ - if (write_symbols == DWARF_DEBUG - && (DECL_INLINE (decl) || DECL_ABSTRACT (decl)) - && ! DECL_ABSTRACT_ORIGIN (decl)) - { - /* The front-end may not have set CURRENT_FUNCTION_DECL, but the - DWARF code expects it to be set in this case. Intuitively, - DECL is the function we just finished defining, so setting - CURRENT_FUNCTION_DECL is sensible. */ - tree saved_cfd = current_function_decl; - int was_abstract = DECL_ABSTRACT (decl); - current_function_decl = decl; - - /* Let the DWARF code do its work. */ - set_decl_abstract_flags (decl, 1); - dwarfout_file_scope_decl (decl, 0); - if (! was_abstract) - set_decl_abstract_flags (decl, 0); - - /* Reset CURRENT_FUNCTION_DECL. */ - current_function_decl = saved_cfd; - } -#endif -} - /* FNDECL is an inline function which is about to be emitted out of line. Do any preparation, such as emitting abstract debug info for the inline before it gets mangled by optimization. */ @@ -2822,7 +2738,7 @@ rest_of_compilation (decl) declared inline but not inlined, and those inlined even though they weren't declared inline. Conveniently, that's what DECL_INLINE means at this point. */ - note_deferral_of_defined_inline_function (decl); + (*debug_hooks->deferred_inline_function) (decl); if (DECL_DEFER_OUTPUT (decl)) { @@ -3802,20 +3718,7 @@ rest_of_compilation (decl) generated. During that call, we *will* be routed past here. */ timevar_push (TV_SYMOUT); -#ifdef DBX_DEBUGGING_INFO - if (write_symbols == DBX_DEBUG) - dbxout_function (decl); -#endif - -#ifdef DWARF_DEBUGGING_INFO - if (write_symbols == DWARF_DEBUG) - dwarfout_file_scope_decl (decl, 0); -#endif - -#ifdef DWARF2_DEBUGGING_INFO - if (write_symbols == DWARF2_DEBUG) - dwarf2out_decl (decl); -#endif + (*debug_hooks->function_decl) (decl); timevar_pop (TV_SYMOUT); exit_rest_of_compilation: diff --git a/gcc/toplev.h b/gcc/toplev.h index 0797b2d95ad..99af4b1eac6 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -123,8 +123,6 @@ extern void fnotice PARAMS ((FILE *, const char *, ...)) extern int wrapup_global_declarations PARAMS ((union tree_node **, int)); extern void check_global_declarations PARAMS ((union tree_node **, int)); -extern void note_deferral_of_defined_inline_function - PARAMS ((union tree_node *)); extern void note_outlining_of_inline_function PARAMS ((union tree_node *)); -- 2.30.2