summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/TableGen/CodeGenTarget.cpp4
-rw-r--r--llvm/utils/TableGen/TableGen.cpp11
2 files changed, 15 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp
index 5dcb5e230cc..5c7be10cebc 100644
--- a/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -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!");
diff --git a/llvm/utils/TableGen/TableGen.cpp b/llvm/utils/TableGen/TableGen.cpp
index 38f81dc396c..c485ed2feb7 100644
--- a/llvm/utils/TableGen/TableGen.cpp
+++ b/llvm/utils/TableGen/TableGen.cpp
@@ -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:
OpenPOWER on IntegriCloud