[LLVMdev] examine dominating relationships between basic blocks

30 views
Skip to first unread message

Chuck Zhao

unread,
Jan 14, 2011, 11:06:27 AM1/14/11
to LLVM Developers Mailing List
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

_______________________________________________
LLVM Developers mailing list
LLV...@cs.uiuc.edu http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

Chris Lattner

unread,
Jan 14, 2011, 2:14:09 PM1/14/11
to Chuck Zhao, LLVM Developers Mailing List

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

Reply all
Reply to author
Forward
0 new messages