summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenTarget.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2009-01-07 00:09:01 +0000
committerBob Wilson <bob.wilson@apple.com>2009-01-07 00:09:01 +0000
commitf76486ac8a3aa808a42e3c7ad44907507a5f02db (patch)
tree37f37d9e9479bef2e600d9089d1349a8491c4d54 /llvm/utils/TableGen/CodeGenTarget.cpp
parent1b90e1cd17ef57cd2ab996ef7d027de121579bda (diff)
downloadbcm5719-llvm-f76486ac8a3aa808a42e3c7ad44907507a5f02db.tar.gz
bcm5719-llvm-f76486ac8a3aa808a42e3c7ad44907507a5f02db.zip
Improve support for type-generic vector intrinsics by teaching TableGen how
to handle LLVMMatchType intrinsic parameters, and by adding new subclasses of LLVMMatchType to match vector types with integral elements that are either twice as wide or half as wide as the elements of the matched type. llvm-svn: 61834
Diffstat (limited to 'llvm/utils/TableGen/CodeGenTarget.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenTarget.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/llvm/utils/TableGen/CodeGenTarget.cpp b/llvm/utils/TableGen/CodeGenTarget.cpp
index c6e94a5dba6..0039a894972 100644
--- a/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -483,7 +483,17 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
for (unsigned i = 0, e = TypeList->getSize(); i != e; ++i) {
Record *TyEl = TypeList->getElementAsRecord(i);
assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!");
- MVT::SimpleValueType VT = getValueType(TyEl->getValueAsDef("VT"));
+ MVT::SimpleValueType VT;
+ if (TyEl->isSubClassOf("LLVMMatchType")) {
+ VT = IS.RetVTs[TyEl->getValueAsInt("Number")];
+ // It only makes sense to use the extended and truncated vector element
+ // variants with iAny types; otherwise, if the intrinsic is not
+ // overloaded, all the types can be specified directly.
+ assert(((!TyEl->isSubClassOf("LLVMExtendedElementVectorType") &&
+ !TyEl->isSubClassOf("LLVMTruncatedElementVectorType")) ||
+ VT == MVT::iAny) && "Expected iAny type");
+ } else
+ VT = getValueType(TyEl->getValueAsDef("VT"));
isOverloaded |= VT == MVT::iAny || VT == MVT::fAny || VT == MVT::iPTRAny;
IS.RetVTs.push_back(VT);
IS.RetTypeDefs.push_back(TyEl);
@@ -497,7 +507,21 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
for (unsigned i = 0, e = TypeList->getSize(); i != e; ++i) {
Record *TyEl = TypeList->getElementAsRecord(i);
assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!");
- MVT::SimpleValueType VT = getValueType(TyEl->getValueAsDef("VT"));
+ MVT::SimpleValueType VT;
+ if (TyEl->isSubClassOf("LLVMMatchType")) {
+ unsigned MatchTy = TyEl->getValueAsInt("Number");
+ if (MatchTy < IS.RetVTs.size())
+ VT = IS.RetVTs[MatchTy];
+ else
+ VT = IS.ParamVTs[MatchTy - IS.RetVTs.size()];
+ // It only makes sense to use the extended and truncated vector element
+ // variants with iAny types; otherwise, if the intrinsic is not
+ // overloaded, all the types can be specified directly.
+ assert(((!TyEl->isSubClassOf("LLVMExtendedElementVectorType") &&
+ !TyEl->isSubClassOf("LLVMTruncatedElementVectorType")) ||
+ VT == MVT::iAny) && "Expected iAny type");
+ } else
+ VT = getValueType(TyEl->getValueAsDef("VT"));
isOverloaded |= VT == MVT::iAny || VT == MVT::fAny || VT == MVT::iPTRAny;
IS.ParamVTs.push_back(VT);
IS.ParamTypeDefs.push_back(TyEl);
OpenPOWER on IntegriCloud