diff options
| author | Michael Kruse <llvm-project@meinersbur.de> | 2025-01-03 10:22:51 +0100 |
|---|---|---|
| committer | Michael Kruse <llvm-project@meinersbur.de> | 2025-01-03 10:22:51 +0100 |
| commit | 38500d63e14ce340236840f60d356cdefb56a52c (patch) | |
| tree | 17edbec446ce9b50d2f215a483b83afb293a635d /llvm/lib/CodeGen/LiveStacks.cpp | |
| parent | 1a3d5daaef7a6a63448a497da3eff7fc9e23df26 (diff) | |
| parent | 27f30029741ecf023baece7b3dde1ff9011ffefc (diff) | |
Merge branch 'main' into users/meinersbur/flang_runtime_split-headersusers/meinersbur/flang_runtime_split-headers
Diffstat (limited to 'llvm/lib/CodeGen/LiveStacks.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/LiveStacks.cpp | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/LiveStacks.cpp b/llvm/lib/CodeGen/LiveStacks.cpp index 6228a4dd2ad3..d615caf48c0a 100644 --- a/llvm/lib/CodeGen/LiveStacks.cpp +++ b/llvm/lib/CodeGen/LiveStacks.cpp @@ -15,20 +15,21 @@ #include "llvm/CodeGen/LiveStacks.h" #include "llvm/CodeGen/TargetRegisterInfo.h" #include "llvm/CodeGen/TargetSubtargetInfo.h" +#include "llvm/IR/Function.h" using namespace llvm; #define DEBUG_TYPE "livestacks" -char LiveStacks::ID = 0; -INITIALIZE_PASS_BEGIN(LiveStacks, DEBUG_TYPE, - "Live Stack Slot Analysis", false, false) +char LiveStacksWrapperLegacy::ID = 0; +INITIALIZE_PASS_BEGIN(LiveStacksWrapperLegacy, DEBUG_TYPE, + "Live Stack Slot Analysis", false, false) INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass) -INITIALIZE_PASS_END(LiveStacks, DEBUG_TYPE, - "Live Stack Slot Analysis", false, false) +INITIALIZE_PASS_END(LiveStacksWrapperLegacy, DEBUG_TYPE, + "Live Stack Slot Analysis", false, true) -char &llvm::LiveStacksID = LiveStacks::ID; +char &llvm::LiveStacksID = LiveStacksWrapperLegacy::ID; -void LiveStacks::getAnalysisUsage(AnalysisUsage &AU) const { +void LiveStacksWrapperLegacy::getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); AU.addPreserved<SlotIndexesWrapperPass>(); AU.addRequiredTransitive<SlotIndexesWrapperPass>(); @@ -42,11 +43,10 @@ void LiveStacks::releaseMemory() { S2RCMap.clear(); } -bool LiveStacks::runOnMachineFunction(MachineFunction &MF) { +void LiveStacks::init(MachineFunction &MF) { TRI = MF.getSubtarget().getRegisterInfo(); // FIXME: No analysis is being done right now. We are relying on the // register allocators to provide the information. - return false; } LiveInterval & @@ -68,6 +68,33 @@ LiveStacks::getOrCreateInterval(int Slot, const TargetRegisterClass *RC) { return I->second; } +AnalysisKey LiveStacksAnalysis::Key; + +LiveStacks LiveStacksAnalysis::run(MachineFunction &MF, + MachineFunctionAnalysisManager &) { + LiveStacks Impl; + Impl.init(MF); + return Impl; +} +PreservedAnalyses +LiveStacksPrinterPass::run(MachineFunction &MF, + MachineFunctionAnalysisManager &AM) { + AM.getResult<LiveStacksAnalysis>(MF).print(OS, MF.getFunction().getParent()); + return PreservedAnalyses::all(); +} + +bool LiveStacksWrapperLegacy::runOnMachineFunction(MachineFunction &MF) { + Impl = LiveStacks(); + Impl.init(MF); + return false; +} + +void LiveStacksWrapperLegacy::releaseMemory() { Impl = LiveStacks(); } + +void LiveStacksWrapperLegacy::print(raw_ostream &OS, const Module *) const { + Impl.print(OS); +} + /// print - Implement the dump method. void LiveStacks::print(raw_ostream &OS, const Module*) const { |
