[llvm-branch-commits] [clang] [NFCI][clang] Allow overriding any global variable address space (PR #195612)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon May 4 07:00:42 PDT 2026
================
@@ -312,13 +312,15 @@ class TargetCodeGenInfo {
virtual llvm::Constant *getNullPointer(const CodeGen::CodeGenModule &CGM,
llvm::PointerType *T, QualType QT) const;
- /// Get target favored AST address space of a global variable for languages
- /// other than OpenCL and CUDA.
- /// If \p D is nullptr, returns the default target favored address space
- /// for global variable.
- virtual LangAS getGlobalVarAddressSpace(CodeGenModule &CGM,
- const VarDecl *D) const;
-
+ /// Adjust the address space proposed by the code generator for \p D.
+ /// If \p AS is empty, it means language semantics did not specify any address
+ /// space for this \p D.
+ ///
+ /// Can be used by targets to further refine the chosen address space for a
+ /// declaration.
+ virtual LangAS adjustGlobalVarAddressSpace(CodeGenModule &CGM,
+ const VarDecl *D,
+ std::optional<LangAS> AS) const;
----------------
arsenm wrote:
I'm not sure I understand why the new parameter is necessary. Can't you infer from VarDecl already?
https://github.com/llvm/llvm-project/pull/195612
More information about the llvm-branch-commits
mailing list