mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[tblgen] Add a timer covering the time spent reading the Instruction defs
This patch adds a -time-regions option to tablegen that can enable timers (currently only one) that assess the performance of tablegen itself. This can be useful for identifying scaling problems with tablegen backends. This particular timer has allowed me to ignore time that is not attributed the GISel combiner pass. It's useful by itself but it is particularly useful in combination with https://reviews.llvm.org/D52954 which causes this period of time to be annotated within Xcode Instruments which in turn allows profile samples and recorded allocations attributed to reading instructions to be filtered out. llvm-svn: 353763
This commit is contained in:
parent
93c70da4ae
commit
410cbf9d39
@ -22,6 +22,8 @@ class raw_ostream;
|
||||
/// raw_ostream.
|
||||
void emitSourceFileHeader(StringRef Desc, raw_ostream &OS);
|
||||
|
||||
extern bool TimeRegions;
|
||||
|
||||
} // End llvm namespace
|
||||
|
||||
#endif
|
||||
|
@ -20,8 +20,10 @@
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Timer.h"
|
||||
#include "llvm/TableGen/Error.h"
|
||||
#include "llvm/TableGen/Record.h"
|
||||
#include "llvm/TableGen/TableGenBackend.h"
|
||||
#include <algorithm>
|
||||
using namespace llvm;
|
||||
|
||||
@ -326,6 +328,8 @@ CodeGenSchedModels &CodeGenTarget::getSchedModels() const {
|
||||
}
|
||||
|
||||
void CodeGenTarget::ReadInstructions() const {
|
||||
NamedRegionTimer T("Read Instructions", "Time spent reading instructions",
|
||||
"CodeGenTarget", "CodeGenTarget", TimeRegions);
|
||||
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
|
||||
if (Insts.size() <= 2)
|
||||
PrintFatalError("No 'Instruction' subclasses defined!");
|
||||
|
@ -55,6 +55,12 @@ enum ActionType {
|
||||
GenExegesis,
|
||||
};
|
||||
|
||||
namespace llvm {
|
||||
/// Storage for TimeRegionsOpt as a global so that backends aren't required to
|
||||
/// include CommandLine.h
|
||||
bool TimeRegions = false;
|
||||
} // end namespace llvm
|
||||
|
||||
namespace {
|
||||
cl::opt<ActionType>
|
||||
Action(cl::desc("Action to perform:"),
|
||||
@ -126,6 +132,11 @@ namespace {
|
||||
Class("class", cl::desc("Print Enum list for this class"),
|
||||
cl::value_desc("class name"), cl::cat(PrintEnumsCat));
|
||||
|
||||
cl::opt<bool, true>
|
||||
TimeRegionsOpt("time-regions",
|
||||
cl::desc("Time regions of tablegens execution"),
|
||||
cl::location(TimeRegions));
|
||||
|
||||
bool LLVMTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
|
||||
switch (Action) {
|
||||
case PrintRecords:
|
||||
|
Loading…
x
Reference in New Issue
Block a user