@@ -75,7 +75,6 @@ RestrictStatepointRemat("restrict-statepoint-remat",
7575 cl::desc(" Restrict remat for statepoint operands" ));
7676
7777namespace {
78-
7978class HoistSpillHelper : private LiveRangeEdit ::Delegate {
8079 MachineFunction &MF;
8180 LiveIntervals &LIS;
@@ -128,15 +127,11 @@ class HoistSpillHelper : private LiveRangeEdit::Delegate {
128127 DenseMap<MachineBasicBlock *, unsigned > &SpillsToIns);
129128
130129public:
131- HoistSpillHelper (MachineFunctionPass &pass, MachineFunction &mf,
132- VirtRegMap &vrm)
133- : MF(mf), LIS(pass.getAnalysis<LiveIntervalsWrapperPass>().getLIS()),
134- LSS (pass.getAnalysis<LiveStacksWrapperLegacy>().getLS()),
135- MDT(pass.getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree()),
130+ HoistSpillHelper (const Spiller::RequiredAnalyses &Analyses,
131+ MachineFunction &mf, VirtRegMap &vrm)
132+ : MF(mf), LIS(Analyses.LIS), LSS(Analyses.LSS), MDT(Analyses.MDT),
136133 VRM (vrm), MRI(mf.getRegInfo()), TII(*mf.getSubtarget().getInstrInfo()),
137- TRI(*mf.getSubtarget().getRegisterInfo()),
138- MBFI(
139- pass.getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI()),
134+ TRI(*mf.getSubtarget().getRegisterInfo()), MBFI(Analyses.MBFI),
140135 IPA(LIS, mf.getNumBlockIDs()) {}
141136
142137 void addToMergeableSpills (MachineInstr &Spill, int StackSlot,
@@ -150,12 +145,10 @@ class InlineSpiller : public Spiller {
150145 MachineFunction &MF;
151146 LiveIntervals &LIS;
152147 LiveStacks &LSS;
153- MachineDominatorTree &MDT;
154148 VirtRegMap &VRM;
155149 MachineRegisterInfo &MRI;
156150 const TargetInstrInfo &TII;
157151 const TargetRegisterInfo &TRI;
158- const MachineBlockFrequencyInfo &MBFI;
159152
160153 // Variables that are valid during spill(), but used by multiple methods.
161154 LiveRangeEdit *Edit = nullptr ;
@@ -190,16 +183,12 @@ class InlineSpiller : public Spiller {
190183 ~InlineSpiller () override = default ;
191184
192185public:
193- InlineSpiller (MachineFunctionPass &Pass, MachineFunction &MF, VirtRegMap &VRM,
194- VirtRegAuxInfo &VRAI)
195- : MF(MF), LIS(Pass.getAnalysis<LiveIntervalsWrapperPass>().getLIS()),
196- LSS (Pass.getAnalysis<LiveStacksWrapperLegacy>().getLS()),
197- MDT(Pass.getAnalysis<MachineDominatorTreeWrapperPass>().getDomTree()),
198- VRM(VRM), MRI(MF.getRegInfo()), TII(*MF.getSubtarget().getInstrInfo()),
199- TRI(*MF.getSubtarget().getRegisterInfo()),
200- MBFI(
201- Pass.getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI()),
202- HSpiller(Pass, MF, VRM), VRAI(VRAI) {}
186+ InlineSpiller (const Spiller::RequiredAnalyses &Analyses, MachineFunction &MF,
187+ VirtRegMap &VRM, VirtRegAuxInfo &VRAI)
188+ : MF(MF), LIS(Analyses.LIS), LSS(Analyses.LSS), VRM(VRM),
189+ MRI (MF.getRegInfo()), TII(*MF.getSubtarget().getInstrInfo()),
190+ TRI(*MF.getSubtarget().getRegisterInfo()), HSpiller(Analyses, MF, VRM),
191+ VRAI(VRAI) {}
203192
204193 void spill (LiveRangeEdit &) override ;
205194 ArrayRef<Register> getSpilledRegs () override { return RegsToSpill; }
@@ -237,10 +226,11 @@ Spiller::~Spiller() = default;
237226
238227void Spiller::anchor () {}
239228
240- Spiller *llvm::createInlineSpiller (MachineFunctionPass &Pass,
241- MachineFunction &MF, VirtRegMap &VRM,
242- VirtRegAuxInfo &VRAI) {
243- return new InlineSpiller (Pass, MF, VRM, VRAI);
229+ Spiller *
230+ llvm::createInlineSpiller (const InlineSpiller::RequiredAnalyses &Analyses,
231+ MachineFunction &MF, VirtRegMap &VRM,
232+ VirtRegAuxInfo &VRAI) {
233+ return new InlineSpiller (Analyses, MF, VRM, VRAI);
244234}
245235
246236// ===----------------------------------------------------------------------===//
0 commit comments