LLVM API Documentation

llvm::LoopInfo Class Reference

#include <LoopInfo.h>

Inheritance diagram for llvm::LoopInfo:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< Loop
* >::const_iterator 
iterator

Public Member Functions

 ~LoopInfo ()
iterator begin () const
iterator end () 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 releaseMemory ()
void print (std::ostream &O, const Module *=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)

Static Public Member Functions

static void stub ()

Friends

class Loop

Detailed Description

LoopInfo - This class builds and contains all of the top level loop structures in the specified function.

Definition at line 220 of file LoopInfo.h.


Member Typedef Documentation

typedef std::vector<Loop*>::const_iterator llvm::LoopInfo::iterator

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

Definition at line 231 of file LoopInfo.h.


Constructor & Destructor Documentation

llvm::LoopInfo::~LoopInfo (  )  [inline]

Definition at line 226 of file LoopInfo.h.

References releaseMemory().


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 288 of file LoopInfo.h.

References llvm::Loop::getParentLoop().

Referenced by CloneLoop().

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

Definition at line 232 of file LoopInfo.h.

Referenced by llvm::ScalarEvolution::print(), and removeLoop().

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

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 291 of file LoopInfo.cpp.

References BB.

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

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

Definition at line 299 of file LoopInfo.cpp.

References llvm::Loop::ParentLoop.

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

Definition at line 233 of file LoopInfo.h.

Referenced by llvm::ScalarEvolution::print(), and removeLoop().

void LoopInfo::getAnalysisUsage ( AnalysisUsage AU  )  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 116 of file LoopInfo.cpp.

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

unsigned llvm::LoopInfo::getLoopDepth ( const BasicBlock BB  )  const [inline]

getLoopDepth - Return the loop nesting level of the specified block...

Definition at line 252 of file LoopInfo.h.

References BB, llvm::Loop::getLoopDepth(), and getLoopFor().

Referenced by llvm::LiveIntervals::runOnMachineFunction().

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

getLoopFor - Return the inner most loop that BB lives in. If a basic block is in no loop (for example the entry node), null is returned.

Definition at line 238 of file LoopInfo.h.

References BB, and I.

Referenced by CloneLoop(), getLoopDepth(), isLoopHeader(), operator[](), llvm::ScalarEvolution::print(), llvm::SplitCriticalEdge(), and llvm::SCEVExpander::visitAddRecExpr().

bool llvm::LoopInfo::isLoopHeader ( BasicBlock BB  )  const [inline]

Definition at line 258 of file LoopInfo.h.

References BB, llvm::Loop::getHeader(), and getLoopFor().

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

operator[] - same as getLoopFor...

Definition at line 246 of file LoopInfo.h.

References BB, and getLoopFor().

void LoopInfo::print ( std::ostream &  O,
const Module = 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 121 of file LoopInfo.cpp.

References E, and I.

Referenced by llvm::operator<<().

void LoopInfo::releaseMemory (  )  [virtual]

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 97 of file LoopInfo.cpp.

References E, and I.

Referenced by runOnFunction(), and ~LoopInfo().

void LoopInfo::removeBlock ( BasicBlock BB  ) 

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 322 of file LoopInfo.cpp.

References BB, llvm::Loop::getParentLoop(), and llvm::Loop::removeBlockFromLoop().

Loop * LoopInfo::removeLoop ( iterator  I  ) 

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 311 of file LoopInfo.cpp.

References begin(), end(), and llvm::Loop::getParentLoop().

bool LoopInfo::runOnFunction ( Function F  )  [virtual]

runOnFunction - Calculate the natural loop information.

Implements llvm::FunctionPass.

Definition at line 91 of file LoopInfo.cpp.

References releaseMemory().

void LoopInfo::stub (  )  [static]

Definition at line 89 of file LoopInfo.cpp.


Friends And Related Function Documentation

friend class Loop [friend]

Definition at line 224 of file LoopInfo.h.


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