[PATCH] D95558: [NFC][CUDA] Refactor registering device variable
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 27 16:58:03 PST 2021
tra added inline comments.
================
Comment at: clang/lib/CodeGen/CGCUDANV.cpp:157
llvm::Function *makeModuleDtorFunction() override;
+ void
+ adjustShadowVarLinkage(const VarDecl *D,
----------------
clang-format it? `void` hanging all by itself looks odd.
================
Comment at: clang/lib/CodeGen/CGCUDANV.cpp:924
+
+void CGNVCUDARuntime::adjustShadowVarLinkage(
+ const VarDecl *D, llvm::GlobalValue::LinkageTypes &Linkage) {
----------------
The name and the functionality do not match -- despite what the name says, the function will set internal linkage on any var with device-side attributes.
Rename to `internalizeDeviceSideVars` ?
================
Comment at: clang/lib/CodeGen/CGCUDARuntime.h:86
+ /// Check whether a variable is a device variable and register it if true.
+ virtual void mayRegisterDeviceVar(const VarDecl *VD,
+ llvm::GlobalVariable &Var) = 0;
----------------
`handleVarRegistration` to make it distinct from the implementation of specific registration kinds.
Maybe, move `registerDevice*` functions under `private:` as they will only be used from the top-level handler called by CGM.
================
Comment at: clang/lib/CodeGen/CGCUDARuntime.h:89
+ /// Register regular device variable (not surface or texture).
+ virtual void registerDeviceVarRegular(const VarDecl *VD,
+ llvm::GlobalVariable &Var, bool Extern,
----------------
Just `registerDeviceVar` would do.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95558/new/
https://reviews.llvm.org/D95558
More information about the cfe-commits
mailing list