Rustc has one compiling option
-C passes=val where we could add extra LLVM passes to run. So I am trying to add my own llvm pass into Rustc.
When I add my pass via this option:
RUSTFLAGS="-C passes=my-pass" cargo build
Compiler reports errors:
error: failed to run LLVM passes: unknown pass name 'my-pass'
In clang we have
-Xclang -load -Xclang path/to/plugin.so. So I try to load my pass via
-C llvm-args=-fpass-plugin=/opt/new-pass/mypass.so -C passes=my-pass in the
clang way. It reports:
rustc -Cllvm-args="..." with: Unknown command line argument '-fpass-plugin=/opt/new-pass/mypass.so'. Also tried to replace
-fpass-plugin with other options like
-load-pass-plugin, but they still cannot be recognized by rustc.
Is there a way to add our custom pass into rustc?