[cfe-dev] Dataflow analysis with LLVM/Clang

João Paulo Rechi Vita joao.vita at gmail.com
Wed Oct 1 06:52:56 PDT 2008

Hello list!

I'm working on a MSc project and I need detect conflictive actions
between different threads in a program, through statical analysis. The
idea is to detect actions like a mutex lock/unlock (besides others),
and do some code insertion at the program to notify a "manager" about
the next conflictive action that is going to happen. This insertion
should be done as early as possible on the program execution flow (so
the "manager" gets the info as early as possible), but it also has to
be accurate (so if a conflictive action is performed at one of the
branches of an if, for example, the insertion has to be made on the
beggining of the branch, because if that branch is not taken at
runtime, that action will not be performed).

I was wondering if it's better to do this on clang, since one of it's
intended uses is statical code analysis and code transformation, or if
it's better to do this over the LLVM IR, as an LLVM pass. AFAIK I'll
need to work over a control-flow graph and call graph in order to make
the analysis, but I'll also need some line information to make the
code insertion (maybe this is at the AST?). I very new to LLVM (and
also new to compilers-related stuff), so I would like to hear some
opinions on this, so I can make a good decision, and (if applicable)
contribute with this work to LLVM/Clang. Also, if someone can point me
a clang or LLVM pass that does similar stuff, it would be great.

Thanks in advance.

João Paulo Rechi Vita
MSc Computer Science Student
Computer Engineer
IC / Unicamp

More information about the cfe-dev mailing list