aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarfout.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-19 06:22:04 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-07-19 06:22:04 +0000
commitc37d72e9931dff0b6d6e649996c1bdaaeb654870 (patch)
treeb1d514bcbcb3022999013a3add1442cb71310221 /gcc/dwarfout.c
parentf26876eec29e7a7ca6c69b854d4822f9cacd519e (diff)
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44145 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dwarfout.c')
-rw-r--r--gcc/dwarfout.c69
1 files changed, 65 insertions, 4 deletions
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;