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

    <tr>
        <th>Summary</th>
        <td>
            RISC-V backend does not support PreserveMost calling convention
        </td>
    </tr>

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

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

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

<pre>
    The RISC-V backend currently does **not support** the `PreserveMost` calling convention. Attempting to compile code that uses it results in a fatal backend error:

```

fatal error: error in backend: Unsupported calling convention

```

**Minimal example (on Compiler Explorer):**  
https://godbolt.org/z/h7e5WT7eM

---

### Questions

- Should the RISC-V backend **implement support** for `PreserveMost`, similar to backends like x86, ARM, and AArch64?
- Or should the frontend or mid-end **automatically lower** unsupported calling conventions like `PreserveMost` to a more compatible one, such as `C`?

---

It would be helpful to clarify whether this is a planned feature, or if `PreserveMost` should be explicitly avoided on RISC-V targets.

Thanks!
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8lE9v6zYMwD-NfCESOHL8pwcfsmwG3qHY9l63nmWLjrXKkiFRabtPP0h21yIIHiBANiWSP_4RhffqYhBbVv7Cyl8zEWiyrj0L9YzKCZP1Vr63TxPC928_zru_oRfDCxoJQ3AODel3kBY9MH5i_GQsgQ_LYh2tAqAJgVX5Hw49uis-Wk-symEQWitzgcGaKxpS1uzhRITzQlFMFgY7L0ojDFYi0CQIgkcPisChD5o8KAMCRkFC_w-FzlnHihPL06rybaXf9erHlfUjGtmUo-wvs9GjvIN41-oa56Myao7W38S8aATGG2vgvMbg4Le3RVuHjvGHSLemBlh-mogWn0Qd493Fyt5q2lt3Ybz7l_FuqrF8fqrxcXW22-0-vBbrgj8D-gjntxvwY7JBy5T4m5KtflUEnNHcVmq07k6lGD-DV7PSwsWqbKY8aPWC8NZU8fz0_TFuwkg4ndwwVUdWdInldwf-E2d01lAEsQ5mJXefTCKQnQWpmPN30PY1pipRhZ9WZOO402BkQcBsHaZGEqR6jWANpnjCMIHwUe0cQ0ywX7P7jeA1UfcIE-plDDq1pBZOje_wOiFN6IAm5UF5ELBoYQxKGFFQcMlJ7K3xHtmWkB4B3xatBhXfkLhaJVGCNR9FI-EuSH6_Ej1Nwrx4xg9fGzCTbSEfigeRYXuoS845z49FNrVN3pTNUMh65H1V17LI-6E45r14aMqDqKpMtTznZV4fDnkTdfZS9uXx0IyiLiXWVcmOOc5C6b3W1zn2Y6a8D9gejs3hWGVa9Kh9mhmcG3yFdMo4jyPEtVFp14eLZ8dcK0_-0wwp0tjeNGaaIF9mB3zN2Z2yZ8Hp9ubpKJpCvx_szHgXvW3bbnH2HxyI8S4xesa7LYhry_8LAAD__0TKnNU">