[HLSL] Allow __builtin_hlsl_resource_getpointer to take no indices (#195151)
In preperation for adding ConstnatBuffer<T>, we will need to be able to
access the base pointer for the data constat buffer resource handle is
pointingto
to. This is done by:
1. Making the index operand in __builtin_hlsl_resource_getpointer
optional.
2. Modifing the codegen for __builtin_hlsl_resource_getpointer to emit a
call to resource.getbasepointer when no index is provided.
3. Add the resource.getbasepointer for the dx and spv targets.
Another issue is that the address space for the pointer returned by
__builtin_hlsl_resource_getpointer is not always hlsl_device any more.
Changes are made to get the correct address space based on the resource
class of the handle.
Note that we cannot implement codegen for
__builtin_hlsl_resource_getpointer directly. The tests for the codegen
changes will be in a follow up PR that add ConstnatBuffer<T>.
Assisted-by: Gemini
<!-- branch-stack-start -->
-------------------------
- main
- https://github.com/llvm/llvm-project/pull/195151 :point_left:
- https://github.com/llvm/llvm-project/pull/195152
- https://github.com/llvm/llvm-project/pull/195153
- https://github.com/llvm/llvm-project/pull/195154
<sup>[Stack](https://www.git-town.com/how-to/proposal-breadcrumb.html)
generated by [Git Town](https://github.com/git-town/git-town)</sup>
<!-- branch-stack-end -->