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

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

//===----------------------------------------------------------------------===//
// AlignedAllocationsPass
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_ALIGNEDALLOCATIONSPASS
struct AlignedAllocationsPassOptions {
  int64_t alignment_ = 64;
};
#undef GEN_PASS_DECL_ALIGNEDALLOCATIONSPASS
#endif // GEN_PASS_DECL_ALIGNEDALLOCATIONSPASS
#ifdef GEN_PASS_DEF_ALIGNEDALLOCATIONSPASS
namespace impl {

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

  AlignedAllocationsPassBase() : ::mlir::OperationPass<mlir::func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
  AlignedAllocationsPassBase(const AlignedAllocationsPassBase &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-memref-aligned-allocations");
  }
  ::llvm::StringRef getArgument() const override { return "xla-memref-aligned-allocations"; }

  ::llvm::StringRef getDescription() const override { return "Add alignment attribute to all `alloc` operations."; }

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

  /// 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 {
    
  }

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

  AlignedAllocationsPassBase(const AlignedAllocationsPassOptions &options) : AlignedAllocationsPassBase() {
    alignment_ = options.alignment_;
  }
protected:
  ::mlir::Pass::Option<int64_t> alignment_{*this, "alignment", ::llvm::cl::desc("Byte alignment for allocated memrefs."), ::llvm::cl::init(64)};
private:
};
} // namespace impl
#undef GEN_PASS_DEF_ALIGNEDALLOCATIONSPASS
#endif // GEN_PASS_DEF_ALIGNEDALLOCATIONSPASS
#ifdef GEN_PASS_REGISTRATION

//===----------------------------------------------------------------------===//
// AlignedAllocationsPass Registration
//===----------------------------------------------------------------------===//

inline void registerAlignedAllocationsPass() {
  ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> {
    return ::xla::CreateAlignedAllocationsPass();
  });
}

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

//===----------------------------------------------------------------------===//
// MemrefTransforms Registration
//===----------------------------------------------------------------------===//

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

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

  AlignedAllocationsPassBase() : ::mlir::OperationPass<mlir::func::FuncOp>(::mlir::TypeID::get<DerivedT>()) {}
  AlignedAllocationsPassBase(const AlignedAllocationsPassBase &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-memref-aligned-allocations");
  }
  ::llvm::StringRef getArgument() const override { return "xla-memref-aligned-allocations"; }

  ::llvm::StringRef getDescription() const override { return "Add alignment attribute to all `alloc` operations."; }

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

  /// 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 {
    
  }

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

protected:
  ::mlir::Pass::Option<int64_t> alignment_{*this, "alignment", ::llvm::cl::desc("Byte alignment for allocated memrefs."), ::llvm::cl::init(64)};
};
#undef GEN_PASS_CLASSES
#endif // GEN_PASS_CLASSES
