Hi all, I have a question about llvm::LoopBase getBlocks() method. Does it return the basic blocks inside the loop in random order? I need to order the blocks in some valid topological ordering of the AST. If getBlocks() does not do that, what can I do to find the ordering? Thanks, Naznin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110509/19b2bc7a/attachment.html>
Whenever I was tying to do that (in version 2.8), it didn't give them to me in a topological order. What I did, as a hack-ish temporary measure, was rely on Function's ordering, and just iterated over all the blocks in the function, checking to see if the loop contains that block. Not at all ideal, and what I was writing later evolved to not need the topological ordering constraint, so I never revisited the problem. In hindsight, I don't even know if Function guarantees that they are presented in a topological order, but it always happened to be the case for me. On Mon, May 9, 2011 at 10:45 AM, Naznin Fauzia <laboni14 at gmail.com> wrote:> Hi all, > > I have a question about llvm::LoopBase getBlocks() method. Does it return > the basic blocks inside the loop in random order? I need to order the blocks > in some valid topological ordering of the AST. If getBlocks() does not do > that, what can I do to find the ordering? > > Thanks, > Naznin > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >
Thanks Michael. Can you please explain you way a bit more? Did you run a function pass then a loop pass? On Mon, May 9, 2011 at 12:56 PM, Michael Ilseman <michael at lunarg.com> wrote:> Whenever I was tying to do that (in version 2.8), it didn't give them > to me in a topological order. What I did, as a hack-ish temporary > measure, was rely on Function's ordering, and just iterated over all > the blocks in the function, checking to see if the loop contains that > block. Not at all ideal, and what I was writing later evolved to not > need the topological ordering constraint, so I never revisited the > problem. In hindsight, I don't even know if Function guarantees that > they are presented in a topological order, but it always happened to > be the case for me. > > > On Mon, May 9, 2011 at 10:45 AM, Naznin Fauzia <laboni14 at gmail.com> wrote: > > Hi all, > > > > I have a question about llvm::LoopBase getBlocks() method. Does it > return > > the basic blocks inside the loop in random order? I need to order the > blocks > > in some valid topological ordering of the AST. If getBlocks() does not do > > that, what can I do to find the ordering? > > > > Thanks, > > Naznin > > > > _______________________________________________ > > 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/20110509/039a1545/attachment.html>