summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-03-23 23:46:27 +0000
committerChris Lattner <sabre@nondot.org>2010-03-23 23:46:27 +0000
commit9972aff7da15e5019b7cf6d0cc6dde0cd6192360 (patch)
tree834156e50078513529265336ca69a52e69315ddf /utils
parentae8f4c4f86f3c1dc58955dfb2a15ff27a7e56bd9 (diff)
downloadllvm-9972aff7da15e5019b7cf6d0cc6dde0cd6192360.tar.gz
llvm-9972aff7da15e5019b7cf6d0cc6dde0cd6192360.tar.bz2
llvm-9972aff7da15e5019b7cf6d0cc6dde0cd6192360.tar.xz
reject void in intrinsic type lists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99347 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/CodeGenTarget.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp
index 0d29a2f355..fbb993f4f4 100644
--- a/utils/TableGen/CodeGenTarget.cpp
+++ b/utils/TableGen/CodeGenTarget.cpp
@@ -488,18 +488,17 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
}
if (EVT(VT).isOverloaded()) {
OverloadedVTs.push_back(VT);
- isOverloaded |= true;
+ isOverloaded = true;
}
+
+ // Reject invalid types.
+ if (VT == MVT::isVoid)
+ throw "Intrinsic '" + DefName + " has void in result type list!";
IS.RetVTs.push_back(VT);
IS.RetTypeDefs.push_back(TyEl);
}
- if (IS.RetVTs.size() == 1 && IS.RetVTs[0] == MVT::isVoid) {
- IS.RetVTs.pop_back();
- IS.RetTypeDefs.pop_back();
- }
-
// Parse the list of parameter types.
TypeList = R->getValueAsListInit("ParamTypes");
for (unsigned i = 0, e = TypeList->getSize(); i != e; ++i) {
@@ -520,10 +519,16 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R) {
"Expected iAny or vAny type");
} else
VT = getValueType(TyEl->getValueAsDef("VT"));
+
if (EVT(VT).isOverloaded()) {
OverloadedVTs.push_back(VT);
- isOverloaded |= true;
+ isOverloaded = true;
}
+
+ // Reject invalid types.
+ if (VT == MVT::isVoid && i != e-1 /*void at end means varargs*/)
+ throw "Intrinsic '" + DefName + " has void in result type list!";
+
IS.ParamVTs.push_back(VT);
IS.ParamTypeDefs.push_back(TyEl);
}