Peng Yu via llvm-dev
2019-Jan-18 22:43 UTC
[llvm-dev] Is it possible to generate the IR representation with the original macro information?
Hi, I use the following commands to compile the IR. But I don't see the macro information in the .ll file. Is there a way to preserve the macro information (print() in this case) for debugging purposes? $ clang -std=gnu99 -g3 -flto -Wall -pedantic -c -o main.o main.c $ clang main.o -flto -fuse-ld=gold '-Wl,-plugin-opt=save-temps' -o main.exe $ llvm-dis main.exe.0.0.preopt.bc /* vim: set noexpandtab tabstop=2: */ #include <stdio.h> #define print() puts("Hello World!"); int main() { print(); return 0; } -- Regards, Peng
David Blaikie via llvm-dev
2019-Jan-19 20:22 UTC
[llvm-dev] Is it possible to generate the IR representation with the original macro information?
-g -fdebug-macro will include macro info in the debug info in the IR. It doesn't track which bits of IR were expanded from macros (anymore than the source locations do without -fdebug-macro) - just provides the macro text so, for instance, debugger users can use the macros in expresions. On Fri, Jan 18, 2019 at 2:43 PM Peng Yu via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > I use the following commands to compile the IR. But I don't see the > macro information in the .ll file. Is there a way to preserve the > macro information (print() in this case) for debugging purposes? > > $ clang -std=gnu99 -g3 -flto -Wall -pedantic -c -o main.o main.c > $ clang main.o -flto -fuse-ld=gold '-Wl,-plugin-opt=save-temps' -o main.exe > $ llvm-dis main.exe.0.0.preopt.bc > > /* vim: set noexpandtab tabstop=2: */ > #include <stdio.h> > > #define print() puts("Hello World!"); > > int main() { > print(); > return 0; > } > > -- > Regards, > Peng > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190119/6321fcd7/attachment.html>
Peng Yu via llvm-dev
2019-Jan-19 20:58 UTC
[llvm-dev] Is it possible to generate the IR representation with the original macro information?
So there is no way to associate macro to IR code? Thanks. On Sat, Jan 19, 2019 at 2:23 PM David Blaikie <dblaikie at gmail.com> wrote:> > -g -fdebug-macro will include macro info in the debug info in the IR. It doesn't track which bits of IR were expanded from macros (anymore than the source locations do without -fdebug-macro) - just provides the macro text so, for instance, debugger users can use the macros in expresions. > > On Fri, Jan 18, 2019 at 2:43 PM Peng Yu via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> Hi, >> >> I use the following commands to compile the IR. But I don't see the >> macro information in the .ll file. Is there a way to preserve the >> macro information (print() in this case) for debugging purposes? >> >> $ clang -std=gnu99 -g3 -flto -Wall -pedantic -c -o main.o main.c >> $ clang main.o -flto -fuse-ld=gold '-Wl,-plugin-opt=save-temps' -o main.exe >> $ llvm-dis main.exe.0.0.preopt.bc >> >> /* vim: set noexpandtab tabstop=2: */ >> #include <stdio.h> >> >> #define print() puts("Hello World!"); >> >> int main() { >> print(); >> return 0; >> } >> >> -- >> Regards, >> Peng >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-- Regards, Peng