[PATCH] D102136: [NewPM] Add C bindings for new pass manager

Mats Larsen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun May 9 14:46:59 PDT 2021


supergrecko added a comment.

> I think you can build `PassBuilder` with an uninitialized `PassInstrumentationCallbacks` object and retrieve it via `PassBuilder::getPassInstrumentationCallbacks` before populating it with `StandardInstrumentation` when FunctionAnalysisManager is available (getPassInstrumentationCallbacks is marked const but the returned pointer is not so I'm not complaining :-P. Plus, the comment for getPassInstrumentationCallbacks also hints this usage).

That sounds like the solution I was looking for. Excellent, thank you!

> Also I'm wondering what about other methods in `PassBuilder`? For instance those "buildXXXPipeline" methods. Do you have any plan/roadmap for adding them? (I'm not saying you should add all of them in a single patch but just curious :-) Since I actually use those methods more often than parsePassPipeline)

I believe the initial plan was to provide an interface to the parserPassPipeline bits of the PassBuilder so I haven't thought too much about it. That's definitely something we could do, in which case I think we could just return a ModulePassManager from the (currently named) LLVMRunPassBuilder function. Arthur and I discussed separating the PassBuilder and ModulePassManager APIs and this seems like a good reason to do that.



================
Comment at: llvm/lib/Passes/PassBuilderBindings.cpp:39
+
+LLVMErrorRef LLVMRunPassBuilder(LLVMPassBuilderRef PB, LLVMModuleRef M,
+                                LLVMBool Debug, LLVMBool VerifyEach,
----------------
myhsu wrote:
> I feel this name is a little bit mis-leading since you're only calling `parsePassPipeline` here, which is not the only features provided by PassBuilder
Yeah, I'm sure there are better names than LLVMRunPassBuilder. I named it LLVMRunPassBuilder because it ends up running the PM, but a name like LLVMParsePassPipeline seems like a better fit. It would also make sense to name it something along those lines if we separate the ModulePassManager API out of this function.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102136



More information about the llvm-commits mailing list