<div dir="ltr">Hello Min-Yih, Arthur.<div><br></div><div>Thank you for the infos.</div><div>The context was that I wanted to run a special pass at the beginning/end of passes whenever a user is running opt with one's custom arguments.</div><div>I was curious whether there is a way to do this without using a wrapper script that introduces the special pass's name to -passes=".." options somehow.</div><div><br></div><div>It seems the register callback functions are invoked only when a default pipeline like default<O2> is used, not when a pass like -passes='simplify-cfg<switch-to-lookup>' is given, as Arthur described.</div><div>Since the special pass should run regardless of whether the pass is default or not, I'll turn to manually giving the pass name and find out.</div><div><br></div><div>Thanks,</div><div>Juneyoung </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Dec 4, 2020 at 4:26 PM Arthur Eubanks <<a href="mailto:aeubanks@google.com">aeubanks@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">There are various opt options [1] that let you specify passes to add at specific points in the pipeline. Also, specifying a target may cause the corresponding TargetMachine to register pass callbacks.<div>Something like "-passes=default<O2>" that creates a full pipeline will add those passes to the pipeline. Otherwise they aren't invoked.<br><div><br></div><div>[1]: <a href="https://github.com/llvm/llvm-project/blob/f5f1a5c2448e31f3c7e6f85b378372a02f8d3e43/llvm/tools/opt/NewPMDriver.cpp#L73" target="_blank">https://github.com/llvm/llvm-project/blob/f5f1a5c2448e31f3c7e6f85b378372a02f8d3e43/llvm/tools/opt/NewPMDriver.cpp#L73</a></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 3, 2020 at 8:29 PM Juneyoung Lee via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello all,<div><br></div><div>Can I register passes at the beginning/end of opt passes (new pass manager)?<br></div><div><br></div><div>I found that registerPipelineStartEPCallback/registerOptimizerLastEPCallback work successfully for clang, but they don't fire when opt -passes="" is used.</div><div><br></div><div>Thanks,</div><div>Juneyoung</div><div><br></div></div></div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><br></div><font size="1">Juneyoung Lee</font><div><font size="1">Software Foundation Lab, Seoul National University</font></div></div></div>