diff --git a/mlir/include/mlir/IR/Action.h b/mlir/include/mlir/IR/Action.h --- a/mlir/include/mlir/IR/Action.h +++ b/mlir/include/mlir/IR/Action.h @@ -57,6 +57,14 @@ os << "Action \"" << getTag() << "\""; } + /// Return whether this action can be skipped by the action manager without + /// breaking the compiler. We assume that the majority of actions are in + /// this category, for the others (like lowering passes), the derived classes + /// can override. + virtual bool canBeSkipped() const { + return true; + } + protected: Action(TypeID actionID) : actionID(actionID) {} @@ -203,6 +211,7 @@ /// CRTP Implementation of an action. This class provides a base class for /// implementing specific actions. +/// /// Derived classes are expected to provide the following: /// * static constexpr StringLiteral tag = "..."; /// - This method returns a unique string identifier, similar to a command @@ -210,6 +219,7 @@ template class ActionImpl : public Action { public: + ActionImpl() : Action(TypeID::get()) {} /// Provide classof to allow casting between action types.