diff options
author | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-06-19 01:30:31 +0000 |
---|---|---|
committer | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-06-19 01:30:31 +0000 |
commit | 161121a99b3fff74b0066f2a2d3bb9102ca55807 (patch) | |
tree | ed63d482b0f935843a41c0fe609e366f30e528ed /gcc/timevar.def | |
parent | 6ec2d11cb5e9e264bfc703303237d525f214c7a9 (diff) | |
download | gcc-161121a99b3fff74b0066f2a2d3bb9102ca55807.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188765 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/timevar.def')
-rw-r--r-- | gcc/timevar.def | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/timevar.def b/gcc/timevar.def index 1f5ea2a81bd..57d9e3f8fd7 100644 --- a/gcc/timevar.def +++ b/gcc/timevar.def @@ -33,13 +33,17 @@ /* The total execution time. */ DEFTIMEVAR (TV_TOTAL , "total time") +/* The compiler phases. These must be mutually exclusive. + Ideally, they would sum to near the total time. */ DEFTIMEVAR (TV_PHASE_SETUP , "phase setup") DEFTIMEVAR (TV_PHASE_PARSING , "phase parsing") DEFTIMEVAR (TV_PHASE_DEFERRED , "phase lang. deferred") -DEFTIMEVAR (TV_PHASE_CGRAPH , "phase cgraph") +DEFTIMEVAR (TV_PHASE_OPT_GEN , "phase opt and generate") DEFTIMEVAR (TV_PHASE_DBGINFO , "phase debug info") DEFTIMEVAR (TV_PHASE_CHECK_DBGINFO , "phase check & debug info") -DEFTIMEVAR (TV_PHASE_GENERATE , "phase generate") +DEFTIMEVAR (TV_PHASE_LATE_ASM , "phase last asm") +DEFTIMEVAR (TV_PHASE_STREAM_IN , "phase stream in") +DEFTIMEVAR (TV_PHASE_STREAM_OUT , "phase stream out") DEFTIMEVAR (TV_PHASE_FINALIZE , "phase finalize") /* Concurrent timers, indicated by "|". */ |