[GlobalISel] Make EnableGlobalISel always set when GISel is enabled · llvm/llvm-project@e6406d5 (original) (raw)

`@@ -137,13 +137,15 @@ static cl::optstd::string PrintMachineInstrs(

`

137

137

`"print-machineinstrs", cl::ValueOptional, cl::desc("Print machine instrs"),

`

138

138

` cl::value_desc("pass-name"), cl::init("option-unspecified"), cl::Hidden);

`

139

139

``

140

``

`-

static cl::opt EnableGlobalISelAbort(

`

``

140

`+

static cl::opt EnableGlobalISelAbort(

`

141

141

`"global-isel-abort", cl::Hidden,

`

142

142

`cl::desc("Enable abort calls when "global" instruction selection "

`

143

``

`-

"fails to lower/select an instruction: 0 disable the abort, "

`

144

``

`-

"1 enable the abort, and "

`

145

``

`-

"2 disable the abort but emit a diagnostic on failure"),

`

146

``

`-

cl::init(1));

`

``

143

`+

"fails to lower/select an instruction"),

`

``

144

`+

cl::values(

`

``

145

`+

clEnumValN(GlobalISelAbortMode::Disable, "0", "Disable the abort"),

`

``

146

`+

clEnumValN(GlobalISelAbortMode::Enable, "1", "Enable the abort"),

`

``

147

`+

clEnumValN(GlobalISelAbortMode::DisableWithDiag, "2",

`

``

148

`+

"Disable the abort but emit a diagnostic on failure")));

`

147

149

``

148

150

`// Temporary option to allow experimenting with MachineScheduler as a post-RA

`

149

151

`// scheduler. Targets can "properly" enable this with

`

`@@ -384,6 +386,9 @@ TargetPassConfig::TargetPassConfig(LLVMTargetMachine &TM, PassManagerBase &pm)

`

384

386

`if (TM.Options.EnableIPRA)

`

385

387

`setRequiresCodeGenSCCOrder();

`

386

388

``

``

389

`+

if (EnableGlobalISelAbort.getNumOccurrences())

`

``

390

`+

TM.Options.GlobalISelAbort = EnableGlobalISelAbort;

`

``

391

+

387

392

`setStartStopPasses();

`

388

393

`}

`

389

394

``

`@@ -721,15 +726,19 @@ bool TargetPassConfig::addCoreISelPasses() {

`

721

726

`// Enable FastISel with -fast-isel, but allow that to be overridden.

`

722

727

` TM->setO0WantsFastISel(EnableFastISelOption != cl::BOU_FALSE);

`

723

728

`if (EnableFastISelOption == cl::BOU_TRUE ||

`

724

``

`-

(TM->getOptLevel() == CodeGenOpt::None && TM->getO0WantsFastISel()))

`

``

729

`+

(TM->getOptLevel() == CodeGenOpt::None && TM->getO0WantsFastISel() &&

`

``

730

`+

!TM->Options.EnableGlobalISel)) {

`

725

731

` TM->setFastISel(true);

`

``

732

`+

TM->setGlobalISel(false);

`

``

733

`+

}

`

726

734

``

727

735

`// Ask the target for an instruction selector.

`

728

736

`// Explicitly enabling fast-isel should override implicitly enabled

`

729

737

`// global-isel.

`

730

738

`if (EnableGlobalISelOption == cl::BOU_TRUE ||

`

731

739

` (EnableGlobalISelOption == cl::BOU_UNSET &&

`

732

740

` TM->Options.EnableGlobalISel && EnableFastISelOption != cl::BOU_TRUE)) {

`

``

741

`+

TM->setGlobalISel(true);

`

733

742

` TM->setFastISel(false);

`

734

743

``

735

744

` SaveAndRestore SavedAddingMachinePasses(AddingMachinePasses, true);

`

`@@ -1165,14 +1174,9 @@ void TargetPassConfig::addBlockPlacement() {

`

1165

1174

`/// GlobalISel Configuration

`

1166

1175

`//===---------------------------------------------------------------------===//

`

1167

1176

`bool TargetPassConfig::isGlobalISelAbortEnabled() const {

`

1168

``

`-

if (EnableGlobalISelAbort.getNumOccurrences() > 0)

`

1169

``

`-

return EnableGlobalISelAbort == 1;

`

1170

``

-

1171

``

`-

// When no abort behaviour is specified, we don't abort if the target says

`

1172

``

`-

// that GISel is enabled.

`

1173

``

`-

return !TM->Options.EnableGlobalISel;

`

``

1177

`+

return TM->Options.GlobalISelAbort == GlobalISelAbortMode::Enable;

`

1174

1178

`}

`

1175

1179

``

1176

1180

`bool TargetPassConfig::reportDiagnosticWhenGlobalISelFallback() const {

`

1177

``

`-

return EnableGlobalISelAbort == 2;

`

``

1181

`+

return TM->Options.GlobalISelAbort == GlobalISelAbortMode::DisableWithDiag;

`

1178

1182

`}

`