How to view CFG of loop (not complete function)

Hi all,

I need to look at the CFG of a loop during debugging. However the
containing function is very large, so it is rather difficult to use the
CFG of the complete function. I tried using the ViewGraph method, but
the compiler kept complaining about undefined symbols related to
GraphTraits or
DOTGraphTraits. Is there any example that I could look at to find out,
what exactly I need to call something like
   ViewGraph(loop, "CFG") ?


Hi Martin,

GraphTraits and DOTGraphTraits are specialized so GraphWriter can print the CFG. Same holds for SelectionDAG and other graph-like structures in llvm.
AFAIK, the GraphWriter doesn't have the ability to stream a range of BB's if that's what you are looking for.
I think you will need to hack a little bit the GraphWriter in order to print a range of nodes instead of the entire graph, or create a custom one.