[LLVMdev] adding comment

reed kotler rkotler at mips.com
Thu Apr 17 16:56:08 PDT 2014


On 04/17/2014 04:37 PM, Pete Cooper wrote:
> On Apr 17, 2014, at 4:26 PM, Reed Kotler <rkotler at mips.com> wrote:
>
>> On 04/17/2014 09:30 AM, Matt Arsenault wrote:
>>> On Apr 16, 2014, at 2:06 PM, reed kotler <rkotler at mips.com> wrote:
>>>
>>>> Is there a simple way to add a comment in the machine instructions of a basic block?
>>>>
>>>> Ideally something that can be used with machine instruction builder.
>>>>
>>> I’ve also been looking for something like this. I’m trying to start work on a pass that would be easiest to implement by merging multiple machine basic blocks into one, but I would really like to retain the comments marking the beginning of the merged blocks. I’ve been considering more complicated ways of doing it rather than losing those
>>>
>>> -Matt
>>>
>> There is definitely a need for a mechanism to be able to add character data to any instruction which will get added as a comment.
> You could do this now with MachineInstrBuilder.addMetadata(…)
>
> Its not the nicest solution, but if you put an MDString inside the metadata then you can attach anything you want to an MI.  Then you’d just need the asm printer to understand these.  It somewhat goes against the spirit of codegen not creating IR, but it would work.
Are you sure that you can even do that?

IR may appear as a constant at this time and place in the compilation.

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




More information about the llvm-dev mailing list