From f35468307d96ed321763d3d7a2819feb9683fc52 Mon Sep 17 00:00:00 2001 From: rth Date: Sun, 6 Jan 2002 03:51:13 +0000 Subject: [PATCH] * c-decl.c (c_expand_body): Don't call outlining_inline_function. * integrate.c (output_inline_function): Likewise. * toplev.c (rest_of_compilation): Do it here instead. Move call to remove_unnecessary_notes after emitting abstract instance. Force an emitted nested function to have its parent emited as well. * dwarf2out.c (loc_descriptor_from_tree): Read mode after checking for null. (rtl_for_decl_location): Do not look at reload data structures before reload has run. * semantics.c (expand_body): Revert last change. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48572 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 ++++++++++++ gcc/c-decl.c | 5 ----- gcc/cp/ChangeLog | 4 ++++ gcc/cp/semantics.c | 5 ----- gcc/dwarf2out.c | 18 +++++++++++++++--- gcc/integrate.c | 6 +----- gcc/toplev.c | 28 +++++++++++++++++++++++----- 7 files changed, 55 insertions(+), 23 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6746ed0f262..7a4adfcf54c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2002-01-05 Richard Henderson + + * c-decl.c (c_expand_body): Don't call outlining_inline_function. + * integrate.c (output_inline_function): Likewise. + * toplev.c (rest_of_compilation): Do it here instead. Move call + to remove_unnecessary_notes after emitting abstract instance. + Force an emitted nested function to have its parent emited as well. + * dwarf2out.c (loc_descriptor_from_tree): Read mode after checking + for null. + (rtl_for_decl_location): Do not look at reload data structures + before reload has run. + 2002-01-05 Kazu Hirata * cse.c: Fix formatting. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index eb29b170a5c..d6e8ac33469 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -6947,11 +6947,6 @@ c_expand_body (fndecl, nested_p, can_defer_p) timevar_push (TV_EXPAND); - if (DECL_INLINE (fndecl)) - /* Do any preparation such as emitting abstract debug info for the - inline before it gets mangled by optimization. */ - (*debug_hooks->outlining_inline_function) (fndecl); - if (nested_p) { /* Make sure that we will evaluate variable-sized types involved diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 591a882ef15..d7fdc572140 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2002-01-05 Richard Henderson + + * semantics.c (expand_body): Revert last change. + 2002-01-04 Jason Merrill * class.c (update_vtable_entry_for_fn): Set delta to zero for a diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 06c1ac21c33..f17019cc8ee 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2503,11 +2503,6 @@ expand_body (fn) recorded when we finished processing the function. */ lineno = STMT_LINENO (DECL_SAVED_TREE (fn)); - if (DECL_INLINE (fn)) - /* Do any preparation such as emitting abstract debug info for the - inline before it gets mangled by optimization. */ - (*debug_hooks->outlining_inline_function) (fn); - /* Generate code for the function. */ genrtl_finish_function (fn); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 4a941545494..3c114848adb 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -7968,7 +7968,6 @@ loc_descriptor_from_tree (loc, addressp) case PARM_DECL: { rtx rtl = rtl_for_decl_location (loc); - enum machine_mode mode = GET_MODE (rtl); if (rtl == NULL_RTX) return 0; @@ -7981,6 +7980,8 @@ loc_descriptor_from_tree (loc, addressp) } else { + enum machine_mode mode = GET_MODE (rtl); + if (GET_CODE (rtl) == MEM) { indirect_p = 1; @@ -8751,7 +8752,18 @@ rtl_for_decl_location (decl) /* Use DECL_RTL as the "location" unless we find something better. */ rtl = DECL_RTL_IF_SET (decl); - if (TREE_CODE (decl) == PARM_DECL) + /* When generating abstract instances, ignore everything except + constants and symbols living in memory. */ + if (! reload_completed) + { + if (rtl + && (CONSTANT_P (rtl) + || (GET_CODE (rtl) == MEM + && CONSTANT_P (XEXP (rtl, 0))))) + return rtl; + rtl = NULL_RTX; + } + else if (TREE_CODE (decl) == PARM_DECL) { if (rtl == NULL_RTX || is_pseudo_reg (rtl)) { @@ -8816,7 +8828,7 @@ rtl_for_decl_location (decl) /* A variable with no DECL_RTL but a DECL_INITIAL is a compile-time constant, and will have been substituted directly into all expressions that use it. C does not have such a concept, but C++ and other languages do. */ - else if (DECL_INITIAL (decl)) + else if (TREE_CODE (decl) == VAR_DECL && DECL_INITIAL (decl)) rtl = expand_expr (DECL_INITIAL (decl), NULL_RTX, VOIDmode, EXPAND_INITIALIZER); diff --git a/gcc/integrate.c b/gcc/integrate.c index 9143e0e09e5..05717564181 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -1,6 +1,6 @@ /* Procedure integration for GCC. Copyright (C) 1988, 1991, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) This file is part of GCC. @@ -2950,10 +2950,6 @@ output_inline_function (fndecl) debug_hooks = &do_nothing_debug_hooks; } - /* Do any preparation, such as emitting abstract debug info for the inline - before it gets mangled by optimization. */ - (*debug_hooks->outlining_inline_function) (fndecl); - /* Compile this function all the way down to assembly code. As a side effect this destroys the saved RTL representation, but that's okay, because we don't need to inline this anymore. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index 02e6befb514..61054262b39 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2363,11 +2363,6 @@ rest_of_compilation (decl) if (!cfun->x_whole_function_mode_p) identify_blocks (); - /* Then remove any notes we don't need. That will make iterating - over the instruction sequence faster, and allow the garbage - collector to reclaim the memory used by the notes. */ - remove_unnecessary_notes (); - /* In function-at-a-time mode, we do not attempt to keep the BLOCK tree in sensible shape. So, we just recalculate it here. */ if (cfun->x_whole_function_mode_p) @@ -2505,6 +2500,29 @@ rest_of_compilation (decl) goto exit_rest_of_compilation; } + /* If we're emitting a nested function, make sure its parent gets + emitted as well. Doing otherwise confuses debug info. */ + { + tree parent; + for (parent = DECL_CONTEXT (current_function_decl); + parent != NULL_TREE; + parent = get_containing_scope (parent)) + if (TREE_CODE (parent) == FUNCTION_DECL) + TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (parent)) = 1; + } + + /* We are now committed to emitting code for this function. Do any + preparation, such as emitting abstract debug info for the inline + before it gets mangled by optimization. */ + if (DECL_INLINE (decl)) + (*debug_hooks->outlining_inline_function) (decl); + + /* Remove any notes we don't need. That will make iterating + over the instruction sequence faster, and allow the garbage + collector to reclaim the memory used by the notes. */ + remove_unnecessary_notes (); + reorder_blocks (); + ggc_collect (); /* Initialize some variables used by the optimizers. */ -- 2.11.4.GIT