diff options
author | Quentin Colombet <qcolombet@apple.com> | 2016-06-08 15:49:23 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2016-06-08 15:49:23 +0000 |
commit | a41272fb4833b6f4a472bd7aaa6ad7ca40ee8744 (patch) | |
tree | 889d2f5cc4df22608796b20e697784ee3f68c2e9 | |
parent | 6feaf82088c5b188928cde3924d484334c8c8d89 (diff) | |
download | bcm5719-llvm-a41272fb4833b6f4a472bd7aaa6ad7ca40ee8744.tar.gz bcm5719-llvm-a41272fb4833b6f4a472bd7aaa6ad7ca40ee8744.zip |
[RegBankSelect] Introduce a command line option to override the running mode.
When the command line option is set, it overrides any thing that the
target may have set. The rationale is that we get what we asked for.
Options are respectively regbankselect-fast and regbankselect-greedy for
fast and greedy mode.
llvm-svn: 272158
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp index 53472857b9a..726ef268adb 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegBankSelect.cpp @@ -18,6 +18,7 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/IR/Function.h" #include "llvm/Support/BlockFrequency.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Target/TargetSubtargetInfo.h" @@ -25,6 +26,14 @@ using namespace llvm; +static cl::opt<RegBankSelect::Mode> RegBankSelectMode( + cl::desc("Mode of the RegBankSelect pass"), cl::Hidden, cl::Optional, + cl::values(clEnumValN(RegBankSelect::Mode::Fast, "regbankselect-fast", + "Run the Fast mode (default mapping)"), + clEnumValN(RegBankSelect::Mode::Greedy, "regbankselect-greedy", + "Use the Greedy mode (best local mapping)"), + clEnumValEnd)); + char RegBankSelect::ID = 0; INITIALIZE_PASS_BEGIN(RegBankSelect, "regbankselect", "Assign register bank of generic virtual registers", @@ -39,6 +48,11 @@ RegBankSelect::RegBankSelect(Mode RunningMode) : MachineFunctionPass(ID), RBI(nullptr), MRI(nullptr), TRI(nullptr), MBFI(nullptr), MBPI(nullptr), OptMode(RunningMode) { initializeRegBankSelectPass(*PassRegistry::getPassRegistry()); + if (RegBankSelectMode.getNumOccurrences() != 0) { + OptMode = RegBankSelectMode; + if (RegBankSelectMode != RunningMode) + DEBUG(dbgs() << "RegBankSelect mode overrided by command line\n"); + } } void RegBankSelect::init(MachineFunction &MF) { |