[cfe-dev] Constructing use-def chains

Ted Kremenek kremenek at apple.com
Tue Sep 1 08:53:15 PDT 2009

On Sep 1, 2009, at 6:37 AM, Simone Pellegrini wrote:

> Hi Ted and Moataz,
> Actually I have already implemented Def-Use chains in clang.
> I didn't announce it in the mailing list because I thought DefUse  
> chain analysis was not in the philosophy of Clang as all the  
> analysis and optimizations are built in LLVM (from SSA code).
> Anyway if the community is interested I can make the implementation  
> available to you, my only concern is about the coding style. I saw  
> you frequently use data containers (map, vector)
> from the LLVM framework while I preferred to stick with the STL  
> (because I am sure they are not buggy) :)
> My current implementations is based on the Kennedy's book algorithm  
> (which is recursive). The analysis has been tested against several  
> codes... I am sure it's still not perfect but it's working in most  
> of the cases.
> regards, Simone Pellegrini

Hi Simone,

We'd be delighted if you wanted to make your DefUse implementation  
available for others to use.  I should mention that for the code to be  
committed back to the Clang tree, it would still have to undergo code  
review like any other patch.  If you don't want to go through this  
process, simply making the code available would be great!

To comment on your point about STL and LLVM data structures, we tend  
to use LLVM data structures (such as DenseMap) instead of those in the  
STL because of their vastly improved performance characteristics.   
Most of the LLVM data structures have direct analogues to STL data  
structures (e.g.,, DenseMap and HashMap), so swapping one for the  
other is usually trivial.  We're not opposed to using STL data  
structures when they are clearly the best solution.


More information about the cfe-dev mailing list