================
@@ -82,6 +83,44 @@ class LLVM_ABI OptBisect : public OptPassGate {
   int LastBisectNum = 0;
 };
 
+/// This class implements a mechanism to disable passes and individual
+/// optimizations at compile time based on a command line option
+/// (-opt-disable) in order to study how single transformations, or
+/// combinations thereof, affect the IR.
+class LLVM_ABI OptDisable : public OptPassGate {
+public:
+  /// Default constructor. Initializes the state to empty set. The disabling
+  /// will be enabled by the cl::opt call-back when the command line option
+  /// is processed.
+  /// Clients should not instantiate this class directly.  All access should go
+  /// through LLVMContext.
+  OptDisable() = default;
+
+  virtual ~OptDisable() = default;
+
+  /// Checks the pass name to determine if the specified pass should run.
+  ///
+  /// The method prints the name of the pass, and whether or not the pass
+  /// will be executed. It returns true if the pass should run, i.e. if
+  /// its name is was not provided via command line.
+  ///
+  /// Most passes should not call this routine directly. Instead, it is called
+  /// through helper routines provided by the base classes of the pass. For
+  /// instance, function passes should call FunctionPass::skipFunction().
+  bool shouldRunPass(const StringRef PassName,
+                     StringRef IRDescription) override;
+
+  /// Parses the command line argument to extract the names of the passes
+  /// to be disabled. Multiple pass names can be provided with comma 
separation.
+  void setDisabled(StringRef Passes);
----------------
mtrofin wrote:

I think that if you model the command line flag as `cl::list`, this part of the 
API may be simpler, ptal.

https://github.com/llvm/llvm-project/pull/145059
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to