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

    <tr>
        <th>Summary</th>
        <td>
            [llvm-c] `ConstantDataArray` constructors for element types other than `i8`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    We from the Crystal programming language would like to support embedding large amounts of scalar data as LLVM constants during code generation, but without having to go through the `LLVMValueRef`s, since we found that step to be relatively time-consuming. It came to our attention that arrays of `i8`s are already essentially supported via `LLVMConstStringInContext2`, but the underlying `llvm::ConstantDataArray` supports a few more data types. We would like to close this gap in the official C API:

```c
const char *LLVMGetRawDataValues(LLVMValueRef c, size_t *SizeInBytes);
LLVMValueRef LLVMConstDataArray(LLVMTypeRef ElementTy, const char *Data, size_t SizeInBytes);
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxsU02PpDYQ_TXmUpqWMU13c-DQ05NORtpI0e5q9xgVUIATYyO73B3m10eGndkPjWSJA6-q3qv3CkPQgyWqRfkoyqcMI4_O13-Q55cnummTNa5b6q8EvXcT8Ehw8UtgNDB7N3icJm0HMGiHiAPB3UXTgdH_ErCDEOfZeQaaGuq6DegHApxctBzA9RBaNOihQ0bAAB8-fPkTWmcDYwJ00aeq1nUEA1nyyNpZoS7QRIa75tFFhhFvCcUOBgc8eheHcaUqDjI1_IIm0kfqxUGGVBu0bQnuBL2LtgMekSEwzalDQ-DJIOsbmQVYT_SQ6MQkcwfPDC1OqzYXPSAz2cRo64He47KqEgepT2kcoCdA4wm7BSiEBEdjltfVUAc3ja9EL0n4J06an-3FWab_WImDfBWcNEXbkTdLEiwO0pjbJIqzKM6Xb0t7QsZzIiIO8nVKAISe7jA5T9uqeZkp7ODrr461xgUCHnWAAWfQdp3p-l63Gg1c4PzXc5on13eQ22uFPK-mQTuiB6HOSc3vxB_xnvisBgShTj-6Ae3mxQv9zankk36hZ_u4cEJWongU8vwT_m1D3yVuHT8v8wr4zdBElj8vqfHPfFLJD-Pem_WmJuvqoquKCjOq8-NeVupU5UU21qeyqprmeFRK5mV_JDwe2_bUqk5KqcpCZrpWUpWykCovVV4Wu1x1iKec9lXRHJp9LvaSJtRml3zbOT9kOoRIda6qfVFlBhsyYb1FpSzdYf0rlEqn6etU9NDEIYi9NDpw-N6GNZv1iFdMK8qnlI53M7EuxseWnQ_QOw-0rW3LBDgeyac827cUZ9GbemSeQ7JeXYW6DprH2OxaNwl1XUO4fR5m7_6hloW6rtyDUNdv4m61-j8AAP__doh76Q">