As long as they don't have an address space explicitly defined.
This allows builtins with pointer arguments to be used with OpenCL.
Differential D8082
Sema: Accept pointers to any address space for builtin functions • tstellarAMD on Mar 5 2015, 7:28 AM. Authored by
Details
Diff Detail
Event TimelineComment Actions Shall TODO/comment be added somewhere saying that handling address space number of pointers in builtins is still to be implemented? Also what the number should be for OpenCL? Should it be taken from LangAS::ID enum?
Comment Actions This appears to be implemented already, but there are no builtins using it. What does need to be done is add a way to
Comment Actions Here is an updated patch with an entirely different approach. Instead of inserting addressspace casts, this patch rewrites the function declaration to match the address space of the call arguments. Comment Actions Much better approach, a few comments inline.
Comment Actions Hi, here is an updated patch. I've addressed all comments except I did not add a DensMap to rewriteBuiltinFunctionDecl(), I wasn't sure exactly how to use this to speed up the function. I can still add this if people think it will help. I did some profiling of a function with 100,000 __builtin_memcpy() calls and this patch doesn't seem to increase compile time. I also did not add handling for return types. I wasn't able to figure out how to get the actual call expression which had the return type used in the code. I added a TODO for this. |
Why not a SmallVector? I don't think this will ever have more than 4 entries (or is it 6 for the atomic compare and exchange?). A SmallVector<QualType, 8> should avoid any heap allocation.