class RegionBase
Declaration
template <class Tr>
class RegionBase { /* full declaration omitted */ };
Description
A single entry single exit Region. A Region is a connected subgraph of a control flow graph that has exactly two connections to the remaining graph. It can be used to analyze or optimize parts of the control flow graph. A simple Region is connected to the remaining graph by just two edges. One edge entering the Region and another one leaving the Region. An extended Region (or just Region) is a subgraph that can be transform into a simple Region. The transformation is done by adding BasicBlocks that merge several entry or exit edges so that after the merge just one entry and one exit edge exists. The \e Entry of a Region is the first BasicBlock that is passed after entering the Region. It is an element of the Region. The entry BasicBlock dominates all BasicBlocks in the Region. The \e Exit of a Region is the first BasicBlock that is passed after leaving the Region. It is not an element of the Region. The exit BasicBlock, postdominates all BasicBlocks in the Region. A canonical Region cannot be constructed by combining smaller Regions. Region A is the \e parent of Region B, if B is completely contained in A. Two canonical Regions either do not intersect at all or one is the parent of the other. The Program Structure Tree is a graph (V, E) where V is the set of Regions in the control flow graph and E is the \e parent relation of these Regions. Example: You can obtain more examples by either calling "opt -regions -analyze anyprogram.ll" or "opt -view-regions-only anyprogram.ll" on any LLVM file you are interested in. The first call returns a textual representation of the program structure tree, the second one creates a graphical representation using graphviz.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:255
Templates
- Tr
Method Overview
- public RegionBase<RegionTr>(const RegionBase<RegionTr> &)
- public RegionBase<RegionTr>(llvm::RegionBase::BlockT * Entry, llvm::RegionBase::BlockT * Exit, llvm::RegionBase::RegionInfoT * RI, llvm::RegionBase::DomTreeT * DT, llvm::RegionBase::RegionT * Parent = nullptr)
- public void addSubRegion(llvm::RegionBase::RegionT * SubRegion, bool moveChildren = false)
- public llvm::RegionBase::iterator begin()
- public llvm::RegionBase::const_iterator begin() const
- public llvm::RegionBase::const_block_iterator block_begin() const
- public llvm::RegionBase::block_iterator block_begin()
- public llvm::RegionBase::const_block_iterator block_end() const
- public llvm::RegionBase::block_iterator block_end()
- public inline llvm::RegionBase::const_block_range blocks() const
- public inline llvm::RegionBase::block_range blocks()
- public void clearNodeCache()
- public bool contains(const llvm::RegionBase::LoopT * L) const
- public bool contains(const llvm::RegionBase::InstT * Inst) const
- public bool contains(const llvm::RegionBase::RegionT * SubRegion) const
- public bool contains(const llvm::RegionBase::BlockT * BB) const
- public void dump() const
- public llvm::RegionBase::element_iterator element_begin()
- public llvm::RegionBase::const_element_iterator element_begin() const
- public llvm::RegionBase::element_iterator element_end()
- public llvm::RegionBase::const_element_iterator element_end() const
- public iterator_range<llvm::RegionBase::const_element_iterator> elements() const
- public iterator_range<llvm::RegionBase::element_iterator> elements()
- public llvm::RegionBase::const_iterator end() const
- public llvm::RegionBase::iterator end()
- public llvm::RegionBase::RegionNodeT * getBBNode(llvm::RegionBase::BlockT * BB) const
- public unsigned int getDepth() const
- public llvm::RegionBase::BlockT * getEnteringBlock() const
- public llvm::RegionBase::BlockT * getEntry() const
- public llvm::RegionBase::BlockT * getExit() const
- public llvm::RegionBase::BlockT * getExitingBlock() const
- public bool getExitingBlocks(SmallVectorImpl<llvm::RegionBase::BlockT *> & Exitings) const
- public llvm::RegionBase::RegionT * getExpandedRegion() const
- public std::string getNameStr() const
- public llvm::RegionBase::RegionNodeT * getNode() const
- public llvm::RegionBase::RegionNodeT * getNode(llvm::RegionBase::BlockT * BB) const
- public llvm::RegionBase::RegionT * getParent() const
- public llvm::RegionBase::RegionInfoT * getRegionInfo() const
- public llvm::RegionBase::RegionT * getSubRegionNode(llvm::RegionBase::BlockT * BB) const
- public bool isSimple() const
- public bool isTopLevelRegion() const
- public llvm::RegionBase::LoopT * outermostLoopInRegion(llvm::RegionBase::LoopInfoT * LI, llvm::RegionBase::BlockT * BB) const
- public llvm::RegionBase::LoopT * outermostLoopInRegion(llvm::RegionBase::LoopT * L) const
- public void print(llvm::raw_ostream & OS, bool printTree = true, unsigned int level = 0, llvm::RegionBase::PrintStyle Style = PrintNone) const
- public llvm::RegionBase::RegionT * removeSubRegion(llvm::RegionBase::RegionT * SubRegion)
- public void replaceEntry(llvm::RegionBase::BlockT * BB)
- public void replaceEntryRecursive(llvm::RegionBase::BlockT * NewEntry)
- public void replaceExit(llvm::RegionBase::BlockT * BB)
- public void replaceExitRecursive(llvm::RegionBase::BlockT * NewExit)
- public void transferChildrenTo(llvm::RegionBase::RegionT * To)
- public void verifyRegion() const
- public ~RegionBase<RegionTr>()
Methods
¶RegionBase<RegionTr>(const RegionBase<RegionTr>&)
RegionBase<RegionTr>(const RegionBase<RegionTr>&)
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:315
Parameters
- const RegionBase<RegionTr>&
¶RegionBase<RegionTr>(
llvm::RegionBase::BlockT* Entry,
llvm::RegionBase::BlockT* Exit,
llvm::RegionBase::RegionInfoT* RI,
llvm::RegionBase::DomTreeT* DT,
llvm::RegionBase::RegionT* Parent = nullptr)
RegionBase<RegionTr>(
llvm::RegionBase::BlockT* Entry,
llvm::RegionBase::BlockT* Exit,
llvm::RegionBase::RegionInfoT* RI,
llvm::RegionBase::DomTreeT* DT,
llvm::RegionBase::RegionT* Parent = nullptr)
Description
Create a new region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:312
Parameters
- llvm::RegionBase::BlockT* Entry
- The entry basic block of the region.
- llvm::RegionBase::BlockT* Exit
- The exit basic block of the region.
- llvm::RegionBase::RegionInfoT* RI
- The region info object that is managing this region.
- llvm::RegionBase::DomTreeT* DT
- The dominator tree of the current function.
- llvm::RegionBase::RegionT* Parent = nullptr
- The surrounding region or NULL if this is a top level region.
¶void addSubRegion(
llvm::RegionBase::RegionT* SubRegion,
bool moveChildren = false)
void addSubRegion(
llvm::RegionBase::RegionT* SubRegion,
bool moveChildren = false)
Description
Add a new subregion to this Region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:527
Parameters
- llvm::RegionBase::RegionT* SubRegion
- The new subregion that will be added.
- bool moveChildren = false
- Move the children of this region, that are also contained in SubRegion into SubRegion.
¶llvm::RegionBase::iterator begin()
llvm::RegionBase::iterator begin()
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:561
¶llvm::RegionBase::const_iterator begin() const
llvm::RegionBase::const_iterator begin() const
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:564
¶llvm::RegionBase::const_block_iterator
block_begin() const
llvm::RegionBase::const_block_iterator
block_begin() const
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:615
¶llvm::RegionBase::block_iterator block_begin()
llvm::RegionBase::block_iterator block_begin()
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:611
¶llvm::RegionBase::const_block_iterator block_end()
const
llvm::RegionBase::const_block_iterator block_end()
const
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:618
¶llvm::RegionBase::block_iterator block_end()
llvm::RegionBase::block_iterator block_end()
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:613
¶inline llvm::RegionBase::const_block_range
blocks() const
inline llvm::RegionBase::const_block_range
blocks() const
Description
Returns a range view of the basic blocks in the region. This is the 'const' version of the range view.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:631
¶inline llvm::RegionBase::block_range blocks()
inline llvm::RegionBase::block_range blocks()
Description
Returns a range view of the basic blocks in the region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:624
¶void clearNodeCache()
void clearNodeCache()
Description
Clear the cache for BB RegionNodes. After calling this function the BasicBlock RegionNodes will be stored at different memory locations. RegionNodes obtained before this function is called are therefore not comparable to RegionNodes abtained afterwords.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:552
¶bool contains(
const llvm::RegionBase::LoopT* L) const
bool contains(
const llvm::RegionBase::LoopT* L) const
Description
Check if the region contains a loop.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:479
Parameters
- const llvm::RegionBase::LoopT* L
- The loop that might be contained in this region.
Returns
True if the loop is contained in the region otherwise false. In case a NULL pointer is passed to this function the result is false, except for the region that describes the whole function. In that case true is returned.
¶bool contains(
const llvm::RegionBase::InstT* Inst) const
bool contains(
const llvm::RegionBase::InstT* Inst) const
Description
Check if the region contains an Instruction.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:470
Parameters
- const llvm::RegionBase::InstT* Inst
- The Instruction that might be contained in this region.
Returns
True if the Instruction is contained in the region otherwise false.
¶bool contains(const llvm::RegionBase::RegionT*
SubRegion) const
bool contains(const llvm::RegionBase::RegionT*
SubRegion) const
Description
Check if the region contains another region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:455
Parameters
- const llvm::RegionBase::RegionT* SubRegion
- The region that might be contained in this Region.
Returns
True if SubRegion is contained in the region otherwise false.
¶bool contains(
const llvm::RegionBase::BlockT* BB) const
bool contains(
const llvm::RegionBase::BlockT* BB) const
Description
Check if the region contains a BasicBlock.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:449
Parameters
- const llvm::RegionBase::BlockT* BB
- The BasicBlock that might be contained in this Region.
Returns
True if the block is contained in the region otherwise false.
¶void dump() const
void dump() const
Description
Print the region to stderr.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:442
¶llvm::RegionBase::element_iterator element_begin()
llvm::RegionBase::element_iterator element_begin()
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:651
¶llvm::RegionBase::const_element_iterator
element_begin() const
llvm::RegionBase::const_element_iterator
element_begin() const
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:657
¶llvm::RegionBase::element_iterator element_end()
llvm::RegionBase::element_iterator element_end()
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:652
¶llvm::RegionBase::const_element_iterator
element_end() const
llvm::RegionBase::const_element_iterator
element_end() const
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:658
¶iterator_range<
llvm::RegionBase::const_element_iterator>
elements() const
iterator_range<
llvm::RegionBase::const_element_iterator>
elements() const
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:659
¶iterator_range<llvm::RegionBase::element_iterator>
elements()
iterator_range<llvm::RegionBase::element_iterator>
elements()
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:653
¶llvm::RegionBase::const_iterator end() const
llvm::RegionBase::const_iterator end() const
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:565
¶llvm::RegionBase::iterator end()
llvm::RegionBase::iterator end()
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:562
¶llvm::RegionBase::RegionNodeT* getBBNode(
llvm::RegionBase::BlockT* BB) const
llvm::RegionBase::RegionNodeT* getBBNode(
llvm::RegionBase::BlockT* BB) const
Description
Get the BasicBlock RegionNode for a BasicBlock
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:520
Parameters
- llvm::RegionBase::BlockT* BB
- The BasicBlock for which the RegionNode is requested.
Returns
The RegionNode representing the BB.
¶unsigned int getDepth() const
unsigned int getDepth() const
Description
Get the nesting level of this Region. An toplevel Region has depth 0.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:381
Returns
The depth of the region.
¶llvm::RegionBase::BlockT* getEnteringBlock() const
llvm::RegionBase::BlockT* getEnteringBlock() const
Description
Return the first block of this region's single entry edge, if existing.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:401
Returns
The BasicBlock starting this region's single entry edge, else NULL.
¶llvm::RegionBase::BlockT* getEntry() const
llvm::RegionBase::BlockT* getEntry() const
Description
Get the entry BasicBlock of the Region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:323
Returns
The entry BasicBlock of the region.
¶llvm::RegionBase::BlockT* getExit() const
llvm::RegionBase::BlockT* getExit() const
Description
Get the exit BasicBlock of the Region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:360
Returns
The exit BasicBlock of the Region, NULL if this is the TopLevel Region.
¶llvm::RegionBase::BlockT* getExitingBlock() const
llvm::RegionBase::BlockT* getExitingBlock() const
Description
Return the first block of this region's single exit edge, if existing.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:408
Returns
The BasicBlock starting this region's single exit edge, else NULL.
¶bool getExitingBlocks(
SmallVectorImpl<llvm::RegionBase::BlockT*>&
Exitings) const
bool getExitingBlocks(
SmallVectorImpl<llvm::RegionBase::BlockT*>&
Exitings) const
Description
Collect all blocks of this region's single exit edge, if existing.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:413
Parameters
- SmallVectorImpl<llvm::RegionBase::BlockT*>& Exitings
Returns
True if this region contains all the predecessors of the exit.
¶llvm::RegionBase::RegionT* getExpandedRegion()
const
llvm::RegionBase::RegionT* getExpandedRegion()
const
Description
Return a new (non-canonical) region, that is obtained by joining this region with its predecessors.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:394
Returns
A region also starting at getEntry(), but reaching to the next basic block that forms with getEntry() a (non-canonical) region. NULL if such a basic block does not exist.
¶std::string getNameStr() const
std::string getNameStr() const
Description
Returns the name of the Region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:424
Returns
The Name of the Region.
¶llvm::RegionBase::RegionNodeT* getNode() const
llvm::RegionBase::RegionNodeT* getNode() const
Description
Get the RegionNode representing the current Region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:371
Returns
The RegionNode representing the current Region.
¶llvm::RegionBase::RegionNodeT* getNode(
llvm::RegionBase::BlockT* BB) const
llvm::RegionBase::RegionNodeT* getNode(
llvm::RegionBase::BlockT* BB) const
Description
Get the RegionNode for a BasicBlock
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:514
Parameters
- llvm::RegionBase::BlockT* BB
- The BasicBlock at which the RegionNode should start.
Returns
If available, the RegionNode that represents the subregion starting at BB. If no subregion starts at BB, the RegionNode representing BB.
¶llvm::RegionBase::RegionT* getParent() const
llvm::RegionBase::RegionT* getParent() const
Description
Get the parent of the Region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:365
Returns
The parent of the Region or NULL if this is a top level Region.
¶llvm::RegionBase::RegionInfoT* getRegionInfo()
const
llvm::RegionBase::RegionInfoT* getRegionInfo()
const
Description
Return the RegionInfo object, that belongs to this Region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:427
¶llvm::RegionBase::RegionT* getSubRegionNode(
llvm::RegionBase::BlockT* BB) const
llvm::RegionBase::RegionT* getSubRegionNode(
llvm::RegionBase::BlockT* BB) const
Description
Get the subregion that starts at a BasicBlock
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:506
Parameters
- llvm::RegionBase::BlockT* BB
- The BasicBlock the subregion should start.
Returns
The Subregion if available, otherwise NULL.
¶bool isSimple() const
bool isSimple() const
Description
Is this a simple region? A region is simple if it has exactly one exit and one entry edge.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:420
Returns
True if the Region is simple.
¶bool isTopLevelRegion() const
bool isTopLevelRegion() const
Description
Check if a Region is the TopLevel region. The toplevel region represents the whole function.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:386
¶llvm::RegionBase::LoopT* outermostLoopInRegion(
llvm::RegionBase::LoopInfoT* LI,
llvm::RegionBase::BlockT* BB) const
llvm::RegionBase::LoopT* outermostLoopInRegion(
llvm::RegionBase::LoopInfoT* LI,
llvm::RegionBase::BlockT* BB) const
Description
Get the outermost loop in the region that contains a basic block. Find for a basic block BB the outermost loop L that contains BB and is itself contained in the region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:500
Parameters
- llvm::RegionBase::LoopInfoT* LI
- A pointer to a LoopInfo analysis.
- llvm::RegionBase::BlockT* BB
- The basic block surrounded by the loop.
Returns
The outermost loop in the region, NULL if such a loop does not exist or if the region describes the whole function.
¶llvm::RegionBase::LoopT* outermostLoopInRegion(
llvm::RegionBase::LoopT* L) const
llvm::RegionBase::LoopT* outermostLoopInRegion(
llvm::RegionBase::LoopT* L) const
Description
Get the outermost loop in the region that contains a loop. Find for a Loop L the outermost loop OuterL that is a parent loop of L and is itself contained in the region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:489
Parameters
- llvm::RegionBase::LoopT* L
- The loop the lookup is started.
Returns
The outermost loop in the region, NULL if such a loop does not exist or if the region describes the whole function.
¶void print(llvm::raw_ostream& OS,
bool printTree = true,
unsigned int level = 0,
llvm::RegionBase::PrintStyle Style =
PrintNone) const
void print(llvm::raw_ostream& OS,
bool printTree = true,
unsigned int level = 0,
llvm::RegionBase::PrintStyle Style =
PrintNone) const
Description
Print the region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:437
Parameters
- llvm::raw_ostream& OS
- The output stream the Region is printed to.
- bool printTree = true
- Print also the tree of subregions.
- unsigned int level = 0
- The indentation level used for printing.
- llvm::RegionBase::PrintStyle Style = PrintNone
¶llvm::RegionBase::RegionT* removeSubRegion(
llvm::RegionBase::RegionT* SubRegion)
llvm::RegionBase::RegionT* removeSubRegion(
llvm::RegionBase::RegionT* SubRegion)
Description
Remove a subregion from this Region. The subregion is not deleted, as it will probably be inserted into another region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:534
Parameters
- llvm::RegionBase::RegionT* SubRegion
- The SubRegion that will be removed.
¶void replaceEntry(llvm::RegionBase::BlockT* BB)
void replaceEntry(llvm::RegionBase::BlockT* BB)
Description
Replace the entry basic block of the region with the new basic block.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:331
Parameters
- llvm::RegionBase::BlockT* BB
- The new entry basic block of the region.
¶void replaceEntryRecursive(
llvm::RegionBase::BlockT* NewEntry)
void replaceEntryRecursive(
llvm::RegionBase::BlockT* NewEntry)
Description
Recursively replace the entry basic block of the region. This function replaces the entry basic block with a new basic block. It also updates all child regions that have the same entry basic block as this region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:346
Parameters
- llvm::RegionBase::BlockT* NewEntry
- The new entry basic block.
¶void replaceExit(llvm::RegionBase::BlockT* BB)
void replaceExit(llvm::RegionBase::BlockT* BB)
Description
Replace the exit basic block of the region with the new basic block.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:337
Parameters
- llvm::RegionBase::BlockT* BB
- The new exit basic block of the region.
¶void replaceExitRecursive(
llvm::RegionBase::BlockT* NewExit)
void replaceExitRecursive(
llvm::RegionBase::BlockT* NewExit)
Description
Recursively replace the exit basic block of the region. This function replaces the exit basic block with a new basic block. It also updates all child regions that have the same exit basic block as this region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:355
Parameters
- llvm::RegionBase::BlockT* NewExit
- The new exit basic block.
¶void transferChildrenTo(
llvm::RegionBase::RegionT* To)
void transferChildrenTo(
llvm::RegionBase::RegionT* To)
Description
Move all direct child nodes of this Region to another Region.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:539
Parameters
- llvm::RegionBase::RegionT* To
- The Region the child nodes will be transferred to.
¶void verifyRegion() const
void verifyRegion() const
Description
Verify if the region is a correct region. Check if this is a correctly build Region. This is an expensive check, as the complete CFG of the Region will be walked.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:545
¶~RegionBase<RegionTr>()
~RegionBase<RegionTr>()
Description
Delete the Region and all its subregions.
Declared at: llvm/include/llvm/Analysis/RegionInfo.h:319