[cfe-dev] Constructing use-def chains
Simone Pellegrini
spellegrini at dps.uibk.ac.at
Tue Sep 1 06:37:09 PDT 2009
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
Ted Kremenek wrote:
> On Aug 30, 2009, at 8:46 AM, moataz ragab wrote:
>
>
>> I would like to construct def-use/ use-def chains for variables and
>> array references from the source code using Clang. I skimmed
>> through the code of LiveVariables.cpp and supporting classes such as
>> AnalysisData. I also looked into llvm code to see how it is done. I
>> am looking for recommendations and have some questions. Please
>> correct me if I am wrong.
>>
>> I think in the LLVM constructs the def-use chains in the liveness
>> analysis (LiveValues)? Correct?
>> In the LiveVariables.cpp this is not done. But it is possible to do
>> it . Correct?
>>
>> Any recommendations or ideas are appreciated.
>>
>
> Hi Moataz,
>
> The current live variables analysis implementation (in Clang, not
> LLVM) has not been optimized for anything but simplicity. There are
> probably areas where it can be significantly improved both in terms of
> functionality and performance.
>
> All the the analyses in libAnalysis have been driven by immediate
> needs. So far there hasn't been a need for use-def chains in the
> static analyzer, so they have never been implemented.
>
> If you are interested, I certainly encourage you to implement def-use
> chains yourself. Depending on what you find easiest, I wouldn't
> necessarily touch the current LiveVariables.cpp and instead start with
> a new analysis. It's up to you.
>
> Cheers,
> Ted
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
More information about the cfe-dev
mailing list