[LLVMdev] Order of Basic Blocks

Ryan Taylor ryta1203 at gmail.com
Mon Nov 21 10:07:14 PST 2011


Is there a way to cast the rpo_iterator to a basic block pointer? I need to
use the functions of the class Basic Block.

On Sun, Nov 20, 2011 at 3:15 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:

> Sorry, forgot to add group to CC.
>
> On Sun, Nov 20, 2011 at 6:14 PM, Ryan Taylor <ryta1203 at gmail.com> wrote:
>
>> Cameron,
>>
>>   To make it less vague, I would ideally like to traverse top down. I
>> believe what you suggested is what I want, I will have a look at it.
>>
>>   Currently, I am iterating over the BBs in a Function, so
>> Function::iterator BBitr=F->begin(), BBitrE=F->end();
>> BBitr!=BBitrE;++BBitr, does that help clarify what I'm looking for? With
>> this current iteration method, I seem to sometimes get top down but other
>> times get bottom up and sometimes it starts top down then jumps to the
>> bottom and goes bottom up. Is there a reason for this randomness?
>>
>> On Sun, Nov 20, 2011 at 6:10 PM, Cameron Zwarich <zwarich at apple.com>wrote:
>>
>>> Your question is a bit vague, but you probably want
>>> ReversePostOrderTraversal from include/llvm/ADT/PostOrderIterator.h.
>>>
>>> Cameron
>>>
>>> On Nov 20, 2011, at 3:00 PM, Ryan Taylor wrote:
>>>
>>> > LLVMers,
>>> >
>>> >   Is there any way to guarantee iteration of the basic blocks from top
>>> down or path to path? Currently it looks sort of semi-random, sometimes
>>> visiting loop heads first and other times loop tails, is there a way I can
>>> visit the BBs top down or path to path?
>>> >
>>> > Thank you.
>>> > _______________________________________________
>>> > LLVM Developers mailing list
>>> > LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111121/ace5f47c/attachment.html>


More information about the llvm-dev mailing list