Add basic support for recognizing a new SDTCisOpSmallerThanOp type constraint

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23725 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-10-14 04:53:53 +00:00
parent 0ee7cff4fb
commit 03ebd802c7
2 changed files with 13 additions and 1 deletions

View 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;
}

View 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