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

#ifdef GEN_PASS_DECL
// Generate declarations for all passes.
#define GEN_PASS_DECL_LEGALIZETFCOMMUNICATIONPASS
#define GEN_PASS_DECL_LEGALIZETFWITHTF2XLA
#undef GEN_PASS_DECL
#endif // GEN_PASS_DECL

//===----------------------------------------------------------------------===//
// LegalizeTFCommunicationPass
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_LEGALIZETFCOMMUNICATIONPASS
#undef GEN_PASS_DECL_LEGALIZETFCOMMUNICATIONPASS
#endif // GEN_PASS_DECL_LEGALIZETFCOMMUNICATIONPASS
#ifdef GEN_PASS_DEF_LEGALIZETFCOMMUNICATIONPASS
namespace impl {

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

  LegalizeTFCommunicationPassBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
  LegalizeTFCommunicationPassBase(const LegalizeTFCommunicationPassBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}

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

  ::llvm::StringRef getDescription() const override { return "Legalize TF/XLA communication ops (TensorFlow dialect) to the HLO dialect"; }

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

  /// 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<mhlo::MhloDialect>();

  registry.insert<sparse_tensor::SparseTensorDialect>();

  }

  /// 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(LegalizeTFCommunicationPassBase<DerivedT>)

protected:
private:
};
} // namespace impl
#undef GEN_PASS_DEF_LEGALIZETFCOMMUNICATIONPASS
#endif // GEN_PASS_DEF_LEGALIZETFCOMMUNICATIONPASS

//===----------------------------------------------------------------------===//
// LegalizeTFWithTF2XLA
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_LEGALIZETFWITHTF2XLA
struct LegalizeTFWithTF2XLAOptions {
  std::string device_type_;
  bool prefer_tf2xla_;
  bool legalize_test_only_ops_;
};
#undef GEN_PASS_DECL_LEGALIZETFWITHTF2XLA
#endif // GEN_PASS_DECL_LEGALIZETFWITHTF2XLA
#ifdef GEN_PASS_DEF_LEGALIZETFWITHTF2XLA
namespace impl {

template <typename DerivedT>
class LegalizeTFWithTF2XLABase : public ::mlir::OperationPass<mlir::func::FuncOp> {
public:
  using Base = LegalizeTFWithTF2XLABase;

  LegalizeTFWithTF2XLABase() : ::mlir::OperationPass<mlir::func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
  LegalizeTFWithTF2XLABase(const LegalizeTFWithTF2XLABase &other) : ::mlir::OperationPass<mlir::func::FuncOp>(other) {}

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

  ::llvm::StringRef getDescription() const override { return "Legalize from TensorFlow to the HLO dialect using tf2xla kernels"; }

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

  /// 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<mhlo::MhloDialect>();

  registry.insert<sparse_tensor::SparseTensorDialect>();

  }

  /// 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(LegalizeTFWithTF2XLABase<DerivedT>)

  LegalizeTFWithTF2XLABase(const LegalizeTFWithTF2XLAOptions &options) : LegalizeTFWithTF2XLABase() {
    device_type_ = options.device_type_;
    prefer_tf2xla_ = options.prefer_tf2xla_;
    legalize_test_only_ops_ = options.legalize_test_only_ops_;
  }
protected:
  ::mlir::Pass::Option<std::string> device_type_{*this, "device-type", ::llvm::cl::desc("XLA device type for execution of TensorFlow ops.")};
  ::mlir::Pass::Option<bool> prefer_tf2xla_{*this, "prefer-tf2xla", ::llvm::cl::desc("Enable legalization when it is not in the list of MLIR-legalized ops.")};
  ::mlir::Pass::Option<bool> legalize_test_only_ops_{*this, "legalize-test-only-ops", ::llvm::cl::desc("Enable tf2xla legalizations for some ops that are enabled only for testing.")};
private:
};
} // namespace impl
#undef GEN_PASS_DEF_LEGALIZETFWITHTF2XLA
#endif // GEN_PASS_DEF_LEGALIZETFWITHTF2XLA
#ifdef GEN_PASS_REGISTRATION

//===----------------------------------------------------------------------===//
// LegalizeTFCommunicationPass Registration
//===----------------------------------------------------------------------===//

inline void registerLegalizeTFCommunicationPass() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return ::mlir::mhlo::CreateLegalizeTFCommunicationPass();
  });
}

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

//===----------------------------------------------------------------------===//
// LegalizeTFWithTF2XLA Registration
//===----------------------------------------------------------------------===//

inline void registerLegalizeTFWithTF2XLA() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return ::mlir::mhlo::createLegalizeTfWithTf2XlaPass();
  });
}

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

//===----------------------------------------------------------------------===//
// TfXla Registration
//===----------------------------------------------------------------------===//

inline void registerTfXlaPasses() {
  registerLegalizeTFCommunicationPass();
  registerLegalizeTFWithTF2XLA();
}
#undef GEN_PASS_REGISTRATION
#endif // GEN_PASS_REGISTRATION
// Deprecated. Please use the new per-pass macros.
#ifdef GEN_PASS_CLASSES

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

  LegalizeTFCommunicationPassBase() : ::mlir::OperationPass<ModuleOp>(::mlir::TypeID::get<DerivedT>()) {}
  LegalizeTFCommunicationPassBase(const LegalizeTFCommunicationPassBase &other) : ::mlir::OperationPass<ModuleOp>(other) {}

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

  ::llvm::StringRef getDescription() const override { return "Legalize TF/XLA communication ops (TensorFlow dialect) to the HLO dialect"; }

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

  /// 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<mhlo::MhloDialect>();

  registry.insert<sparse_tensor::SparseTensorDialect>();

  }

  /// 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(LegalizeTFCommunicationPassBase<DerivedT>)

protected:
};

template <typename DerivedT>
class LegalizeTFWithTF2XLABase : public ::mlir::OperationPass<mlir::func::FuncOp> {
public:
  using Base = LegalizeTFWithTF2XLABase;

  LegalizeTFWithTF2XLABase() : ::mlir::OperationPass<mlir::func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
  LegalizeTFWithTF2XLABase(const LegalizeTFWithTF2XLABase &other) : ::mlir::OperationPass<mlir::func::FuncOp>(other) {}

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

  ::llvm::StringRef getDescription() const override { return "Legalize from TensorFlow to the HLO dialect using tf2xla kernels"; }

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

  /// 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<mhlo::MhloDialect>();

  registry.insert<sparse_tensor::SparseTensorDialect>();

  }

  /// 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(LegalizeTFWithTF2XLABase<DerivedT>)

protected:
  ::mlir::Pass::Option<std::string> device_type_{*this, "device-type", ::llvm::cl::desc("XLA device type for execution of TensorFlow ops.")};
  ::mlir::Pass::Option<bool> prefer_tf2xla_{*this, "prefer-tf2xla", ::llvm::cl::desc("Enable legalization when it is not in the list of MLIR-legalized ops.")};
  ::mlir::Pass::Option<bool> legalize_test_only_ops_{*this, "legalize-test-only-ops", ::llvm::cl::desc("Enable tf2xla legalizations for some ops that are enabled only for testing.")};
};
#undef GEN_PASS_CLASSES
#endif // GEN_PASS_CLASSES
