Files
gps/tools/local/circt/include/mlir/Interfaces/RuntimeVerifiableOpInterface.h.inc
T
2026-07-12 11:01:51 +03:00

93 lines
4.8 KiB
C++

/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|* *|
|* Interface Declarations *|
|* *|
|* Automatically generated file, do not edit! *|
|* *|
\*===----------------------------------------------------------------------===*/
namespace mlir {
/// Implementations of this interface generate IR for runtime op verification.
///
/// Incorrect op usage can often be caught by op verifiers based on static
/// program information. However, in the absence of static program information,
/// it can remain undetected at compile time (e.g., in case of dynamic memref
/// strides instead of static memref strides). Such cases can be checked at
/// runtime. The op-specific checks are generated by this interface.
class RuntimeVerifiableOpInterface;
} // namespace mlir
namespace mlir {
/// Implementations of this interface generate IR for runtime op verification.
///
/// Incorrect op usage can often be caught by op verifiers based on static
/// program information. However, in the absence of static program information,
/// it can remain undetected at compile time (e.g., in case of dynamic memref
/// strides instead of static memref strides). Such cases can be checked at
/// runtime. The op-specific checks are generated by this interface.
namespace detail {
struct RuntimeVerifiableOpInterfaceInterfaceTraits {
struct Concept {
/// The methods defined by the interface.
void (*generateRuntimeVerification)(const Concept *impl, ::mlir::Operation *, ::mlir::OpBuilder &, ::mlir::Location, function_ref<std::string(Operation *, StringRef)>);
};
template<typename ConcreteOp>
class Model : public Concept {
public:
using Interface = ::mlir::RuntimeVerifiableOpInterface;
Model() : Concept{generateRuntimeVerification} {}
static inline void generateRuntimeVerification(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpBuilder & builder, ::mlir::Location loc, function_ref<std::string(Operation *, StringRef)> generateErrorMessage);
};
template<typename ConcreteOp>
class FallbackModel : public Concept {
public:
using Interface = ::mlir::RuntimeVerifiableOpInterface;
FallbackModel() : Concept{generateRuntimeVerification} {}
static inline void generateRuntimeVerification(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpBuilder & builder, ::mlir::Location loc, function_ref<std::string(Operation *, StringRef)> generateErrorMessage);
};
template<typename ConcreteModel, typename ConcreteOp>
class ExternalModel : public FallbackModel<ConcreteModel> {
public:
using ConcreteEntity = ConcreteOp;
};
};
template <typename ConcreteOp>
struct RuntimeVerifiableOpInterfaceTrait;
} // namespace detail
class RuntimeVerifiableOpInterface : public ::mlir::OpInterface<RuntimeVerifiableOpInterface, detail::RuntimeVerifiableOpInterfaceInterfaceTraits> {
public:
using ::mlir::OpInterface<RuntimeVerifiableOpInterface, detail::RuntimeVerifiableOpInterfaceInterfaceTraits>::OpInterface;
template <typename ConcreteOp>
struct Trait : public detail::RuntimeVerifiableOpInterfaceTrait<ConcreteOp> {};
/// Generate IR to verify this op at runtime, aborting runtime execution if
/// verification fails.
void generateRuntimeVerification(::mlir::OpBuilder & builder, ::mlir::Location loc, function_ref<std::string(Operation *, StringRef)> generateErrorMessage);
};
} // namespace mlir
namespace mlir::detail {
template <typename ConcreteOp>
struct RuntimeVerifiableOpInterfaceTrait : public ::mlir::OpInterface<RuntimeVerifiableOpInterface, detail::RuntimeVerifiableOpInterfaceInterfaceTraits>::Trait<ConcreteOp> {
};
} // namespace mlir::detail
namespace mlir {
template<typename ConcreteOp>
void detail::RuntimeVerifiableOpInterfaceInterfaceTraits::Model<ConcreteOp>::generateRuntimeVerification(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpBuilder & builder, ::mlir::Location loc, function_ref<std::string(Operation *, StringRef)> generateErrorMessage) {
return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).generateRuntimeVerification(builder, loc, generateErrorMessage);
}
template<typename ConcreteOp>
void detail::RuntimeVerifiableOpInterfaceInterfaceTraits::FallbackModel<ConcreteOp>::generateRuntimeVerification(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OpBuilder & builder, ::mlir::Location loc, function_ref<std::string(Operation *, StringRef)> generateErrorMessage) {
return static_cast<const ConcreteOp *>(impl)->generateRuntimeVerification(tablegen_opaque_val, builder, loc, generateErrorMessage);
}
} // namespace mlir