>> I am not really sure whether to do a X86NASMPrinter or whether to bypass >> that for now and work on an X86COFFWriter which would be more useful to >> me ? > > I wouldn't suggest writing an X86NASMPrinter: just change the current > Intel printer to do what you want. Noone is currently using the intel > printer, so you can do what you wish to it.Once I have finished rewriting the MASM printer then a NASM one should take no time at all, he says :) 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.>> 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.> 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. Aaron
On Mon, 2005-07-11 at 19:24 +0100, 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.Couldn't one conditionally output some macros for the assembler to translate the reg names rather than having another .td file? or is '%' not a valid part of a macro on NASM? Andrew
> On Mon, 2005-07-11 at 19:24 +0100, 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. > > Couldn't one conditionally output some macros for the assembler to > translate the reg names rather than having another .td file? or is '%' > not a valid part of a macro on NASM?I've already written the code for MASM, besides it is neater that way. I have augmented the X86InstrInfo.td file with another target class for MASM, and can either use the MASM class for NASM or do the same thing again creating another target class for NASM. Aaron
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/