This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] move some debug routines from final.c to dbxout.c


On Tue, Apr 5, 2011 at 1:36 PM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> I was looking at debug_flush_symbol_queue and thought "gosh, it's
> inefficient if we're calling this all the time, but it only does work
> when we want DBX_DEBUGGING_INFO." ?So I looked around and saw that
> debug_flush_symbol_queue and friends are only called from dbxout.c. ?So
> this patch moves them there; any inefficiency can be cleaned up at a
> later point in time. ;)
>
> Tested on x86_64-unknown-linux-gnu; verified that DBX_DEBUGGING_INFO is
> defined and therefore dbxout.c gets compile-checked. ?OK to commit?

Ok if you built any target with DBX support enabled.

Richard.

> -Nathan
>
> ? ? ? ?* debug.h (debug_flush_symbol_queue, debug_queue_symbol): Delete.
> ? ? ? ?(debug_free_queue, debug_nesting, symbol_queue_index): Delete.
> ? ? ? ?* final.c (debug_flush_symbol_queue, debug_queue_symbol):
> ? ? ? ?Move these...
> ? ? ? ?(debug_free_queue, debug_nesting, symbol_queue_index):
> ? ? ? ?...and these...
> ? ? ? ?* dbxout.c: ...to here. ?Make static.
>
> diff --git a/gcc/dbxout.c b/gcc/dbxout.c
> index 89d52a1..5ed9b69 100644
> --- a/gcc/dbxout.c
> +++ b/gcc/dbxout.c
> @@ -96,6 +96,20 @@ along with GCC; see the file COPYING3. ?If not see
> ?#include "xcoffout.h"
> ?#endif
>
> +/* When -gused is used, emit debug info for only used symbols. But in
> + ? addition to the standard intercepted debug_hooks there are some
> + ? direct calls into this file, i.e., dbxout_symbol, dbxout_parms, and
> + ? dbxout_reg_params. ?Those routines may also be called from a higher
> + ? level intercepted routine. So to prevent recording data for an inner
> + ? call to one of these for an intercept, we maintain an intercept
> + ? nesting counter (debug_nesting). We only save the intercepted
> + ? arguments if the nesting is 1. ?*/
> +static int debug_nesting = 0;
> +
> +static tree *symbol_queue;
> +static int symbol_queue_index = 0;
> +static int symbol_queue_size = 0;
> +
> ?#define DBXOUT_DECR_NESTING \
> ? if (--debug_nesting == 0 && symbol_queue_index > 0) \
> ? ? { emit_pending_bincls_if_required (); debug_flush_symbol_queue (); }
> @@ -333,6 +347,7 @@ static const char *dbxout_common_check (tree, int *);
> ?static void dbxout_global_decl (tree);
> ?static void dbxout_type_decl (tree, int);
> ?static void dbxout_handle_pch (unsigned);
> +static void debug_free_queue (void);
>
> ?/* The debug hooks structure. ?*/
> ?#if defined (DBX_DEBUGGING_INFO)
> @@ -1403,7 +1418,73 @@ dbxout_type_index (tree type)
> ?}
>
>
> +/* Generate the symbols for any queued up type symbols we encountered
> + ? while generating the type info for some originally used symbol.
> + ? This might generate additional entries in the queue. ?Only when
> + ? the nesting depth goes to 0 is this routine called. ?*/
> +
> +static void
> +debug_flush_symbol_queue (void)
> +{
> + ?int i;
> +
> + ?/* Make sure that additionally queued items are not flushed
> + ? ? prematurely. ?*/
> +
> + ?++debug_nesting;
> +
> + ?for (i = 0; i < symbol_queue_index; ++i)
> + ? ?{
> + ? ? ?/* If we pushed queued symbols then such symbols must be
> + ? ? ? ? output no matter what anyone else says. ?Specifically,
> + ? ? ? ? we need to make sure dbxout_symbol() thinks the symbol was
> + ? ? ? ? used and also we need to override TYPE_DECL_SUPPRESS_DEBUG
> + ? ? ? ? which may be set for outside reasons. ?*/
> + ? ? ?int saved_tree_used = TREE_USED (symbol_queue[i]);
> + ? ? ?int saved_suppress_debug = TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]);
> + ? ? ?TREE_USED (symbol_queue[i]) = 1;
> + ? ? ?TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]) = 0;
> +
> +#ifdef DBX_DEBUGGING_INFO
> + ? ? ?dbxout_symbol (symbol_queue[i], 0);
> +#endif
> +
> + ? ? ?TREE_USED (symbol_queue[i]) = saved_tree_used;
> + ? ? ?TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]) = saved_suppress_debug;
> + ? ?}
> +
> + ?symbol_queue_index = 0;
> + ?--debug_nesting;
> +}
>
> +/* Queue a type symbol needed as part of the definition of a decl
> + ? symbol. ?These symbols are generated when debug_flush_symbol_queue()
> + ? is called. ?*/
> +
> +static void
> +debug_queue_symbol (tree decl)
> +{
> + ?if (symbol_queue_index >= symbol_queue_size)
> + ? ?{
> + ? ? ?symbol_queue_size += 10;
> + ? ? ?symbol_queue = XRESIZEVEC (tree, symbol_queue, symbol_queue_size);
> + ? ?}
> +
> + ?symbol_queue[symbol_queue_index++] = decl;
> +}
> +
> +/* Free symbol queue. ?*/
> +static void
> +debug_free_queue (void)
> +{
> + ?if (symbol_queue)
> + ? ?{
> + ? ? ?free (symbol_queue);
> + ? ? ?symbol_queue = NULL;
> + ? ? ?symbol_queue_size = 0;
> + ? ?}
> +}
> +
> ?/* Used in several places: evaluates to '0' for a private decl,
> ? ?'1' for a protected decl, '2' for a public decl. ?*/
> ?#define DECL_ACCESSIBILITY_CHAR(DECL) \
> diff --git a/gcc/debug.h b/gcc/debug.h
> index ffdca54..efdffe1 100644
> --- a/gcc/debug.h
> +++ b/gcc/debug.h
> @@ -186,12 +186,6 @@ extern int dwarf2out_do_frame (void);
> ?extern int dwarf2out_do_cfi_asm (void);
> ?extern void dwarf2out_switch_text_section (void);
>
> -extern void debug_flush_symbol_queue (void);
> -extern void debug_queue_symbol (tree);
> -extern void debug_free_queue (void);
> -extern int debug_nesting;
> -extern int symbol_queue_index;
> -
> ?const char *remap_debug_filename (const char *);
> ?void add_debug_prefix_map (const char *);
>
> diff --git a/gcc/final.c b/gcc/final.c
> index cc7234c..3d97397 100644
> --- a/gcc/final.c
> +++ b/gcc/final.c
> @@ -4146,87 +4146,6 @@ leaf_renumber_regs_insn (rtx in_rtx)
> ? ? ? }
> ?}
> ?#endif
> -
> -
> -/* When -gused is used, emit debug info for only used symbols. But in
> - ? addition to the standard intercepted debug_hooks there are some direct
> - ? calls into this file, i.e., dbxout_symbol, dbxout_parms, and dbxout_reg_params.
> - ? Those routines may also be called from a higher level intercepted routine. So
> - ? to prevent recording data for an inner call to one of these for an intercept,
> - ? we maintain an intercept nesting counter (debug_nesting). We only save the
> - ? intercepted arguments if the nesting is 1. ?*/
> -int debug_nesting = 0;
> -
> -static tree *symbol_queue;
> -int symbol_queue_index = 0;
> -static int symbol_queue_size = 0;
> -
> -/* Generate the symbols for any queued up type symbols we encountered
> - ? while generating the type info for some originally used symbol.
> - ? This might generate additional entries in the queue. ?Only when
> - ? the nesting depth goes to 0 is this routine called. ?*/
> -
> -void
> -debug_flush_symbol_queue (void)
> -{
> - ?int i;
> -
> - ?/* Make sure that additionally queued items are not flushed
> - ? ? prematurely. ?*/
> -
> - ?++debug_nesting;
> -
> - ?for (i = 0; i < symbol_queue_index; ++i)
> - ? ?{
> - ? ? ?/* If we pushed queued symbols then such symbols must be
> - ? ? ? ? output no matter what anyone else says. ?Specifically,
> - ? ? ? ? we need to make sure dbxout_symbol() thinks the symbol was
> - ? ? ? ? used and also we need to override TYPE_DECL_SUPPRESS_DEBUG
> - ? ? ? ? which may be set for outside reasons. ?*/
> - ? ? ?int saved_tree_used = TREE_USED (symbol_queue[i]);
> - ? ? ?int saved_suppress_debug = TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]);
> - ? ? ?TREE_USED (symbol_queue[i]) = 1;
> - ? ? ?TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]) = 0;
> -
> -#ifdef DBX_DEBUGGING_INFO
> - ? ? ?dbxout_symbol (symbol_queue[i], 0);
> -#endif
> -
> - ? ? ?TREE_USED (symbol_queue[i]) = saved_tree_used;
> - ? ? ?TYPE_DECL_SUPPRESS_DEBUG (symbol_queue[i]) = saved_suppress_debug;
> - ? ?}
> -
> - ?symbol_queue_index = 0;
> - ?--debug_nesting;
> -}
> -
> -/* Queue a type symbol needed as part of the definition of a decl
> - ? symbol. ?These symbols are generated when debug_flush_symbol_queue()
> - ? is called. ?*/
> -
> -void
> -debug_queue_symbol (tree decl)
> -{
> - ?if (symbol_queue_index >= symbol_queue_size)
> - ? ?{
> - ? ? ?symbol_queue_size += 10;
> - ? ? ?symbol_queue = XRESIZEVEC (tree, symbol_queue, symbol_queue_size);
> - ? ?}
> -
> - ?symbol_queue[symbol_queue_index++] = decl;
> -}
> -
> -/* Free symbol queue. ?*/
> -void
> -debug_free_queue (void)
> -{
> - ?if (symbol_queue)
> - ? ?{
> - ? ? ?free (symbol_queue);
> - ? ? ?symbol_queue = NULL;
> - ? ? ?symbol_queue_size = 0;
> - ? ?}
> -}
>
> ?/* Turn the RTL into assembly. ?*/
> ?static unsigned int
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]