[clang] [clang][SYCL] Implement address space attributes for SYCL (PR #200849)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 10 06:50:26 PDT 2026
================
@@ -576,21 +576,38 @@ class ParsedAttr final
}
}
- /// If this is an OpenCL address space attribute, returns its SYCL
- /// representation in LangAS, otherwise returns default address space.
+ /// If this is a SYCL address space attribute, returns its SYCL
+ /// representation in LangAS.
LangAS asSYCLLangAS() const {
- switch (getKind()) {
- case ParsedAttr::AT_OpenCLGlobalAddressSpace:
+ switch (getParsedKind()) {
+ case ParsedAttr::AT_SYCLGlobalAddressSpace:
return LangAS::sycl_global;
+ // TODO: OpenCLGlobalDeviceAddressSpace, OpenCLGlobalHostAddressSpace,
+ // sycl_global_device, and sycl_global_host will be removed after
+ // deprecation.
+ // https://discourse.llvm.org/t/rfc-remove-opencl-global-device-and-opencl-global-host-address-space-attributes/90677
case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
return LangAS::sycl_global_device;
case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
return LangAS::sycl_global_host;
- case ParsedAttr::AT_OpenCLLocalAddressSpace:
+ case ParsedAttr::AT_SYCLLocalAddressSpace:
return LangAS::sycl_local;
- case ParsedAttr::AT_OpenCLPrivateAddressSpace:
+ case ParsedAttr::AT_SYCLPrivateAddressSpace:
return LangAS::sycl_private;
+ case ParsedAttr::AT_SYCLGenericAddressSpace:
+ return LangAS::sycl_generic;
+ case ParsedAttr::AT_SYCLConstantAddressSpace:
+ return LangAS::sycl_constant;
+ // The OpenCL address space attributes are available to enable
+ // implicit conversions between OpenCL address space attributes and
+ // SYCL address space attributes when targeting the OpenCL execution
+ // environments.
+ case ParsedAttr::AT_OpenCLGlobalAddressSpace:
+ case ParsedAttr::AT_OpenCLLocalAddressSpace:
+ case ParsedAttr::AT_OpenCLPrivateAddressSpace:
case ParsedAttr::AT_OpenCLGenericAddressSpace:
+ case ParsedAttr::AT_OpenCLConstantAddressSpace:
+ return asOpenCLLangAS();
----------------
elizabethandrews wrote:
>>I might be missing something though, so @elizabethandrews, please confirm I'm making sense.
I am unaware of other users of these attributes.
https://github.com/llvm/llvm-project/pull/200849
More information about the cfe-commits
mailing list