llvm/tools/mlir/include/mlir/Dialect/Quant/Transforms/Passes.h.inc

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

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

//===----------------------------------------------------------------------===//
// LowerQuantOps
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_LOWERQUANTOPS
std::unique_ptr<::mlir::Pass> createLowerQuantOps();
#undef GEN_PASS_DECL_LOWERQUANTOPS
#endif // GEN_PASS_DECL_LOWERQUANTOPS
#ifdef GEN_PASS_DEF_LOWERQUANTOPS

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

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

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

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

  ::llvm::StringRef getDescription() const override { return "Lower quant.dcast and quant.qcast ops"; }

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

  /// 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<linalg::LinalgDialect>();
    registry.insert<quant::QuantDialect>();
    registry.insert<shape::ShapeDialect>();
    registry.insert<tensor::TensorDialect>();
  }

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

protected:
private:

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

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

//===----------------------------------------------------------------------===//
// StripFuncQuantTypes
//===----------------------------------------------------------------------===//
#ifdef GEN_PASS_DECL_STRIPFUNCQUANTTYPES
std::unique_ptr<::mlir::Pass> createStripFuncQuantTypes();
#undef GEN_PASS_DECL_STRIPFUNCQUANTTYPES
#endif // GEN_PASS_DECL_STRIPFUNCQUANTTYPES
#ifdef GEN_PASS_DEF_STRIPFUNCQUANTTYPES

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

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

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

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

  ::llvm::StringRef getDescription() const override { return "Strip quantized types from function headers"; }

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

  /// 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<func::FuncDialect>();
    registry.insert<quant::QuantDialect>();
  }

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

protected:
private:

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

std::unique_ptr<::mlir::Pass> createStripFuncQuantTypes() {
  return impl::createStripFuncQuantTypes();
}
#undef GEN_PASS_DEF_STRIPFUNCQUANTTYPES
#endif // GEN_PASS_DEF_STRIPFUNCQUANTTYPES
#ifdef GEN_PASS_REGISTRATION

//===----------------------------------------------------------------------===//
// LowerQuantOps Registration
//===----------------------------------------------------------------------===//

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

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

//===----------------------------------------------------------------------===//
// StripFuncQuantTypes Registration
//===----------------------------------------------------------------------===//

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

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

//===----------------------------------------------------------------------===//
// Quant Registration
//===----------------------------------------------------------------------===//

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

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

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

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

  ::llvm::StringRef getDescription() const override { return "Lower quant.dcast and quant.qcast ops"; }

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

  /// 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));
  }

  /// Register the dialects that must be loaded in the context before this pass.
  void getDependentDialects(::mlir::DialectRegistry &registry) const override {
    registry.insert<arith::ArithDialect>();
    registry.insert<linalg::LinalgDialect>();
    registry.insert<quant::QuantDialect>();
    registry.insert<shape::ShapeDialect>();
    registry.insert<tensor::TensorDialect>();
  }

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

protected:
};

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

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

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

  ::llvm::StringRef getDescription() const override { return "Strip quantized types from function headers"; }

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

  /// 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));
  }

  /// Register the dialects that must be loaded in the context before this pass.
  void getDependentDialects(::mlir::DialectRegistry &registry) const override {
    registry.insert<func::FuncDialect>();
    registry.insert<quant::QuantDialect>();
  }

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

protected:
};
#undef GEN_PASS_CLASSES
#endif // GEN_PASS_CLASSES