[llvm-dev] Is it possible to generate the IR representation with the original macro information?

Peng Yu via llvm-dev llvm-dev at lists.llvm.org
Sat Jan 19 12:58:14 PST 2019


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


More information about the llvm-dev mailing list