[llvm-dev] LLVM: mapping unoptimized IR back to clang AST
Tomas Kalibera via llvm-dev
llvm-dev at lists.llvm.org
Tue Sep 15 02:10:02 PDT 2015
Hi,
I would like to rewrite a C program based on analyzing the LLVM IR of
that C program, produced by CLANG. Did anyone have any hints on how to
map the IR back to CLANG AST?
Can I do better than invoking clang with "-g -O0" to produce an IR for
this task? (can I get more debug info, disable more optimizations?)
The debug info in LLVM IR does not seem to have information on C macros
(while CLANG AST does) - is there a way to get that information from the IR?
Is it possible to add some custom meta-data to CLANG AST nodes that
would somehow propagate through CLANG to the LLVM IR?
I could think of wrapping some AST nodes into dummy function calls, but
that seems rather crude.
Indeed, some analysis can also be done at AST level, but it seems to me
that it is easier to do at the IR level. Also the IR level has linking
information, one can do inter-procedural analyses.
Thanks
Tomas
More information about the llvm-dev
mailing list