On 10/20/2015 11:04 PM, Alexander Monakov wrote:
On Tue, 20 Oct 2015, Bernd Schmidt wrote:
On 10/20/2015 08:34 PM, Alexander Monakov wrote:
This allows to emit decls in 'shared' memory from the middle-end.
* config/nvptx/nvptx.c (nvptx_legitimate_address_p): Adjust prototype.
(nvptx_section_for_decl): If type of decl has a specific address
space, return it.
(nvptx_addr_space_from_address): Ditto.
(TARGET_ADDR_SPACE_POINTER_MODE): Define.
(TARGET_ADDR_SPACE_ADDRESS_MODE): Ditto.
(TARGET_ADDR_SPACE_SUBSET_P): Ditto.
(TARGET_ADDR_SPACE_CONVERT): Ditto.
(TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P): Ditto.
Not a fan of this I'm afraid. I used to have address space support in the
nvptx backend, but the middle-end was too broken for it to work, so I made
nvptx deal with all the address space complications internally. Is there a
reason why this approach can't work for what you want to do? (Also, where are
you using this?)
It is used in patch 06/14, to copy omp_data_o to shared memory. I don't see
any other sane approach.
There is an alternative - decorate anything you'd like to go to shared
memory with a special attribute, then handled that attribute in
nvptx_addr_space_from_address and nvptx_section_for_decl. I actually
made such a patch for Cesar a while ago, maybe he still has it?
This would avoid the pitfalls with gcc's middle-end address space
handling, and the #ifdef ADDR_SPACE_SHARED in patch 6 which is a bit ugly.
Bernd