@@ -51,6 +51,7 @@ class RecordVal;
5151class Resolver ;
5252class StringInit ;
5353class TypedInit ;
54+ class TGTimer ;
5455
5556// ===----------------------------------------------------------------------===//
5657// Type Classes
@@ -1785,11 +1786,13 @@ class Record {
17851786 }
17861787
17871788 RecordVal *getValue (const Init *Name) {
1788- return const_cast <RecordVal *>(static_cast <const Record *>(this )->getValue (Name));
1789+ return const_cast <RecordVal *>(
1790+ static_cast <const Record *>(this )->getValue (Name));
17891791 }
17901792
17911793 RecordVal *getValue (StringRef Name) {
1792- return const_cast <RecordVal *>(static_cast <const Record *>(this )->getValue (Name));
1794+ return const_cast <RecordVal *>(
1795+ static_cast <const Record *>(this )->getValue (Name));
17931796 }
17941797
17951798 void addTemplateArg (Init *Name) {
@@ -2033,29 +2036,7 @@ class RecordKeeper {
20332036
20342037 Init *getNewAnonymousName ();
20352038
2036- // / Start phase timing; called if the --time-phases option is specified.
2037- void startPhaseTiming () {
2038- TimingGroup = new TimerGroup (" TableGen" , " TableGen Phase Timing" );
2039- }
2040-
2041- // / Start timing a phase. Automatically stops any previous phase timer.
2042- void startTimer (StringRef Name) const ;
2043-
2044- // / Stop timing a phase.
2045- void stopTimer ();
2046-
2047- // / Start timing the overall backend. If the backend itself starts a timer,
2048- // / then this timer is cleared.
2049- void startBackendTimer (StringRef Name);
2050-
2051- // / Stop timing the overall backend.
2052- void stopBackendTimer ();
2053-
2054- // / Stop phase timing and print the report.
2055- void stopPhaseTiming () {
2056- if (TimingGroup)
2057- delete TimingGroup;
2058- }
2039+ TGTimer &getTimer () const { return *Timer; }
20592040
20602041 // ===--------------------------------------------------------------------===//
20612042 // High-level helper methods, useful for tablegen backends.
@@ -2089,16 +2070,9 @@ class RecordKeeper {
20892070 mutable std::map<std::string, std::vector<const Record *>> Cache;
20902071 GlobalMap ExtraGlobals;
20912072
2092- // TODO: Move timing related code out of RecordKeeper.
2093- // These members are for the phase timing feature. We need a timer group,
2094- // the last timer started, and a flag to say whether the last timer
2095- // is the special "backend overall timer."
2096- mutable TimerGroup *TimingGroup = nullptr ;
2097- mutable Timer *LastTimer = nullptr ;
2098- mutable bool BackendTimer = false ;
2099-
21002073 // / The internal uniquer implementation of the RecordKeeper.
21012074 std::unique_ptr<detail::RecordKeeperImpl> Impl;
2075+ std::unique_ptr<TGTimer> Timer;
21022076};
21032077
21042078// / Sorting predicate to sort record pointers by name.
0 commit comments