NASM Backend

Hi again,

I have put together a “blank skeleton” for a X86NASMPrinter class, with effectively the same behaviour as the X86IntelAsmPrinter class. I had to do this within the X86AsmPrinter.cpp file rather than as a separate source file as the dependancies were so. Please do not commit this yet, I have included it not for confidence sake :))

I do not know whether it is a good idea to split the X86AsmPrinter.cpp class up into a ‘.h’ file as well as a ‘.cpp’ file thus allowing the NASMPrinter to be in a separate ‘.cpp’ file or not.

Also it would be possible to split X86AsmPrinter, X86IntelAsmPrinter, and X86ATTAsmPrinter up into different ‘.cpp’ files and either a common or separate headers. Should I do this ?

There are another couple of other issues I would like advice on :-

One is testing how to go about testing the NASM backend and integrating the testing with the existing test framework.

The other is why do the following methods return false :-

bool X86IntelAsmPrinter::doInitialization(Module &M)
bool X86TargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out)

Aaron

X86AsmPrinter.cpp (21.1 KB)

I have put together a "blank skeleton" for a X86NASMPrinter class, with effectively the same behaviour as the X86IntelAsmPrinter class. I had to do this within the X86AsmPrinter.cpp file rather than as a separate source file as the dependancies were so. Please do not commit this yet, I have included it not for confidence sake :))

Ok.

I do not know whether it is a good idea to split the X86AsmPrinter.cpp class up into a '.h' file as well as a '.cpp' file thus allowing the NASMPrinter to be in a separate '.cpp' file or not.

I wouldn't be opposed to that at all.

Also it would be possible to split X86AsmPrinter, X86IntelAsmPrinter, and X86ATTAsmPrinter up into different '.cpp' files and either a common or separate headers. Should I do this ?

Sure, sounds good.

There are another couple of other issues I would like advice on :-

One is testing how to go about testing the NASM backend and integrating the testing with the existing test framework.

The best way to do this is to write regression tests for it (e.g. test/Regression/CodeGen/X86), and be able to run the llvm-test suite on a system that uses nasm. The combination allows you to test for specific bugs, and gives a pretty good coverage test as well.

The other is why do the following methods return false :-

       bool X86IntelAsmPrinter::doInitialization(Module &M)

This method returns false because it does not modify the module, this is part of the PassManager api documented here:
http://llvm.cs.uiuc.edu/docs/WritingAnLLVMPass.html

       bool X86TargetMachine::addPassesToEmitAssembly(PassManager &PM, std::ostream &Out)

This returns true to indicate that asm writing is supported by the target. This is documented in: include/llvm/Target/TargetMachine.h

-Chris

Hi again,

Sorry about getting the wrong file, I took it from my root source tree rather than my Windows one.

I will but out until after the 1.5 release then do the X86 backend changes from that.

All the best with the release,

Aaron