summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-14 22:50:53 +0000
committerChris Lattner <sabre@nondot.org>2004-08-14 22:50:53 +0000
commit6ffa501d9f879dd55101e29bbaa7a9167abc5a07 (patch)
tree264bf7c27b072a186d32beda376939811a0512fc /llvm/lib
parent412602d7d9ff3a50eb1bb7ba9f06d28c7ed97fe8 (diff)
downloadbcm5719-llvm-6ffa501d9f879dd55101e29bbaa7a9167abc5a07.tar.gz
bcm5719-llvm-6ffa501d9f879dd55101e29bbaa7a9167abc5a07.zip
Make the AsmWriter a first-class tblgen object. Allow targets to specify
name of the generated asmwriter class, and the name of the format string. llvm-svn: 15747
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Target.td53
1 files changed, 38 insertions, 15 deletions
diff --git a/llvm/lib/Target/Target.td b/llvm/lib/Target/Target.td
index 7158d4b0ba4..ac2c0281ea4 100644
--- a/llvm/lib/Target/Target.td
+++ b/llvm/lib/Target/Target.td
@@ -133,20 +133,6 @@ class Instruction {
}
-// InstrInfo - This class should only be instantiated once to provide parameters
-// which are global to the the target machine.
-//
-class InstrInfo {
- Instruction PHIInst;
-
- // If the target wants to associate some target-specific information with each
- // instruction, it should provide these two lists to indicate how to assemble
- // the target specific information into the 32 bits available.
- //
- list<string> TSFlagsFields = [];
- list<int> TSFlagsShifts = [];
-}
-
/// ops definition - This is just a simple marker used to identify the operands
/// list for an instruction. This should be used like this:
/// (ops R32:$dst, R32:$src) or something similar.
@@ -166,6 +152,40 @@ def i16imm : Operand<i16>;
def i32imm : Operand<i32>;
def i64imm : Operand<i64>;
+// InstrInfo - This class should only be instantiated once to provide parameters
+// which are global to the the target machine.
+//
+class InstrInfo {
+ Instruction PHIInst;
+
+ // If the target wants to associate some target-specific information with each
+ // instruction, it should provide these two lists to indicate how to assemble
+ // the target specific information into the 32 bits available.
+ //
+ list<string> TSFlagsFields = [];
+ list<int> TSFlagsShifts = [];
+}
+
+//===----------------------------------------------------------------------===//
+// AsmWriter - This class can be implemented by targets that need to customize
+// the format of the .s file writer.
+//
+// Subtargets can have multiple different asmwriters (e.g. AT&T vs Intel syntax
+// on X86 for example).
+//
+class AsmWriter {
+ // AsmWriterClassName - This specifies the suffix to use for the asmwriter
+ // class. Generated AsmWriter classes are always prefixed with the target
+ // name.
+ string AsmWriterClassName = "AsmPrinter";
+
+ // InstFormatName - AsmWriters can specify the name of the format string to
+ // print instructions with.
+ string InstFormatName = "AsmString";
+}
+def DefaultAsmWriter : AsmWriter;
+
+
//===----------------------------------------------------------------------===//
// Target - This class contains the "global" target information
//
@@ -178,8 +198,11 @@ class Target {
// this target. Typically this is an i32 or i64 type.
ValueType PointerType;
- // InstructionSet - Instruction set description for this target
+ // InstructionSet - Instruction set description for this target.
InstrInfo InstructionSet;
+
+ // AssemblyWriter - The AsmWriter instance to use for this target.
+ AsmWriter AssemblyWriter = DefaultAsmWriter;
}
OpenPOWER on IntegriCloud