<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/91406>91406</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[DirectX] Introduce llvm.dx.handle.fromHeap intrinsic and lowering
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:DirectX
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
bogner
</td>
</tr>
</table>
<pre>
When creating handles for dynamic resources in llvm we'll represent it with a `llvm.dx.handle.fromHeap` intrinsic that creates a target type. There's more information in #90553 but generally this will look something like so:
```llvm
; RWStructuredBuffer<float4> Buf = ResourceDescriptorHeap[2];
%buf = call target("dx.Buffer", <4 x f32>, 1, 0)
@llvm.dx.handle.fromHeap.tdx.Buffer_v4f32_1_0(
i32 2, i1 false)
```
This will need to be lowered to `createHandleFromHeap` + `annotateHandle` dxil operations.
## Acceptance Criteria
- The llvm intrinsic and dxil operation are defined
- Emitting dxil will translate the llvm intrinsic to the appropriate dxil ops.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VMFupDgQ_RpzKQWBDd3NgUM6ndbsdXak2Vtk7AK8MTYqF5Pk71dAJ5Od3Wm1jLCrXvm9eoVOyQ0BsRX1WdSXTC88Rmq7OASkrIv2rf0-YgBDqNmFAUYdrMcEfSSwb0FPzgBhigsZTOACeP9jghcU8ug9EM6ECQODY3hxPIIGcSjWmNy-5jtY3lOcvqCexaEAF5hcSM4Aj5r3uphAA2sakIHfZszh24i0lkgwRUJwoY80aXYxrFcQUjVFXSvoFoYBA5L2_g14dAlenPfgY3yGFCfkceXk3TNCikLdi-Iiivf1UOz_9ba3LXWGr9__ZFoML4T2vPQ9klAPvY-aK6Ee4bz0INQFvt40uWAy5GaOtDGsz1LUF6HON0BZd7cEo72_kRTyJKS0r_kNX0ohH0CohwpeoVdSqMd1o1yXQshmx4JPP1H9TuOcP3CfflS9kk_lU7EW3DGckrBVcyX02if8gP-Q47NG3z4kDYgWOEKH4OML0v4mDsXewS_bLa6fGi3keT3WIUT-CFgP7KvzEGekrZ8p_1dPpBJSwb0xOLMOBuGBHCM5vZ_frc7YLfjTSDrYX0BBE4LF3gW074mPk-PN4VvoxolJh-Q1I_B_UTluu3qeKc7k1qhbkZRntlW2UY3OsC2PZV2Wp7JosrHt6-pQVv0RDSqJqjemLmstm-Z06g6lPGaulYWsiro4yrIqq2Ouy9409qSVOvaVPTWiKnDSzudbfyMNmUtpwbYpq-KQed2hT9swS9lp84zBCnV_cYSG_1qNVF8yatfcu24Z0uoTlzj9RGPHfvsavOfUF_gjMEW7mF2D_zHVL2JvBnBhyBby7cg8p3W05FXI6-B4XLrcxEnI6zZY--Nupvg3GhbyuvFJQl43Sv8EAAD__6PefPY">