diff options
author | Arthur Eubanks <aeubanks@google.com> | 2023-09-14 14:10:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-14 14:10:14 -0700 |
commit | 0a1aa6cda2758b0926a95f87d39ffefb1cb90200 (patch) | |
tree | 766dc35b70235864f287a9f0a2cef45d487203ad /llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | |
parent | ae84b160d2fe61a7211817262ce717a17d27c0ae (diff) | |
download | llvm-0a1aa6cda2758b0926a95f87d39ffefb1cb90200.zip llvm-0a1aa6cda2758b0926a95f87d39ffefb1cb90200.tar.gz llvm-0a1aa6cda2758b0926a95f87d39ffefb1cb90200.tar.bz2 |
[NFC][CodeGen] Change CodeGenOpt::Level/CodeGenFileType into enum classes (#66295)
This will make it easy for callers to see issues with and fix up calls
to createTargetMachine after a future change to the params of
TargetMachine.
This matches other nearby enums.
For downstream users, this should be a fairly straightforward
replacement,
e.g. s/CodeGenOpt::Aggressive/CodeGenOptLevel::Aggressive
or s/CGFT_/CodeGenFileType::
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/PowerPC/PPCTargetMachine.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp index eaef4bf..42f052c 100644 --- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp @@ -197,7 +197,7 @@ static std::string getDataLayoutString(const Triple &T) { return Ret; } -static std::string computeFSAdditions(StringRef FS, CodeGenOpt::Level OL, +static std::string computeFSAdditions(StringRef FS, CodeGenOptLevel OL, const Triple &TT) { std::string FullFS = std::string(FS); @@ -209,14 +209,14 @@ static std::string computeFSAdditions(StringRef FS, CodeGenOpt::Level OL, FullFS = "+64bit"; } - if (OL >= CodeGenOpt::Default) { + if (OL >= CodeGenOptLevel::Default) { if (!FullFS.empty()) FullFS = "+crbits," + FullFS; else FullFS = "+crbits"; } - if (OL != CodeGenOpt::None) { + if (OL != CodeGenOptLevel::None) { if (!FullFS.empty()) FullFS = "+invariant-function-descriptors," + FullFS; else @@ -345,7 +345,7 @@ PPCTargetMachine::PPCTargetMachine(const Target &T, const Triple &TT, const TargetOptions &Options, std::optional<Reloc::Model> RM, std::optional<CodeModel::Model> CM, - CodeGenOpt::Level OL, bool JIT) + CodeGenOptLevel OL, bool JIT) : LLVMTargetMachine(T, getDataLayoutString(TT), TT, CPU, computeFSAdditions(FS, OL, TT), Options, getEffectiveRelocModel(TT, RM), @@ -414,7 +414,7 @@ public: : TargetPassConfig(TM, PM) { // At any optimization level above -O0 we use the Machine Scheduler and not // the default Post RA List Scheduler. - if (TM.getOptLevel() != CodeGenOpt::None) + if (TM.getOptLevel() != CodeGenOptLevel::None) substitutePass(&PostRASchedulerID, &PostMachineSchedulerID); } @@ -454,7 +454,7 @@ TargetPassConfig *PPCTargetMachine::createPassConfig(PassManagerBase &PM) { } void PPCPassConfig::addIRPasses() { - if (TM->getOptLevel() != CodeGenOpt::None) + if (TM->getOptLevel() != CodeGenOptLevel::None) addPass(createPPCBoolRetToIntPass()); addPass(createAtomicExpandPass()); @@ -463,7 +463,7 @@ void PPCPassConfig::addIRPasses() { // Generate PowerPC target-specific entries for scalar math functions // that are available in IBM MASS (scalar) library. - if (TM->getOptLevel() == CodeGenOpt::Aggressive && + if (TM->getOptLevel() == CodeGenOptLevel::Aggressive && EnablePPCGenScalarMASSEntries) { TM->Options.PPCGenScalarMASSEntries = EnablePPCGenScalarMASSEntries; addPass(createPPCGenScalarMASSEntriesPass()); @@ -473,7 +473,7 @@ void PPCPassConfig::addIRPasses() { if (EnablePrefetch.getNumOccurrences() > 0) addPass(createLoopDataPrefetchPass()); - if (TM->getOptLevel() >= CodeGenOpt::Default && EnableGEPOpt) { + if (TM->getOptLevel() >= CodeGenOptLevel::Default && EnableGEPOpt) { // Call SeparateConstOffsetFromGEP pass to extract constants within indices // and lower a GEP with multiple indices to either arithmetic operations or // multiple GEPs with single index. @@ -490,13 +490,13 @@ void PPCPassConfig::addIRPasses() { } bool PPCPassConfig::addPreISel() { - if (MergeStringPool && getOptLevel() != CodeGenOpt::None) + if (MergeStringPool && getOptLevel() != CodeGenOptLevel::None) addPass(createPPCMergeStringPoolPass()); - if (!DisableInstrFormPrep && getOptLevel() != CodeGenOpt::None) + if (!DisableInstrFormPrep && getOptLevel() != CodeGenOptLevel::None) addPass(createPPCLoopInstrFormPrepPass(getPPCTargetMachine())); - if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None) + if (!DisableCTRLoops && getOptLevel() != CodeGenOptLevel::None) addPass(createHardwareLoopsLegacyPass()); return false; @@ -516,7 +516,7 @@ bool PPCPassConfig::addInstSelector() { addPass(createPPCISelDag(getPPCTargetMachine(), getOptLevel())); #ifndef NDEBUG - if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None) + if (!DisableCTRLoops && getOptLevel() != CodeGenOptLevel::None) addPass(createPPCCTRLoopsVerify()); #endif @@ -527,12 +527,12 @@ bool PPCPassConfig::addInstSelector() { void PPCPassConfig::addMachineSSAOptimization() { // Run CTR loops pass before any cfg modification pass to prevent the // canonical form of hardware loop from being destroied. - if (!DisableCTRLoops && getOptLevel() != CodeGenOpt::None) + if (!DisableCTRLoops && getOptLevel() != CodeGenOptLevel::None) addPass(createPPCCTRLoopsPass()); // PPCBranchCoalescingPass need to be done before machine sinking // since it merges empty blocks. - if (EnableBranchCoalescing && getOptLevel() != CodeGenOpt::None) + if (EnableBranchCoalescing && getOptLevel() != CodeGenOptLevel::None) addPass(createPPCBranchCoalescingPass()); TargetPassConfig::addMachineSSAOptimization(); // For little endian, remove where possible the vector swap instructions @@ -541,7 +541,7 @@ void PPCPassConfig::addMachineSSAOptimization() { !DisableVSXSwapRemoval) addPass(createPPCVSXSwapRemovalPass()); // Reduce the number of cr-logical ops. - if (ReduceCRLogical && getOptLevel() != CodeGenOpt::None) + if (ReduceCRLogical && getOptLevel() != CodeGenOptLevel::None) addPass(createPPCReduceCRLogicalsPass()); // Target-specific peephole cleanups performed after instruction // selection. @@ -552,7 +552,7 @@ void PPCPassConfig::addMachineSSAOptimization() { } void PPCPassConfig::addPreRegAlloc() { - if (getOptLevel() != CodeGenOpt::None) { + if (getOptLevel() != CodeGenOptLevel::None) { initializePPCVSXFMAMutatePass(*PassRegistry::getPassRegistry()); insertPass(VSXFMAMutateEarly ? &RegisterCoalescerID : &MachineSchedulerID, &PPCVSXFMAMutateID); @@ -570,12 +570,12 @@ void PPCPassConfig::addPreRegAlloc() { if (EnableExtraTOCRegDeps) addPass(createPPCTOCRegDepsPass()); - if (getOptLevel() != CodeGenOpt::None) + if (getOptLevel() != CodeGenOptLevel::None) addPass(&MachinePipelinerID); } void PPCPassConfig::addPreSched2() { - if (getOptLevel() != CodeGenOpt::None) + if (getOptLevel() != CodeGenOptLevel::None) addPass(&IfConverterID); } @@ -583,7 +583,7 @@ void PPCPassConfig::addPreEmitPass() { addPass(createPPCPreEmitPeepholePass()); addPass(createPPCExpandISELPass()); - if (getOptLevel() != CodeGenOpt::None) + if (getOptLevel() != CodeGenOptLevel::None) addPass(createPPCEarlyReturnPass()); } |