Find a file
Lawrence Crowl a910399dfd The intent of the phases was to have a high-level but mutually exclusive accounting of compile time.
The intent of the phases was to have a high-level but mutually exclusive
accounting of compile time.  We want to track compile time in a way that
tells us which conceptual phases are taking the most time.  That intent
is not currently satisfied.  This patch restores that intent.

Add code to verify that the sum of the phase times is less than the total
time, to detect when phases are overlapped.  A slight amount of leeway is
required due to time jitters.  This verification is done as the last step
in printing timevars so that any timevar information is not lost.

Rename the phases to be clearer about what they measure, so that they
are less likely to be modified to be overlapping.  The primary example
is to change TV_PHASE_GENERATE to TV_PHASE_LATE_ASM, meaning late work
on the assembly.  This name change avoids confusion n moving the timevar
start call after the call to lang_hooks.decls.final_write_globals, which
prevents overlapping phases.

Each implementation of lang_hooks.decls.final_write_globals, is responsible
for starting and stopping its own phases.  Each implementation currently has
a first phase of TV_PHASE_DEFERRED for front-end work deferred until after
parsing is complete.  The second phase has been renamed from TV_PHASE_CGRAPH
to TV_PHASE_OPT_GEN, to better reflect its use as the main optimization
and generation phase.  This phase accounts for 70%-80% of compilation time
during bootstrap.  The third phase is TV_PHASE_DBGINFO, except in cp/decl2.c,
where it is TV_PHASE_CHECK_DBGINFO because cc1plus mixes checking in with
debug info generation.  In langhooks.c, write_global_declarations was
using TV_PHASE_CHECK_DBGINFO, but it was doing no checking.  So, it now
uses TV_PHASE_DBGINFO.

The changes to LTO are significant.  First, initialization now uses
TV_PHASE_SETUP.  Reading files now uses TV_PHASE_STREAM_IN.  Writing files
now uses TV_PHASE_STREAM_OUT.  The remaining phase is TV_PHASE_OPT_GEN
(formerly TV_PHASE_CGRAPH).  Finally, because LTO is treated as a front
end, TV_PHASE_PARSING and TV_PARSE_GLOBAL active around it.  It is not
parsing, and so those timers should not be active.  Rather than make all
front ends manage them, we turn them off as the first thing in LTO and turn
them back on as the last thing.

Tested on x86_64.


Index: gcc/ChangeLog

2012-06-18  Lawrence Crowl  <crowl@google.com>

	* timevar.def (TV_PHASE_GENERATE): Rename to TV_PHASE_LATE_ASM.
	(TV_PHASE_CGRAPH): Rename to TV_PHASE_OPT_GEN.
	(TV_PHASE_STREAM_IN): New.
	(TV_PHASE_STREAM_OUT): New.
	* timevar.c (validate_phases): New.
	(timevar_print): Call validate_phases.
	* c-decl.c (c_write_global_declarations): Rename use of TV_PHASE_CGRAPH
	to TV_PHASE_OPT_GEN.
	* langhooks.c (write_global_declarations): Rename use of
	TV_PHASE_CGRAPH to TV_PHASE_OPT_GEN.  Use TV_PHASE_DBGINFO instead of
	TV_PHASE_CHECK_DBGINFO.
	* toplev.c (compile_file): Rename use of TV_PHASE_GENERATE to
	TV_PHASE_LATE_ASM.  Move start of TV_PHASE_LATE_ASM to after call to
	lang_hooks.decls.final_write_globals.

Index: gcc/cp/ChangeLog

2012-06-18  Lawrence Crowl  <crowl@google.com>

	* decl2.c (cp_write_global_declarations): Rename use of TV_PHASE_CGRAPH
	to TV_PHASE_OPT_GEN.

Index: gcc/lto/ChangeLog

2012-06-18  Lawrence Crowl  <crowl@google.com>

        * lto.c (do_whole_program_analysis):  Rename use of TV_PHASE_CGRAPH to
	TV_PHASE_OPT_GEN.  Use new timevar TV_PHASE_STREAM_OUT around the call
	to lto_wpa_write_files.
	(lto_main):  Rename use of TV_PHASE_CGRAPH to TV_PHASE_OPT_GEN.  Move
	start of TV_PHASE_OPT_GEN to include call to materialize_cgraph.  Use
	TV_PHASE_SETUP for the call to lto_init.  Use new timevar
	TV_PHASE_STREAM_IN around the call to read_cgraph_and_symbols.
	Turn TV_PHASE_PARSING off then back on again, because LTO is pretending
	to be a front end, but is not one.

