/* Autogenerated by mlir-tblgen; don't manually edit */

#ifdef GEN_PASS_DECL
// Generate declarations for all passes.
#define GEN_PASS_DECL_PARTITION
#define GEN_PASS_DECL_SHARDSIMPLIFY
#define GEN_PASS_DECL_SHARDINGPROPAGATION
#undef GEN_PASS_DECL
#endif // GEN_PASS_DECL

//===----------------------------------------------------------------------===//
// Partition
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_PARTITION
std::unique_ptr<::mlir::Pass> createPartition();
#undef GEN_PASS_DECL_PARTITION
#endif // GEN_PASS_DECL_PARTITION
#ifdef GEN_PASS_DEF_PARTITION

namespace impl {
  std::unique_ptr<::mlir::Pass> createPartition();
} // namespace impl
namespace impl {

template <typename DerivedT>
class PartitionBase : public ::mlir::InterfacePass<mlir::FunctionOpInterface> {
public:
  using Base = PartitionBase;

  PartitionBase() : ::mlir::InterfacePass<mlir::FunctionOpInterface>(::mlir::TypeID::get<DerivedT>()) {}
  PartitionBase(const PartitionBase &other) : ::mlir::InterfacePass<mlir::FunctionOpInterface>(other) {}
  PartitionBase& operator=(const PartitionBase &) = delete;
  PartitionBase(PartitionBase &&) = delete;
  PartitionBase& operator=(PartitionBase &&) = delete;
  ~PartitionBase() = default;

  /// Returns the command-line argument attached to this pass.
  static constexpr ::llvm::StringLiteral getArgumentName() {
    return ::llvm::StringLiteral("shard-partition");
  }
  ::llvm::StringRef getArgument() const override { return "shard-partition"; }

  ::llvm::StringRef getDescription() const override { return R"PD(Partition a function into SPMD form.)PD"; }

  /// Returns the derived pass name.
  static constexpr ::llvm::StringLiteral getPassName() {
    return ::llvm::StringLiteral("Partition");
  }
  ::llvm::StringRef getName() const override { return "Partition"; }

  /// Support isa/dyn_cast functionality for the derived pass class.
  static bool classof(const ::mlir::Pass *pass) {
    return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
  }

  /// A clone method to create a copy of this pass.
  std::unique_ptr<::mlir::Pass> clonePass() const override {
    return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
  }

  /// Return the dialect that must be loaded in the context before this pass.
  void getDependentDialects(::mlir::DialectRegistry &registry) const override {
    registry.insert<shard::ShardDialect>();
  }

  /// Explicitly declare the TypeID for this class. We declare an explicit private
  /// instantiation because Pass classes should only be visible by the current
  /// library.
  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PartitionBase<DerivedT>)

protected:
private:

  friend std::unique_ptr<::mlir::Pass> createPartition() {
    return std::make_unique<DerivedT>();
  }
};
} // namespace impl

std::unique_ptr<::mlir::Pass> createPartition() {
  return impl::createPartition();
}
#undef GEN_PASS_DEF_PARTITION
#endif // GEN_PASS_DEF_PARTITION

//===----------------------------------------------------------------------===//
// ShardSimplify
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_SHARDSIMPLIFY
std::unique_ptr<::mlir::Pass> createShardSimplify();
#undef GEN_PASS_DECL_SHARDSIMPLIFY
#endif // GEN_PASS_DECL_SHARDSIMPLIFY
#ifdef GEN_PASS_DEF_SHARDSIMPLIFY

namespace impl {
  std::unique_ptr<::mlir::Pass> createShardSimplify();
} // namespace impl
namespace impl {

template <typename DerivedT>
class ShardSimplifyBase : public ::mlir::OperationPass<> {
public:
  using Base = ShardSimplifyBase;

  ShardSimplifyBase() : ::mlir::OperationPass<>(::mlir::TypeID::get<DerivedT>()) {}
  ShardSimplifyBase(const ShardSimplifyBase &other) : ::mlir::OperationPass<>(other) {}
  ShardSimplifyBase& operator=(const ShardSimplifyBase &) = delete;
  ShardSimplifyBase(ShardSimplifyBase &&) = delete;
  ShardSimplifyBase& operator=(ShardSimplifyBase &&) = delete;
  ~ShardSimplifyBase() = default;

