LLVM 20.0.0git
TGTimer.h
Go to the documentation of this file.
1//===- llvm/TableGen/TGTimer.h - Class for TableGen Timer -------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the TableGen timer class. It's a thin wrapper around timer
10// support in llvm/Support/Timer.h.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TABLEGEN_TGTIMER_H
15#define LLVM_TABLEGEN_TGTIMER_H
16
17#include "llvm/ADT/StringRef.h"
18#include "llvm/Support/Timer.h"
19#include <memory>
20
21namespace llvm {
22
23// Timer related functionality f or TableGen backends.
24class TGTimer {
25private:
26 std::unique_ptr<TimerGroup> TimingGroup;
27 std::unique_ptr<Timer> LastTimer;
28 bool BackendTimer = false; // Is last timer special backend overall timer?
29
30public:
31 TGTimer() = default;
32 ~TGTimer() = default;
33
34 /// Start phase timing; called if the --time-phases option is specified.
36 TimingGroup =
37 std::make_unique<TimerGroup>("TableGen", "TableGen Phase Timing");
38 }
39
40 /// Start timing a phase. Automatically stops any previous phase timer.
42
43 /// Stop timing a phase.
44 void stopTimer();
45
46 /// Start timing the overall backend. If the backend itself starts a timer,
47 /// then this timer is cleared.
49
50 /// Stop timing the overall backend.
51 void stopBackendTimer();
52
53 /// Stop phase timing and print the report.
54 void stopPhaseTiming() { TimingGroup.reset(); }
55};
56
57} // end namespace llvm
58
59#endif // LLVM_TABLEGEN_TGTIMER_H
std::string Name
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
TGTimer()=default
void startPhaseTiming()
Start phase timing; called if the –time-phases option is specified.
Definition: TGTimer.h:35
void stopTimer()
Stop timing a phase.
Definition: TGTimer.cpp:33
void startTimer(StringRef Name)
Start timing a phase. Automatically stops any previous phase timer.
Definition: TGTimer.cpp:18
void stopPhaseTiming()
Stop phase timing and print the report.
Definition: TGTimer.h:54
~TGTimer()=default
void stopBackendTimer()
Stop timing the overall backend.
Definition: TGTimer.cpp:49
void startBackendTimer(StringRef Name)
Start timing the overall backend.
Definition: TGTimer.cpp:41
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18