<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/126584>126584</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [HLSL] Generate Root Signature Descriptor Table Metadata from AST
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            HLSL
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
            inbelic
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          inbelic
      </td>
    </tr>
</table>

<pre>
    This issue handles the generation of root signature LLVM IR metadata from the parsed AST. Specifically, we will handle this for the `DescriptorTable` and `DescriptorTableClause`.

We will again follow the representation of a list of "root elements" following the defined [metadata representation](https://github.com/llvm/wg-hlsl/blob/main/proposals/0002-root-signature-in-clang.md#metadata-schema).

AC:
- [ ] Define `CGHLSLRuntime::addRootSignature` in `CGRuntime.h`
- [ ] Implement `CGHLSLRuntime::addRootSignature` in `CGRuntime.cpp`
- [ ] Implement metadata generation for `DescriptorTable` and `DescriptorTableClause` in `HLSLRootSignatures.[h|cpp]`
- [ ] Add usage of `addRootSignature` to `emitEntryFunction` in `CGRuntime.cpp`
- [ ] Add tests of generated metadata using `emit-llvm` in `CodeGenHLSL/RootSignatures.hlsl`
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykVM2OpDYQfhpzsUCmGOjmwIHpDpOVZi_To-RscAGOjI1ss615-8getntnNVGi7KlbuOr7KX8u7pycNGJDykcCIHWPSg4EgJTnhG9-NrbZPya9EW_N6ywdlc5tSGeuhUJH_Yx0Qo2We2k0NSO1xngagLnfLNLn5z--0i8vdEHPBfecjtYssW3l1qGg7eU1o5cVBznKgSv1RuBEr0ivUqmdhvpAPBob-0jFzugGK1dv7CvvFZKKUa7FJycnxTcXzjPCWsLaP3dcPnGp6WiUMtcIanG16FD7mw9OlXQ-_CMA0RQqXFB7RwD2Vqmn2C1wlBoFJeXjzedHRFKeCRxn71dHipZAR6CbpJ-3PhvMQqBT6lv4uU7prJwi0PXK9AS6hUtNoFutWY3jyhHoGGOQBkXpbcyp1OmguJ6yRRAovotI3TDjwgnUu__2FNhZmwaplJRneo7Sw-hOT78_X55fNu3lgqGsaLkQL8b4y3eaMGip34v3wmwmFfuA-GVZ3wf1C6DDuv4z7G3EPwQvhON_BWOnjip_VOUyUj7O5HAKUsrzz2paIejm-IQxIBX7zJQ34QQX6X_T3r51mx5iFP6b38Dg0XkXGHanKO7mNxfStxOkMT53YCPwCXUwRaD7yVfMV8US0RSiLmqeYJMfihryCiBP5kZUeXGoqh6wRi76YRhYUeR1DwyOx2N_TGQDDEoGOcvr4sDybBzrqn8YD3lV44H1B_LAcOFSZUFVZuyUxKXR5FCVx4dE8R6V27fOu8a4cmwT6tN-mxx5YOH1uTuCl17FTRUbyjN92kdCgz1680fvF03jTdOvHzZPe3lNNquaf3-KUcxqzV84eAJdtBCe3-7iWwN_BwAA__8j2rZR">