[llvm] [NewPM][CodeGen] add TargetPassConfig like API (PR #70906)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 8 22:41:57 PST 2024


================
@@ -155,12 +198,17 @@ template <typename DerivedT> class CodeGenPassBuilder {
   }
 
   PassInstrumentationCallbacks *getPassInstrumentationCallbacks() const {
-    return PIC;
+    static PassInstrumentationCallbacks PseudoPIC;
+    return PIC ? PIC : &PseudoPIC;
   }
 
-protected:
-  template <typename PassT> using has_key_t = decltype(PassT::Key);
+  /// Allow the target to disable a specific standard pass by default.
+  template <typename PassT> void disablePass() {
+    getPassInstrumentationCallbacks()->registerShouldRunOptionalPassCallback(
+        [](StringRef P, Any IR) { return P != PassT::name(); });
----------------
paperchalice wrote:

Will refactor related code if #70912 is merged.

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


More information about the llvm-commits mailing list