================
@@ -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;
----------------
Pierre-vh wrote:
I could if I refactored a bit more and moved all the logic that determines the
AS of a GV (from CodeGenModule) into the base TargetInfo method. I'd need to
pass some more arguments though, like the OpenMPRuntime pointer
I just thought it was easier to keep CGM as-is, and just give more control to
the TargetInfo hook.
https://github.com/llvm/llvm-project/pull/195612
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits