forked from OSchip/llvm-project
Add a new SDTCisIntVectorOfSameSize type constraint
llvm-svn: 26890
This commit is contained in:
parent
93d99f9928
commit
c1b31d8a83
|
@ -63,14 +63,14 @@ static bool LHSIsSubsetOfRHS(const std::vector<unsigned char> &LHS,
|
||||||
|
|
||||||
/// isExtIntegerVT - Return true if the specified extended value type vector
|
/// isExtIntegerVT - Return true if the specified extended value type vector
|
||||||
/// contains isInt or an integer value type.
|
/// contains isInt or an integer value type.
|
||||||
static bool isExtIntegerInVTs(std::vector<unsigned char> EVTs) {
|
static bool isExtIntegerInVTs(const std::vector<unsigned char> &EVTs) {
|
||||||
assert(!EVTs.empty() && "Cannot check for integer in empty ExtVT list!");
|
assert(!EVTs.empty() && "Cannot check for integer in empty ExtVT list!");
|
||||||
return EVTs[0] == MVT::isInt || !(FilterEVTs(EVTs, MVT::isInteger).empty());
|
return EVTs[0] == MVT::isInt || !(FilterEVTs(EVTs, MVT::isInteger).empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isExtFloatingPointVT - Return true if the specified extended value type
|
/// isExtFloatingPointVT - Return true if the specified extended value type
|
||||||
/// vector contains isFP or a FP value type.
|
/// vector contains isFP or a FP value type.
|
||||||
static bool isExtFloatingPointInVTs(std::vector<unsigned char> EVTs) {
|
static bool isExtFloatingPointInVTs(const std::vector<unsigned char> &EVTs) {
|
||||||
assert(!EVTs.empty() && "Cannot check for integer in empty ExtVT list!");
|
assert(!EVTs.empty() && "Cannot check for integer in empty ExtVT list!");
|
||||||
return EVTs[0] == MVT::isFP ||
|
return EVTs[0] == MVT::isFP ||
|
||||||
!(FilterEVTs(EVTs, MVT::isFloatingPoint).empty());
|
!(FilterEVTs(EVTs, MVT::isFloatingPoint).empty());
|
||||||
|
@ -103,6 +103,10 @@ SDTypeConstraint::SDTypeConstraint(Record *R) {
|
||||||
ConstraintType = SDTCisOpSmallerThanOp;
|
ConstraintType = SDTCisOpSmallerThanOp;
|
||||||
x.SDTCisOpSmallerThanOp_Info.BigOperandNum =
|
x.SDTCisOpSmallerThanOp_Info.BigOperandNum =
|
||||||
R->getValueAsInt("BigOperandNum");
|
R->getValueAsInt("BigOperandNum");
|
||||||
|
} else if (R->isSubClassOf("SDTCisIntVectorOfSameSize")) {
|
||||||
|
ConstraintType = SDTCisIntVectorOfSameSize;
|
||||||
|
x.SDTCisIntVectorOfSameSize_Info.OtherOperandNum =
|
||||||
|
R->getValueAsInt("OtherOpNum");
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Unrecognized SDTypeConstraint '" << R->getName() << "'!\n";
|
std::cerr << "Unrecognized SDTypeConstraint '" << R->getName() << "'!\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -259,6 +263,19 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N,
|
||||||
}
|
}
|
||||||
return MadeChange;
|
return MadeChange;
|
||||||
}
|
}
|
||||||
|
case SDTCisIntVectorOfSameSize: {
|
||||||
|
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::getIntVectorWithNumElements(MVT::getVectorNumElements(IVT));
|
||||||
|
return NodeToApply->UpdateNodeType(IVT, TP);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace llvm {
|
||||||
unsigned OperandNo; // The operand # this constraint applies to.
|
unsigned OperandNo; // The operand # this constraint applies to.
|
||||||
enum {
|
enum {
|
||||||
SDTCisVT, SDTCisPtrTy, SDTCisInt, SDTCisFP, SDTCisSameAs,
|
SDTCisVT, SDTCisPtrTy, SDTCisInt, SDTCisFP, SDTCisSameAs,
|
||||||
SDTCisVTSmallerThanOp, SDTCisOpSmallerThanOp
|
SDTCisVTSmallerThanOp, SDTCisOpSmallerThanOp, SDTCisIntVectorOfSameSize
|
||||||
} ConstraintType;
|
} ConstraintType;
|
||||||
|
|
||||||
union { // The discriminated union.
|
union { // The discriminated union.
|
||||||
|
@ -63,6 +63,9 @@ namespace llvm {
|
||||||
struct {
|
struct {
|
||||||
unsigned BigOperandNum;
|
unsigned BigOperandNum;
|
||||||
} SDTCisOpSmallerThanOp_Info;
|
} SDTCisOpSmallerThanOp_Info;
|
||||||
|
struct {
|
||||||
|
unsigned OtherOperandNum;
|
||||||
|
} SDTCisIntVectorOfSameSize_Info;
|
||||||
} x;
|
} x;
|
||||||
|
|
||||||
/// ApplyTypeConstraint - Given a node in a pattern, apply this type
|
/// ApplyTypeConstraint - Given a node in a pattern, apply this type
|
||||||
|
|
Loading…
Reference in New Issue