hi all,<br><br>The patch in the attachment add a new pass - region pass 
to the llvm system. A region pass is similar to a loop pass, all of them
 execute on a group of BasicBlocks at one time, but it operate on a 
single entry single exit region, not the nature loop. <br>
<br>The original purpose to add such a pass to llvm system is to allow 
us find out the static control part (SCoP) for the polyhedral 
optimization framework(<a href="http://wiki.llvm.org/Polyhedral_optimization_framework" target="_blank">http://wiki.llvm.org/Polyhedral_optimization_framework</a>)
 for llvm, but we think the region pass may help for others llvm 
developer, so we try to commit these code to llvm. hope it is not too 
late.<br>
<br>here is some introduction to "region" class written by grosser(<a href="mailto:grosser@fim.uni-passau.de" target="_blank">grosser@fim.uni-passau.de</a>),
 the author of the region detection pass.<br><br><br> A region is a 
connected subgraph of a control flow graph that has exactly<br>
 two connections to the rest of the graph.<br> The easiest definition of
 a region is a region connected with the CFG<br> by two edges, an entry 
edge and an exit edge. Such a region is called<br> simple.<br> However 
there also exist regions, that have several entry and exit edges,<br>
 but that can be transformed to a region with a single entry and exit 
edge by<br> inserting merge basic blocks. These regions are called 
refined regions.<br><br> A region R (simple or refined) has these 
attributes:<br> <br>
 * One entry basic block "entry" (part of the region)<br> * One exit 
basic block "exit" (not part of the region)<br><br> There exists always 
one entry basic block, where all edges entering the<br> region end. This
 entry basic block is always part of the region. By<br>
 inserting a basic block merging all entry edges before the entry basic<br> block,
 a single entry edge can be created.<br> There also exists always one 
exit basic block, where all edges leaving the<br> region end. This basic
 block is never part of the region. By inserting a<br>
 merge basic block before the exit basic block, a single exit edge can 
be<br> created.<br><br> * Every basic block BB in R:<br>   * is 
dominated by "entry"<br>   * is postdominated by "exit"<br>   (Not 
enough to check, if BB is part of R)<br>
<br> * "exit" always postdominates "entry"<br> * "entry" may dominate 
"exit"<br><br> * An edge (a,b) is part of the region if both a and b are
 part of the region<br>   or if a is part of the region and b is the 
exit node.<br>
<br> * A region is canonical, if it cannot be constructed by combining 
smaller<br>   regions.<br><br> Example:<br><br> CFG:   1<br>       / |<br>     
 2   |<br>     / \   3<br>    4   5  |<br>    |   |  |<br>    6   7  8<br>
     \  | /<br>      \ |/       region A: 1 -> 9 {1,2,3,4,5,6,7,8}<br>       
 9        region B: 2 -> 9 {2,4,5,6,7}<br><br> One region A is the 
parent of B is B is completely contained in A (as in the<br> example), 
whereas canonical regions either do not intersect at all or one is<br>
 the parent of the other.<br> Therefore a tree, called program structure
 tree, can be built out of the<br> regions by using this relation.<br><br>--best
 regards<br><font color="#888888">ether</font>