[cfe-dev] CFG documentation

Gaurav Mittal gaurav at binachip.com
Fri Dec 17 12:29:55 PST 2010


Hi Ted,

Thanks for the explanation. After a brief chat with someone who explored
using LLVM for a slightly different purpose, I have determined that I might
be barking up the wrong tree. Maybe I should be looking at the LLVM assembly
language instead since it maintains type information anyway and should be
easier to convert to my tool's native CDFG.

Regards,

Gaurav

 

 

From: Ted Kremenek [mailto:kremenek at apple.com] 
Sent: Friday, December 17, 2010 10:34 AM
To: gaurav at binachip.com
Cc: cfe-dev at cs.uiuc.edu
Subject: Re: [cfe-dev] CFG documentation

 

 

On Dec 17, 2010, at 5:40 AM, Gaurav Mittal wrote:





Hi Ted,

Thanks for the link. I had actually already gone through all the
documentation online and am currently sifting through the source code
starting at cfg.h and branching out. I think using the command line to dump
the CFG will help get a jump start, thanks.

Through my posting on the mailing list I was looking for more information
on:

1. Whether there exists a CFG API that hides the implementation details.

The public methods of the CFG class should be considered as part of its API.





2. The CFG structure and how it relates/uses the AST. E.g. how would one
lookup the nature of a variable in an expression or its scope, how the
symbol tables are accessed, etc. I think this would relate to how the AST
gets translated to the CFG.

 

 

I think some of your questions more have to do with how some fundamental
concepts are represented in Clang in general.  The CFG simply models a
control-flow relation between elements (i.e., statements and expressions) in
the AST, no more and no less.  It does not encapsulate scope or reason about
anything else except statements and expressions.

 

The AST encapsulates statements, expressions, and declarations.  There is no
symbol table per se in the Clang frontend, as all symbols are uniquely
identified by their (canonical) declarations.  The LLVM backend reasons
about symbols differently since that represents a strictly low-level
representation of the program.  Scope is currently not modeled explicitly in
the AST, but it can be inferred.  The parser and semantic analyzer reason
about scope while building the AST, but that information is not recorded in
the AST.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101217/56c3d80e/attachment.html>


More information about the cfe-dev mailing list