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]

[vta,vta4.4] Re: VTA merge - ssa (gimple, trees, tuples)


On Jun  5, 2009, Richard Guenther <richard.guenther@gmail.com> wrote:

>    (or as I suggested elsewhere enable debug stmts unconditionally in
>    the end).

This is kind of an approximation of your suggestion.

It enables -fvar-trackign-assignments to be enabled even when
-fvar-tracking isn't, such as when debug info generation is disabled.
It will then emit debug stmts, convert them to insns, maintain them
throughout compilation, and then discard them in the var-tracking pass.

The one combination it doesn't permit is compilation with -g and
traditional -fvar-tracking enabled, while also emitting, maintaining and
discarding debug insns.  I couldn't figure out a way to introduce it
without yet another command-line flag.  You think we'd miss this?

Here's what I'm installing in the VTA and VTA4.4 branches now.

for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* doc/invoke.texi (fvar-tracking-assignments): Note that it can be
	enabled with debug info generation disabled.
	* toplev.c (flag_var_tracking, flag_var_tracking_assignments):
	Update comments.
	(process_options): Don't reset flag_var_tracking_assignments.  Set
	it along with flag_var_tracking to negative as needed.
	* var-tracking.c (vt_finalize): Discard debug insns and finish if
	flag_var_tracking_assignments is negative.

Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi.orig	2009-06-11 06:12:05.000000000 -0300
+++ gcc/doc/invoke.texi	2009-06-11 06:17:58.000000000 -0300
@@ -5383,8 +5383,10 @@ the debug info format supports it.
 Annotate assignments to user variables early in the compilation and
 attempt to carry the annotations over throughout the compilation all the
 way to the end, in an attempt to improve debug information while
-optimizing.  It is verbosely disabled if it's enabled with var-tracking
-disabled.
+optimizing.
+
+It can be enabled even if var-tracking is disabled, in which case
+annotations will be created and maintained, but discarded at the end.
 
 @item -fvar-tracking-assignments-toggle
 @opindex fvar-tracking-assignments-toggle
Index: gcc/toplev.c
===================================================================
--- gcc/toplev.c.orig	2009-06-11 06:12:05.000000000 -0300
+++ gcc/toplev.c	2009-06-11 06:33:29.000000000 -0300
@@ -1,6 +1,6 @@
 /* Top level of GCC compilers (cc1, cc1plus, etc.)
    Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -319,15 +319,17 @@ int flag_dump_rtl_in_asm = 0;
    the support provided depends on the backend.  */
 rtx stack_limit_rtx;
 
-/* Nonzero if we should track variables.  When
-   flag_var_tracking == AUTODETECT_VALUE it will be set according
-   to optimize, debug_info_level and debug_hooks in process_options ().  */
+/* Positive if we should track variables, negative if we should run
+   the var-tracking pass only to discard debug annotations, zero if
+   we're not to run it.  When flag_var_tracking == AUTODETECT_VALUE it
+   will be set according to optimize, debug_info_level and debug_hooks
+   in process_options ().  */
 int flag_var_tracking = AUTODETECT_VALUE;
 
-/* Nonzero if we should track variable assignments.  When
-   flag_var_tracking_assignments == AUTODETECT_VALUE it will be set
-   according to flag_var_tracking, optimize, debug_info_level and
-   debug_hooks in process_options ().  */
+/* Positive if we should track variables at assignments, negative if
+   we should run the var-tracking pass only to discard debug
+   annotations.  When flag_var_tracking_assignments ==
+   AUTODETECT_VALUE it will be set according to flag_var_tracking.  */
 int flag_var_tracking_assignments = AUTODETECT_VALUE;
 
 /* Nonzero if we should toggle flag_var_tracking_assignments after
@@ -1953,8 +1955,7 @@ process_options (void)
       || debug_hooks->var_location == do_nothing_debug_hooks.var_location)
     {
       if (flag_var_tracking == 1
-	  || flag_var_tracking_uninit == 1
-	  || flag_var_tracking_assignments == 1)
+	  || flag_var_tracking_uninit == 1)
         {
 	  if (debug_info_level < DINFO_LEVEL_NORMAL)
 	    warning (0, "variable tracking requested, but useless unless "
@@ -1965,7 +1966,6 @@ process_options (void)
 	}
       flag_var_tracking = 0;
       flag_var_tracking_uninit = 0;
-      flag_var_tracking_assignments = 0;
     }
 
   if (flag_rename_registers == AUTODETECT_VALUE)
@@ -1979,15 +1979,10 @@ process_options (void)
     flag_var_tracking_assignments = flag_var_tracking;
 
   if (flag_var_tracking_assignments_toggle)
-    flag_var_tracking_assignments = !flag_var_tracking_assignments
-      && flag_var_tracking;
+    flag_var_tracking_assignments = !flag_var_tracking_assignments;
 
   if (flag_var_tracking_assignments && !flag_var_tracking)
-    {
-      warning (0, "variable tracking in assignments requested, "
-	       "but useless without variable tracking");
-      flag_var_tracking_assignments = 0;
-    }
+    flag_var_tracking = flag_var_tracking_assignments = -1;
 
   if (flag_tree_cselim == AUTODETECT_VALUE)
 #ifdef HAVE_conditional_move
Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c.orig	2009-06-11 06:12:05.000000000 -0300
+++ gcc/var-tracking.c	2009-06-11 06:37:45.000000000 -0300
@@ -6841,6 +6841,12 @@ vt_finalize (void)
 unsigned int
 variable_tracking_main (void)
 {
+  if (flag_var_tracking_assignments < 0)
+    {
+      delete_debug_insns ();
+      return 0;
+    }
+
   if (n_basic_blocks > 500 && n_edges / n_basic_blocks >= 20)
     {
       vt_debug_insns_local (true);

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

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