[LLVMdev] X86AsmPrinter + MASM and NASM backends

Chris Lattner sabre at nondot.org
Mon Jul 11 15:40:35 PDT 2005


On Mon, 11 Jul 2005, Aaron Gray wrote:
> The NASM like the MASM does not have % symbols on the register names so will 
> either inherit from the MASM printer or have its own TableGen class.

This is easy, just change X86IntelAsmPrinter::printOp to not add the % 
prefix:

   case MachineOperand::MO_MachineRegister:
     if (MRegisterInfo::isPhysicalRegister(MO.getReg()))
       // Bug Workaround: See note in Printer::doInitialization about %.
       O << "%" << RI.get(MO.getReg()).Name;
     else
       O << "%reg" << MO.getReg();
     return;

... The comment about a bug workaround is obsolete now (it's referring to 
a GAS bug in intel mode, which we don't use anymore), so feel free to 
change it.

>>> Also looking at your ELF code I do not know how to fit it in exactly with 
>>> the command line switches etc.
>> 
>> I don't know which you would prefer.  I'm actively (but slowly) hacking on 
>> the ELF writer in my spare time.  It will probably be a lot easier to write 
>> the COFF writer after the ELF write is done, so you can use it as an 
>> example.
>
> Yes I will wait till you have done the ELF writer.

Ok.

>> In any case, getting the nasm writer working will be much easier still.
>
> I am probably going to do a NASM version after a bit of a break.

ok.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/




More information about the llvm-dev mailing list