Start adding usefulness to the DAG node definitions, add a new Expander
[oota-llvm.git] / lib / Target / Target.td
index 546eeec3c4c490966f959c2b0bf0a2e342845121..d7f7d7c41babf51d6bfd0c72933ed69a30a45798 100644 (file)
@@ -18,12 +18,9 @@ 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
-
 
 //===----------------------------------------------------------------------===//
 // Register file description - These classes are used to fill in the target
@@ -42,7 +39,7 @@ class Register {
 // "name" of the register, you can use this to specify a custom name instead.
 //
 class NamedReg<string n> : Register {
-  set Name = n;
+  let Name = n;
 }
 
 // RegisterAliases - You should define instances of this class to indicate which
@@ -103,14 +100,23 @@ class Instruction {
   bit isCall       = 0;     // Is this instruction a call instruction?
   bit isTwoAddress = 0;     // Is this a two address instruction?
   bit isTerminator = 0;     // Is this part of the terminator for a basic block?
+
+  // Pattern - Set to the DAG pattern for this instruction, if we know of one,
+  // otherwise, uninitialized.
+  dag Pattern;
 }
 
+class Expander<dag pattern, list<dag> result> {
+  dag Pattern      = pattern;
+  list<dag> Result = result;
+}
+
+
 // InstrInfo - This class should only be instantiated once to provide parameters
 // which are global to the the target machine.
 //
 class InstrInfo {
   Instruction PHIInst;
-  Instruction NOOPInst;
 
   // If the target wants to associate some target-specific information with each
   // instruction, it should provide these two lists to indicate how to assemble
@@ -136,3 +142,53 @@ class Target {
   // InstructionSet - Instruction set description for this target
   InstrInfo InstructionSet;
 }
+
+
+//===----------------------------------------------------------------------===//
+// DAG node definitions used by the instruction selector...
+//
+class DagNodeResultType;
+def DNRT_void  : DagNodeResultType;  // Tree node always returns void
+def DNRT_val   : DagNodeResultType;  // A non-void type
+def DNRT_arg0  : DagNodeResultType;  // Tree node returns same type as Arg0
+
+class DagNodeArgType;
+def DNAT_val   : DagNodeArgType;     // Any value
+def DNAT_arg0  : DagNodeArgType;     // Same as for arg #0
+def DNAT_ptr   : DagNodeArgType;     // Returns the target pointer type
+
+class DagNode<DagNodeResultType ret, list<DagNodeArgType> args> {
+  DagNodeResultType RetType = ret;
+  list<DagNodeArgType> ArgTypes = args;
+  string EnumName = ?;
+}
+
+// BuiltinDagNodes are built into the instruction selector and correspond to
+// enum values.
+class BuiltinDagNode<DagNodeResultType Ret, list<DagNodeArgType> Args,
+                     string Ename> : DagNode<Ret, Args> {
+  let EnumName = Ename;
+}
+
+// Magic nodes...
+def set     : DagNode<DNRT_void, [DNAT_val, DNAT_arg0]>;
+
+// Terminals...
+def imm     : DagNode<DNRT_val, []>;
+
+// Arithmetic...
+def plus    : BuiltinDagNode<DNRT_arg0, [DNAT_val, DNAT_arg0], "Plus">;
+def minus   : BuiltinDagNode<DNRT_arg0, [DNAT_val, DNAT_arg0], "Minus">;
+//def mult    : DagNode<2, DNRT_arg0>;
+//def div     : DagNode<2, DNRT_arg0>;
+//def udiv    : DagNode<2, DNRT_arg0>;
+//def mod     : DagNode<2, DNRT_arg0>;
+//def umod    : DagNode<2, DNRT_arg0>;
+
+//def load    : DagNode<1, DNRT_val>;
+//def store   : DagNode<2, DNRT_Void>;
+
+// Other...
+def ret     : BuiltinDagNode<DNRT_void, [DNAT_val], "Ret">;
+def retvoid : BuiltinDagNode<DNRT_void, [], "RetVoid">;
+