  /// Returns the command-line argument attached to this pass.
  static constexpr ::llvm::StringLiteral getArgumentName() {
    return ::llvm::StringLiteral("shard-simplify");
  }
  ::llvm::StringRef getArgument() const override { return "shard-simplify"; }

  ::llvm::StringRef getDescription() const override { return R"PD(Shard simplify patterns.)PD"; }

  /// Returns the derived pass name.
  static constexpr ::llvm::StringLiteral getPassName() {
    return ::llvm::StringLiteral("ShardSimplify");
  }
  ::llvm::StringRef getName() const override { return "ShardSimplify"; }

  /// Support isa/dyn_cast functionality for the derived pass class.
  static bool classof(const ::mlir::Pass *pass) {
    return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
  }

  /// A clone method to create a copy of this pass.
  std::unique_ptr<::mlir::Pass> clonePass() const override {
    return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
  }

  /// Return the dialect that must be loaded in the context before this pass.
  void getDependentDialects(::mlir::DialectRegistry &registry) const override {
    registry.insert<arith::ArithDialect>();
    registry.insert<shard::ShardDialect>();
  }

  /// Explicitly declare the TypeID for this class. We declare an explicit private
  /// instantiation because Pass classes should only be visible by the current
  /// library.
  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ShardSimplifyBase<DerivedT>)

protected:
private:

  friend std::unique_ptr<::mlir::Pass> createShardSimplify() {
    return std::make_unique<DerivedT>();
  }
};
} // namespace impl

std::unique_ptr<::mlir::Pass> createShardSimplify() {
  return impl::createShardSimplify();
}
#undef GEN_PASS_DEF_SHARDSIMPLIFY
#endif // GEN_PASS_DEF_SHARDSIMPLIFY

//===----------------------------------------------------------------------===//
// ShardingPropagation
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_SHARDINGPROPAGATION
struct ShardingPropagationOptions {
  mlir::shard::TraversalOrder traversal = mlir::shard::TraversalOrder::BackwardForward;
};
std::unique_ptr<::mlir::Pass> createShardingPropagation();
std::unique_ptr<::mlir::Pass> createShardingPropagation(ShardingPropagationOptions options);
#undef GEN_PASS_DECL_SHARDINGPROPAGATION
#endif // GEN_PASS_DECL_SHARDINGPROPAGATION
#ifdef GEN_PASS_DEF_SHARDINGPROPAGATION

namespace impl {
  std::unique_ptr<::mlir::Pass> createShardingPropagation();
} // namespace impl

namespace impl {
  std::unique_ptr<::mlir::Pass> createShardingPropagation(ShardingPropagationOptions options);
} // namespace impl
namespace impl {

template <typename DerivedT>
class ShardingPropagationBase : public ::mlir::InterfacePass<mlir::FunctionOpInterface> {
public:
  using Base = ShardingPropagationBase;

  ShardingPropagationBase() : ::mlir::InterfacePass<mlir::FunctionOpInterface>(::mlir::TypeID::get<DerivedT>()) {}
  ShardingPropagationBase(const ShardingPropagationBase &other) : ::mlir::InterfacePass<mlir::FunctionOpInterface>(other) {}
  ShardingPropagationBase& operator=(const ShardingPropagationBase &) = delete;
  ShardingPropagationBase(ShardingPropagationBase &&) = delete;
  ShardingPropagationBase& operator=(ShardingPropagationBase &&) = delete;
  ~ShardingPropagationBase() = default;

  /// Returns the command-line argument attached to this pass.
  static constexpr ::llvm::StringLiteral getArgumentName() {
    return ::llvm::StringLiteral("sharding-propagation");
  }
  ::llvm::StringRef getArgument() const override { return "sharding-propagation"; }

  ::llvm::StringRef getDescription() const override { return R"PD(sharding propagation)PD"; }

  /// Returns the derived pass name.
  static constexpr ::llvm::StringLiteral getPassName() {
    return ::llvm::StringLiteral("ShardingPropagation");
  }
  ::llvm::StringRef getName() const override { return "ShardingPropagation"; }

  /// Support isa/dyn_cast functionality for the derived pass class.
  static bool classof(const ::mlir::Pass *pass) {
    return pass->getTypeID() == ::mlir::TypeID::get<DerivedT>();
  }

  /// A clone method to create a copy of this pass.
  std::unique_ptr<::mlir::Pass> clonePass() const override {
    return std::make_unique<DerivedT>(*static_cast<const DerivedT *>(this));
  }

