C compilers allows to embed assembly code in a C program.
I am pretty sure that Clang should allow embedding LLVM assembly or intrinsic code in C program. How can I embed LLVM assembly in C code?
Right now you can't.
You can, however, write an LLVM assembly function separately in its own file, mark it as alwaysinline
, then compile it with the rest of your files - this should get you the same result. See this related question on how to first compile your C files to IR and then link them together.
You can even compile the files separately and make sure you perform link-time optimization (LTO), should do the same thing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With