24 #define DEBUG_TYPE "loop-pass-manager"
30 class PrintLoopPass :
public LoopPass {
52 Out <<
"Printing <null> block";
72 CurrentLoop =
nullptr;
94 for (std::deque<Loop *>::iterator
I = LQ.begin(),
95 E = LQ.end();
I != E; ++
I) {
106 assert (CurrentLoop != L &&
"Cannot insert CurrentLoop");
119 if (L == CurrentLoop)
126 for (std::deque<Loop *>::iterator
I = LQ.begin(),
127 E = LQ.end();
I != E; ++
I) {
142 assert (CurrentLoop == L &&
"Can redo only CurrentLoop");
158 if (
BasicBlock *BB = dyn_cast<BasicBlock>(V)) {
198 auto &LIWP = getAnalysis<LoopInfoWrapperPass>();
199 LI = &LIWP.getLoopInfo();
200 bool Changed =
false;
221 for (std::deque<Loop *>::const_iterator
I = LQ.begin(), E = LQ.end();
231 while (!LQ.empty()) {
233 CurrentLoop = LQ.back();
234 skipThisLoop =
false;
235 redoThisLoop =
false;
251 Changed |= P->
runOnLoop(CurrentLoop, *
this);
256 skipThisLoop ?
"<deleted>" :
280 skipThisLoop ?
"<deleted>" :
302 LQ.push_back(CurrentLoop);
316 errs().
indent(Offset*2) <<
"Loop Pass Manager\n";
329 const std::string &Banner)
const {
330 return new PrintLoopPass(Banner, O);
342 while (!PMS.
empty() &&
358 while (!PMS.
empty() &&
367 assert (!PMS.
empty() &&
"Unable to create Loop Pass Manager");
397 <<
"' in function " << F->
getName() <<
"\n");
Pass interface - Implemented by all 'passes'.
bool preserveHigherLevelAnalysis(Pass *P)
PassManagerType
Different types of internal pass managers.
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
void dumpLastUses(Pass *P, unsigned Offset) const
virtual void dumpPassStructure(unsigned Offset=0)
virtual void deleteAnalysisLoop(Loop *L)
Delete analysis info associated with Loop L.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
std::vector< LoopT * >::const_reverse_iterator reverse_iterator
virtual const char * getPassName() const
getPassName - Return a nice clean name for a pass.
void assignPassManager(PMStack &PMS, PassManagerType PMT) override
Assign pass manager to manage this pass.
void dumpRequiredSet(const Pass *P) const
LoopT * getParentLoop() const
void updateUnloop(Loop *Unloop)
updateUnloop - Update LoopInfo after removing the last backedge from a loop–now the "unloop"...
void yield()
Calls the yield callback (if applicable).
void dumpPassInfo(Pass *P, enum PassDebuggingString S1, enum PassDebuggingString S2, StringRef Msg)
BlockT * getHeader() const
virtual PassManagerType getPassManagerType() const
PMTopLevelManager manages LastUser info and collects common APIs used by top level pass managers...
Timer * getPassTimer(Pass *)
If TimingInfo is enabled then start pass timer.
StringRef getName() const
Return a constant reference to the value's name.
The TimeRegion class is used as a helper class to call the startTimer() and stopTimer() methods of th...
void schedulePass(Pass *P)
Schedule pass P for execution.
AnalysisUsage & addRequired()
void freePass(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove P.
void deleteSimpleAnalysisLoop(Loop *L)
Invoke deleteAnalysisLoop hook for all passes that implement simple analysis interface.
void verifyPreservedAnalysis(Pass *P)
verifyPreservedAnalysis – Verify analysis presreved by pass P.
void populateInheritedAnalysis(PMStack &PMS)
PMStack - This class implements a stack data structure of PMDataManager pointers. ...
void initializeAnalysisImpl(Pass *P)
All Required analyses should be available to the pass as it runs! Here we fill in the AnalysisImpls m...
PassManagerPrettyStackEntry - This is used to print informative information about what pass is runnin...
reverse_iterator rbegin() const
Pass * createPrinterPass(raw_ostream &O, const std::string &Banner) const override
getPrinterPass - Get a pass to print the function corresponding to a Loop.
void add(Pass *P, bool ProcessAnalysis=true)
Add pass P into the PassVector.
void addChildLoop(LoopT *NewChild)
addChildLoop - Add the specified loop to be a child of this loop.
unsigned getNumContainedPasses() const
void insertLoopIntoQueue(Loop *L)
void verifyLoop() const
verifyLoop - Verify loop structure
std::vector< LoopT * >::const_reverse_iterator reverse_iterator
virtual bool doInitialization(Loop *L, LPPassManager &LPM)
void insertLoop(Loop *L, Loop *ParentLoop)
void dumpPreservedSet(const Pass *P) const
LLVM Basic Block Representation.
virtual bool doFinalization()
void addIndirectPassManager(PMDataManager *Manager)
void getAnalysisUsage(AnalysisUsage &Info) const override
Pass Manager itself does not invalidate any analysis info.
Represent the analysis usage information of a pass.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang","erlang-compatible garbage collector")
FunctionPass class - This class is used to implement most global optimizations.
void deleteSimpleAnalysisValue(Value *V, Loop *L)
deleteSimpleAnalysisValue - Invoke deleteAnalysisValue hook for all passes that implement simple anal...
void recordAvailableAnalysis(Pass *P)
Augment AvailableAnalysis by adding analysis made available by pass P.
reverse_iterator rend() const
void removeNotPreservedAnalysis(Pass *P)
Remove Analysis that is not preserved by the pass.
void deleteLoopFromQueue(Loop *L)
Delete loop from the loop queue and loop hierarchy (LoopInfo).
void removeDeadPasses(Pass *P, StringRef Msg, enum PassDebuggingString)
Remove dead passes used by P.
bool skipOptnoneFunction(const Loop *L) const
skipOptnoneFunction - Containing function has Attribute::OptimizeNone and most transformation passes ...
void addTopLevelLoop(LoopT *New)
addTopLevelLoop - This adds the specified loop to the collection of top-level loops.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
PMDataManager * top() const
Function must not be optimized.
void setPreservesAll()
Set by analyses that do not transform their input at all.
void dumpPassStructure(unsigned Offset) override
Print passes managed by this manager.
void preparePassManager(PMStack &PMS) override
Check if available pass managers are suitable for this pass or not.
std::vector< BlockT * >::const_iterator block_iterator
virtual bool runOnLoop(Loop *L, LPPassManager &LPM)=0
block_iterator block_end() const
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
void cloneBasicBlockSimpleAnalysis(BasicBlock *From, BasicBlock *To, Loop *L)
SimpleAnalysis - Provides simple interface to update analysis info maintained by various passes...
LoopPass * getContainedPass(unsigned N)
void push(PMDataManager *PM)
PMDataManager provides the common place to manage the analysis data used by pass managers.
This file defines passes to print out IR in various granularities.
virtual void cloneBasicBlockAnalysis(BasicBlock *F, BasicBlock *T, Loop *L)
SimpleAnalysis - Provides simple interface to update analysis info maintained by various passes...
LLVM Value Representation.
virtual void deleteAnalysisValue(Value *V, Loop *L)
deleteAnalysisValue - Delete analysis info associated with value V.
bool runOnFunction(Function &F) override
run - Execute all of the passes scheduled for execution.
static void addLoopIntoQueue(Loop *L, std::deque< Loop * > &LQ)
This class implements an extremely fast bulk output stream that can only output to a stream...
block_iterator block_begin() const
The legacy pass manager's analysis pass to compute loop information.
Pass * getAsPass() override