[llvm-dev] How to include a opt pass in clang driver
Friedman, Eli via llvm-dev
llvm-dev at lists.llvm.org
Mon Jun 25 13:57:42 PDT 2018
On 6/25/2018 1:38 PM, Soham Sinha via llvm-dev wrote:
> Hello,
>
> I have written a pass for the IR and I can run it with opt -load
> lib/LLVMMyPass.so -mypass -myarguments -S -o output.ll < output.bc
>
> I have registered my pass with the following code:
> static RegisterPass<MyPass>
> X("mypass", "MyPass Pass (with getAnalysisUsage implemented)");
>
> How do I include the same pass in the clang driver. I tried running
> the pass:
>
> clang output.c -o output -Xclang -load -Xclang lib/LLVMMyPass.so
> -mypass -myarguments
>
> However, the pass is not being run as I cannot see output from my
> pass. What is the standard way to do it?
See RegisterStandardPasses in llvm/Transforms/IPO/PassManagerBuilder.h .
-Eli
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
More information about the llvm-dev
mailing list