[PATCH] Sema: Accept pointers to any address space for builtin functions

Tom Stellard thomas.stellard at amd.com
Thu Mar 5 09:24:09 PST 2015


In http://reviews.llvm.org/D8082#134961, @Anastasia wrote:

> Shall TODO/comment be added somewhere saying that handling address space number of pointers in builtins is still to be implemented?


This appears to be implemented already, but there are no builtins using it.  What does need to be done is add a way to
specify a named address space, like constant or local, because right now the builtins only accept integer address spaces.


REPOSITORY
  rL LLVM

================
Comment at: lib/Sema/SemaExpr.cpp:4393
@@ +4392,3 @@
+
+        Expr *PtrArg = DefaultFunctionArrayLvalueConversion(Arg).get();
+        QualType PtrTy = PtrArg->getType();
----------------
Anastasia wrote:
> Not sure if this cast might create a problem in some OpenCL-GPU architectures, because spec generally disallows conversion between constant and any other address spaces (see OpenCL C v2.0 s6.5.5). 
> 
> I feel like a better way to handle this would be to create separate builtins overloads for constant and generic address space in OpenCL v2.0 and for all address spaces in OpenCL <v2.0. But this seems more work to me.
I'm not sure about the cast issue.  I do see that for memcpy addrspacecast IR instructions are emitted.

I'm open to adding separate overloads, I just wanted to try a generic solution first.

http://reviews.llvm.org/D8082

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list