[llvm-branch-commits] [clang] [llvm] [RFC][LLVM][Clang] Add LLVM plugin hook for back-ends (PR #170846)
Stefan Gränitz via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Dec 8 02:49:21 PST 2025
================
@@ -49,7 +53,14 @@ struct PassPluginLibraryInfo {
/// The callback for registering plugin passes with a \c PassBuilder
/// instance
- void (*RegisterPassBuilderCallbacks)(PassBuilder &);
+ void (*RegisterPassBuilderCallbacks)(PassBuilder &) = nullptr;
+
+ /// Callback called before running the back-end passes on the module. The
+ /// callback can generate code itself by writing the expected output to OS and
+ /// returning true to prevent the default pipeline and further plugin
+ /// callbacks from running.
+ bool (*PreCodeGenCallback)(Module &, TargetMachine &, CodeGenFileType,
----------------
weliveindetail wrote:
I like the idea to have pre/post opt/codegen callbacks. If we ever get the new pass manager in the Codegen pipeline, that would help plugins to handle the pipeline change. Could we generalize this into something like `registerPipelinePhaseCallbacks()`?
https://github.com/llvm/llvm-project/pull/170846
More information about the llvm-branch-commits
mailing list