16 #include "llvm/ADT/STLExtras.h" 
   20 #define GET_OP_CLASSES 
   21 #include "mlir/Dialect/Transform/IRDLExtension/IRDLExtensionOps.cpp.inc" 
   26 IRDLCollectMatchingOp::apply(TransformRewriter &rewriter,
 
   27                              TransformResults &results, TransformState &state) {
 
   28   auto dialect = cast<irdl::DialectOp>(getBody().front().front());
 
   30   irdl::OperationOp operation = *body.
getOps<irdl::OperationOp>().begin();
 
   33       DenseMap<irdl::TypeOp, std::unique_ptr<DynamicTypeDefinition>>(),
 
   34       DenseMap<irdl::AttributeOp, std::unique_ptr<DynamicAttrDefinition>>());
 
   39   for (
Operation *payload : state.getPayloadOps(getRoot())) {
 
   41       if (succeeded(verifier(target))) {
 
   42         matched.push_back(target);
 
   47   results.set(cast<OpResult>(getMatched()), matched);
 
   51 void IRDLCollectMatchingOp::getEffects(
 
   60   if (!llvm::hasSingleElement(bodyBlock))
 
   61     return emitOpError() << 
"expects a single operation in the body";
 
   63   auto dialect = dyn_cast<irdl::DialectOp>(bodyBlock.
front());
 
   65     return emitOpError() << 
"expects the body operation to be " 
   66                          << irdl::DialectOp::getOperationName();
 
   72   auto irdlOperations = dialect.getOps<irdl::OperationOp>();
 
   73   if (!llvm::hasSingleElement(irdlOperations))
 
   74     return emitOpError() << 
"expects IRDL to contain exactly one operation";
 
   76   if (!dialect.getOps<irdl::TypeOp>().empty() ||
 
   77       !dialect.getOps<irdl::AttributeOp>().empty()) {
 
   78     return emitOpError() << 
"IRDL types and attributes are not yet supported";
 
static MLIRContext * getContext(OpFoldResult val)
Block represents an ordered list of Operations.
iterator_range< op_iterator< OpT > > getOps()
Return an iterator range over the operations within this block that are of 'OpT'.
The result of a transform IR operation application.
static DiagnosedSilenceableFailure success()
Constructs a DiagnosedSilenceableFailure in the success state.
void eraseHandler(HandlerID id)
Erase the registered diagnostic handler with the given identifier.
HandlerID registerHandler(HandlerTy handler)
Register a new handler for diagnostics to the engine.
This class contains all of the information necessary to report a diagnostic to the DiagnosticEngine.
DiagnosticEngine & getDiagEngine()
Returns the diagnostic engine for this context.
Operation is the basic unit of execution within MLIR.
llvm::unique_function< LogicalResult(Operation *) const  > createVerifier(OperationOp operation, const DenseMap< irdl::TypeOp, std::unique_ptr< DynamicTypeDefinition >> &typeDefs, const DenseMap< irdl::AttributeOp, std::unique_ptr< DynamicAttrDefinition >> &attrDefs)
Generate an op verifier function from the given IRDL operation definition.
Include the generated interface declarations.
LogicalResult verify(Operation *op, bool verifyRecursively=true)
Perform (potentially expensive) checks of invariants, used to detect compiler bugs,...