aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorYaxun (Sam) Liu <yaxun.liu@amd.com>2021-01-19 17:36:58 -0500
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2021-02-24 18:23:45 -0500
commit47acdec1dd5d6d4c279727a97313c586c20e9c6f (patch)
tree9a3bae91ae524ca8556ee2e3b4c483ef1a27d703 /clang/lib/CodeGen/CodeGenModule.h
parentc519460745ece21238b0ee6c0f9b921366701308 (diff)
downloadllvm-47acdec1dd5d6d4c279727a97313c586c20e9c6f.zip
llvm-47acdec1dd5d6d4c279727a97313c586c20e9c6f.tar.gz
llvm-47acdec1dd5d6d4c279727a97313c586c20e9c6f.tar.bz2
[CUDA][HIP] Support accessing static device variable in host code for -fgpu-rdc
For -fgpu-rdc mode, static device vars in different TU's may have the same name. To support accessing file-scope static device variables in host code, we need to give them a distinct name and external linkage. This can be done by postfixing each static device variable with a distinct CUID (Compilation Unit ID) hash. Since the static device variables have different name across compilation units, now we let them have external linkage so that they can be looked up by the runtime. Reviewed by: Artem Belevich, and Jon Chesterfield Differential Revision: https://reviews.llvm.org/D85223
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index 6411874..49f9404 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -1422,6 +1422,10 @@ public:
TBAAAccessInfo *TBAAInfo = nullptr);
bool stopAutoInit();
+ /// Print the postfix for externalized static variable for single source
+ /// offloading languages CUDA and HIP.
+ void printPostfixForExternalizedStaticVar(llvm::raw_ostream &OS) const;
+
private:
llvm::Constant *GetOrCreateLLVMFunction(
StringRef MangledName, llvm::Type *Ty, GlobalDecl D, bool ForVTable,