diff options
author | Nate Begeman <natebegeman@mac.com> | 2008-02-09 01:37:05 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2008-02-09 01:37:05 +0000 |
commit | b5af3344c196de5ed3f45b250dfb864be6e9ddc5 (patch) | |
tree | f6e59a1f1536f34b5e2c10427ab94fae3917a5b6 /utils/TableGen | |
parent | 9071dd3a57db98da6a4d1a5b52640bfbd4d09ef8 (diff) | |
download | external_llvm-b5af3344c196de5ed3f45b250dfb864be6e9ddc5.zip external_llvm-b5af3344c196de5ed3f45b250dfb864be6e9ddc5.tar.gz external_llvm-b5af3344c196de5ed3f45b250dfb864be6e9ddc5.tar.bz2 |
Tablegen support for insert & extract element matching
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46901 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r-- | utils/TableGen/CodeGenDAGPatterns.cpp | 17 | ||||
-rw-r--r-- | utils/TableGen/CodeGenDAGPatterns.h | 6 |
2 files changed, 22 insertions, 1 deletions
diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp index 14b2b80..146488e 100644 --- a/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/utils/TableGen/CodeGenDAGPatterns.cpp @@ -112,6 +112,10 @@ SDTypeConstraint::SDTypeConstraint(Record *R) { ConstraintType = SDTCisIntVectorOfSameSize; x.SDTCisIntVectorOfSameSize_Info.OtherOperandNum = R->getValueAsInt("OtherOpNum"); + } else if (R->isSubClassOf("SDTCisEltOfVec")) { + ConstraintType = SDTCisEltOfVec; + x.SDTCisEltOfVec_Info.OtherOperandNum = + R->getValueAsInt("OtherOpNum"); } else { cerr << "Unrecognized SDTypeConstraint '" << R->getName() << "'!\n"; exit(1); @@ -288,6 +292,19 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N, } return false; } + case SDTCisEltOfVec: { + TreePatternNode *OtherOperand = + getOperandNum(x.SDTCisIntVectorOfSameSize_Info.OtherOperandNum, + N, NumResults); + if (OtherOperand->hasTypeSet()) { + if (!MVT::isVector(OtherOperand->getTypeNum(0))) + TP.error(N->getOperator()->getName() + " VT operand must be a vector!"); + MVT::ValueType IVT = OtherOperand->getTypeNum(0); + IVT = MVT::getVectorElementType(IVT); + return NodeToApply->UpdateNodeType(IVT, TP); + } + return false; + } } return false; } diff --git a/utils/TableGen/CodeGenDAGPatterns.h b/utils/TableGen/CodeGenDAGPatterns.h index d62b279..44c154a 100644 --- a/utils/TableGen/CodeGenDAGPatterns.h +++ b/utils/TableGen/CodeGenDAGPatterns.h @@ -56,7 +56,8 @@ struct SDTypeConstraint { unsigned OperandNo; // The operand # this constraint applies to. enum { SDTCisVT, SDTCisPtrTy, SDTCisInt, SDTCisFP, SDTCisSameAs, - SDTCisVTSmallerThanOp, SDTCisOpSmallerThanOp, SDTCisIntVectorOfSameSize + SDTCisVTSmallerThanOp, SDTCisOpSmallerThanOp, SDTCisIntVectorOfSameSize, + SDTCisEltOfVec } ConstraintType; union { // The discriminated union. @@ -75,6 +76,9 @@ struct SDTypeConstraint { struct { unsigned OtherOperandNum; } SDTCisIntVectorOfSameSize_Info; + struct { + unsigned OtherOperandNum; + } SDTCisEltOfVec_Info; } x; /// ApplyTypeConstraint - Given a node in a pattern, apply this type |