[LLVMdev] How to associate extra comments to a MachineInstruction ?

Andrew Trick atrick at apple.com
Fri May 31 19:29:53 PDT 2013


On May 30, 2013, at 2:53 PM, Eric Christopher <echristo at gmail.com> wrote:

> On Thu, May 30, 2013 at 2:16 PM, Jeroen Dobbelaere
> <Jeroen.Dobbelaere at synopsys.com> wrote:
>>> From: Eric Christopher
>>> Subject: Re: [LLVMdev] How to associate extra comments to a
>>> MachineInstruction ?
>>> 
>>> Should be spelled like this yes?
>>> 
>>> Asm->OutStreamer.AddComment("foo")
>>> Asm->EmitFoo();
>>> 
>>> -eric
>> 
>> 
>> That  should work at the moment that you are emitting the instructions.
>> 
> 
> Yep.
> 
>> But what would you do when you are manipulating a MachineBasicBlock and want to
>> annotate some instructions there ? (way before the assembler jumps in)
>> The annotation belongs to the instruction and other manipulations that are performed later (like reordering of instructions)
>> should keep the annotation (iff the instruction itself is kept).
>> 
> 
> Not really a way to do it so far. There's a set of specific comments
> to put on, but...

It would be nice, but there’s no existing mechanism.

I personally think it should be handled by adding an implicit operand to the machineinstr that holds a constant index into a table of annotations strings, or maybe an MDNode is more convenient. Unfortunately there’s target-specific code lurking out there that makes assumptions about the number of operands.

-Andy

>>> 
>>> On Thu, May 30, 2013 at 1:44 PM, Jeroen Dobbelaere
>>> <Jeroen.Dobbelaere at synopsys.com> wrote:
>>>> Hi,
>>>> 
>>>> is there a convenient way to associate/add a comment to a
>>> MachineInstruction, so that
>>>> in the produced assembly file, the comment is added next to the
>>> instruction ?
>>>> 
>>>> Greetings,
>>>> 
>>>> Jeroen Dobbelaere
>>>> 
>>>> 
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130531/757ad68d/attachment.html>


More information about the llvm-dev mailing list