[HLSL] Generate buffer subscript operators
authorChris Bieneman <chris.bieneman@me.com>
Fri, 2 Sep 2022 19:32:24 +0000 (14:32 -0500)
committerChris Bieneman <chris.bieneman@me.com>
Fri, 2 Sep 2022 19:55:43 +0000 (14:55 -0500)
commit00ecacca7d90f96a1d54bc3fa38986fdd64e4c72
tree8ca26c5329c3aa409e111e351d1465b7d74d2c00
parent055721ff75dd2bf786df34101de4260815104279
[HLSL] Generate buffer subscript operators

In HLSL buffer types support array subscripting syntax for loads and
stores. This change fleshes out the subscript operators to become array
accesses on the underlying handle pointer. This will allow LLVM
optimization passes to optimize resource accesses the same way any other
memory access would be optimized.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D131268
clang/lib/Sema/HLSLExternalSemaSource.cpp
clang/lib/Sema/SemaType.cpp
clang/test/AST/HLSL/RWBuffer-AST.hlsl
clang/test/CodeGenHLSL/buffer-array-operator.hlsl [new file with mode: 0644]