[LLVMdev] [PATCH] Support asm comment output

Chris Lattner clattner at apple.com
Mon Jul 13 14:03:30 PDT 2009


On Jul 13, 2009, at 1:58 PM, David Greene wrote:
>>> Ok, here's an example:
>>>
>>>       movl    (%rsi), %ecx                                # LLVM
>>> Instruction:         volatile store i32* %ksize, i32**  
>>> %ksize3       ;
>>> [oox.4 : sln.5]
>>>
>>>                                                           #
>>> [result] Pattern
>>> 1367
>>
>> Instead of printing 1367, why not print "MOV32rm" like -print-
>> machineinstr does?  If you really want 1367, just print MI-
>>
>>> getOpcode().  The asmprinter definitely has this information.
>
> Ok, I wasn't aware of that at the time I did this stuff.  Printing the
> pattern name is even better!

Oh, also, if it's not clear :), I'm really excited by this work.   
Making the .s files more readable would be a huge quality of life  
improvement for many people working on the code generator!

>
>>> I forgot about the LLVM instruction information.  That's something
>>> that can't
>>> be synthesized by the asmprinter.  Again, we only emit some of this
>>> with
>>> special debug flags so we don't carry the original IR around in
>>> comments all
>>> the time.  :)
>>
>> Sure, I understand that comments in general only get turned on with
>> something like -fverbose-asm.  But where/how do you expect this
>> information to be propagated onto the machineinstrs?
>
> Some comments are on all the time, but those I think we can do with
> asmprinter, as you suggest.

Yep.

> I have patches that propagate comments from Instructions to SDNodes to
> MachineInstrs.
> Again, after answering the FI stack slot question, the IR-level  
> instruction
> information is the only thing we can't do through asmprinter.  I'm  
> open to
> other ways of capturing the information that don't require comments in
> MachineInstrs.  But the information has to be stored somewhere.

Ok, lets deal with this as a separate pass.  A good solution may be to  
have an on-the-side DenseMap<MachineInstr*,Instruction*>.

>> For now, lets go forward with the plan of having the asmprinter
>> generate the comments.  It sounds like it can cover at least 75% of
>> what you're interested in, and the other cases probably have better
>> solutions that sticking a vector of std::string on MachineInstr.
>
> That's ok by me.  Let's hash through this some more as stuff comes  
> on-line.

Thanks Dave!

-Chris



More information about the llvm-dev mailing list