diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2012-05-20 21:08:35 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2012-05-20 21:08:35 +0000 |
commit | f44bdf9c5fc347f1639d50c49de2b836f28017e2 (patch) | |
tree | a21092fbd172f3ac505a42a8bc578d9daeee9b77 /clang/lib/CodeGen/CodeGenModule.h | |
parent | 853a8a982bb9b3220e3625b725b15faa8ba91d99 (diff) | |
download | bcm5719-llvm-f44bdf9c5fc347f1639d50c49de2b836f28017e2.tar.gz bcm5719-llvm-f44bdf9c5fc347f1639d50c49de2b836f28017e2.zip |
CUDA: add CodeGen support for global variable address spaces.
Because in CUDA types do not have associated address spaces,
globals are declared in their "native" address space, and accessed
by bitcasting the pointer to address space 0. This relies on address
space 0 being a unified address space.
llvm-svn: 157167
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index bde03a7cedf..8f3bd78ac42 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -517,6 +517,12 @@ public: CreateOrReplaceCXXRuntimeVariable(StringRef Name, llvm::Type *Ty, llvm::GlobalValue::LinkageTypes Linkage); + /// GetGlobalVarAddressSpace - Return the address space of the underlying + /// global variable for D, as determined by its declaration. Normally this + /// is the same as the address space of D's type, but in CUDA, address spaces + /// are associated with declarations, not types. + unsigned GetGlobalVarAddressSpace(const VarDecl *D, unsigned AddrSpace); + /// GetAddrOfGlobalVar - Return the llvm::Constant for the address of the /// given global variable. If Ty is non-null and if the global doesn't exist, /// then it will be greated with the specified type instead of whatever the |