diff options
| author | Volkan Keles <vkeles@apple.com> | 2018-01-17 22:34:21 +0000 |
|---|---|---|
| committer | Volkan Keles <vkeles@apple.com> | 2018-01-17 22:34:21 +0000 |
| commit | a79b0620a08d94a58fd48787e78cc83924632ad8 (patch) | |
| tree | 87ae63a1b25d6e521c7873f30434846ed2d7e57f /llvm/lib/CodeGen/TargetPassConfig.cpp | |
| parent | 8b1986b5cb2c4282aab50794e05be412fbc421d1 (diff) | |
| download | bcm5719-llvm-a79b0620a08d94a58fd48787e78cc83924632ad8.tar.gz bcm5719-llvm-a79b0620a08d94a58fd48787e78cc83924632ad8.zip | |
Add a TargetOption to enable/disable GlobalISel
Summary:
This patch adds a new target option in order to control GlobalISel.
This will allow the users to enable/disable GlobalISel prior to the
backend by calling `TargetMachine::setGlobalISel(bool Enable)`.
No test case as there is already a test to check GlobalISel
command line options.
See: CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll.
Reviewers: qcolombet, aemerson, ab, dsanders
Reviewed By: qcolombet
Subscribers: rovka, javed.absar, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D42137
llvm-svn: 322773
Diffstat (limited to 'llvm/lib/CodeGen/TargetPassConfig.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/TargetPassConfig.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index c90a93d7e24..acdc814c45c 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -123,9 +123,9 @@ static cl::opt<cl::boolOrDefault> EnableFastISelOption("fast-isel", cl::Hidden, cl::desc("Enable the \"fast\" instruction selector")); -static cl::opt<cl::boolOrDefault> - EnableGlobalISel("global-isel", cl::Hidden, - cl::desc("Enable the \"global\" instruction selector")); +static cl::opt<cl::boolOrDefault> EnableGlobalISelOption( + "global-isel", cl::Hidden, + cl::desc("Enable the \"global\" instruction selector")); static cl::opt<std::string> PrintMachineInstrs( "print-machineinstrs", cl::ValueOptional, cl::desc("Print machine instrs"), @@ -704,19 +704,23 @@ void TargetPassConfig::addISelPrepare() { } bool TargetPassConfig::addCoreISelPasses() { - // Enable FastISel with -fast, but allow that to be overridden. + // Enable FastISel with -fast-isel, but allow that to be overridden. TM->setO0WantsFastISel(EnableFastISelOption != cl::BOU_FALSE); if (EnableFastISelOption == cl::BOU_TRUE || (TM->getOptLevel() == CodeGenOpt::None && TM->getO0WantsFastISel())) TM->setFastISel(true); - // Ask the target for an isel. - // Enable GlobalISel if the target wants to, but allow that to be overriden. + // Ask the target for an instruction selector. + bool EnableGlobalISel = TM->Options.EnableGlobalISel; // Explicitly enabling fast-isel should override implicitly enabled // global-isel. - if (EnableGlobalISel == cl::BOU_TRUE || - (EnableGlobalISel == cl::BOU_UNSET && isGlobalISelEnabled() && - EnableFastISelOption != cl::BOU_TRUE)) { + if (EnableGlobalISel && (EnableGlobalISelOption == cl::BOU_UNSET) && + (EnableFastISelOption == cl::BOU_TRUE)) + EnableGlobalISel = false; + if (EnableGlobalISelOption == cl::BOU_TRUE) + EnableGlobalISel = true; + + if (EnableGlobalISel) { if (addIRTranslator()) return true; @@ -1130,18 +1134,13 @@ void TargetPassConfig::addBlockPlacement() { //===---------------------------------------------------------------------===// /// GlobalISel Configuration //===---------------------------------------------------------------------===// - -bool TargetPassConfig::isGlobalISelEnabled() const { - return false; -} - bool TargetPassConfig::isGlobalISelAbortEnabled() const { if (EnableGlobalISelAbort.getNumOccurrences() > 0) return EnableGlobalISelAbort == 1; // When no abort behaviour is specified, we don't abort if the target says // that GISel is enabled. - return !isGlobalISelEnabled(); + return !TM->Options.EnableGlobalISel; } bool TargetPassConfig::reportDiagnosticWhenGlobalISelFallback() const { |

