encode size information into each ValueType
authorChris Lattner <sabre@nondot.org>
Fri, 1 Aug 2003 05:18:03 +0000 (05:18 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 1 Aug 2003 05:18:03 +0000 (05:18 +0000)
Add new RegisterInfo class

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7469 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Target.td

index e63cd635cccb265672be9bb923eea48e9acccdcd..2dec163c9a9bde887a8f16d05e324a8e1ffe59a8 100644 (file)
 // Value types - These values correspond to the register types defined in the
 // ValueTypes.h file.
 //
-class ValueType { string Namespace = "MVT"; }
+class ValueType<int size> { string Namespace = "MVT"; int Size = size; }
 
-def i1   : ValueType;    // One bit boolean value
-def i8   : ValueType;    // 8-bit integer value
-def i16  : ValueType;    // 16-bit integer value
-def i32  : ValueType;    // 32-bit integer value
-def i64  : ValueType;    // 64-bit integer value
-def i128 : ValueType;    // 128-bit integer value
-def f32  : ValueType;    // 32-bit floating point value
-def f64  : ValueType;    // 64-bit floating point value
-def f80  : ValueType;    // 80-bit floating point value
-def f128 : ValueType;    // 128-bit floating point value
+def i1   : ValueType<1>;      // One bit boolean value
+def i8   : ValueType<8>;      // 8-bit integer value
+def i16  : ValueType<16>;     // 16-bit integer value
+def i32  : ValueType<32>;     // 32-bit integer value
+def i64  : ValueType<64>;     // 64-bit integer value
+def i128 : ValueType<128>;    // 128-bit integer value
+def f32  : ValueType<32>;     // 32-bit floating point value
+def f64  : ValueType<64>;     // 64-bit floating point value
+def f80  : ValueType<80>;     // 80-bit floating point value
+def f128 : ValueType<128>;    // 128-bit floating point value
 
 
 //===----------------------------------------------------------------------===//
@@ -61,6 +61,7 @@ class RegisterClass<ValueType regType, int alignment, list<Register> regList> {
   // Alignment - Specify the alignment required of the registers when they are
   // stored or loaded to memory.
   //
+  int Size = RegType.Size;
   int Alignment = alignment;
 
   // MemberList - Specify which registers are in this class.  If the
@@ -76,6 +77,27 @@ class RegisterClass<ValueType regType, int alignment, list<Register> regList> {
   code allocation_order_end;
 }
 
+// RegisterInfo - This class should only be instantiated once to provide
+// parameters which are global to the the target machine, such as callee safed
+// registers.
+//
+class RegisterInfo {
+  // ClassName - Specify the name of the class that should be generated by the
+  // register info emitter.  This class may be further subclasses by custom
+  // target code to implement virtual methods as necessary.  Targets must
+  // specify a value for this.
+  //
+  string ClassName;
+
+  // CalleeSavedRegisters - As you might guess, this is a list of the callee
+  // saved registers for a target.
+  list<Register> CalleeSavedRegisters = [];
+  
+  // PointerType - Specify the value type to be used to represent pointers in
+  // this target.  Typically this is an i32 or i64 type.
+  ValueType PointerType;
+}
+
 
 //===----------------------------------------------------------------------===//
 // Instruction set description -