LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
llvm::LoopInfo Class Reference

#include <LoopInfo.h>

Inheritance diagram for llvm::LoopInfo:
Inheritance graph
[legend]
Collaboration diagram for llvm::LoopInfo:
Collaboration graph
[legend]

Public Types

typedef LoopInfoBase
< BasicBlock, Loop >::iterator 
iterator
 
typedef LoopInfoBase
< BasicBlock, Loop >
::reverse_iterator 
reverse_iterator
 

Public Member Functions

 LoopInfo ()
 
LoopInfoBase< BasicBlock, Loop > & getBase ()
 
iterator begin () const
 
iterator end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
bool empty () const
 
LoopgetLoopFor (const BasicBlock *BB) const
 
const Loopoperator[] (const BasicBlock *BB) const
 
unsigned getLoopDepth (const BasicBlock *BB) const
 
bool isLoopHeader (BasicBlock *BB) const
 
virtual bool runOnFunction (Function &F)
 
virtual void verifyAnalysis () const
 
virtual void releaseMemory ()
 
virtual void print (raw_ostream &O, const Module *M=0) const
 
virtual void getAnalysisUsage (AnalysisUsage &AU) const
 
LoopremoveLoop (iterator I)
 
void changeLoopFor (BasicBlock *BB, Loop *L)
 
void changeTopLevelLoop (Loop *OldLoop, Loop *NewLoop)
 
void addTopLevelLoop (Loop *New)
 
void removeBlock (BasicBlock *BB)
 
void updateUnloop (Loop *Unloop)
 
bool replacementPreservesLCSSAForm (Instruction *From, Value *To)
 
- Public Member Functions inherited from llvm::FunctionPass
 FunctionPass (char &pid)
 
PasscreatePrinterPass (raw_ostream &O, const std::string &Banner) const
 createPrinterPass - Get a function printer pass. More...
 
virtual void assignPassManager (PMStack &PMS, PassManagerType T)
 
virtual PassManagerType getPotentialPassManagerType () const
 Return what kind of Pass Manager can manage this pass. More...
 
- Public Member Functions inherited from llvm::Pass
 Pass (PassKind K, char &pid)
 
virtual ~Pass ()
 
PassKind getPassKind () const
 
virtual const char * getPassName () const
 
AnalysisID getPassID () const
 getPassID - Return the PassID number that corresponds to this pass. More...
 
virtual bool doInitialization (Module &)
 
virtual bool doFinalization (Module &)
 
void dump () const
 
virtual void preparePassManager (PMStack &)
 Check if available pass managers are suitable for this pass or not. More...
 
void setResolver (AnalysisResolver *AR)
 
AnalysisResolvergetResolver () const
 
virtual void * getAdjustedAnalysisPointer (AnalysisID ID)
 
virtual ImmutablePassgetAsImmutablePass ()
 
virtual PMDataManagergetAsPMDataManager ()
 
virtual void dumpPassStructure (unsigned Offset=0)
 
template<typename AnalysisType >
AnalysisType * getAnalysisIfAvailable () const
 
bool mustPreserveAnalysisID (char &AID) const
 
template<typename AnalysisType >
AnalysisType & getAnalysis () const
 
template<typename AnalysisType >
AnalysisType & getAnalysis (Function &F)
 
template<typename AnalysisType >
AnalysisType & getAnalysisID (AnalysisID PI) const
 
template<typename AnalysisType >
AnalysisType & getAnalysisID (AnalysisID PI, Function &F)
 

Static Public Attributes

static char ID = 0
 

Friends

class LoopBase< BasicBlock, Loop >
 

Additional Inherited Members

- Static Public Member Functions inherited from llvm::Pass
static const PassInfolookupPassInfo (const void *TI)
 
static const PassInfolookupPassInfo (StringRef Arg)
 
static PasscreatePass (AnalysisID ID)
 

Detailed Description

Definition at line 589 of file LoopInfo.h.

Member Typedef Documentation

iterator/begin/end - The interface to the top-level loops in the current function.

Definition at line 607 of file LoopInfo.h.

Definition at line 608 of file LoopInfo.h.

Constructor & Destructor Documentation

llvm::LoopInfo::LoopInfo ( )
inline

Member Function Documentation

void llvm::LoopInfo::addTopLevelLoop ( Loop New)
inline

addTopLevelLoop - This adds the specified loop to the collection of top-level loops.

Definition at line 672 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::addTopLevelLoop().

Referenced by llvm::LPPassManager::insertLoop().

iterator llvm::LoopInfo::begin ( ) const
inline

Definition at line 609 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::begin().

Referenced by verifyAnalysis().

void llvm::LoopInfo::changeLoopFor ( BasicBlock BB,
Loop L 
)
inline

changeLoopFor - Change the top-level loop that contains BB to the specified loop. This should be used by transformations that restructure the loop hierarchy tree.

Definition at line 660 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::changeLoopFor().

void llvm::LoopInfo::changeTopLevelLoop ( Loop OldLoop,
Loop NewLoop 
)
inline

changeTopLevelLoop - Replace the specified loop in the top-level loops list with the indicated loop.

Definition at line 666 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::changeTopLevelLoop().

bool llvm::LoopInfo::empty ( ) const
inline

Definition at line 613 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::empty().

iterator llvm::LoopInfo::end ( ) const
inline

Definition at line 610 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::end().

Referenced by verifyAnalysis().

void LoopInfo::getAnalysisUsage ( AnalysisUsage ) const
virtual

getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job. If a pass specifies that it uses a particular analysis result to this function, it can then use the getAnalysis<AnalysisType>() function, below.

Reimplemented from llvm::Pass.

Definition at line 706 of file LoopInfo.cpp.

References llvm::AnalysisUsage::addRequired(), and llvm::AnalysisUsage::setPreservesAll().

LoopInfoBase<BasicBlock, Loop>& llvm::LoopInfo::getBase ( )
inline
unsigned llvm::LoopInfo::getLoopDepth ( const BasicBlock BB) const
inline

getLoopDepth - Return the loop nesting level of the specified block. A depth of 0 means the block is not inside any loop.

Definition at line 631 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::getLoopDepth().

Loop* llvm::LoopInfo::getLoopFor ( const BasicBlock BB) const
inline
bool llvm::LoopInfo::isLoopHeader ( BasicBlock BB) const
inline

Definition at line 636 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::isLoopHeader().

const Loop* llvm::LoopInfo::operator[] ( const BasicBlock BB) const
inline

operator[] - same as getLoopFor...

Definition at line 624 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::getLoopFor().

void LoopInfo::print ( raw_ostream O,
const Module M = 0 
) const
virtual

print - Print out the internal state of the pass. This is called by Analyze to print out the contents of an analysis. Otherwise it is not necessary to implement this method. Beware that the module pointer MAY be null. This automatically forwards to a virtual function that does not provide the Module* in case the analysis doesn't need it it can just be ignored.

Reimplemented from llvm::Pass.

Definition at line 711 of file LoopInfo.cpp.

reverse_iterator llvm::LoopInfo::rbegin ( ) const
inline

Definition at line 611 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::rbegin().

Referenced by llvm::LPPassManager::runOnFunction().

virtual void llvm::LoopInfo::releaseMemory ( )
inlinevirtual

releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed. The default behavior of passes is to hold onto memory for the entire duration of their lifetime (which is the entire compile time). For pipelined passes, this is not a big deal because that memory gets recycled every time the pass is invoked on another program unit. For IP passes, it is more important to free memory when it is unused.

Optionally implement this function to release pass memory when it is no longer used.

Reimplemented from llvm::Pass.

Definition at line 646 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::releaseMemory().

Referenced by runOnFunction().

void llvm::LoopInfo::removeBlock ( BasicBlock BB)
inline

removeBlock - This method completely removes BB from all data structures, including all of the Loop objects it is nested in and our mapping from BasicBlocks to loops.

Definition at line 679 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::removeBlock().

Referenced by FoldBlockIntoPredecessor().

Loop* llvm::LoopInfo::removeLoop ( iterator  I)
inline

removeLoop - This removes the specified top-level loop from this loop info object. The loop is not deleted, as it will presumably be inserted into another loop.

Definition at line 655 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::removeLoop().

reverse_iterator llvm::LoopInfo::rend ( ) const
inline

Definition at line 612 of file LoopInfo.h.

References llvm::LoopInfoBase< N, M >::rend().

Referenced by llvm::LPPassManager::runOnFunction().

bool llvm::LoopInfo::replacementPreservesLCSSAForm ( Instruction From,
Value To 
)
inline

replacementPreservesLCSSAForm - Returns true if replacing From with To everywhere is guaranteed to preserve LCSSA form.

Definition at line 691 of file LoopInfo.h.

References llvm::LoopBase< N, M >::contains(), llvm::dyn_cast(), llvm::Instruction::getParent(), and I.

Referenced by llvm::UnrollLoop().

bool LoopInfo::runOnFunction ( Function F)
virtual

runOnFunction - Calculate the natural loop information.

Implements llvm::FunctionPass.

Definition at line 615 of file LoopInfo.cpp.

References getBase(), and releaseMemory().

void LoopInfo::updateUnloop ( Loop Unloop)

updateUnloop - Update LoopInfo after removing the last backedge from a loop–now the "unloop". This updates the loop forest and parent loops for each block so that Unloop is no longer referenced, but the caller must actually delete the Unloop object.

updateUnloop - The last backedge has been removed from a loop–now the "unloop". Find a new parent for the blocks contained within unloop and update the loop tree. We don't necessarily have valid dominators at this point, but LoopInfo is still valid except for the removal of this loop.

Note that Unloop may now be an empty loop. Calling Loop::getHeader without checking first is illegal.

Definition at line 628 of file LoopInfo.cpp.

References llvm::LoopBase< N, M >::begin(), llvm::LoopBase< N, M >::block_begin(), llvm::LoopBase< N, M >::block_end(), llvm::LoopBase< N, M >::empty(), llvm::LoopBase< N, M >::end(), getLoopFor(), llvm::LoopBase< N, M >::getParentLoop(), I, llvm::prior(), and llvm::LoopBase< N, M >::removeChildLoop().

Referenced by llvm::LPPassManager::deleteLoopFromQueue().

void LoopInfo::verifyAnalysis ( ) const
virtual

verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis information.

Reimplemented from llvm::Pass.

Definition at line 683 of file LoopInfo.cpp.

References begin(), llvm::DenseSet< ValueT, ValueInfoT >::count(), end(), I, Loops, and VerifyLoopInfo.

Friends And Related Function Documentation

friend class LoopBase< BasicBlock, Loop >
friend

Definition at line 591 of file LoopInfo.h.

Member Data Documentation

char LoopInfo::ID = 0
static

Definition at line 596 of file LoopInfo.h.


The documentation for this class was generated from the following files: