diff options
author | Christopher Lamb <christopher.lamb@gmail.com> | 2008-02-04 02:31:56 +0000 |
---|---|---|
committer | Christopher Lamb <christopher.lamb@gmail.com> | 2008-02-04 02:31:56 +0000 |
commit | ebb97e98c03f8d7034bd3748a10e35f39a95c289 (patch) | |
tree | 9304659bdd12a3b9e9965ebec497f777d508e919 /CodeGen/CodeGenModule.cpp | |
parent | 550ce0f9b732388ea6f0ab6881d28ef3f5f4906b (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/CodeGenModule.cpp')
-rw-r--r-- | CodeGen/CodeGenModule.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/CodeGen/CodeGenModule.cpp b/CodeGen/CodeGenModule.cpp index edf3dc4283..382f651272 100644 --- a/CodeGen/CodeGenModule.cpp +++ b/CodeGen/CodeGenModule.cpp @@ -131,7 +131,8 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D, llvm::Constant *&Entry = GlobalDeclMap[D]; if (Entry) return Entry; - const llvm::Type *Ty = getTypes().ConvertTypeForMem(D->getType()); + QualType ASTTy = D->getType(); + const llvm::Type *Ty = getTypes().ConvertTypeForMem(ASTTy); // Check to see if the global already exists. llvm::GlobalVariable *GV = getModule().getGlobalVariable(D->getName(), true); @@ -140,7 +141,8 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D, if (GV == 0) { return Entry = new llvm::GlobalVariable(Ty, false, llvm::GlobalValue::ExternalLinkage, - 0, D->getName(), &getModule()); + 0, D->getName(), &getModule(), 0, + ASTTy.getAddressSpace()); } // If the pointer type matches, just return it. @@ -162,7 +164,8 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalVar(const VarDecl *D, // making a new global of the correct type, RAUW, then steal the name. llvm::GlobalVariable *NewGV = new llvm::GlobalVariable(Ty, false, llvm::GlobalValue::ExternalLinkage, - 0, D->getName(), &getModule()); + 0, D->getName(), &getModule(), 0, + ASTTy.getAddressSpace()); NewGV->takeName(GV); // Replace uses of GV with the globalvalue we will endow with a body. |