0

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
5
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Oct 10, 2024 at 18:22
  • Welcome to StackOverflow! Please take the tour to learn how this site works and read "How to Ask". Then come back and edit your question to enhance it. Commented Oct 12, 2024 at 6:09
  • I have formatted and reworded your question in the hope it shows your issue a bit clearer. Please check it and correct, if necessary. Commented Oct 12, 2024 at 6:09
  • Please extent the example command lines that do not work to the complete form. Commented Oct 12, 2024 at 6:10
  • You tried -Xclang -load -Xclang ...so (does not work). Have you tried -Xclang -load=...so? Commented Oct 12, 2024 at 6:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.