[LLVMdev] Generating DFG or CDFG from C code

Andrew Trick atrick at apple.com
Thu Jun 30 22:51:38 PDT 2011


On Jun 30, 2011, at 10:05 PM, janarbek wrote:

> 
> Hi All,
> I am reposting my question again since i think my question was not clear enough. 
> I am wondering is it possible to generate Control Data Flow Graph from C using LLVM? or is it possible to get web-like structure of C code using llvm /
> 
> Thanks in advance,
> Any comment suggestion would be appreciated.
> 
> Jan Ma.
> 
>  
> 
> ===========================================
> 
> 
> --- On Thu, 6/30/11, janarbek <canarbekmatay at yahoo.com> wrote:
> 
> From: janarbek <canarbekmatay at yahoo.com>
> Subject: Generating DFG or CDFG from C code
> To: llvmdev at cs.uiuc.edu
> Date: Thursday, June 30, 2011, 11:55 AM
> 
> Hi All,
> 
> I am new to LLVM. I want to generate a Dataflow graph or Control Dataflow graph from C code using LLVM. I have no idea how to do it in LLVM. I tried to use analysis and transform passes such as "-dot-cfg" but it doesn't give what I want. I want to generate a node for each operation in C code. 
> 
> Thanks in advance.
> JM.
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

I don't know if anyone has already done this, but some important pieces are there. See Dataflow.h and GraphWriter.h.

I think you'll run into a problem though because the value graph isn't fully connected. You have to walk the instruction stream looking for "roots".

-Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110630/302d8087/attachment.html>


More information about the llvm-dev mailing list