summaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-12 17:29:32 +0000
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-12 17:29:32 +0000
commitdd4d567f4b6b498242097c41d63666bdae320ac1 (patch)
treefa9c6420956ceaeda45b771bd1f988fdc65ddc59 /gcc/toplev.c
parent00f25bbcebad83862b4991807685338e776f84b9 (diff)
downloadgcc-dd4d567f4b6b498242097c41d63666bdae320ac1.tar.gz
Move global state in timevar.c to a new "timer" class
gcc/ChangeLog: * timevar.c (timevar_enable): Delete in favor of... (g_timer): New global. (struct timevar_def): Move to timevar.h inside class timer. (struct timevar_stack_def): Likewise. (timevars): Delete global in favor of field "m_timevars" within class timer in timevar.h (stack): Likewise, in favor of field "m_stack". (unused_stack_instances): Likewise, in favor of field "m_unused_stack_instances". (start_time): Likewise, in favor of field "m_start_time". (get_time): Eliminate check for timevar_enable. (timer::timer): New function, built from part of timevar_init. (timevar_init): Rewrite idempotency test from using "timevar_enable" bool to using dynamic allocation of "g_timer". Move rest of implementation into timer's constructor. (timevar_push_1): Rename to... (timer::push): ...this, adding "m_" prefixes to variables that are now fields of timer. (timevar_pop_1): Likewise, rename to... (timer::pop): ...this, and add "m_" prefixes. (timevar_start): Replace test for "timevar_enable" with one for "g_timer", and move bulk of implementation to... (timer::start): ...here, adding "m_" prefixes. (timevar_stop): Likewise, from here... (timer::stop): ...to here. (timevar_cond_start): Likewise, from here... (timer::cond_start): ...to here. (timevar_cond_stop): Likewise, from here... (timer::cond_stop): ...to here. (validate_phases): Rename to... (timer::validate_phases): ...this, and add "m_" prefixes. Make locals "total" and "tv" const. (timevar_print): Rename to... (timer::print): ...this, and add "m_" prefixes. Make locals "total" and "tv" const. Eliminate test for timevar_enable. * timevar.h (timevar_enable): Eliminate. (g_timer): New declaration. (timevar_push_1): Eliminate. (timevar_pop_1): Eliminate. (timevar_print): Eliminate. (class timer): New class. (timevar_push): Rewrite to use g_timer. (timevar_pop): Likewise. * toplev.c (toplev::~toplev): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223092 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 27736c29d08..9b1151b0186 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -2095,8 +2095,11 @@ toplev::toplev (bool use_TV_TOTAL, bool init_signals)
toplev::~toplev ()
{
- timevar_stop (TV_TOTAL);
- timevar_print (stderr);
+ if (g_timer)
+ {
+ g_timer->stop (TV_TOTAL);
+ g_timer->print (stderr);
+ }
}
void