summaryrefslogtreecommitdiffstats
path: root/clang/CodeGen/CodeGenModule.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
commit025b5fb88303dec0883d3399fa208510efa192b1 (patch)
treeb314915575fc690bed7112d694875092d9a0dce4 /clang/CodeGen/CodeGenModule.cpp
parente5b8b7db4ac1e870665301c5d2914d434b607cb4 (diff)
downloadbcm5719-llvm-025b5fb88303dec0883d3399fa208510efa192b1.tar.gz
bcm5719-llvm-025b5fb88303dec0883d3399fa208510efa192b1.zip
Add experimental support for address space qualified types. Address space
qualifiers use the __attribute__((address_space(id))) syntax. llvm-svn: 46691
Diffstat (limited to 'clang/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/CodeGen/CodeGenModule.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/CodeGen/CodeGenModule.cpp b/clang/CodeGen/CodeGenModule.cpp
index edf3dc42831..382f651272f 100644
--- a/clang/CodeGen/CodeGenModule.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud