llvm::Region Class Reference

#include <RegionInfo.h>

Inheritance diagram for llvm::Region:

llvm::RegionNode

List of all members.

Public Types

typedef RegionSetIt< std::map
< BasicBlock *, RegionNode * >
::iterator
iterator
typedef RegionSetIt< std::map
< BasicBlock *, RegionNode * >
::const_iterator
const_iterator
typedef df_iterator
< RegionNode *, SmallPtrSet
< RegionNode *, 8 >, false,
GraphTraits< FlatIt
< RegionNode * > > > 
block_iterator
typedef df_iterator< const
RegionNode *, SmallPtrSet
< const RegionNode *, 8 >
, false, GraphTraits< FlatIt
< const RegionNode * > > > 
const_block_iterator

Public Member Functions

 Region (BasicBlock *Entry, BasicBlock *Exit, RegionInfo *RI, DominatorTree *DT, PostDominatorTree *PDT, Region *Parent=0)
bool contains (BasicBlock *BB) const
 Check if the region contains a basic block.
BasicBlock * getEntry () const
 Get the entry basic block of the region.
BasicBlock * getExit () const
 Get the exit basic block of the region.
std::string getName () const
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
RegionNodegetChildNode (BasicBlock *BB) const
 Get the immediately child region node by mapping to bb.
RegionNodegetBBNode (BasicBlock *BB) const
 Get the lowest level child BB node by mapping to bb.
RegionNodegetGraphEntry () const
 Graphtraits support.
RegionNodegetFlatGraphEntry () const
block_iterator block_begin ()
block_iterator block_end ()
const_block_iterator block_begin () const
const_block_iterator block_end () const
void print (raw_ostream &os, bool printtree=true, unsigned level=0) const
 Print the region.
void verifyRegion () const
 Verify if the region is a correct region.
unsigned getRegionDepth () const
 Return the nesting level of this region.
RegionremoveChildRegion (Region *Child)
void addChildRegion (Region *NewChild)
void transferChildrenTo (Region *To)
 Move all direct child nodes (BBs and Regions) of the region to target.
void transferChildrenTo (RegionInfo *To)
void removeBlock (BasicBlock *BB)
void addBlock (BasicBlock *BB)

Friends

class RegionInfo


Detailed Description

A Region is a connected subgraph of a control flow graph that has exactly two connections to the remaining graph.

A Region that is connected to the remaing graph by just two edges, one edge entering the Region and another one leaving the Region, is called simple.

A Region that has several entry and exit edges, but that can be transformed to a simple Region by inserting merge basic blocks is called refined Region.

A basic block is called "entry" of a Region, if it dominates all other basic blocks in this Region. The entry basic block is the first basic block that is passed after entering the Region. It is part of the Region.

A basic block is called "exit" of a Region, if it is the first basic block that is passed after leaving the Region. It is not part of the Region.

A Region is canonical, if it cannot be constructed by combining smaller Regions.

Region A is the 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.

Example:

/// CFG:   1
///       / |
///      2   |
///     / \   3
///    4   5  |
///    |   |  |
///    6   7  8
///     \  | /
///      \ |/       Region A: 1 -> 9 {1,2,3,4,5,6,7,8}
///        9        Region B: 2 -> 9 {2,4,5,6,7}
/// 

A tree, called program structure tree, can be built using the "parent" relation.


Member Typedef Documentation

typedef df_iterator<RegionNode*, SmallPtrSet<RegionNode*, 8>, false, GraphTraits<FlatIt<RegionNode*> > > llvm::Region::block_iterator

block_iterator/block_begin/block_end, use to iterate the BBs inside the region

typedef RegionSetIt<std::map<BasicBlock*, RegionNode*>::iterator> llvm::Region::iterator

iterator/begin/end - Return the regions contained entirely within this region.


Member Function Documentation

void llvm::Region::addBlock ( BasicBlock *  BB  ) 

addBlock - This adds a basic block directly to the basic block list. This should only be used by transformations that create new regions. Other transformations should use addBasicBlockToRegion.

void llvm::Region::addChildRegion ( Region NewChild  ) 

addChildRegion - Add the specified region to be a child of this region. This updates the region depth of the new child.

bool llvm::Region::contains ( BasicBlock *  BB  )  const

Check if the region contains a basic block.

Parameters:
BB The basic block that might be contained in this region.
Returns:
True if the block is contained in the region otherwise false.

BasicBlock* llvm::Region::getEntry (  )  const [inline]

Get the entry basic block of the region.

Returns:
The entry basic block of the region.

BasicBlock* llvm::Region::getExit (  )  const [inline]

Get the exit basic block of the region.

Returns:
The exit basic block of the region.

unsigned llvm::Region::getRegionDepth (  )  const

Return the nesting level of this region.

An outer-most region has depth 1, for consistency with region depth values used for basic blocks, where depth 0 is used for blocks not inside any regions.

Returns:
The depth of the region.

void llvm::Region::removeBlock ( BasicBlock *  BB  ) 

removeBlock - This removes the specified basic block from the current region, updating the Blocks as appropriate. This does not update the mapping in the RegionInfo class.

Region* llvm::Region::removeChildRegion ( Region Child  ) 

removeChildRegion - This removes the specified child from being a subregion of this region. The region is not deleted, as it will probably be inserted into another region.


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

Generated on Fri Mar 19 01:41:25 2010 by  doxygen 1.5.8