[LLVMdev] Make LoopBase inherit from "RegionBase"?

Jan Sjodin jan_sjodin at yahoo.com
Fri Jan 22 08:30:11 PST 2010


On 01/21/10 20:42, Jan Sjodin wrote:
>>>> Imo, a loop is simply a special kind of region, so a "filter" is perhaps the way to
>>>> go if you are interested in loops. Regions containing loops will have to be inspected
>>>> using the PST. 
>>>
>>> Except loops that have multiple exits. they are not necessarily (single
>>> entry single exit) region, if the exists do not jump to the same exit bb.
>> 
>> Yes, my assumption was to classify structured loops, but that does not exclude unstructured
>> regions that contain unstructured loops. 
>
> Can you explain your definition of structured/unstructured loops/regions.

Unstructured regions in this case means there is control flow in the region that is not
interesting to look into or classify any further.

> A structured loop does have just one exit?

When you say "structured loop" I believe that means it has a single exit and does not use break
or goto to exit the loop.  A loop contained within a region may have multiple exits. If you need 
to reason about these kinds of loops, you can create a special kind of region for them. If they
are not interesting, then you would simply treat them as unstructured SESE-regions. This mostly
relates to creating convenience functions around regions so that you can easily extract the body, 
exit-edge[s], then/else portions of contitionals etc. 

> Does a unstructured region have multiple exits, or it just contains
> unstructured code?

It just contains unstructured code, that cannot be decomposed into smaller
SESE-regions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100122/3adb063d/attachment.html>


More information about the llvm-dev mailing list