diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h --- a/llvm/include/llvm/TableGen/Record.h +++ b/llvm/include/llvm/TableGen/Record.h @@ -1829,7 +1829,7 @@ /// Stop timing a phase. void stopTimer(); - /// Start timing the overall backend. If the backend starts a timer, + /// Start timing the overall backend. If the backend itself starts a timer, /// then this timer is cleared. void startBackendTimer(StringRef Name); diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp --- a/llvm/lib/Support/Timer.cpp +++ b/llvm/lib/Support/Timer.cpp @@ -53,6 +53,11 @@ InfoOutputFilename("info-output-file", cl::value_desc("filename"), cl::desc("File to append -stats and -timer output to"), cl::Hidden, cl::location(getLibSupportInfoOutputFilename())); + + static cl::opt + SortTimers("sort-timers", cl::desc("In the report, sort the timers in each group " + "in wall clock time order"), + cl::init(true), cl::Hidden); } std::unique_ptr llvm::CreateInfoOutputFile() { @@ -301,8 +306,9 @@ } void TimerGroup::PrintQueuedTimers(raw_ostream &OS) { - // Sort the timers in descending order by amount of time taken. - llvm::sort(TimersToPrint); + // Perhaps sort the timers in descending order by amount of time taken. + if (SortTimers) + llvm::sort(TimersToPrint); TimeRecord Total; for (const PrintRecord &Record : TimersToPrint) diff --git a/llvm/utils/TableGen/DAGISelEmitter.cpp b/llvm/utils/TableGen/DAGISelEmitter.cpp --- a/llvm/utils/TableGen/DAGISelEmitter.cpp +++ b/llvm/utils/TableGen/DAGISelEmitter.cpp @@ -189,6 +189,7 @@ namespace llvm { void EmitDAGISel(RecordKeeper &RK, raw_ostream &OS) { + RK.startTimer("Parse patterns"); DAGISelEmitter(RK).run(OS); }