[LLVMdev] Inserting comments

Devang Patel dpatel at apple.com
Tue Nov 4 09:39:46 PST 2008


On Nov 4, 2008, at 12:57 AM, Scott Graham wrote:

> Hi
>
> Anyone have any clever way of inserting a comment (or
> comment-ish-thing) that will make it to an .ll that's generated at the
> same time as writing out the bitcode?
>
> I'd been hacking comments in using an alloca with the name of the
> value being the comment, but just realized that they weren't getting
> removed at the codegen level despite being unused (no opt), when I got
> a stack overflow due to having them in a loop.
>
> I tried a no-op bitcast, but that gets removed too early, and doesn't
> make to the .ll. I don't especially care if they disappear after
> running passes, just that they survive long enough to see them in a
> dump(), and that they don't affect the program behaviour.
>

Try using llvm.var.annotation intrinsic.

> thanks,
> scott
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-
Devang






More information about the llvm-dev mailing list