This is the mail archive of the
mailing list for the GCC project.
New dump infrastructure
- From: Sharad Singhai <singhai at google dot com>
- To: gcc <gcc at gcc dot gnu dot org>
- Cc: David Li <davidxl at google dot com>, Richard Biener <richard dot guenther at gmail dot com>
- Date: Tue, 16 Oct 2012 01:21:29 -0700
- Subject: New dump infrastructure
This is a solicitation for help in converting passes to use the new
dump infrastructure. More context below.
I have enhanced the dump infrastructure in r191883, r191884. These
patches updated the tree/rtl dump facility so that passes do not
reference the dump file directly, but instead use a different (and
hopefully cleaner) API.
Instead of this
fprintf (dump_file, ...);
the new style looks like this
if (dump_kind_p (...))
In addition, I also added a new option -fopt-info. This option allows
one to focus on high-level optimizations without scanning lots of
verbose tree/rtl dump files. Currently, the following categories of
optimization info are defined in dumpfile.c:
MSG_OPTIMIZED_LOCATIONS /* -fopt-info optimized sources */
MSG_MISSED_OPTIMIZATION /* missed opportunities */
MSG_NOTE /* general optimization info */
MSG_ALL /* Dump all available info */
The same dump API works for both regular dumps as well as -fopt-info
dumps. This is because the dump_kind_p () accepts a union of dump
flags. These flags include all of the TDF_* flags as well as newly
designed MSG_* flags.
For example, one could say
if (dump_kind_p (MSG_OPTIMIZED_LOCATIONS | TDF_BLOCKS))
This means that dump the info if either the -fopt-info-optimized or
-ftree-<pass>-blocks options is given. The dump files for these dumps
could be different, but individual passes do not need to worry about
that. It is handled transparently.
Another feature is that this new dump infrastructure allows dumps to
be redirected into command line named files (including stderr/stdout)
instead of auto generated filenames.
Since the number of existing dump call sites is quite large, currently
both old *and* new schemes are in use. The plan is to gradually
transition passes to use the new dump infrastructure and deprecate the
old dump style. This will also provide better optimization reports in
Now I am asking for help. :)
Thus far I have converted the vectorization passes to use the new dump
scheme and output optimization details using -fopt-info. However, all
other passes need help. It would be great if you could help convert
your favorite pass (or two).