How can I get cargo to emit LLVM-IR instead of a binary for my project? I know that you can use the --emit=llvm-ir
flag in rustc
, but I've read some Github issues that show it's impossible to pass arbitrary compiler flags to cargo.
Is there any way I can get cargo to emit LLVM-IR directly?
rustc uses LLVM to generate code. LLVM can generate very fast code, but it comes at a cost. LLVM is a very big system. In fact, LLVM code makes up the majority of the Rust codebase.
There is cargo rustc
to pass arbitrary compiler flags through Cargo to rustc
. So I think:
cargo rustc -- --emit=llvm-ir
is what you want!
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