[clang] [clang][SYCL] Implement address space attributes for SYCL (PR #200849)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 9 08:48:55 PDT 2026


================
@@ -69,43 +69,128 @@ bool Qualifiers::isStrictSupersetOf(Qualifiers Other) const {
           (hasObjCLifetime() && !Other.hasObjCLifetime()));
 }
 
+// The memory region designated by a SYCL or OpenCL address space. Address
+// spaces that are neither SYCL nor OpenCL map to NotOpenCLSYCL.
+enum class MemoryRegion {
+  Global,
+  Local,
+  Private,
+  Generic,
+  Constant,
+  GlobalDevice,
+  GlobalHost,
+  NotOpenCLSYCL,
+};
+
+static MemoryRegion getMemoryRegion(LangAS AS) {
+  switch (AS) {
+  case LangAS::sycl_global:
+  case LangAS::opencl_global:
+    return MemoryRegion::Global;
+  case LangAS::sycl_local:
+  case LangAS::opencl_local:
+    return MemoryRegion::Local;
+  case LangAS::sycl_private:
+  case LangAS::opencl_private:
+    return MemoryRegion::Private;
+  case LangAS::sycl_generic:
+  case LangAS::opencl_generic:
+    return MemoryRegion::Generic;
----------------
tahonermann wrote:

Ok, sounds good. Handling of the default address space is something we can revisit later if necessary.

https://github.com/llvm/llvm-project/pull/200849


More information about the cfe-commits mailing list