  /// Return the dialect that must be loaded in the context before this pass.
  void getDependentDialects(::mlir::DialectRegistry &registry) const override {
    registry.insert<shard::ShardDialect>();
  }

  /// Explicitly declare the TypeID for this class. We declare an explicit private
  /// instantiation because Pass classes should only be visible by the current
  /// library.
  MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ShardingPropagationBase<DerivedT>)

  ShardingPropagationBase(ShardingPropagationOptions options) : ShardingPropagationBase() {
    traversal = std::move(options.traversal);
  }
protected:
  ::mlir::Pass::Option<mlir::shard::TraversalOrder> traversal{*this, "traversal", ::llvm::cl::desc(R"PO(Traversal order to use for sharding propagation:)PO"), ::llvm::cl::init(mlir::shard::TraversalOrder::BackwardForward), ::llvm::cl::values(
              clEnumValN(mlir::shard::TraversalOrder::Forward, "forward",
              "Forward only traversal."),
              clEnumValN(mlir::shard::TraversalOrder::Backward, "backward",
              "backward only traversal."),
              clEnumValN(mlir::shard::TraversalOrder::ForwardBackward, "forward-backward",
              "forward-backward traversal."),
              clEnumValN(mlir::shard::TraversalOrder::BackwardForward, "backward-forward",
              "backward-forward traversal.")
            )};
private:

  friend std::unique_ptr<::mlir::Pass> createShardingPropagation() {
    return std::make_unique<DerivedT>();
  }

  friend std::unique_ptr<::mlir::Pass> createShardingPropagation(ShardingPropagationOptions options) {
    return std::make_unique<DerivedT>(std::move(options));
  }
};
} // namespace impl

std::unique_ptr<::mlir::Pass> createShardingPropagation() {
  return impl::createShardingPropagation();
}

std::unique_ptr<::mlir::Pass> createShardingPropagation(ShardingPropagationOptions options) {
  return impl::createShardingPropagation(std::move(options));
}
#undef GEN_PASS_DEF_SHARDINGPROPAGATION
#endif // GEN_PASS_DEF_SHARDINGPROPAGATION
#ifdef GEN_PASS_REGISTRATION
// Generate registrations for all passes.
#define GEN_PASS_REGISTRATION_PARTITION
#define GEN_PASS_REGISTRATION_SHARDSIMPLIFY
#define GEN_PASS_REGISTRATION_SHARDINGPROPAGATION
#endif // GEN_PASS_REGISTRATION

//===----------------------------------------------------------------------===//
// Partition Registration
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_REGISTRATION_PARTITION

inline void registerPartition() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return createPartition();
  });
}

// Old registration code, kept for temporary backwards compatibility.
inline void registerPartitionPass() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return createPartition();
  });
}

#undef GEN_PASS_REGISTRATION_PARTITION
#endif // GEN_PASS_REGISTRATION_PARTITION

//===----------------------------------------------------------------------===//
// ShardSimplify Registration
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_REGISTRATION_SHARDSIMPLIFY

inline void registerShardSimplify() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return createShardSimplify();
  });
}

// Old registration code, kept for temporary backwards compatibility.
inline void registerShardSimplifyPass() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return createShardSimplify();
  });
}

#undef GEN_PASS_REGISTRATION_SHARDSIMPLIFY
#endif // GEN_PASS_REGISTRATION_SHARDSIMPLIFY

//===----------------------------------------------------------------------===//
// ShardingPropagation Registration
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_REGISTRATION_SHARDINGPROPAGATION

inline void registerShardingPropagation() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return createShardingPropagation();
  });
}

// Old registration code, kept for temporary backwards compatibility.
inline void registerShardingPropagationPass() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return createShardingPropagation();
  });
}

#undef GEN_PASS_REGISTRATION_SHARDINGPROPAGATION
#endif // GEN_PASS_REGISTRATION_SHARDINGPROPAGATION
#ifdef GEN_PASS_REGISTRATION

//===----------------------------------------------------------------------===//
// Shard Registration
//===----------------------------------------------------------------------===//

inline void registerShardPasses() {
  registerPartition();
  registerShardSimplify();
  registerShardingPropagation();
}
#undef GEN_PASS_REGISTRATION
#endif // GEN_PASS_REGISTRATION
#ifdef GEN_PASS_CLASSES
#error "GEN_PASS_CLASSES is deprecated; use per-pass macros"
#undef GEN_PASS_CLASSES
#endif // GEN_PASS_CLASSES
