[llvm-branch-commits] [RFC][Clang] Allow plugins to hook into back-end (PR #165257)

Alexis Engelke via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Oct 27 07:50:35 PDT 2025


aengelke wrote:

> do you use a plugin to swap clang's CodeGen

We swap LLVM's CodeGen (the machine code generation part), but want to keep Clang's CodeGen (the part that generates LLVM IR and optimizes that). We want the front-end and middle-end optimizations to behave as usual and only replace the back-end with out own back-end.

> why the standard plugin system does not work well there?

The standard front-end plugins permit replacing, e.g., the CodeGenAction with something else. But we do want Clang's CodeGen to work normally. CodeGenAction and emitBackendOutput are very inflexible; adding a custom back-end through a PluginASTAction would essentially require us to copy large parts of CodeGenAction.cpp and BackendUtil.cpp, which is not maintainable.

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


More information about the llvm-branch-commits mailing list