[llvm-branch-commits] [Clang] Optionally use NewPM to run CodeGen Pipeline (PR #191579)
Eli Friedman via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Jun 24 15:48:44 PDT 2026
================
@@ -1281,6 +1285,73 @@ void EmitAssemblyHelper::RunCodegenPipeline(
}
}
+void EmitAssemblyHelper::RunCodegenPipelineNewPM(
+ BackendAction Action, std::unique_ptr<raw_pwrite_stream> &OS,
+ std::unique_ptr<llvm::ToolOutputFile> &DwoOS) {
+ if (!actionRequiresCodeGen(Action))
+ return;
+
+ // Normal mode, emit a .s or .o file by running the code generator. Note,
+ // this also adds codegenerator level optimization passes.
+ CodeGenFileType CGFT = getCodeGenFileType(Action);
+
+ // Invoke pre-codegen callback from plugin, which might want to take over the
+ // entire code generation itself.
+ for (const std::unique_ptr<llvm::PassPlugin> &Plugin : CI.getPassPlugins()) {
+ if (Plugin->invokePreCodeGenCallback(*TheModule, *TM, CGFT, *OS))
+ return;
----------------
efriedma-quic wrote:
Please refactor to share the common code. (It might be hard to share everything, but most of it should be easy.)
https://github.com/llvm/llvm-project/pull/191579
More information about the llvm-branch-commits
mailing list