This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[vta] add -fmin-insn-uid=@{uid}
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 03 Jan 2008 03:25:52 -0200
- Subject: [vta] add -fmin-insn-uid=@{uid}
This message starts a large series of patches I wrote last year, that
got bootstrap-debug bootstrap4-debug(g0) to pass on i686-pc-linux-gnu,
ia64-linux-gnu and ppc64-linux-gnu, in addition to x86_64-linux-gnu
that passed before.
It's much easier to compare debug dumps when insn uids don't vary
because of debug insns. Instead of trying to keep non-debug insns at
the standard range and moving debug insns out of the way, I found it
much simpler and more efficient to add a command-line option that
moved the non-debug insns to another range and let debug insns pay the
extra cost of having to check for overlaps.
I realize abuse of this option will grow some arrays and slow things
down, but this is just to debug the compiler, so it should be fine.
Memory impact with the option disabled is very small (one int per
function).
Installing in the vta branch.
for gcc/ChangeLog.vta
from Alexandre Oliva <aoliva@redhat.com>
* common.opt (fmin-insn-uid=): New.
* emit-rtl (cur_debug_insn_uid): New macro.
(set_new_first_and_last_insn): Set it.
(make_debug_insn_raw): Use it.
(init_emit): Initialize it.
* function.h (struct emit_status): Add x_cur_debug_insn_uid.
* doc/invoke.texi (-fmin-insn-uid=): Document it.
Index: gcc/common.opt
===================================================================
--- gcc/common.opt.orig 2007-11-23 18:05:54.000000000 -0200
+++ gcc/common.opt 2007-12-27 22:21:20.000000000 -0200
@@ -665,6 +665,10 @@ fmessage-length=
Common RejectNegative Joined UInteger
-fmessage-length=<number> Limit diagnostics to <number> characters per line. 0 suppresses line-wrapping
+fmin-insn-uid=
+Common RejectNegative Var(flag_min_insn_uid) Init(0) Joined UInteger
+Use insn uids above the given value for non-debug insns.
+
fmodulo-sched
Common Report Var(flag_modulo_sched) Optimization
Perform SMS based modulo scheduling before the first scheduling pass
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c.orig 2007-11-23 18:05:54.000000000 -0200
+++ gcc/emit-rtl.c 2007-12-27 22:45:02.000000000 -0200
@@ -171,6 +171,7 @@ static GTY ((if_marked ("ggc_marked_p"),
#define first_insn (cfun->emit->x_first_insn)
#define last_insn (cfun->emit->x_last_insn)
#define cur_insn_uid (cfun->emit->x_cur_insn_uid)
+#define cur_debug_insn_uid (cfun->emit->x_cur_debug_insn_uid)
#define last_location (cfun->emit->x_last_location)
#define first_label_num (cfun->emit->x_first_label_num)
@@ -2184,8 +2185,22 @@ set_new_first_and_last_insn (rtx first,
last_insn = last;
cur_insn_uid = 0;
- for (insn = first; insn; insn = NEXT_INSN (insn))
- cur_insn_uid = MAX (cur_insn_uid, INSN_UID (insn));
+ if (flag_min_insn_uid)
+ {
+ cur_insn_uid = flag_min_insn_uid - 1;
+ cur_debug_insn_uid = 0;
+
+ for (insn = first; insn; insn = NEXT_INSN (insn))
+ if (INSN_UID (insn) < flag_min_insn_uid)
+ cur_debug_insn_uid = MAX (cur_debug_insn_uid, INSN_UID (insn));
+ else
+ cur_insn_uid = MAX (cur_insn_uid, INSN_UID (insn));
+
+ cur_debug_insn_uid++;
+ }
+ else
+ for (insn = first; insn; insn = NEXT_INSN (insn))
+ cur_insn_uid = MAX (cur_insn_uid, INSN_UID (insn));
cur_insn_uid++;
}
@@ -3466,7 +3481,9 @@ make_debug_insn_raw (rtx pattern)
rtx insn;
insn = rtx_alloc (DEBUG_INSN);
- INSN_UID (insn) = cur_insn_uid++;
+ INSN_UID (insn) = cur_debug_insn_uid < flag_min_insn_uid
+ ? cur_debug_insn_uid++
+ : cur_insn_uid++;
PATTERN (insn) = pattern;
INSN_CODE (insn) = -1;
@@ -5296,7 +5313,11 @@ init_emit (void)
f->emit = ggc_alloc (sizeof (struct emit_status));
first_insn = NULL;
last_insn = NULL;
- cur_insn_uid = 1;
+ if (flag_min_insn_uid)
+ cur_insn_uid = flag_min_insn_uid;
+ else
+ cur_insn_uid = 1;
+ cur_debug_insn_uid = 1;
reg_rtx_no = LAST_VIRTUAL_REGISTER + 1;
last_location = UNKNOWN_LOCATION;
first_label_num = label_num;
Index: gcc/function.h
===================================================================
--- gcc/function.h.orig 2007-11-23 18:05:53.000000000 -0200
+++ gcc/function.h 2007-12-27 22:28:29.000000000 -0200
@@ -64,6 +64,10 @@ struct emit_status GTY(())
Reset to 1 for each function compiled. */
int x_cur_insn_uid;
+ /* INSN_UID for next debug insn emitted. Only used if
+ -fmin-debug-insn-uid=<value> is given with nonzero value. */
+ int x_cur_debug_insn_uid;
+
/* Location the last line-number NOTE emitted.
This is used to avoid generating duplicates. */
location_t x_last_location;
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi.orig 2007-11-23 17:41:22.000000000 -0200
+++ gcc/doc/invoke.texi 2007-12-27 22:33:46.000000000 -0200
@@ -299,10 +299,11 @@ Objective-C and Objective-C++ Dialects}.
-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
-feliminate-unused-debug-symbols -femit-class-debug-always @gol
--fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
+-fmem-report -fmin-insn-uid=@var{uid} @gol
+-fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
-ftest-coverage -ftime-report -fvar-tracking @gol
--fvar-tracking-assigments -g -g@var{level} -gcoff -gdwarf-2 @gol
+-fvar-tracking-assigments -g -g@var{level} -gcoff -gdwarf-2 @gol
-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
-fdebug-prefix-map=@var{old}=@var{new} @gol
-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
@@ -4223,6 +4224,14 @@ pass when it finishes.
Makes the compiler print some statistics about permanent memory
allocation when it finishes.
+@item -fmin-insn-uid=@var{uid}
+@opindex fmin-insn-uid
+Use uids starting at @var{uid} for non-debug insns created by
+@option{-fvar-tracking-assignments}. The range below @var{uid} is
+reserved exclusively for debug insns, but debug insns may get
+(non-overlapping) uids above @var{uid} if the reserved range is
+exhausted.
+
@item -fpre-ipa-mem-report
@opindex fpre-ipa-mem-report
@item -fpost-ipa-mem-report
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}