mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-07 14:33:15 +00:00
bring sanity to EnforceVectorEltType
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99354 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
640a3f5309
commit
66fb9d26c6
@ -394,24 +394,39 @@ bool EEVT::TypeSet::EnforceSmallerThan(EEVT::TypeSet &Other, TreePattern &TP) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// EnforceVectorEltTypeIs - 'this' is now constrainted to be a vector type
|
/// EnforceVectorEltTypeIs - 'this' is now constrainted to be a vector type
|
||||||
/// whose element is VT.
|
/// whose element is specified by VTOperand.
|
||||||
bool EEVT::TypeSet::EnforceVectorEltTypeIs(MVT::SimpleValueType VT,
|
bool EEVT::TypeSet::EnforceVectorEltTypeIs(EEVT::TypeSet &VTOperand,
|
||||||
TreePattern &TP) {
|
TreePattern &TP) {
|
||||||
TypeSet InputSet(*this);
|
// "This" must be a vector and "VTOperand" must be a scalar.
|
||||||
bool MadeChange = false;
|
bool MadeChange = false;
|
||||||
|
MadeChange |= EnforceVector(TP);
|
||||||
|
MadeChange |= VTOperand.EnforceScalar(TP);
|
||||||
|
|
||||||
|
// If we know the vector type, it forces the scalar to agree.
|
||||||
|
if (isConcrete()) {
|
||||||
|
EVT IVT = getConcrete();
|
||||||
|
IVT = IVT.getVectorElementType();
|
||||||
|
return MadeChange |
|
||||||
|
VTOperand.MergeInTypeInfo(IVT.getSimpleVT().SimpleTy, TP);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the scalar type is known, filter out vector types whose element types
|
||||||
|
// disagree.
|
||||||
|
if (!VTOperand.isConcrete())
|
||||||
|
return MadeChange;
|
||||||
|
|
||||||
// If we know nothing, then get the full set.
|
MVT::SimpleValueType VT = VTOperand.getConcrete();
|
||||||
if (TypeVec.empty())
|
|
||||||
MadeChange = FillWithPossibleTypes(TP, isVector, "vector");
|
|
||||||
|
|
||||||
// Filter out all the non-vector types and types which don't have the right
|
TypeSet InputSet(*this);
|
||||||
// element type.
|
|
||||||
for (unsigned i = 0; i != TypeVec.size(); ++i)
|
// Filter out all the types which don't have the right element type.
|
||||||
if (!isVector(TypeVec[i]) ||
|
for (unsigned i = 0; i != TypeVec.size(); ++i) {
|
||||||
EVT(TypeVec[i]).getVectorElementType().getSimpleVT().SimpleTy != VT) {
|
assert(isVector(TypeVec[i]) && "EnforceVector didn't work");
|
||||||
|
if (EVT(TypeVec[i]).getVectorElementType().getSimpleVT().SimpleTy != VT) {
|
||||||
TypeVec.erase(TypeVec.begin()+i--);
|
TypeVec.erase(TypeVec.begin()+i--);
|
||||||
MadeChange = true;
|
MadeChange = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (TypeVec.empty()) // FIXME: Really want an SMLoc here!
|
if (TypeVec.empty()) // FIXME: Really want an SMLoc here!
|
||||||
TP.error("Type inference contradiction found, forcing '" +
|
TP.error("Type inference contradiction found, forcing '" +
|
||||||
@ -642,22 +657,11 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N,
|
|||||||
TreePatternNode *VecOperand =
|
TreePatternNode *VecOperand =
|
||||||
getOperandNum(x.SDTCisEltOfVec_Info.OtherOperandNum, N, NodeInfo,
|
getOperandNum(x.SDTCisEltOfVec_Info.OtherOperandNum, N, NodeInfo,
|
||||||
VResNo);
|
VResNo);
|
||||||
if (VecOperand->hasTypeSet(VResNo)) {
|
|
||||||
if (!isVector(VecOperand->getType(VResNo)))
|
|
||||||
TP.error(N->getOperator()->getName() + " VT operand must be a vector!");
|
|
||||||
EVT IVT = VecOperand->getType(VResNo);
|
|
||||||
IVT = IVT.getVectorElementType();
|
|
||||||
return NodeToApply->UpdateNodeType(ResNo, IVT.getSimpleVT().SimpleTy, TP);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NodeToApply->hasTypeSet(ResNo) &&
|
// Filter vector types out of VecOperand that don't have the right element
|
||||||
VecOperand->getExtType(VResNo).hasVectorTypes()){
|
// type.
|
||||||
// Filter vector types out of VecOperand that don't have the right element
|
return VecOperand->getExtType(VResNo).
|
||||||
// type.
|
EnforceVectorEltTypeIs(NodeToApply->getExtType(ResNo), TP);
|
||||||
return VecOperand->getExtType(VResNo).
|
|
||||||
EnforceVectorEltTypeIs(NodeToApply->getType(ResNo), TP);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -129,7 +129,7 @@ namespace EEVT {
|
|||||||
|
|
||||||
/// EnforceVectorEltTypeIs - 'this' is now constrainted to be a vector type
|
/// EnforceVectorEltTypeIs - 'this' is now constrainted to be a vector type
|
||||||
/// whose element is VT.
|
/// whose element is VT.
|
||||||
bool EnforceVectorEltTypeIs(MVT::SimpleValueType VT, TreePattern &TP);
|
bool EnforceVectorEltTypeIs(EEVT::TypeSet &VT, TreePattern &TP);
|
||||||
|
|
||||||
bool operator!=(const TypeSet &RHS) const { return TypeVec != RHS.TypeVec; }
|
bool operator!=(const TypeSet &RHS) const { return TypeVec != RHS.TypeVec; }
|
||||||
bool operator==(const TypeSet &RHS) const { return TypeVec == RHS.TypeVec; }
|
bool operator==(const TypeSet &RHS) const { return TypeVec == RHS.TypeVec; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user