Wenbin Zhang
2010-Aug-27 20:58 UTC
[LLVMdev] how to check whether from basicblock A we can go to basicblock B within the same function?
Dear all, Is there a way to check whether we can go from A to B within a function when I'm writing a pass? Thanks. Best, --Wenbin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100827/8cf26762/attachment.html>
John Criswell
2010-Aug-27 21:09 UTC
[LLVMdev] how to check whether from basicblock A we can go to basicblock B within the same function?
Wenbin Zhang wrote:> Dear all, > Is there a way to check whether we can go from A to B within a > function when I'm writing a pass?I assume you are asking whether control flow can pass from BasicBlock A to BasicBlock B. In that case, yes: all you need to do is look at the terminator instruction of BasicBlock A and see if it can branch to BasicBlock B. There's a new indirect branch instruction; I don't believe it is used very often. You might have to handle those specially, but I'll let others comment on that. -- John T.> Thanks. > Best, > --Wenbin
Wenbin Zhang
2010-Aug-27 21:28 UTC
[LLVMdev] how to check whether from basicblock A we can go to basicblock B within the same function?
----- Original Message ----- From: "John Criswell" <criswell at illinois.edu> To: "Wenbin Zhang" <zhangwen at cse.ohio-state.edu> Cc: <llvmdev at cs.uiuc.edu> Sent: Friday, August 27, 2010 5:09 PM Subject: Re: [LLVMdev] how to check whether from basicblock A we can go to basicblock B within the same function?> Wenbin Zhang wrote: >> Dear all, >> Is there a way to check whether we can go from A to B within a >> function when I'm writing a pass? > > I assume you are asking whether control flow can pass from BasicBlock A > to BasicBlock B. In that case, yes: all you need to do is look at the > terminator instruction of BasicBlock A and see if it can branch to > BasicBlock B.Yes, also switch and invoke instruction have the similar effects. So does it mean that I need to recursively traverse all the possible destinations from A (following the terminator instructions) to see whether I can reach B? Thanks.> > There's a new indirect branch instruction; I don't believe it is used > very often. You might have to handle those specially, but I'll let > others comment on that. > > -- John T. > >> Thanks. >> Best, >> --Wenbin >Best, --Wenbin
Seemingly Similar Threads
- [LLVMdev] how to check whether from basicblock A we can go to basicblock B within the same function?
- [LLVMdev] how to check whether from basicblock A we can go to basicblock B within the same function?
- [LLVMdev] how to check whether from basicblock A we can go to basicblock B within the same function?
- [LLVMdev] a problem when using postDominatorTree
- [LLVMdev] how to check whether from basicblock A we can go to basicblock B within the same function?