diff options
author | Michael Liao <michael.hliao@gmail.com> | 2019-06-17 12:51:36 +0000 |
---|---|---|
committer | Michael Liao <michael.hliao@gmail.com> | 2019-06-17 12:51:36 +0000 |
commit | e40f879eb2cbe0571e0ddaaf17c30792326f9f68 (patch) | |
tree | b64a97836cd01a35cab7b618b53726e65ed85617 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | f1e2827170b3a93f85beae334b29bb98575de2e5 (diff) | |
download | bcm5719-llvm-e40f879eb2cbe0571e0ddaaf17c30792326f9f68.tar.gz bcm5719-llvm-e40f879eb2cbe0571e0ddaaf17c30792326f9f68.zip |
[HIP] Add the interface deriving the stub name of device kernels.
Summary:
- Revise the interface to derive the stub name and simplify the
assertion of it.
Reviewers: yaxunl, tra
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D63335
llvm-svn: 363553
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 7edac4d0114..559f3a73d38 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -1088,13 +1088,11 @@ StringRef CodeGenModule::getMangledName(GlobalDecl GD) { const auto *ND = cast<NamedDecl>(GD.getDecl()); std::string MangledName = getMangledNameImpl(*this, GD, ND); - // Postfix kernel stub names with .stub to differentiate them from kernel - // names in device binaries. This is to facilitate the debugger to find - // the correct symbols for kernels in the device binary. + // Adjust kernel stub mangling as we may need to be able to differentiate + // them from the kernel itself (e.g., for HIP). if (auto *FD = dyn_cast<FunctionDecl>(GD.getDecl())) - if (getLangOpts().HIP && !getLangOpts().CUDAIsDevice && - FD->hasAttr<CUDAGlobalAttr>()) - MangledName = MangledName + ".stub"; + if (!getLangOpts().CUDAIsDevice && FD->hasAttr<CUDAGlobalAttr>()) + MangledName = getCUDARuntime().getDeviceStubName(MangledName); auto Result = Manglings.insert(std::make_pair(MangledName, GD)); return MangledDeclNames[CanonicalGD] = Result.first->first(); |