[cfe-dev] Constructing use-def chains
Ted Kremenek
kremenek at apple.com
Sun Aug 30 09:36:18 PDT 2009
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
More information about the cfe-dev
mailing list