From 650b5fc6cb55a6e6d39f5d8e7750b34cf0a426b0 Mon Sep 17 00:00:00 2001 From: Andrea Di Biagio Date: Thu, 17 May 2018 12:27:03 +0000 Subject: [llvm-mca] add flag -all-views and flag -all-stats. Flag -all-views enables all the views. Flag -all-stats enables all the views that print hardware statistics. llvm-svn: 332602 --- llvm/tools/llvm-mca/llvm-mca.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'llvm/tools/llvm-mca/llvm-mca.cpp') diff --git a/llvm/tools/llvm-mca/llvm-mca.cpp b/llvm/tools/llvm-mca/llvm-mca.cpp index 51d6ad1d984..451ea07ceb5 100644 --- a/llvm/tools/llvm-mca/llvm-mca.cpp +++ b/llvm/tools/llvm-mca/llvm-mca.cpp @@ -154,6 +154,15 @@ static cl::opt PrintInstructionInfoView( cl::desc("Print the instruction info view (enabled by default)"), cl::cat(ViewOptions), cl::init(true)); +static cl::opt EnableAllStats("all-stats", + cl::desc("Print all hardware statistics"), + cl::cat(ViewOptions), cl::init(false)); + +static cl::opt + EnableAllViews("all-views", + cl::desc("Print all views including hardware statistics"), + cl::cat(ViewOptions), cl::init(false)); + namespace { const Target *getTarget(const char *ProgName) { @@ -273,6 +282,32 @@ public: }; } // end of anonymous namespace +static void processOptionImpl(cl::opt &O, const cl::opt &Default) { + if (!O.getNumOccurrences() || O.getPosition() < Default.getPosition()) + O = Default.getValue(); +} + +static void processViewOptions() { + if (!EnableAllViews.getNumOccurrences() && + !EnableAllStats.getNumOccurrences()) + return; + + if (EnableAllViews.getNumOccurrences()) { + processOptionImpl(PrintResourcePressureView, EnableAllViews); + processOptionImpl(PrintTimelineView, EnableAllViews); + processOptionImpl(PrintInstructionInfoView, EnableAllViews); + } + + const cl::opt &Default = + EnableAllViews.getPosition() < EnableAllStats.getPosition() + ? EnableAllStats + : EnableAllViews; + processOptionImpl(PrintRegisterFileStats, Default); + processOptionImpl(PrintDispatchStats, Default); + processOptionImpl(PrintSchedulerStats, Default); + processOptionImpl(PrintRetireStats, Default); +} + int main(int argc, char **argv) { InitLLVM X(argc, argv); @@ -309,6 +344,9 @@ int main(int argc, char **argv) { return 1; } + // Apply overrides to llvm-mca specific options. + processViewOptions(); + SourceMgr SrcMgr; // Tell SrcMgr about this buffer, which is what the parser will pick up. -- cgit v1.2.3