Unfortunately, this still ends up in a slightly awkward place between
Sema and CG, since a few CG phases create implicit parameters (e.g. for
`this`) which also need to be deduced into the correct address space by
Sema. This is intended to be clearly extensible for other targets that
also need this.
Changes the constructor for ImplicitParamDecl to be private again, so
that all users will go through the Create method, by making the object
ctor itself declared `protected` (like all the other VarDecl subtypes).
The memory is later cleaned up by the ASTContext bump allocator, and
since the stack is basically also a bump allocator, is is typically
equally fast. (Reverts 550d13aebb)
(If I got my commit stacked extraction right) This should allow removing
the special cases for OpenCL from EmitParmDecl once
https://github.com/llvm/llvm-project/pull/181390 lands, since this
aligns the behavior of that function with the declared intent of each
VarDecl.
This changed many tests because previously OpenCL just assumed that
allocations for parameters were actually made in the addrspace of Ty,
but didn't actually check against that properly, resulting in some
unnecessary copies. That will be fixed even more completely in
https://github.com/llvm/llvm-project/pull/181390 even more, removing
also the unnecessary addrspace casts.
296 KiB
296 KiB