diff options
author | Petr Pavlu <petr.pavlu@arm.com> | 2018-11-29 12:56:32 +0000 |
---|---|---|
committer | Petr Pavlu <petr.pavlu@arm.com> | 2018-11-29 12:56:32 +0000 |
commit | e6406d568c550dc27999d96d174f8fe354ab545a (patch) | |
tree | 421f4da37c594aaa063eefb1b138d3d0c32a4e01 /llvm/lib/CodeGen/TargetPassConfig.cpp | |
parent | 3e3696bf467debb19f413642c49c14df839a584a (diff) | |
download | bcm5719-llvm-e6406d568c550dc27999d96d174f8fe354ab545a.tar.gz bcm5719-llvm-e6406d568c550dc27999d96d174f8fe354ab545a.zip |
[GlobalISel] Make EnableGlobalISel always set when GISel is enabled
Change meaning of TargetOptions::EnableGlobalISel. The flag was
previously set only when a target switched on GlobalISel but it is now
always set when the GlobalISel pipeline is enabled. This makes the flag
consistent with TargetOptions::EnableFastISel and allows its use in
other parts of the compiler to determine when GlobalISel is enabled.
The EnableGlobalISel flag had previouly only one use in
TargetPassConfig::isGlobalISelAbortEnabled(). The method used its value
to determine if GlobalISel was enabled by a target and returned false in
such a case. To preserve the current behaviour, a new flag
TargetOptions::GlobalISelAbort is introduced to separately record the
abort behaviour.
Differential Revision: https://reviews.llvm.org/D54518
llvm-svn: 347861
Diffstat (limited to 'llvm/lib/CodeGen/TargetPassConfig.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetPassConfig.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index 03d8ad9421d..4d767c2f0f8 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -137,13 +137,15 @@ static cl::opt<std::string> PrintMachineInstrs( "print-machineinstrs", cl::ValueOptional, cl::desc("Print machine instrs"), cl::value_desc("pass-name"), cl::init("option-unspecified"), cl::Hidden); -static cl::opt<int> EnableGlobalISelAbort( +static cl::opt<GlobalISelAbortMode> EnableGlobalISelAbort( "global-isel-abort", cl::Hidden, cl::desc("Enable abort calls when \"global\" instruction selection " - "fails to lower/select an instruction: 0 disable the abort, " - "1 enable the abort, and " - "2 disable the abort but emit a diagnostic on failure"), - cl::init(1)); + "fails to lower/select an instruction"), + cl::values( + clEnumValN(GlobalISelAbortMode::Disable, "0", "Disable the abort"), + clEnumValN(GlobalISelAbortMode::Enable, "1", "Enable the abort"), + clEnumValN(GlobalISelAbortMode::DisableWithDiag, "2", + "Disable the abort but emit a diagnostic on failure"))); // Temporary option to allow experimenting with MachineScheduler as a post-RA // scheduler. Targets can "properly" enable this with @@ -384,6 +386,9 @@ TargetPassConfig::TargetPassConfig(LLVMTargetMachine &TM, PassManagerBase &pm) if (TM.Options.EnableIPRA) setRequiresCodeGenSCCOrder(); + if (EnableGlobalISelAbort.getNumOccurrences()) + TM.Options.GlobalISelAbort = EnableGlobalISelAbort; + setStartStopPasses(); } @@ -721,8 +726,11 @@ bool TargetPassConfig::addCoreISelPasses() { // 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->getOptLevel() == CodeGenOpt::None && TM->getO0WantsFastISel() && + !TM->Options.EnableGlobalISel)) { TM->setFastISel(true); + TM->setGlobalISel(false); + } // Ask the target for an instruction selector. // Explicitly enabling fast-isel should override implicitly enabled @@ -730,6 +738,7 @@ bool TargetPassConfig::addCoreISelPasses() { if (EnableGlobalISelOption == cl::BOU_TRUE || (EnableGlobalISelOption == cl::BOU_UNSET && TM->Options.EnableGlobalISel && EnableFastISelOption != cl::BOU_TRUE)) { + TM->setGlobalISel(true); TM->setFastISel(false); SaveAndRestore<bool> SavedAddingMachinePasses(AddingMachinePasses, true); @@ -1165,14 +1174,9 @@ void TargetPassConfig::addBlockPlacement() { /// GlobalISel Configuration //===---------------------------------------------------------------------===// 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 !TM->Options.EnableGlobalISel; + return TM->Options.GlobalISelAbort == GlobalISelAbortMode::Enable; } bool TargetPassConfig::reportDiagnosticWhenGlobalISelFallback() const { - return EnableGlobalISelAbort == 2; + return TM->Options.GlobalISelAbort == GlobalISelAbortMode::DisableWithDiag; } |