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: [debuglocus] do not generate debuglocus unless -g


> hmm. I'd rather change it to check at a lower level than within the callers.
>
> It would take ever so slightly a hair longer at compile time, but it  
> keeps the same compile path which is useful.

Yeah, I thought about doing it in the callees as well, but decided
against it because of compile time.  But now that I think of it, it's
probably minimal, and keeping the same compile path is indeed helpful.

How about this?

No regressions.

	* debuglocus.c (create_debuglocus_table): Only create table when
	debugging.
	(new_debuglocus_entry): Handle empty table.
	(create_debuglocus_for_decl_and_locus): Same.
	(debuglocus_bitmap_verify): Same.
	* Makefile.in (debuglocus.o): Depend on FLAGS_H.

Index: debuglocus.c
===================================================================
--- debuglocus.c	(revision 146001)
+++ debuglocus.c	(working copy)
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3.  
 #include "debuglocus.h"
 #include "hashtab.h"
 #include "input.h"
+#include "flags.h"
 
 
 /* This file contains data and functions required to implement debuglocus 
@@ -73,6 +74,9 @@ static GTY(()) debuglocus_table_t *debug
 void
 create_debuglocus_table (void)
 {
+  if (debug_info_level < DINFO_LEVEL_NORMAL)
+    return;
+
   if (debugtable == NULL)
     debugtable = init_debuglocus_table ();
 }
@@ -139,7 +143,9 @@ new_debuglocus_entry (debuglocus_table_t
 {
   int i;
   debuglocus_p dlocus;
-  gcc_assert (tab != NULL);
+
+  if (tab == NULL)
+    return NULL;
 
   i = tab->size++;
   
@@ -303,6 +309,9 @@ debuglocus_p 
 create_debuglocus_for_decl (tree var)
 {
   debuglocus_p ptr = create_debuglocus_entry ();
+
+  if (!ptr)
+    return NULL;
   ptr->decl = var;
   return ptr;
 }
@@ -313,6 +322,9 @@ source_location
 create_debuglocus_for_decl_and_locus (tree var, source_location locus)
 {
   debuglocus_p ptr = create_debuglocus_for_decl (var);
+
+  if (!ptr)
+    return locus;
   ptr->locus = locus;
   return debuglocus_from_pointer (ptr);
 }
@@ -322,7 +334,12 @@ create_debuglocus_for_decl_and_locus (tr
 void
 replace_gimple_locus_with_debuglocus (gimple stmt, debuglocus_p dlocus)
 {
-  source_location locus = gimple_location (stmt);
+  source_location locus;
+
+  if (dlocus == NULL)
+    return;
+
+  locus = gimple_location (stmt);
 
   /* Conflicting locus's shouldn't occurr.  */
   gcc_assert (dlocus->locus == UNKNOWN_LOCATION || 
@@ -709,7 +726,10 @@ debuglocus_bitmap_verify (FILE *f, bitma
   bool first = true;
   debuglocus_table_t *tab = current_debuglocus_table ();
 
-  if (tab && flags & TDF_DETAILS)
+  if (!tab)
+    return;
+
+  if (flags & TDF_DETAILS)
     dump_debuglocus_table (f, tab);
 
   /* Dump new debuglocus entries generated in this pass.  */
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 146001)
+++ Makefile.in	(working copy)
@@ -2544,7 +2544,7 @@ dbxout.o : dbxout.c $(CONFIG_H) $(SYSTEM
    $(TOPLEV_H) $(GGC_H) $(OBSTACK_H) $(EXPR_H) gt-dbxout.h
 debug.o : debug.c debug.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
 debuglocus.o : debuglocus.c debuglocus.h $(CONFIG_H) $(SYSTEM_H) coretypes.h \
-   gt-debuglocus.h $(TM_H) $(INPUT_H)
+   gt-debuglocus.h $(TM_H) $(INPUT_H) $(FLAGS_H)
 sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) debug.h \
    $(TREE_H) $(GGC_H) $(RTL_H) $(REGS_H) $(FLAGS_H) insn-config.h \
    output.h $(TOPLEV_H) $(TM_P_H) gsyms.h langhooks.h $(TARGET_H) sdbout.h \


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