implement SDTCisVTSmallerThanOp with EnforceSmallerThan
authorChris Lattner <sabre@nondot.org>
Wed, 24 Mar 2010 00:06:46 +0000 (00:06 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 24 Mar 2010 00:06:46 +0000 (00:06 +0000)
instead of reimplementing it wrong and poorly.

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

utils/TableGen/CodeGenDAGPatterns.cpp

index 08d81b857b47b85aa7c43ee0561a3085a3ec44b3..ffb9ba90f3af5d87269cdf0611d3e99269af6522 100644 (file)
@@ -627,22 +627,15 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N,
       TP.error(N->getOperator()->getName() + " expects a VT operand!");
     MVT::SimpleValueType VT =
      getValueType(static_cast<DefInit*>(NodeToApply->getLeafValue())->getDef());
-    if (!isInteger(VT))
-      TP.error(N->getOperator()->getName() + " VT operand must be integer!");
+    
+    EEVT::TypeSet TypeListTmp(VT, TP);
     
     unsigned OResNo = 0;
     TreePatternNode *OtherNode =
       getOperandNum(x.SDTCisVTSmallerThanOp_Info.OtherOperandNum, N, NodeInfo,
                     OResNo);
-    
-    // It must be integer.
-    bool MadeChange = OtherNode->getExtType(OResNo).EnforceInteger(TP);
 
-    // This doesn't try to enforce any information on the OtherNode, it just
-    // validates it when information is determined.
-    if (OtherNode->hasTypeSet(OResNo) && OtherNode->getType(OResNo) <= VT)
-      OtherNode->UpdateNodeType(OResNo, MVT::Other, TP);  // Throw an error.
-    return MadeChange;
+    return TypeListTmp.EnforceSmallerThan(OtherNode->getExtType(OResNo), TP);
   }
   case SDTCisOpSmallerThanOp: {
     unsigned BResNo = 0;