15
15
#include " llvm/CodeGen/LiveStacks.h"
16
16
#include " llvm/CodeGen/TargetRegisterInfo.h"
17
17
#include " llvm/CodeGen/TargetSubtargetInfo.h"
18
+ #include " llvm/IR/Function.h"
18
19
using namespace llvm ;
19
20
20
21
#define DEBUG_TYPE " livestacks"
21
22
22
- char LiveStacks ::ID = 0 ;
23
- INITIALIZE_PASS_BEGIN (LiveStacks , DEBUG_TYPE,
24
- " Live Stack Slot Analysis" , false , false )
23
+ char LiveStacksWrapperLegacy ::ID = 0 ;
24
+ INITIALIZE_PASS_BEGIN (LiveStacksWrapperLegacy , DEBUG_TYPE,
25
+ " Live Stack Slot Analysis" , false , false )
25
26
INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass)
26
- INITIALIZE_PASS_END(LiveStacks , DEBUG_TYPE,
27
- " Live Stack Slot Analysis" , false , false )
27
+ INITIALIZE_PASS_END(LiveStacksWrapperLegacy , DEBUG_TYPE,
28
+ " Live Stack Slot Analysis" , false , false )
28
29
29
- char &llvm::LiveStacksID = LiveStacks ::ID;
30
+ char &llvm::LiveStacksID = LiveStacksWrapperLegacy ::ID;
30
31
31
- void LiveStacks ::getAnalysisUsage (AnalysisUsage &AU) const {
32
+ void LiveStacksWrapperLegacy ::getAnalysisUsage (AnalysisUsage &AU) const {
32
33
AU.setPreservesAll ();
33
34
AU.addPreserved <SlotIndexesWrapperPass>();
34
35
AU.addRequiredTransitive <SlotIndexesWrapperPass>();
@@ -42,11 +43,10 @@ void LiveStacks::releaseMemory() {
42
43
S2RCMap.clear ();
43
44
}
44
45
45
- bool LiveStacks::runOnMachineFunction (MachineFunction &MF) {
46
+ void LiveStacks::init (MachineFunction &MF) {
46
47
TRI = MF.getSubtarget ().getRegisterInfo ();
47
48
// FIXME: No analysis is being done right now. We are relying on the
48
49
// register allocators to provide the information.
49
- return false ;
50
50
}
51
51
52
52
LiveInterval &
@@ -68,6 +68,33 @@ LiveStacks::getOrCreateInterval(int Slot, const TargetRegisterClass *RC) {
68
68
return I->second ;
69
69
}
70
70
71
+ AnalysisKey LiveStacksAnalysis::Key;
72
+
73
+ LiveStacks LiveStacksAnalysis::run (MachineFunction &MF,
74
+ MachineFunctionAnalysisManager &) {
75
+ LiveStacks Impl;
76
+ Impl.init (MF);
77
+ return Impl;
78
+ }
79
+ PreservedAnalyses
80
+ LiveStacksPrinterPass::run (MachineFunction &MF,
81
+ MachineFunctionAnalysisManager &AM) {
82
+ AM.getResult <LiveStacksAnalysis>(MF).print (OS, MF.getFunction ().getParent ());
83
+ return PreservedAnalyses::all ();
84
+ }
85
+
86
+ bool LiveStacksWrapperLegacy::runOnMachineFunction (MachineFunction &MF) {
87
+ Impl = LiveStacks ();
88
+ Impl.init (MF);
89
+ return false ;
90
+ }
91
+
92
+ void LiveStacksWrapperLegacy::releaseMemory () { Impl = LiveStacks (); }
93
+
94
+ void LiveStacksWrapperLegacy::print (raw_ostream &OS, const Module *) const {
95
+ Impl.print (OS);
96
+ }
97
+
71
98
// / print - Implement the dump method.
72
99
void LiveStacks::print (raw_ostream &OS, const Module*) const {
73
100
0 commit comments