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

Stefan Gränitz via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 30 11:03:14 PDT 2025


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

Well, sounds reasonable, but I am still skeptic about the current implementation. I don't see `ManagedStatic` members LLVM header files anywhere.

Why not do this?
* add another static function like `invokeTargetPassConfigCallbacks([...])`
* move both declarations somewhere closer to `parseBinutilsVersion()` (which is static too)
* implement both functions in `TargetMachine.cpp` and define the vector there as well in global scope

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


More information about the llvm-commits mailing list