diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-05-17 12:27:03 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-05-17 12:27:03 +0000 |
commit | 650b5fc6cb55a6e6d39f5d8e7750b34cf0a426b0 (patch) | |
tree | 9dd282709d9e8e8ec14933bde448e7a6e012e022 /llvm/tools/llvm-mca/llvm-mca.cpp | |
parent | 448550d947e74912b8a3b49db517ab793e96d027 (diff) | |
download | bcm5719-llvm-650b5fc6cb55a6e6d39f5d8e7750b34cf0a426b0.tar.gz bcm5719-llvm-650b5fc6cb55a6e6d39f5d8e7750b34cf0a426b0.zip |
[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
Diffstat (limited to 'llvm/tools/llvm-mca/llvm-mca.cpp')
-rw-r--r-- | llvm/tools/llvm-mca/llvm-mca.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
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<bool> PrintInstructionInfoView( cl::desc("Print the instruction info view (enabled by default)"), cl::cat(ViewOptions), cl::init(true)); +static cl::opt<bool> EnableAllStats("all-stats", + cl::desc("Print all hardware statistics"), + cl::cat(ViewOptions), cl::init(false)); + +static cl::opt<bool> + 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<bool> &O, const cl::opt<bool> &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<bool> &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. |