[PATCH] D31404: [OpenCL] Allow alloca return non-zero private pointer

Tony Tye via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 21:21:34 PDT 2017


t-tye added inline comments.


================
Comment at: include/clang/AST/ASTContext.h:2319
     return AddrSpaceMapMangling || 
-           AS < LangAS::Offset || 
-           AS >= LangAS::Offset + LangAS::Count;
+           AS > LangAS::target_first;
   }
----------------
Should this be >= since it wants to return for all target address spaces, and target_first is the first one?


================
Comment at: include/clang/AST/Type.h:336-342
+  /// Get the address space value used in diagnostics.
+  unsigned getAddressSpacePrintValue() const {
+    unsigned AS = getAddressSpace();
+    if (AS >= LangAS::target_first)
+      return AS - LangAS::target_first;
+    return AS;
+  }
----------------
Is this the right thing to do? This is making the CLANG named address spaces have the same numbers as the target-specific address space numbers which would seem rather confusing.

What do the diagnostics want to display? For example, they could display the address space as a human readable form such as "Default", "OpenCL-global", CUDA-device", "target-specific(5)", etc. To do that this function could take an iostream and a LangAS value and use << to write to the iostream.


https://reviews.llvm.org/D31404





More information about the cfe-commits mailing list