[LLVMdev] getting pointer to CFG object for any given C program

Sameer Sahasrabuddhe sameer.sahasrabuddhe at amd.com
Sun Oct 7 21:00:49 PDT 2012

On Sun, 7 Oct 2012 13:26:35 +0530
Rajendra <rks at cse.iitb.ac.in> wrote:

> Let say we have a C program, and we want to get pointer to CFG object 
> for this code
> in order to traverse basic blocks and do some analysis using CFG 
> object.
>  From my main program main.cpp, how can I get pointer to CFG object
> if argv[1] = hello.c ?

On the off-chance that this is a newbie question, whatever you are
trying to do, can it be expressed as an LLVM FunctionPass? In the LLVM
IR, each function body is a CFG over basic blocks. Then you don't have
to worry about how the frontend constructs the CFG.


More information about the llvm-dev mailing list