[LLVMdev] Annotating output assembly with input C statements

Alireza Moshtaghi Alireza.Moshtaghi at synopsys.com
Mon Apr 15 15:17:34 PDT 2013


Hi,
I'm trying to annotate the final assembly output of my llvm codegen with the corresponding input C statements.
It would've been super easy if the source information were included in the IR debug info. But obviously they are not, and there are good reasons why not !
So I'm bound to collecting all my information in the back-end from the existing debug pseudo instructions. As you know, the debug instructions only have file name and line number information. But without actually parsing the input file and collecting the C statement and function start and end line numbers in the file, it would be a non-trivial task to emit proper source line information in the output assembly. Obviously, it is not recommended to use clang objects in the backend either, so I was wondering if anyone in the llvm community has attempted this before. Currently, I'm planning on writing my own parser but if someone has better solutions, please let me know.

Thanks
Ali




More information about the llvm-dev mailing list