From-SVN: r188765
2012-06-19 01:30:31 +00:00
boehm-gc Regenerate configure files for libtool.m4 change 2012-05-16 15:11:18 -07:00
config mt-sde: Fix typos. 2012-05-29 16:54:57 +01:00
contrib The new mklog script prints three spaces after the date part, which is wrong. 2012-06-06 08:50:55 -04:00
fixincludes configure.ac: Use GCC_AC_FUNC_MMAP_BLACKLIST instead of gcc_AC_FUNC_MMAP_BLACKLIST. 2012-05-29 21:28:57 +02:00
gcc The intent of the phases was to have a high-level but mutually exclusive accounting of compile time. 2012-06-19 01:30:31 +00:00
gnattools Remove obsolete IRIX 6.5 support 2012-03-14 16:33:37 +00:00
include * dwarf2.def (DW_OP): Add DW_OP_GNU_const_index. 2012-06-18 23:35:08 +00:00
INSTALL
intl
libada Makefile.in (GNATLIBCFLAGS_FOR_C): Remove $(PIC_FLAG_FOR_TARGET). 2012-06-11 15:24:12 +00:00
libatomic re PR other/53231 (libatomic/tas_n.c💯10: error: 'ret' undeclared (first use in this function)) 2012-05-22 23:54:32 +00:00
libcpp * cpplib.pot: Regenerate. 2012-06-13 22:48:00 +01:00
libdecnumber warnings.m4 (ACX_PROG_CC_WARNING_OPTS): Avoid leading dash in expr call. 2011-12-20 16:54:12 +00:00
libffi Regenerate configure files for libtool.m4 change 2012-05-16 15:11:18 -07:00
libgcc sfp-machine.h (FP_HANDLE_EXCEPTIONS): Use __builtin_expect when checking for exceptions. 2012-06-17 15:54:53 +02:00
libgfortran PR 53456 Fix incorrect ChangeLog entry. 2012-06-04 22:15:21 +03:00
libgo compiler, reflect: Quote package path with tabs. 2012-06-14 05:04:04 +00:00
libgomp re PR c/53580 (Internal Segmentation fault in nested "omp parallel", "omp parallel for" and "omp parallel for reduction" Directives) 2012-06-07 08:36:55 +02:00
libiberty demangle-expected: Add regression test. 2012-05-22 13:55:02 +00:00
libitm eh_cpp.cc: Fix __cxa_end_catch declaration. 2012-05-21 22:48:00 +00:00
libjava locks.h (compare_and_swap): Use __sync_bool_compare_and_swap. 2012-06-15 08:08:04 +00:00
libmudflap * mf-impl.h: Fix typo. 2012-05-29 20:21:05 +01:00
libobjc Regenerate configure files for libtool.m4 change 2012-05-16 15:11:18 -07:00
libquadmath re PR target/51007 (Quadmath I/O doesn't work on MinGW) 2012-05-31 18:51:27 +00:00
libssp re PR target/51007 (Quadmath I/O doesn't work on MinGW) 2012-05-31 18:51:27 +00:00
libstdc++-v3 re PR libstdc++/53678 (namespace pollution on NetBSD) 2012-06-18 22:43:58 +01:00
lto-plugin * lto-plugin.c: Fix typo. 2012-05-29 20:21:25 +01:00
maintainer-scripts crontab: Enable snapshots from gcc-4_7-branch. 2012-03-22 09:25:49 +00:00
zlib Regenerate configure files for libtool.m4 change 2012-05-16 15:11:18 -07:00
ABOUT-NLS
ChangeLog * ChangeLog: Fix whitespace. 2012-06-13 12:43:26 +02:00
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub Update config.sub to 2012-04-18 version from official repo. 2012-04-25 15:48:28 +00:00
configure re PR bootstrap/50461 (mpfr.h found in mpfr-3.1.0/src instead of mpfr-3.0.1/. as previously) 2012-05-09 16:20:17 +00:00
configure.ac re PR bootstrap/50461 (mpfr.h found in mpfr-3.1.0/src instead of mpfr-3.0.1/. as previously) 2012-05-09 16:20:17 +00:00
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
depcomp
install-sh
libtool-ldflags
libtool.m4 Add x32 support to libtool.m4 2012-05-15 09:07:28 -07:00
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
MAINTAINERS MAINTAINERS (Write After Approval): Add myself. 2012-05-29 20:18:29 +00:00
Makefile.def Add libatomic as a target library. 2012-05-01 08:48:28 -07:00
Makefile.in Makefile.tpl (gcc-no-fixedincludes): Rename into ... 2012-05-16 13:37:14 +00:00
Makefile.tpl Makefile.tpl (gcc-no-fixedincludes): Rename into ... 2012-05-16 13:37:14 +00:00
missing
mkdep
mkinstalldirs
move-if-change
README
symlink-tree
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.