[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
Wed Dec 10 12:18:11 PST 2025


================
@@ -1265,6 +1259,14 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
 void EmitAssemblyHelper::RunCodegenPipeline(
     BackendAction Action, std::unique_ptr<raw_pwrite_stream> &OS,
     std::unique_ptr<llvm::ToolOutputFile> &DwoOS) {
+  // Invoke pre-codegen callback from plugin, which might want to take over the
+  // entire code generation itself.
+  for (auto &Plugin : Plugins) {
+    CodeGenFileType CGFT = getCodeGenFileType(Action);
----------------
weliveindetail wrote:

Assertion inside fails for a EmitLL action, happens with `-flto`. There is no test for clang. It would be very easy with https://discourse.llvm.org/t/rfc-a-reference-pass-plugin-in-llvm/89073/12 ;-)

https://github.com/llvm/llvm-project/pull/170846


More information about the llvm-branch-commits mailing list