diff options
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 { |
