Aug 14, 2004 //===----------------------------------------------------------------------===// The AsmWriterGenerator support needs to support target variants with multiple different methods of formatting the .s file (e.g. Intel vs AT&T syntax), as well as target variants that have very small differents (e.g. R0 vs 0 on PPC variants). Also, it should make it as easy as possible to specify standard targets, leaving all of the default implementation details in the implementation. To support this, we expect the main target class to be defined like this: class Target { ... AsmWriter Writer = DefaultAsmWriter; } The AsmWriter class would be defined as: class AsmWriter { string CommentChar = ";"; string DataSection = ".data"; string ... string InstFormatName = "AsmString"; } def DefaultAsmWriter : AsmWriter; //===----------------------------------------------------------------------===// To implement this, targets can add asmstrings to their various instruction classes and other objects (e.g. operands). Next, the target can define various asmwriters as they choose, e.g.: def X86ATTAsmWriter : AsmWriter { let InstFormatName = "ATTAsmString"; let RegFormatName = "ATTAsmString; } def X86IntelAsmWriter : AsmWriter { let InstFormatName = "IntelAsmString"; let RegFormatName = "IntelAsmString"; let DataSection = ".section data"; ... whatever else ... } //===----------------------------------------------------------------------===// Finally, the various targets are assembled from the different required pieces: def CygwinTarget : X86Target { let Writer = X86ATTAsmWriter; let InstFormat = ...; } def NasmTarget : X86Target { let Writer = X86IntelAsmWriter; }