![]() I noticed that, while the C/C++ frontends invoke the GENERIC match.pd simplifications to do early folding, the debug output from generic-match.cc does not appear in the -fdump-tree-original output, even with -fdump-tree-original-folding or -fdump-tree-original-all. This patch fixes that. For example, before the patch, for the following code: int a[2]; void bar (); void f() { if ((unsigned long)(a + 1) == 0) bar (); } on AArch64 at -O0, -fdump-tree-original-all would give: ;; Function f (null) ;; enabled by -tree-original { if (0) { bar (); } } After the patch, we get: Applying pattern match.pd:3774, generic-match.cc:24535 Matching expression match.pd:146, generic-match.cc:23 Applying pattern match.pd:5638, generic-match.cc:13388 ;; Function f (null) ;; enabled by -tree-original { if (0) { bar (); } } The reason we don't get the match.pd output as it stands, is that the original dump is treated specially in c-opts.cc: it gets its own state which is independent from that used by other dump files in the compiler. Like most of the compiler, the generated generic-match.cc has code of the form: if (dump_file && (dump_flags & TDF_FOLDING)) fprintf (dump_file, ...); But, as it stands, -fdump-tree-original has its own FILE * and flags in c-opts.cc (original_dump_{file,flags}) and never touches the global dump_{file,flags} (managed by dumpfile.{h,cc}). This patch adjusts the code in c-opts.cc to use the main dump infrastructure used by the rest of the compiler, instead of treating the original dump specially. We take the opportunity to make a small refactor: the code in c-gimplify.cc:c_genericize can, with this change, use the global dump infrastructure to get the original dump file and flags instead of using the bespoke get_dump_info function implemented in c-opts.cc. With this change, we remove the only use of get_dump_info, so this can be removed. Note that we also fix a leak of the original dump file in c_common_parse_file. I originally thought it might be possible to achieve this with only one static call to dump_finish () (by simply moving it earlier in the loop), but unfortunately the dump file is required to be open while c_parse_final_cleanups runs, as we (e.g.) perform some template instantiations here for C++, which need to appear in the original dump file. We adjust cgraph_node::get_create to avoid introducing noise in the original dump file: without this, these "Introduced new external node" lines start appearing in the original dump files, which breaks tests that do a scan-tree-dump-times on the original dump looking for a certain function name. gcc/c-family/ChangeLog: * c-common.h (get_dump_info): Delete. * c-gimplify.cc (c_genericize): Get TDI_original dump file info from the global dump_manager instead of the (now obsolete) get_dump_info. * c-opts.cc (original_dump_file): Delete. (original_dump_flags): Delete. (c_common_parse_file): Switch to using global dump_manager to manage the original dump file; fix leak of dump file. (get_dump_info): Delete. gcc/ChangeLog: * cgraph.cc (cgraph_node::get_create): Don't dump if the current symtab state is PARSING. |
||
---|---|---|
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
symlink-tree | ||
test-driver | ||
ylwrap |
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.