[cfe-commits] [PATCH] OpenCL: introduce support for function scope __local variables

John McCall rjmccall at apple.com
Wed Jul 27 14:26:30 PDT 2011


On Jul 27, 2011, at 2:10 PM, Peter Collingbourne wrote:
> This patch introduces support for function scope __local variables.
> It does so by introducing a new storage class, SC_WorkGroupLocal,
> for __local variables, and an OpenCL runtime class which controls
> how __local variable declarations are emitted.  The default behaviour
> is simply to emit an internal global.

--- a/include/clang/Basic/Specifiers.h
+++ b/include/clang/Basic/Specifiers.h
@@ -146,6 +146,7 @@ namespace clang {
     SC_PrivateExtern,
 
     // These are only legal on variables.
+    SC_WorkGroupLocal,

Is there a similar concept in CUDA?  If not, please put "OpenCL" in
the name somewhere.

+++ b/lib/AST/Decl.cpp
@@ -1126,6 +1126,7 @@ const char *VarDecl::getStorageClassSpecifierString(StorageClass SC) {
   case SC_PrivateExtern: return "__private_extern__"; break;
   case SC_Register:      return "register"; break;
   case SC_Static:        return "static"; break;
+  case SC_WorkGroupLocal:return "work-group-local"; break;

This should return the source-code spelling, i.e. "__local".

John.



More information about the cfe-commits mailing list