[llvm] [CodeGen] Expose the extensibility of PassConfig to plugins (PR #139059)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 26 05:54:49 PDT 2025


================
@@ -119,6 +125,9 @@ class TargetMachine {
   std::optional<PGOOptions> PGOOption;
 
 public:
+  static ManagedStatic<SmallVector<PassConfigCallback, 1>>
+      TargetPassConfigCallbacks;
----------------
Tcc100 wrote:

Legacy plugins have to register themselves from within their constructor. At this point, the TargetMachine object is not available to the plugin as it is only created later as part of the build pipeline.

I'd also prefer a non-static solution but, unfortunately, I don't think this is possible. Please correct me if I missed anything to implement this.

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


More information about the llvm-commits mailing list