aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2012-05-21 23:21:28 +0000
committerPete Cooper <peter_cooper@apple.com>2012-05-21 23:21:28 +0000
commitb428511989eea383b4fa65678c12b055d5c72af5 (patch)
tree1b1f678ec301f4fa858c927eb4d44ed164fa5934
parent4b6e6750fed37879ce4730571cae1bfa342e8e02 (diff)
Added address space qualifier to intrinsic PointerType arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157218 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Intrinsics.td6
-rw-r--r--lib/VMCore/Function.cpp7
-rw-r--r--utils/TableGen/IntrinsicEmitter.cpp6
3 files changed, 16 insertions, 3 deletions
diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td
index 58b178f25a..599d5bb2e2 100644
--- a/include/llvm/Intrinsics.td
+++ b/include/llvm/Intrinsics.td
@@ -63,11 +63,15 @@ class LLVMType<ValueType vt> {
ValueType VT = vt;
}
-class LLVMPointerType<LLVMType elty>
+class LLVMQualPointerType<LLVMType elty, int addrspace>
: LLVMType<iPTR>{
LLVMType ElTy = elty;
+ int AddrSpace = addrspace;
}
+class LLVMPointerType<LLVMType elty>
+ : LLVMQualPointerType<elty, 0>;
+
class LLVMAnyPointerType<LLVMType elty>
: LLVMType<iPTRAny>{
LLVMType ElTy = elty;
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index 5a2a56637e..6339c6791d 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -388,8 +388,11 @@ static Type *DecodeFixedType(unsigned &NextElt, ArrayRef<unsigned char> Infos,
return VectorType::get(DecodeFixedType(NextElt, Infos, Tys, Context), 16);
case IIT_V32:
return VectorType::get(DecodeFixedType(NextElt, Infos, Tys, Context), 32);
- case IIT_PTR:
- return PointerType::getUnqual(DecodeFixedType(NextElt, Infos, Tys,Context));
+ case IIT_PTR: {
+ unsigned AddrSpace = Infos[NextElt++];
+ Type *PtrTy = DecodeFixedType(NextElt, Infos, Tys,Context);
+ return PointerType::get(PtrTy, AddrSpace);
+ }
case IIT_ARG:
case IIT_EXTEND_VEC_ARG:
case IIT_TRUNC_VEC_ARG: {
diff --git a/utils/TableGen/IntrinsicEmitter.cpp b/utils/TableGen/IntrinsicEmitter.cpp
index c6acddf9dd..a595b1edd7 100644
--- a/utils/TableGen/IntrinsicEmitter.cpp
+++ b/utils/TableGen/IntrinsicEmitter.cpp
@@ -413,6 +413,12 @@ static void EncodeFixedType(Record *R, unsigned &NextArgNo,
if (VT == MVT::iPTR) {
Sig.push_back(IIT_PTR);
+ unsigned AddrSpace = 0;
+ if (R->isSubClassOf("LLVMQualPointerType")) {
+ AddrSpace = R->getValueAsInt("AddrSpace");
+ assert(AddrSpace < 256 && "Address space exceeds 255");
+ }
+ Sig.push_back(AddrSpace);
return EncodeFixedType(R->getValueAsDef("ElTy"), NextArgNo, Sig);
}