9 #ifndef MLIR_IR_DIALECTINTERFACE_H 10 #define MLIR_IR_DIALECTINTERFACE_H 13 #include "llvm/ADT/DenseSet.h" 26 template <
typename ConcreteType,
typename BaseT>
46 template <
typename ConcreteType>
57 : dialect(dialect), interfaceID(id) {}
76 struct InterfaceKeyInfo :
public DenseMapInfo<const DialectInterface *> {
85 if (rhs == getEmptyKey() || rhs == getTombstoneKey())
93 using InterfaceVectorT = std::vector<const DialectInterface *>;
106 auto it = interfaces.find_as(dialect);
107 return it == interfaces.end() ? nullptr : *it;
112 template <
typename InterfaceT>
114 InterfaceVectorT::const_iterator,
115 const InterfaceT &(*)(const DialectInterface *)> {
117 return *
static_cast<const InterfaceT *
>(interface);
120 iterator(InterfaceVectorT::const_iterator it)
121 : llvm::mapped_iterator<
122 InterfaceVectorT::const_iterator,
143 InterfaceVectorT orderedInterfaces;
149 template <
typename InterfaceType>
157 : detail::DialectInterfaceCollectionBase(
162 template <
typename Object>
164 return static_cast<const InterfaceType *
>(
Definition: InferTypeOpInterface.cpp:20
iterator end() const
Definition: DialectInterface.h:172
Definition: STLExtras.h:95
Definition: Operation.h:27
Definition: DialectInterface.h:27
static ClassID * getInterfaceID()
Get a unique id for the derived interface type.
Definition: DialectInterface.h:32
iterator< InterfaceT > interface_end() const
Definition: DialectInterface.h:133
Dialect * getDialect() const
Return the dialect that this interface represents.
Definition: DialectInterface.h:50
Definition: DialectInterface.h:150
const InterfaceType * getInterfaceFor(Object *obj) const
Definition: DialectInterface.h:163
const DialectInterface * getInterfaceFor(Dialect *dialect) const
Get the interface for the given dialect.
Definition: DialectInterface.h:105
DialectInterfaceBase(Dialect *dialect)
Definition: DialectInterface.h:35
Definition: DialectInterface.h:74
inline ::llvm::hash_code hash_value(AffineExpr arg)
Make AffineExpr hashable.
Definition: AffineExpr.h:201
iterator< InterfaceT > interface_begin() const
Iterator access to the held interfaces.
Definition: DialectInterface.h:130
DialectInterfaceCollection(MLIRContext *ctx)
Collect the registered dialect interfaces within the provided context.
Definition: DialectInterface.h:156
Definition: MLIRContext.h:34
ClassID * getID() const
Return the derived interface id.
Definition: DialectInterface.h:53
Definition: DialectInterface.h:113
const DialectInterface * getInterfaceFor(Operation *op) const
Definition: Dialect.cpp:154
DialectInterface(Dialect *dialect, ClassID *id)
Definition: DialectInterface.h:56
iterator begin() const
Definition: DialectInterface.h:171
This class represents an interface overridden for a single dialect.
Definition: DialectInterface.h:40