[cfe-dev] Questions on adding a CLANG builtin to connect to a LLVM intrinsic

David Mallasén Quintana via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 18 03:34:36 PST 2022


Hello,

I have added new instructions to the RISC-V LLVM backend for some
specific hardware I developed and I want to access a sequence of them
directly from C code. As of now I do this using inline assembly but it
can be a bit cumbersome. If I'm not mistaken the way to go would be to
access this functionality from C with CLANG builtins and lowering this
to machine code with LLVM intrinsics that generate my target RISC-V
instructions.

I have seen the documentation on how to add LLVM intrinsics. However,
I can't find something similar with CLANG builtins, so any pointers to
some documentation would be greatly appreciated. Also, if there is a
better way of achieving this I would be grateful for some information
on how it could be done.

Best regards,
David


More information about the cfe-dev mailing list