diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/CodeGen.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp | 46 | ||||
-rw-r--r-- | llvm/lib/Passes/PassBuilder.cpp | 1 |
3 files changed, 36 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/CodeGen.cpp b/llvm/lib/CodeGen/CodeGen.cpp index 3169a10..beb7fb2 100644 --- a/llvm/lib/CodeGen/CodeGen.cpp +++ b/llvm/lib/CodeGen/CodeGen.cpp @@ -46,7 +46,7 @@ void llvm::initializeCodeGen(PassRegistry &Registry) { initializeFEntryInserterPass(Registry); initializeFinalizeISelPass(Registry); initializeFinalizeMachineBundlesPass(Registry); - initializeFixupStatepointCallerSavedPass(Registry); + initializeFixupStatepointCallerSavedLegacyPass(Registry); initializeFuncletLayoutPass(Registry); initializeGCMachineCodeAnalysisPass(Registry); initializeGCModuleInfoPass(Registry); diff --git a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp index 36903fd..8f7dded 100644 --- a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp +++ b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp @@ -20,6 +20,7 @@ /// //===----------------------------------------------------------------------===// +#include "llvm/CodeGen/FixupStatepointCallerSaved.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/Statistic.h" #include "llvm/CodeGen/MachineFrameInfo.h" @@ -58,14 +59,18 @@ static cl::opt<unsigned> MaxStatepointsWithRegs( namespace { -class FixupStatepointCallerSaved : public MachineFunctionPass { +struct FixupStatepointCallerSavedImpl { + bool run(MachineFunction &MF); +}; + +class FixupStatepointCallerSavedLegacy : public MachineFunctionPass { public: static char ID; - FixupStatepointCallerSaved() : MachineFunctionPass(ID) { - initializeFixupStatepointCallerSavedPass(*PassRegistry::getPassRegistry()); + FixupStatepointCallerSavedLegacy() : MachineFunctionPass(ID) { + initializeFixupStatepointCallerSavedLegacyPass( + *PassRegistry::getPassRegistry()); } - void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesCFG(); MachineFunctionPass::getAnalysisUsage(AU); @@ -80,12 +85,12 @@ public: } // End anonymous namespace. -char FixupStatepointCallerSaved::ID = 0; -char &llvm::FixupStatepointCallerSavedID = FixupStatepointCallerSaved::ID; +char FixupStatepointCallerSavedLegacy::ID = 0; +char &llvm::FixupStatepointCallerSavedID = FixupStatepointCallerSavedLegacy::ID; -INITIALIZE_PASS_BEGIN(FixupStatepointCallerSaved, DEBUG_TYPE, +INITIALIZE_PASS_BEGIN(FixupStatepointCallerSavedLegacy, DEBUG_TYPE, "Fixup Statepoint Caller Saved", false, false) -INITIALIZE_PASS_END(FixupStatepointCallerSaved, DEBUG_TYPE, +INITIALIZE_PASS_END(FixupStatepointCallerSavedLegacy, DEBUG_TYPE, "Fixup Statepoint Caller Saved", false, false) // Utility function to get size of the register. @@ -590,10 +595,7 @@ public: }; } // namespace -bool FixupStatepointCallerSaved::runOnMachineFunction(MachineFunction &MF) { - if (skipFunction(MF.getFunction())) - return false; - +bool FixupStatepointCallerSavedImpl::run(MachineFunction &MF) { const Function &F = MF.getFunction(); if (!F.hasGC()) return false; @@ -620,3 +622,23 @@ bool FixupStatepointCallerSaved::runOnMachineFunction(MachineFunction &MF) { } return Changed; } + +bool FixupStatepointCallerSavedLegacy::runOnMachineFunction( + MachineFunction &MF) { + if (skipFunction(MF.getFunction())) + return false; + + return FixupStatepointCallerSavedImpl().run(MF); +} + +PreservedAnalyses +FixupStatepointCallerSavedPass::run(MachineFunction &MF, + MachineFunctionAnalysisManager &MFAM) { + + if (!FixupStatepointCallerSavedImpl().run(MF)) + return PreservedAnalyses::all(); + + auto PA = getMachineFunctionPassPreservedAnalyses(); + PA.preserveSet<CFGAnalyses>(); + return PA; +} diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index 191bed1..8080059 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -92,6 +92,7 @@ #include "llvm/CodeGen/ExpandMemCmp.h" #include "llvm/CodeGen/ExpandPostRAPseudos.h" #include "llvm/CodeGen/FinalizeISel.h" +#include "llvm/CodeGen/FixupStatepointCallerSaved.h" #include "llvm/CodeGen/GCMetadata.h" #include "llvm/CodeGen/GlobalMerge.h" #include "llvm/CodeGen/GlobalMergeFunctions.h" |