Add basic support for recognizing a new SDTCisOpSmallerThanOp type constraint
authorChris Lattner <sabre@nondot.org>
Fri, 14 Oct 2005 04:53:53 +0000 (04:53 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 14 Oct 2005 04:53:53 +0000 (04:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23725 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/DAGISelEmitter.cpp
utils/TableGen/DAGISelEmitter.h

index c67d01090fca37b8ab9c5114b9cdcee068bd6914..8cbed47e0848803b01da4d7816f4c3bb17f9863a 100644 (file)
@@ -40,6 +40,10 @@ SDTypeConstraint::SDTypeConstraint(Record *R) {
     ConstraintType = SDTCisVTSmallerThanOp;
     x.SDTCisVTSmallerThanOp_Info.OtherOperandNum = 
       R->getValueAsInt("OtherOperandNum");
+  } else if (R->isSubClassOf("SDTCisOpSmallerThanOp")) {
+    ConstraintType = SDTCisOpSmallerThanOp;
+    x.SDTCisOpSmallerThanOp_Info.BigOperandNum = 
+      R->getValueAsInt("BigOperandNum");
   } else {
     std::cerr << "Unrecognized SDTypeConstraint '" << R->getName() << "'!\n";
     exit(1);
@@ -157,6 +161,10 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N,
       OtherNode->UpdateNodeType(MVT::Other, TP);  // Throw an error.
     return false;
   }
+  case SDTCisOpSmallerThanOp: {
+    // TODO
+    return false;
+  }
   }  
   return false;
 }
index 464edfdc424adedd2cdd92312ffaca0df47a3a19..4b2a2fb769e2f84576c7da3ec9710bd293a42a0b 100644 (file)
@@ -34,7 +34,8 @@ namespace llvm {
     
     unsigned OperandNo;   // The operand # this constraint applies to.
     enum { 
-      SDTCisVT, SDTCisInt, SDTCisFP, SDTCisSameAs, SDTCisVTSmallerThanOp
+      SDTCisVT, SDTCisInt, SDTCisFP, SDTCisSameAs, SDTCisVTSmallerThanOp,
+      SDTCisOpSmallerThanOp
     } ConstraintType;
     
     union {   // The discriminated union.
@@ -47,6 +48,9 @@ namespace llvm {
       struct {
         unsigned OtherOperandNum;
       } SDTCisVTSmallerThanOp_Info;
+      struct {
+        unsigned BigOperandNum;
+      } SDTCisOpSmallerThanOp_Info;
     } x;
 
     /// ApplyTypeConstraint - Given a node in a pattern, apply this type