yibo yuan
yibo yuan

Reputation: 1

How to run pass with clang

I have written a compiler pass, which needs to change IR, and I want to use it in Clang.

It works well when I use:

opt -load=/home/yyb/Desktop/test/libinsertca.so -passes=Insertca -S test.ll -o test2.ll

But when I want to use the frontend command "clang", such as

clang -Xclang -load -Xclang ...so -Xclang -passes=Insertca

or

clang -fpass-plugin=....so

it doesn't change the IR, its like there never has my pass.

What command should I use to compile a C file with my pass by Clang?

My clang version is:

clang version 20.0.0git (https://github.com/llvm/llvm-project.git f2f9cdd22171f0c54cad7c6b183857f3d856c344)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin

Upvotes: 0

Views: 67

Answers (0)

Related Questions