[cfe-dev] source-to-source transformations using LLVM/ Clang
kris.mani.123 at gmail.com
Wed Jan 22 09:16:47 PST 2014
I need some help in understanding few things related to llvm/clang.
What I want to do is to take a C source code and then get some information
from source code like the number of branches, load/store count etc. and
then instrument the source code with this obtained information. At the
moment, I can think of 2 approaches:
(1) Clang: Generate AST from the source code, obtain these counts (if it is
possible) from AST traversal and do then do transformations on AST to
generate instrumented source code so that I can use gcc later.
(2) LLVM: Emit bitcode file from clang. Write an analysis pass to count
these values and then using Transformation pass, add these values to thr IR
and then, if possible, generate instrumented source code.
Can someone kindly suggest which option is better as both of these
approaches deal at different levels. Any pointers to some sample codes
would be really helpful to me.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev