Mercurial > hg > CbC > CbC_llvm
comparison lib/CodeGen/ShrinkWrap.cpp @ 120:1172e4bd9c6f
update 4.0.0
author | mir3636 |
---|---|
date | Fri, 25 Nov 2016 19:14:25 +0900 |
parents | 7d135dc70f03 |
children | 803732b1fca8 |
comparison
equal
deleted
inserted
replaced
101:34baf5011add | 120:1172e4bd9c6f |
---|---|
197 AU.addRequired<MachinePostDominatorTree>(); | 197 AU.addRequired<MachinePostDominatorTree>(); |
198 AU.addRequired<MachineLoopInfo>(); | 198 AU.addRequired<MachineLoopInfo>(); |
199 MachineFunctionPass::getAnalysisUsage(AU); | 199 MachineFunctionPass::getAnalysisUsage(AU); |
200 } | 200 } |
201 | 201 |
202 const char *getPassName() const override { | 202 StringRef getPassName() const override { return "Shrink Wrapping analysis"; } |
203 return "Shrink Wrapping analysis"; | |
204 } | |
205 | 203 |
206 /// \brief Perform the shrink-wrapping analysis and update | 204 /// \brief Perform the shrink-wrapping analysis and update |
207 /// the MachineFrameInfo attached to \p MF with the results. | 205 /// the MachineFrameInfo attached to \p MF with the results. |
208 bool runOnMachineFunction(MachineFunction &MF) override; | 206 bool runOnMachineFunction(MachineFunction &MF) override; |
209 }; | 207 }; |
254 return false; | 252 return false; |
255 } | 253 } |
256 | 254 |
257 /// \brief Helper function to find the immediate (post) dominator. | 255 /// \brief Helper function to find the immediate (post) dominator. |
258 template <typename ListOfBBs, typename DominanceAnalysis> | 256 template <typename ListOfBBs, typename DominanceAnalysis> |
259 MachineBasicBlock *FindIDom(MachineBasicBlock &Block, ListOfBBs BBs, | 257 static MachineBasicBlock *FindIDom(MachineBasicBlock &Block, ListOfBBs BBs, |
260 DominanceAnalysis &Dom) { | 258 DominanceAnalysis &Dom) { |
261 MachineBasicBlock *IDom = &Block; | 259 MachineBasicBlock *IDom = &Block; |
262 for (MachineBasicBlock *BB : BBs) { | 260 for (MachineBasicBlock *BB : BBs) { |
263 IDom = Dom.findNearestCommonDominator(IDom, BB); | 261 IDom = Dom.findNearestCommonDominator(IDom, BB); |
264 if (!IDom) | 262 if (!IDom) |
265 break; | 263 break; |
519 | 517 |
520 DEBUG(dbgs() << "Final shrink wrap candidates:\nSave: " << Save->getNumber() | 518 DEBUG(dbgs() << "Final shrink wrap candidates:\nSave: " << Save->getNumber() |
521 << ' ' << Save->getName() << "\nRestore: " | 519 << ' ' << Save->getName() << "\nRestore: " |
522 << Restore->getNumber() << ' ' << Restore->getName() << '\n'); | 520 << Restore->getNumber() << ' ' << Restore->getName() << '\n'); |
523 | 521 |
524 MachineFrameInfo *MFI = MF.getFrameInfo(); | 522 MachineFrameInfo &MFI = MF.getFrameInfo(); |
525 MFI->setSavePoint(Save); | 523 MFI.setSavePoint(Save); |
526 MFI->setRestorePoint(Restore); | 524 MFI.setRestorePoint(Restore); |
527 ++NumCandidates; | 525 ++NumCandidates; |
528 return false; | 526 return false; |
529 } | 527 } |
530 | 528 |
531 bool ShrinkWrap::isShrinkWrapEnabled(const MachineFunction &MF) { | 529 bool ShrinkWrap::isShrinkWrapEnabled(const MachineFunction &MF) { |