[LLVMdev] Assembly Printer

David Greene dag at cray.com
Mon Jan 4 14:09:10 PST 2010


On Sunday 03 January 2010 01:00, Chris Lattner wrote:
> On Jan 1, 2010, at 12:51 PM, mmms1841 wrote:
> > I am trying to understand how LLVM does code generation and I have a
> > couple of questions. I am using LLVM 2.6.
> >
> > First,
> > if I want to change the name of an instruction,  all I need to do is to
> > modify the XXXInstrInfo.td, right? Using Sparc as an example,  if I
> > wanted to output "mysra" instead of "sra", in SparcInstrInfo.td, I would
> > write,
> >
> > defm SRA : F3_12<"mysra", 0b100111, sra>;
> >
> > Is this correct?
>
> Yes.

IMHO, this is a poor way to do this kind of thing.  It eventually
leads to confusion where someone things SRA means "sra" and someone
else thinks it meas "mysra."  It gets worse as "mysra" acquires
subtly different semantics than "sra."  Better to write a separate pattern
and use AddedComplexity to prefer it.

Just a nugget of wisdom from personal experience.  :)

                            -Dave



More information about the llvm-dev mailing list