<div dir="ltr">Hi Eli,<div><br></div><div>I have tried that:</div><div><br></div><div><div>static void registerMyPass(const PassManagerBuilder &,</div><div> llvm::legacy::PassManagerBase &PM) {</div><div> PM.add(new MyPass());</div><div>}</div><div><br></div><div>static RegisterStandardPasses</div><div> RegisterMyPass(PassManagerBuilder::EP_OptimizerLast,</div><div> registerMyPass);</div></div><div><br></div><div>It still couldn't find my pass.</div><div><br></div><div><br clear="all"><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Regards,<div>Soham Sinha</div><div>PhD Student, Department of Computer Science</div><div>Boston University</div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jun 25, 2018 at 3:58 PM Friedman, Eli <<a href="mailto:efriedma@codeaurora.org">efriedma@codeaurora.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 6/25/2018 1:38 PM, Soham Sinha via llvm-dev wrote:<br>
> Hello,<br>
><br>
> I have written a pass for the IR and I can run it with opt -load <br>
> lib/LLVMMyPass.so -mypass -myarguments -S -o output.ll < output.bc<br>
><br>
> I have registered my pass with the following code:<br>
> static RegisterPass<MyPass><br>
> X("mypass", "MyPass Pass (with getAnalysisUsage implemented)");<br>
><br>
> How do I include the same pass in the clang driver. I tried running <br>
> the pass:<br>
><br>
> clang output.c -o output -Xclang -load -Xclang lib/LLVMMyPass.so <br>
> -mypass -myarguments<br>
><br>
> However, the pass is not being run as I cannot see output from my <br>
> pass. What is the standard way to do it?<br>
<br>
See RegisterStandardPasses in llvm/Transforms/IPO/PassManagerBuilder.h .<br>
<br>
-Eli<br>
<br>
-- <br>
Employee of Qualcomm Innovation Center, Inc.<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project<br>
<br>
</blockquote></div>