[clang] [llvm] [RISC-V] Add CSR read/write builtins (PR #85091)

Nemanja Ivanovic via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 07:51:21 PDT 2024


nemanjai wrote:

Individual implementations will provide different sets of CSR's and need a way to read/write them. Of course, this can be done with inline asm, but doing such things with inline asm has its limitations (no error checking, if a user attempts to wrap the asm in a function, they won't be able to build code that calls those functions with -O0 as inlining/constant propagation is required, etc.).

Providing builtins to do this allows the compiler to do range checking and ensure CSR # is a literal.

https://github.com/llvm/llvm-project/pull/85091


More information about the llvm-commits mailing list