[LLVMdev] Identify recursion in a call graph

Duncan Sands baldrick at free.fr
Sat Oct 30 04:38:02 PDT 2010


Hi Trevor,

> Is there any facility in LLVM to identify recursion in a call graph? I
> realize this is undecidable in the general case due to function
> pointers, but at least the static cases could be identified. I don't
> even care about whole-program recursion, just looking at a single
> module would suffice. But I don't see anything like this already in
> LLVM, so do I simply write some code to look for cycles in the call
> graph? Thanks,

use the facilities in SCCIterator.h, or declare your pass to be a
CallGraphSCCPass in which case it will work one strongly connected
component at a time.

Ciao,

Duncan.



More information about the llvm-dev mailing list