[PATCH] D137103: [LegacyPM] Port example pass SimplifyCFG to new PM

Sebastian Peryt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 15:48:32 PDT 2022


speryt updated this revision to Diff 473046.
speryt added a comment.

Addressed (hopefully) all review comments.
I tried to understand how the naming schemas should work for registering new pass plugin, but there is a chance I might have missed something or misunderstood.
Bottom-line question is, what should I change, so I can call this pass with flags `-tut-simplifycfg -tut-simplifycfg-version=XX`?

My best guess is that I might be missing one extra registration step. I added `-DLLVM_INCLUDE_EXAMPLES=ON` to cmake which resulted in `-- Registering SimplifyCFG as a pass plugin (static build: OFF)` which indicates that I should somehow register plugin with PassBuilder as dynamically linked. As described here:

> // Load plugin dynamically.
> auto Plugin = PassPlugin::Load(PathToPlugin);
> if (!Plugin)
> report_error();
> // Register plugin extensions in PassBuilder.
> Plugin.registerPassBuilderCallbacks(PB);

But from documentation and look at sources it is unclear how/where exactly it should be done. I'll appreciate any pointers.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137103/new/

https://reviews.llvm.org/D137103

Files:
  llvm/examples/IRTransforms/CMakeLists.txt
  llvm/examples/IRTransforms/InitializePasses.cpp
  llvm/examples/IRTransforms/InitializePasses.h
  llvm/examples/IRTransforms/SimplifyCFG.cpp
  llvm/examples/IRTransforms/SimplifyCFG.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137103.473046.patch
Type: text/x-patch
Size: 7556 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221103/ba905f85/attachment.bin>


More information about the llvm-commits mailing list