rjmccall added a comment.

A qualifier "outside" the block-pointer type is telling you what address space 
the object which holds the block pointer is in, which is a completely different 
thing.  Instead of `__global int (^block4)(void) = ^{ return 0; };`, you need 
to write `int (^__global block4)(void) = ^{ return 0; };`.

> We add `__generic` addr space to pointee type of block pointer type for all 
> block variables. However, we don't do the same for block literals. Hence we 
> need to generate conversion from `LangAS::Default` to 
> `LangAS::opencl_generic`... I think this just aligns with what we do for 
> other similar cases in OpenCL.
> 
> We also add `__global`/`__private` to block pointer type in block variable 
> declarations, but we do the same for all other objects. At IR generation we 
> generate block literals with captures as local variables in `__private` addr 
> space and block literals without captures as global variables in `__global` 
> addr space.

Okay, so it sounds like *from the language perspective* all block pointers are 
actually pointers into `__generic`, and the thing with literals is just an 
implementation detail that's been inappropriately expressed in the AST.  The 
better implementation strategy is to make sure that (1) the AST uses the 
size/alignment of a `__generic` pointer for a block pointer and (2) IRGen 
implicitly converts block literals to `__generic` pointers when it emits them, 
and then there's no such thing as a block pointer to a qualified type.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64083/new/

https://reviews.llvm.org/D64083



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to