How to apply LLVM pass written in C++ to Rust source code?


With clang, C/C++ source code can be optimized with LLVM pass library (say with -Xclang flag.

What is the counterpart of -Xclang from Rust?

Is there any idiomatic way to apply LLVM passes to Rust source code?

And I am also curious whether there is any crates that allows developers to write their own LLVM pass in Rust.