aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/CodeGenTarget.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-04-01 07:20:02 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-04-01 07:20:02 +0000
commitc4de3dec62c3f60ae7297f93c19c799c403c2e9f (patch)
treec88cc6deaac15a9909fcb080329cb03376530c77 /utils/TableGen/CodeGenTarget.cpp
parent86a5a368f82ed3898689f602f1978778a6e4a369 (diff)
downloadexternal_llvm-c4de3dec62c3f60ae7297f93c19c799c403c2e9f.zip
external_llvm-c4de3dec62c3f60ae7297f93c19c799c403c2e9f.tar.gz
external_llvm-c4de3dec62c3f60ae7297f93c19c799c403c2e9f.tar.bz2
For PR1297:
Implement code generation for overloaded intrinsic functions. The basic difference is that "actual" argument types must be provided when constructing intrinsic names and types. Also, for recognition, only the prefix is examined. If it matches, the suffix is assumed to match. The suffix is checked by the Verifier, however. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/CodeGenTarget.cpp')
-rw-r--r--utils/TableGen/CodeGenTarget.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp
index 7cf80b0..151295f 100644
--- a/utils/TableGen/CodeGenTarget.cpp
+++ b/utils/TableGen/CodeGenTarget.cpp
@@ -43,6 +43,7 @@ std::string llvm::getName(MVT::ValueType T) {
case MVT::i32: return "MVT::i32";
case MVT::i64: return "MVT::i64";
case MVT::i128: return "MVT::i128";
+ case MVT::iAny: return "MVT::iAny";
case MVT::f32: return "MVT::f32";
case MVT::f64: return "MVT::f64";
case MVT::f80: return "MVT::f80";
@@ -74,6 +75,7 @@ std::string llvm::getEnumName(MVT::ValueType T) {
case MVT::i32: return "MVT::i32";
case MVT::i64: return "MVT::i64";
case MVT::i128: return "MVT::i128";
+ case MVT::iAny: return "MVT::iAny";
case MVT::f32: return "MVT::f32";
case MVT::f64: return "MVT::f64";
case MVT::f80: return "MVT::f80";
@@ -570,6 +572,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R, CodeGenTarget *CGT) {
TheDef = R;
std::string DefName = R->getName();
ModRef = WriteMem;
+ isOverloaded = false;
if (DefName.size() <= 4 ||
std::string(DefName.begin(), DefName.begin()+4) != "int_")
@@ -610,13 +613,14 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R, CodeGenTarget *CGT) {
Record *TyEl = TypeList->getElementAsRecord(i);
assert(TyEl->isSubClassOf("LLVMType") && "Expected a type!");
ArgTypes.push_back(TyEl->getValueAsString("TypeVal"));
-
- if (CGT)
- ArgVTs.push_back(getValueType(TyEl->getValueAsDef("VT"), CGT));
+ MVT::ValueType VT = getValueType(TyEl->getValueAsDef("VT"), CGT);
+ isOverloaded |= VT == MVT::iAny;
+ ArgVTs.push_back(VT);
ArgTypeDefs.push_back(TyEl);
}
if (ArgTypes.size() == 0)
throw "Intrinsic '"+DefName+"' needs at least a type for the ret value!";
+
// Parse the intrinsic properties.
ListInit *PropList = R->getValueAsListInit("Properties");