On 4/12/13 3:19 PM, Arsen wrote:
> Thank you John.
> Actually the opt tool (from LLVM 3.2 version) can generate the needed graphs
> (with pass "-domfrontier").
> But I just want to surely know is there some pass or builder which can be
> integrated somehow so it will be possible directly to generate CDG?
Yes and no. There's isn't a control dependence pass in LLVM per se, but
I believe that is primarily because control dependence is very easy to
compute with the existing analysis passes in LLVM. With
PostDominanceFrontier, it was extremely simple (I think it was calling
two methods in the PostDominanceFrontier pass).
It might be slightly more work to compute it with PostDominatorTree, but
not significantly. And, IIRC, you'll want to use PostDominatorTree
instead of DominatorTree. For control dependence, I believe you
essentially flip the CFG upside-down and compute the dominance
frontier. Using post dominators instead of dominators does the same
thing and is described in the Allen and Kennedy book.
-- John T.