1 //===- TGTimer.cpp - TableGen Timer implementation --------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // Implement the tablegen timer class.
11 //===----------------------------------------------------------------------===//
13 #include "llvm/TableGen/TGTimer.h"
16 // These functions implement the phase timing facility. Starting a timer
17 // when one is already running stops the running one.
18 void TGTimer::startTimer(StringRef Name
) {
21 if (LastTimer
&& LastTimer
->isRunning()) {
22 LastTimer
->stopTimer();
29 LastTimer
= std::make_unique
<Timer
>("", Name
, *TimingGroup
);
30 LastTimer
->startTimer();
33 void TGTimer::stopTimer() {
37 assert(LastTimer
&& "No phase timer was started");
38 LastTimer
->stopTimer();
41 void TGTimer::startBackendTimer(StringRef Name
) {
49 void TGTimer::stopBackendTimer() {
50 if (!TimingGroup
|| !BackendTimer
)