mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-17 03:24:34 +00:00
Add a new overloaded EVT::vAny type for use in TableGen to allow intrinsic
arguments that are vectors of any size and element type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78631 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -87,9 +87,16 @@ bool isExtIntegerInVTs(const std::vector<unsigned char> &EVTs) {
|
||||
/// isExtFloatingPointInVTs - Return true if the specified extended value type
|
||||
/// vector contains isFP or a FP value type.
|
||||
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 FP in empty ExtVT list!");
|
||||
return EVTs[0] == isFP || !(FilterEVTs(EVTs, isFloatingPoint).empty());
|
||||
}
|
||||
|
||||
/// isExtVectorInVTs - Return true if the specified extended value type
|
||||
/// vector contains a vector value type.
|
||||
bool isExtVectorInVTs(const std::vector<unsigned char> &EVTs) {
|
||||
assert(!EVTs.empty() && "Cannot check for vector in empty ExtVT list!");
|
||||
return !(FilterEVTs(EVTs, isVector).empty());
|
||||
}
|
||||
} // end namespace EEVT.
|
||||
} // end namespace llvm.
|
||||
|
||||
@@ -495,6 +502,14 @@ bool TreePatternNode::UpdateNodeType(const std::vector<unsigned char> &ExtVTs,
|
||||
setTypes(FVTs);
|
||||
return true;
|
||||
}
|
||||
if (ExtVTs[0] == EVT::vAny && EEVT::isExtVectorInVTs(getExtTypes())) {
|
||||
assert(hasTypeSet() && "should be handled above!");
|
||||
std::vector<unsigned char> FVTs = FilterEVTs(getExtTypes(), isVector);
|
||||
if (getExtTypes() == FVTs)
|
||||
return false;
|
||||
setTypes(FVTs);
|
||||
return true;
|
||||
}
|
||||
|
||||
// If we know this is an int or fp type, and we are told it is a specific one,
|
||||
// take the advice.
|
||||
@@ -504,7 +519,9 @@ bool TreePatternNode::UpdateNodeType(const std::vector<unsigned char> &ExtVTs,
|
||||
if (((getExtTypeNum(0) == EEVT::isInt || getExtTypeNum(0) == EVT::iAny) &&
|
||||
EEVT::isExtIntegerInVTs(ExtVTs)) ||
|
||||
((getExtTypeNum(0) == EEVT::isFP || getExtTypeNum(0) == EVT::fAny) &&
|
||||
EEVT::isExtFloatingPointInVTs(ExtVTs))) {
|
||||
EEVT::isExtFloatingPointInVTs(ExtVTs)) ||
|
||||
(getExtTypeNum(0) == EVT::vAny &&
|
||||
EEVT::isExtVectorInVTs(ExtVTs))) {
|
||||
setTypes(ExtVTs);
|
||||
return true;
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ std::string llvm::getEnumName(EVT::SimpleValueType T) {
|
||||
case EVT::i128: return "EVT::i128";
|
||||
case EVT::iAny: return "EVT::iAny";
|
||||
case EVT::fAny: return "EVT::fAny";
|
||||
case EVT::vAny: return "EVT::vAny";
|
||||
case EVT::f32: return "EVT::f32";
|
||||
case EVT::f64: return "EVT::f64";
|
||||
case EVT::f80: return "EVT::f80";
|
||||
@@ -496,7 +497,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
|
||||
} else {
|
||||
VT = getValueType(TyEl->getValueAsDef("VT"));
|
||||
}
|
||||
if (VT == EVT::iAny || VT == EVT::fAny || VT == EVT::iPTRAny) {
|
||||
if (EVT(VT).isOverloaded()) {
|
||||
OverloadedVTs.push_back(VT);
|
||||
isOverloaded |= true;
|
||||
}
|
||||
@@ -526,7 +527,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
|
||||
VT == EVT::iAny) && "Expected iAny type");
|
||||
} else
|
||||
VT = getValueType(TyEl->getValueAsDef("VT"));
|
||||
if (VT == EVT::iAny || VT == EVT::fAny || VT == EVT::iPTRAny) {
|
||||
if (EVT(VT).isOverloaded()) {
|
||||
OverloadedVTs.push_back(VT);
|
||||
isOverloaded |= true;
|
||||
}
|
||||
|
@@ -203,7 +203,7 @@ static void EmitTypeGenerate(raw_ostream &OS, const Record *ArgType,
|
||||
<< "(dyn_cast<VectorType>(Tys[" << Number << "]))";
|
||||
else
|
||||
OS << "Tys[" << Number << "]";
|
||||
} else if (VT == EVT::iAny || VT == EVT::fAny) {
|
||||
} else if (VT == EVT::iAny || VT == EVT::fAny || VT == EVT::vAny) {
|
||||
// NOTE: The ArgNo variable here is not the absolute argument number, it is
|
||||
// the index of the "arbitrary" type in the Tys array passed to the
|
||||
// Intrinsic::getDeclaration function. Consequently, we only want to
|
||||
@@ -329,7 +329,7 @@ void IntrinsicEmitter::EmitVerifier(const std::vector<CodeGenIntrinsic> &Ints,
|
||||
EVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT"));
|
||||
OS << getEnumName(VT);
|
||||
|
||||
if (VT == EVT::iAny || VT == EVT::fAny || VT == EVT::iPTRAny)
|
||||
if (EVT(VT).isOverloaded())
|
||||
OverloadedTypeIndices.push_back(j);
|
||||
|
||||
if (VT == EVT::isVoid && j != 0 && j != je - 1)
|
||||
@@ -357,7 +357,7 @@ void IntrinsicEmitter::EmitVerifier(const std::vector<CodeGenIntrinsic> &Ints,
|
||||
EVT::SimpleValueType VT = getValueType(ArgType->getValueAsDef("VT"));
|
||||
OS << getEnumName(VT);
|
||||
|
||||
if (VT == EVT::iAny || VT == EVT::fAny || VT == EVT::iPTRAny)
|
||||
if (EVT(VT).isOverloaded())
|
||||
OverloadedTypeIndices.push_back(j + RetTys.size());
|
||||
|
||||
if (VT == EVT::isVoid && j != 0 && j != je - 1)
|
||||
|
Reference in New Issue
Block a user