aboutsummaryrefslogtreecommitdiff
path: root/CodeGen/CodeGenTypes.cpp
diff options
context:
space:
mode:
authorChristopher Lamb <christopher.lamb@gmail.com>2008-02-04 02:31:56 +0000
committerChristopher Lamb <christopher.lamb@gmail.com>2008-02-04 02:31:56 +0000
commitebb97e98c03f8d7034bd3748a10e35f39a95c289 (patch)
tree9304659bdd12a3b9e9965ebec497f777d508e919 /CodeGen/CodeGenTypes.cpp
parent550ce0f9b732388ea6f0ab6881d28ef3f5f4906b (diff)
Add experimental support for address space qualified types. Address space
qualifiers use the __attribute__((address_space(id))) syntax. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46691 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CodeGenTypes.cpp')
-rw-r--r--CodeGen/CodeGenTypes.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/CodeGen/CodeGenTypes.cpp b/CodeGen/CodeGenTypes.cpp
index 9e8a2e0ea6..326503197f 100644
--- a/CodeGen/CodeGenTypes.cpp
+++ b/CodeGen/CodeGenTypes.cpp
@@ -199,7 +199,8 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
}
case Type::Pointer: {
const PointerType &P = cast<PointerType>(Ty);
- return llvm::PointerType::getUnqual(ConvertType(P.getPointeeType()));
+ QualType ETy = P.getPointeeType();
+ return llvm::PointerType::get(ConvertType(ETy), ETy.getAddressSpace());
}
case Type::Reference: {
const ReferenceType &R = cast<ReferenceType>(Ty);
@@ -245,7 +246,8 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
// Struct return passes the struct byref.
if (!ResultType->isFirstClassType() && ResultType != llvm::Type::VoidTy) {
- const llvm::Type *RType = llvm::PointerType::getUnqual(ResultType);
+ const llvm::Type *RType = llvm::PointerType::get(ResultType,
+ FP.getResultType().getAddressSpace());
QualType RTy = Context.getPointerType(FP.getResultType());
TypeHolderMap.insert(std::make_pair(RTy.getTypePtr(),
llvm::PATypeHolder(RType)));
@@ -263,6 +265,10 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
return llvm::FunctionType::get(ResultType, ArgTys, isVarArg);
}
+
+ case Type::ASQual:
+ return ConvertType(cast<ASQualType>(Ty).getBaseType());
+ break;
case Type::ObjCInterface:
assert(0 && "FIXME: add missing functionality here");
@@ -386,8 +392,10 @@ void CodeGenTypes::DecodeArgumentTypes(const FunctionTypeProto &FTP,
if (Ty->isFirstClassType())
ArgTys.push_back(Ty);
else {
- QualType PTy = Context.getPointerType(FTP.getArgType(i));
- const llvm::Type *PtrTy = llvm::PointerType::getUnqual(Ty);
+ QualType ATy = FTP.getArgType(i);
+ QualType PTy = Context.getPointerType(ATy);
+ unsigned AS = ATy.getAddressSpace();
+ const llvm::Type *PtrTy = llvm::PointerType::get(Ty, AS);
TypeHolderMap.insert(std::make_pair(PTy.getTypePtr(),
llvm::PATypeHolder(PtrTy)));