[LLVMdev] Make LoopBase inherit from "RegionBase"?

Tobias Grosser grosser at fim.uni-passau.de
Thu Jan 21 01:12:18 PST 2010


On 01/20/10 18:16, Jan Sjodin wrote:
>> I think this should be implemented as a RegionFilter, that checks if a
> 
>> region contains a loop, and that can be asked for further information.
>> In general I do not think this kind of analysis belongs to a region, but
>> as you proposed some kind of filter could be applied. In the short term
>> the passes who need this information could get it on their own.
>>
>>> and a long term consideration about "region pass":
>>>
>>> if we want to integrate region analysis and optimization framework into
>>> llvm,  i think we can use an approach that similar to loop analysis and
>>> optimization: write a class "regionpass" inherit from "pass", and the
>>> corresponding pass manger "RegionPassManager". (a kind of function pass)
>>> if we follow this approach, we need to push the region pass manager into
>>> the llvm pass manager stack.
>>> the first question of this approach is, whats the relationship between
>>> "loop pass manager" and "region pass manager"?
>>>
>>> way 1: make region pass manager below loop pass manager in the stack
>>>
>>> pass manager stack:
>>>
>>> bb pass manager <---top
>>> loop pass manager
>>> region pass manager
>>> function pass manager
>>> ... <---bottom
>>>
>>> in this way the region hierarchy need to be reconstruct when a loop
>>> transform change it.
>>>
>>> way 2: make region pass manager above loop pass manager in the stack
>>>
>>> pass manager stack:
>>>
>>> bb pass manager <---top
>>> region pass manager
>>> loop pass manager
>>> function pass manager
>>>     ... <---bottom
>>>
>>> in this way the loop hierarchy need to be reconstruct when a region pass
>>> change it.
>>>
>>> now we need to choose a way to minimize the loop reconstruction or
>>> region reconstruction. i think that the chance that a region transform
>>> affect the loop structure is smaller, so maybe way 2 is better.
>> This would need some thoughts. Ideal I think we would not order them, but if
>> a region changed, just reconstruct the loops that are in this region and
>> if a
>> loop changed just reconstruct the regions in this loop.
> 
> 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.



More information about the llvm-dev mailing list