Tablegen support for insert & extract element matching

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46901 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nate Begeman
2008-02-09 01:37:05 +00:00
parent 9071dd3a57
commit b5af3344c1
3 changed files with 38 additions and 1 deletions
+17
View File
@@ -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;
}