[LLVMdev] NASM Backend

Chris Lattner sabre at nondot.org
Tue May 10 10:16:41 PDT 2005


On Tue, 10 May 2005, Aaron Gray wrote:

> 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

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list