mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
Generalize my hack to use SDNodeInfo to find out when a
node is always guaranteed to have a particular type instead of hacking in ISD::STORE explicitly. This allows us to use implied types for a broad range of nodes, even target specific ones. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97355 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -447,6 +447,30 @@ SDNodeInfo::SDNodeInfo(Record *R) : Def(R) {
|
||||
TypeConstraints.assign(ConstraintList.begin(), ConstraintList.end());
|
||||
}
|
||||
|
||||
/// getKnownType - If the type constraints on this node imply a fixed type
|
||||
/// (e.g. all stores return void, etc), then return it as an
|
||||
/// MVT::SimpleValueType. Otherwise, return EEVT::isUnknown.
|
||||
unsigned SDNodeInfo::getKnownType() const {
|
||||
unsigned NumResults = getNumResults();
|
||||
assert(NumResults <= 1 &&
|
||||
"We only work with nodes with zero or one result so far!");
|
||||
|
||||
for (unsigned i = 0, e = TypeConstraints.size(); i != e; ++i) {
|
||||
// Make sure that this applies to the correct node result.
|
||||
if (TypeConstraints[i].OperandNo >= NumResults) // FIXME: need value #
|
||||
continue;
|
||||
|
||||
switch (TypeConstraints[i].ConstraintType) {
|
||||
default: break;
|
||||
case SDTypeConstraint::SDTCisVT:
|
||||
return TypeConstraints[i].x.SDTCisVT_Info.VT;
|
||||
case SDTypeConstraint::SDTCisPtrTy:
|
||||
return MVT::iPTR;
|
||||
}
|
||||
}
|
||||
return EEVT::isUnknown;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// TreePatternNode implementation
|
||||
//
|
||||
|
Reference in New Issue
Block a user