This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[vta] introduce -fverbose-cselib
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 01 Mar 2009 03:27:42 -0300
- Subject: [vta] introduce -fverbose-cselib
Long ago, while working on the var-tracking pass to turn debug insns
into var-tracking's VAR_LOCATION notes output, using cselib, I added a
lot of debug output to cselib and var-tracking.
Having spent a lot of time debugging sel-sched on IA64, the huge
uninteresting dumps got kind of annoying, causing diffs between debug
and non-debug dumps to be huge and very slow to compute. (On IA64,
scheduling and var-tracking are performed as part of the mach pass)
Eventually I got tired of this and silenced the dumps I'd added, but
introducing a command-line option to enable it.
Here's the patch that does this. I'm installing it in the branch.
for gcc/ChangeLog.vta
from Alexandre Oliva <aoliva@redhat.com>
* common.opt (fverbose-cselib): New.
* cselib.c (new_cselib_val, expand_loc): Honor it.
(cselib_expand_value_rtx_1): Likewise.
(cselib_subst_to_values): Likewise.
* doc/invoke.texi: Document it.
* var-tracking.c (val_resolve): Honor it.
(dataflow_set_different_1): Likewise.
(dataflow_set_different_2): Likewise.
(count_uses, add_uses, add_stores, add_with_sets): Likewise.
(vt_find_locations, vt_initialize): Likewise.
Index: gcc/common.opt
===================================================================
--- gcc/common.opt.orig 2009-01-14 01:46:14.000000000 -0200
+++ gcc/common.opt 2009-01-14 01:55:02.000000000 -0200
@@ -1,6 +1,6 @@
; Options for the language- and target-independent parts of the compiler.
-; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
+; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
; Free Software Foundation, Inc.
;
; This file is part of GCC.
@@ -1379,6 +1379,10 @@ fverbose-asm
Common Report Var(flag_verbose_asm)
Add extra commentary to assembler output
+fverbose-cselib
+Common Var(flag_verbose_cselib)
+Add a lot of information to dumps of passes that use cselib.
+
fvisibility=
Common Joined RejectNegative
-fvisibility=[default|internal|hidden|protected] Set the default symbol visibility
Index: gcc/cselib.c
===================================================================
--- gcc/cselib.c.orig 2009-01-14 01:46:14.000000000 -0200
+++ gcc/cselib.c 2009-01-14 01:46:27.000000000 -0200
@@ -1,6 +1,6 @@
/* Common subexpression elimination library for GNU compiler.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008
+ 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
@@ -867,7 +867,7 @@ new_cselib_val (unsigned int value, enum
e->locs = 0;
e->next_containing_mem = 0;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
fprintf (dump_file, "cselib value %u ", value);
if (flag_dump_noaddr || flag_dump_unnumbered)
@@ -978,7 +978,7 @@ expand_loc (struct elt_loc_list *p, stru
else if (!REG_P (p->loc))
{
rtx result;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
print_inline_rtx (dump_file, p->loc, 0);
fprintf (dump_file, "\n");
@@ -993,7 +993,7 @@ expand_loc (struct elt_loc_list *p, stru
if (regno != UINT_MAX)
{
rtx result;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
fprintf (dump_file, "r%d\n", regno);
result = cselib_expand_value_rtx_1 (reg_result, evd, max_depth - 1);
@@ -1001,7 +1001,7 @@ expand_loc (struct elt_loc_list *p, stru
return result;
}
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
if (reg_result)
{
@@ -1115,7 +1115,7 @@ cselib_expand_value_rtx_1 (rtx orig, str
bitmap_set_bit (evd->regs_active, regno);
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
fprintf (dump_file, "expanding: r%d into: ", regno);
result = expand_loc (l->elt->locs, evd, max_depth);
@@ -1152,7 +1152,7 @@ cselib_expand_value_rtx_1 (rtx orig, str
case VALUE:
{
rtx result;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
fputs ("\nexpanding ", dump_file);
print_rtl_single (dump_file, orig);
@@ -1178,7 +1178,7 @@ cselib_expand_value_rtx_1 (rtx orig, str
&& GET_MODE (orig) != VOIDmode)
{
result = gen_rtx_CONST (GET_MODE (orig), result);
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
fprintf (dump_file, " wrapping const_int result in const to preserve mode %s\n",
GET_MODE_NAME (GET_MODE (orig)));
}
@@ -1351,7 +1351,7 @@ cselib_subst_to_values (rtx x)
static cselib_val *
cselib_log_lookup (rtx x, cselib_val *ret)
{
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
fputs ("cselib lookup ", dump_file);
print_inline_rtx (dump_file, x, 2);
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi.orig 2009-01-14 01:46:14.000000000 -0200
+++ gcc/doc/invoke.texi 2009-01-14 01:46:27.000000000 -0200
@@ -1,5 +1,5 @@
@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-@c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+@c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
@c Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@@ -11,7 +11,7 @@
@c man begin COPYRIGHT
Copyright @copyright{} 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.
Permission is granted to copy, distribute and/or modify this document
@@ -311,7 +311,7 @@ Objective-C and Objective-C++ Dialects}.
-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
-ftest-coverage -ftime-report -fvar-tracking @gol
-fvar-tracking-assigments -fvar-tracking-assignments-toggle @gol
--g -g@var{level} -gtoggle @gol
+-fverbose-cselib -g -g@var{level} -gtoggle @gol
-gcoff -gdwarf-2 -ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
-fdebug-prefix-map=@var{old}=@var{new} @gol
@@ -5166,6 +5166,11 @@ disabled.
Toggle @option{-fvar-tracking-assignments}, in the same way that
@option{-gtoggle} toggles @option{-g}.
+@item -fverbose-cselib
+@opindex fverbose-cselib
+Cause cselib to add a lot of information to the dump files of passes
+that use it, if dumping is enabled on such passes.
+
@item -print-file-name=@var{library}
@opindex print-file-name
Print the full absolute name of the library file @var{library} that
Index: gcc/var-tracking.c
===================================================================
--- gcc/var-tracking.c.orig 2008-12-10 03:19:23.000000000 -0200
+++ gcc/var-tracking.c 2009-01-14 02:17:14.000000000 -0200
@@ -1,5 +1,5 @@
/* Variable tracking routines for the GNU compiler.
- Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008
+ Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
@@ -1329,7 +1329,7 @@ val_resolve (dataflow_set *set, rtx val,
decl_or_value dv = dv_from_value (val);
void **slot;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
fprintf (dump_file, "%i: ", INSN_UID (insn));
print_inline_rtx (dump_file, val, 0);
@@ -2800,7 +2800,7 @@ dataflow_set_different_1 (void **slot, v
{
dataflow_set_different_value = true;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
fprintf (dump_file, "dataflow difference found: removal of:\n");
dump_variable (var1);
@@ -2814,7 +2814,7 @@ dataflow_set_different_1 (void **slot, v
{
dataflow_set_different_value = true;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
fprintf (dump_file, "dataflow difference found: old and new follow:\n");
dump_variable (var1);
@@ -2845,7 +2845,7 @@ dataflow_set_different_2 (void **slot, v
{
dataflow_set_different_value = true;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
fprintf (dump_file, "dataflow difference found: addition of:\n");
dump_variable (var1);
@@ -3298,7 +3298,7 @@ count_uses (rtx *loc, void *cuip)
VTI (cui->bb)->n_mos++;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (*loc, cui->bb, cui->insn, mopt, dump_file);
switch (mopt)
@@ -3446,7 +3446,7 @@ add_uses (rtx *loc, void *data)
mo->type = MO_VAL_USE;
mloc = cselib_subst_to_values (XEXP (mloc, 0));
mo->u.loc = gen_rtx_CONCAT (Pmode, val->val_rtx, mloc);
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (mo->u.loc, cui->bb, cui->insn,
mo->type, dump_file);
mo = mon;
@@ -3514,7 +3514,7 @@ add_uses (rtx *loc, void *data)
mloc = cselib_subst_to_values (XEXP (mloc, 0));
mo->u.loc = gen_rtx_CONCAT (Pmode, val->val_rtx, mloc);
mo->insn = cui->insn;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (mo->u.loc, cui->bb, cui->insn,
mo->type, dump_file);
mo = mon;
@@ -3563,7 +3563,7 @@ add_uses (rtx *loc, void *data)
else
gcc_assert (type == MO_USE || type == MO_USE_NO_VAR);
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (mo->u.loc, cui->bb, cui->insn, mo->type, dump_file);
}
@@ -3654,7 +3654,7 @@ add_stores (rtx loc, const_rtx expr, voi
mloc = cselib_subst_to_values (XEXP (mloc, 0));
mo->u.loc = gen_rtx_CONCAT (Pmode, val->val_rtx, mloc);
mo->insn = cui->insn;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (mo->u.loc, cui->bb, cui->insn,
mo->type, dump_file);
mo = VTI (bb)->mos + VTI (bb)->n_mos++;
@@ -3772,7 +3772,7 @@ add_stores (rtx loc, const_rtx expr, voi
mo->type = MO_VAL_SET;
log_and_return:
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (mo->u.loc, cui->bb, cui->insn, mo->type, dump_file);
}
@@ -3827,7 +3827,7 @@ add_with_sets (rtx insn, struct cselib_s
mo->type = MO_CALL;
mo->insn = insn;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (PATTERN (insn), bb, insn, mo->type, dump_file);
}
@@ -4309,7 +4309,7 @@ vt_find_locations (void)
changed = compute_bb_dataflow (bb);
htabsz += VTI (bb)->in.vars->size + VTI (bb)->out.vars->size;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
fprintf (dump_file,
"BB %i: in %i, out %i, tsz %i, rem %i\n",
bb->index, (int)VTI (bb)->in.vars->n_elements,
@@ -4318,7 +4318,7 @@ vt_find_locations (void)
if (changed)
{
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
fprintf (dump_file, "BB %i ->", bb->index);
FOR_EACH_EDGE (e, ei, bb->succs)
@@ -4326,7 +4326,7 @@ vt_find_locations (void)
if (e->dest == EXIT_BLOCK_PTR)
continue;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
fprintf (dump_file, " %i", e->dest->index);
if (TEST_BIT (visited, e->dest->index))
@@ -4349,11 +4349,11 @@ vt_find_locations (void)
}
}
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
fputc ('\n', dump_file);
}
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
fprintf (dump_file, "BB %i IN:\n", bb->index);
dump_dataflow_set (&VTI (bb)->in);
@@ -4367,7 +4367,7 @@ vt_find_locations (void)
if (MAY_HAVE_DEBUG_INSNS
&& merge_with_missing_1pdv_as_union)
{
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
fprintf (dump_file,
"dataflow union completed, starting dataflow merge\n");
goto repeat_with_intersect;
@@ -5768,7 +5768,7 @@ vt_initialize (void)
if (MAY_HAVE_DEBUG_INSNS)
{
cselib_record_sets_hook = count_with_sets;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
fprintf (dump_file, "first value: %i\n",
cselib_get_next_unknown_value ());
}
@@ -5786,14 +5786,14 @@ vt_initialize (void)
if (pre)
{
VTI (bb)->n_mos++;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (GEN_INT (pre), bb, insn,
MO_ADJUST, dump_file);
}
if (post)
{
VTI (bb)->n_mos++;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (GEN_INT (post), bb, insn,
MO_ADJUST, dump_file);
}
@@ -5802,7 +5802,7 @@ vt_initialize (void)
if (MAY_HAVE_DEBUG_INSNS)
{
cselib_process_insn (insn);
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
print_rtl_single (dump_file, insn);
dump_cselib_table (dump_file);
@@ -5813,7 +5813,7 @@ vt_initialize (void)
if (CALL_P (insn))
{
VTI (bb)->n_mos++;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (PATTERN (insn), bb, insn,
MO_CALL, dump_file);
}
@@ -5828,7 +5828,7 @@ vt_initialize (void)
next_value_after = cselib_get_next_unknown_value ();
cselib_reset_table_with_next_value (next_value_before);
cselib_record_sets_hook = add_with_sets;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
fprintf (dump_file, "first value: %i\n",
cselib_get_next_unknown_value ());
}
@@ -5852,7 +5852,7 @@ vt_initialize (void)
mo->u.adjust = pre;
mo->insn = insn;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (PATTERN (insn), bb, insn,
MO_ADJUST, dump_file);
}
@@ -5862,7 +5862,7 @@ vt_initialize (void)
if (MAY_HAVE_DEBUG_INSNS)
{
cselib_process_insn (insn);
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
{
print_rtl_single (dump_file, insn);
dump_cselib_table (dump_file);
@@ -5879,7 +5879,7 @@ vt_initialize (void)
mo->u.adjust = post;
mo->insn = insn;
- if (dump_file)
+ if (dump_file && flag_verbose_cselib)
log_op_type (PATTERN (insn), bb, insn,
MO_ADJUST, dump_file);
}
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
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