[cfe-dev] Extracting llvm IR CFG from Clang

John Criswell via cfe-dev cfe-dev at lists.llvm.org
Wed Feb 17 09:27:16 PST 2016


On 2/15/16 8:57 PM, xiaohui chen via cfe-dev wrote:
> Dear All:
>
> I am working on Clang/LLVM and interested to know if there is a 
> programmatic way to extract the CFG of a specific
> node in AST like a for loop?
>
>  I am aware of |-emit-llvm|option, but it will apply on the whole TU.
>
> For example,
> we could use CFG::buildCFG to extract the source level CFG of a 
> specific node.
> Is there a counterpart API to extract the LLVM IR level CFG of a 
> specific node?

The LLVM IR expresses each function as a set of basic blocks with an 
explicit CFG.  In other words, the LLVM IR encodes the CFG of each 
function explicitly.  If you have the LLVM IR of a function, you already 
have the CFG.

Regards,

John Criswell

>
> Sincerely
> xiaohui
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


-- 
John Criswell
Assistant Professor
Department of Computer Science, University of Rochester
http://www.cs.rochester.edu/u/criswell

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160217/41b6906c/attachment.html>


More information about the cfe-dev mailing list