Chuck Zhao
2011-Jan-14 16:06 UTC
[LLVMdev] examine dominating relationships between basic blocks
I am building code which needs to examine dominating relationships between Basic Blocks. I searched the Programming Guide (http://llvm.org/docs/ProgrammersManual.html#common), it mentioned briefly that such details will be covered in the future. So, I am tuning to the list and ask. Say, I have BasicBlock * a, *b, and need to know whether a DOM b, (a DOMi b, a DOMp b, a PostDOM b), etc. How can these be expressed? Similar things, how can I find all BasicBlocks that a dominates, (DOM, DOMp, PostDOM, ...) Browsing the source code, I seem to find things like DominatorFrontier, DominatorTree, etc. But I have no clue how they can be used. Can somebody leverage some more details please. Thank you Chuck
Chris Lattner
2011-Jan-14 19:14 UTC
[LLVMdev] examine dominating relationships between basic blocks
On Jan 14, 2011, at 8:06 AM, Chuck Zhao wrote:> I am building code which needs to examine dominating relationships > between Basic Blocks. > I searched the Programming Guide > (http://llvm.org/docs/ProgrammersManual.html#common), it mentioned > briefly that such details will be covered in the future. > > So, I am tuning to the list and ask. > > Say, I have BasicBlock * a, *b, and need to know whether a DOM b, (a > DOMi b, a DOMp b, a PostDOM b), etc. > How can these be expressed? > > Similar things, > how can I find all BasicBlocks that a dominates, (DOM, DOMp, PostDOM, ...) > > Browsing the source code, I seem to find things like DominatorFrontier, > DominatorTree, etc. > But I have no clue how they can be used.Hi Chuck, You can get this by requiring the DominatorTree pass from your pass. There are lots of examples of this in lib/Transforms/Scalar for example, -Chris