Files
gps/tools/local/circt/include/mlir/Dialect/EmitC/IR/EmitCInterfaces.h.inc
T
2026-07-12 11:01:51 +03:00

164 lines
6.0 KiB
C++

/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
|* *|
|* Interface Declarations *|
|* *|
|* Automatically generated file, do not edit! *|
|* *|
\*===----------------------------------------------------------------------===*/
namespace mlir::emitc {
/// Interface to mark operations that can be part of the CExpression.
class CExpressionInterface;
} // namespace mlir::emitc
namespace mlir::emitc {
/// Interface to mark operations that can be part of the CExpression.
namespace detail {
struct CExpressionInterfaceInterfaceTraits {
struct Concept {
/// The methods defined by the interface.
bool (*hasSideEffects)(const Concept *impl, ::mlir::Operation *);
bool (*alwaysInline)(const Concept *impl, ::mlir::Operation *);
};
template<typename ConcreteOp>
class Model : public Concept {
public:
using Interface = ::mlir::emitc::CExpressionInterface;
Model() : Concept{hasSideEffects, alwaysInline} {}
static inline bool hasSideEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
static inline bool alwaysInline(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
};
template<typename ConcreteOp>
class FallbackModel : public Concept {
public:
using Interface = ::mlir::emitc::CExpressionInterface;
FallbackModel() : Concept{hasSideEffects, alwaysInline} {}
static inline bool hasSideEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
static inline bool alwaysInline(const Concept *impl, ::mlir::Operation *tablegen_opaque_val);
};
template<typename ConcreteModel, typename ConcreteOp>
class ExternalModel : public FallbackModel<ConcreteModel> {
public:
using ConcreteEntity = ConcreteOp;
bool hasSideEffects(::mlir::Operation *tablegen_opaque_val) const;
bool alwaysInline(::mlir::Operation *tablegen_opaque_val) const;
};
};
template <typename ConcreteOp>
struct CExpressionInterfaceTrait;
} // namespace detail
class CExpressionInterface : public ::mlir::OpInterface<CExpressionInterface, detail::CExpressionInterfaceInterfaceTraits> {
public:
using ::mlir::OpInterface<CExpressionInterface, detail::CExpressionInterfaceInterfaceTraits>::OpInterface;
template <typename ConcreteOp>
struct Trait : public detail::CExpressionInterfaceTrait<ConcreteOp> {};
/// Check whether operation has side effects that may affect the expression
/// evaluation.
///
/// By default operation is marked as having side effects.
///
/// ```c++
/// class ConcreteOp ... {
/// public:
/// bool hasSideEffects() {
/// // That way we can override the default implementation.
/// return false;
/// }
/// };
/// ```
bool hasSideEffects();
/// Check whether operation must be inlined into all its users.
///
/// By default operation is not marked as always inlined.
///
/// ```c++
/// class ConcreteOp ... {
/// public:
/// bool alwaysInline() {
/// // That way we can override the default implementation.
/// return true;
/// }
/// };
/// ```
bool alwaysInline();
};
} // namespace mlir::emitc
namespace mlir::emitc::detail {
template <typename ConcreteOp>
struct CExpressionInterfaceTrait : public ::mlir::OpInterface<CExpressionInterface, detail::CExpressionInterfaceInterfaceTraits>::Trait<ConcreteOp> {
/// Check whether operation has side effects that may affect the expression
/// evaluation.
///
/// By default operation is marked as having side effects.
///
/// ```c++
/// class ConcreteOp ... {
/// public:
/// bool hasSideEffects() {
/// // That way we can override the default implementation.
/// return false;
/// }
/// };
/// ```
bool hasSideEffects() {
return true;
}
/// Check whether operation must be inlined into all its users.
///
/// By default operation is not marked as always inlined.
///
/// ```c++
/// class ConcreteOp ... {
/// public:
/// bool alwaysInline() {
/// // That way we can override the default implementation.
/// return true;
/// }
/// };
/// ```
bool alwaysInline() {
return false;
}
};
} // namespace mlir::emitc::detail
namespace mlir::emitc {
template<typename ConcreteOp>
bool detail::CExpressionInterfaceInterfaceTraits::Model<ConcreteOp>::hasSideEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).hasSideEffects();
}
template<typename ConcreteOp>
bool detail::CExpressionInterfaceInterfaceTraits::Model<ConcreteOp>::alwaysInline(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
return (llvm::cast<ConcreteOp>(tablegen_opaque_val)).alwaysInline();
}
template<typename ConcreteOp>
bool detail::CExpressionInterfaceInterfaceTraits::FallbackModel<ConcreteOp>::hasSideEffects(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
return static_cast<const ConcreteOp *>(impl)->hasSideEffects(tablegen_opaque_val);
}
template<typename ConcreteOp>
bool detail::CExpressionInterfaceInterfaceTraits::FallbackModel<ConcreteOp>::alwaysInline(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) {
return static_cast<const ConcreteOp *>(impl)->alwaysInline(tablegen_opaque_val);
}
template<typename ConcreteModel, typename ConcreteOp>
bool detail::CExpressionInterfaceInterfaceTraits::ExternalModel<ConcreteModel, ConcreteOp>::hasSideEffects(::mlir::Operation *tablegen_opaque_val) const {
return true;
}
template<typename ConcreteModel, typename ConcreteOp>
bool detail::CExpressionInterfaceInterfaceTraits::ExternalModel<ConcreteModel, ConcreteOp>::alwaysInline(::mlir::Operation *tablegen_opaque_val) const {
return false;
}
} // namespace mlir::emitc