[LLVMdev] Get the call graph SCCs from a function pass

Török Edwin edwintorok at gmail.com
Sun May 10 12:06:16 PDT 2009

On 2009-05-10 21:52, Nick Johnson wrote:
>>>> Does getAnalysis<CallGraph>() work?
> Thanks Edwin, that works!
> What about the CallGraphSCC ?  It looks like one can declare a
> CallGraphSCCPass, but I don't see any other way to get the SCCs of the
> call graph.

You can use scc_iterator from ADT/SCCIterator.h, that gives you  a
std::vector of functions that are part of the same SCC, on each iteration.

Have a look at tools/opt/PrintSCC.cpp for an example, or at the
implementation of CallGraphSCCPass in lib/Analysis/IPA/

Best regards,

More information about the llvm-dev mailing list