Lines Matching defs:rewrite

274 /// An IR rewrite that can be committed (upon success) or rolled back (upon
283 /// The kind of the rewrite. Rewrites can be undone if the conversion fails.
304 /// Roll back the rewrite. Operations may be erased during rollback.
307 /// Commit the rewrite. At this point, it is certain that the dialect
326 static bool classof(const IRRewrite *rewrite) { return true; }
338 /// A block rewrite.
341 /// Return the block that this rewrite operates on.
344 static bool classof(const IRRewrite *rewrite) {
345 return rewrite->getKind() >= Kind::CreateBlock &&
346 rewrite->getKind() <= Kind::ReplaceBlockArg;
354 // The block that this rewrite operates on.
359 /// There is no extra work to commit the rewrite. During rollback, the newly
366 static bool classof(const IRRewrite *rewrite) {
367 return rewrite->getKind() == Kind::CreateBlock;
400 static bool classof(const IRRewrite *rewrite) {
401 return rewrite->getKind() == Kind::EraseBlock;
406 "rewrite was neither rolled back nor committed/cleaned up");
410 // The block (owned by this rewrite) was not actually erased yet. It was
448 /// Inlining of a block. This rewrite is immediately reflected in the IR.
449 /// Note: This rewrite represents only the inlining of the operations. The
450 /// erasure of the inlined block is a separate rewrite.
469 static bool classof(const IRRewrite *rewrite) {
470 return rewrite->getKind() == Kind::InlineBlock;
474 // Put the operations from the destination block (owned by the rewrite)
496 /// Moving of a block. This rewrite is immediately reflected in the IR.
504 static bool classof(const IRRewrite *rewrite) {
505 return rewrite->getKind() == Kind::MoveBlock;
534 /// Block type conversion. This rewrite is partially reflected in the IR.
542 static bool classof(const IRRewrite *rewrite) {
543 return rewrite->getKind() == Kind::BlockTypeConversion;
559 /// Replacing a block argument. This rewrite is not immediately reflected in the
561 /// until the rewrite is committed.
570 static bool classof(const IRRewrite *rewrite) {
571 return rewrite->getKind() == Kind::ReplaceBlockArg;
585 /// An operation rewrite.
588 /// Return the operation that this rewrite operates on.
591 static bool classof(const IRRewrite *rewrite) {
592 return rewrite->getKind() >= Kind::MoveOperation &&
593 rewrite->getKind() <= Kind::UnresolvedMaterialization;
601 // The operation that this rewrite operates on.
605 /// Moving of an operation. This rewrite is immediately reflected in the IR.
613 static bool classof(const IRRewrite *rewrite) {
614 return rewrite->getKind() == Kind::MoveOperation;
644 /// In-place modification of an op. This rewrite is immediately reflected in
662 static bool classof(const IRRewrite *rewrite) {
663 return rewrite->getKind() == Kind::ModifyOperation;
668 "rewrite was neither committed nor rolled back");
712 /// with "null" replacements. This rewrite is not immediately reflected in the
714 /// original op is not erased until the rewrite is committed.
722 static bool classof(const IRRewrite *rewrite) {
723 return rewrite->getKind() == Kind::ReplaceOperation;
744 static bool classof(const IRRewrite *rewrite) {
745 return rewrite->getKind() == Kind::CreateOperation;
779 static bool classof(const IRRewrite *rewrite) {
780 return rewrite->getKind() == Kind::UnresolvedMaterialization;
819 /// Return "true" if there is an operation rewrite that matches the specified
820 /// rewrite type and operation among the given rewrites.
823 return any_of(std::forward<R>(rewrites), [&](auto &rewrite) {
824 auto *rewriteTy = dyn_cast<RewriteTy>(rewrite.get());
829 /// Return "true" if there is a block rewrite that matches the specified
830 /// rewrite type and block among the given rewrites.
833 return any_of(std::forward<R>(rewrites), [&](auto &rewrite) {
834 auto *rewriteTy = dyn_cast<RewriteTy>(rewrite.get());
864 /// Append a rewrite. Rewrites are committed upon success and rolled back upon
1039 /// to the corresponding rewrite objects.
1191 for (auto &rewrite : rewrites)
1192 rewrite->cleanup(eraseRewriter);
1215 for (auto &rewrite :
1217 rewrite->rollback();
1682 // Unlink the block from its parent region. The block is kept in the rewrite
1819 llvm::reverse(impl->rewrites), [&](std::unique_ptr<IRRewrite> &rewrite) {
1820 auto *modifyRewrite = dyn_cast<ModifyOperationRewrite>(rewrite.get());
1876 /// A set of rewrite patterns that can be used to legalize a given operation.
2175 // Try to match and rewrite a pattern on this operation.
2245 BlockRewrite *rewrite = dyn_cast<BlockRewrite>(impl.rewrites[i].get());
2246 if (!rewrite)
2248 Block *block = rewrite->getBlock();
2250 ReplaceBlockArgRewrite>(rewrite))
2290 "operation '{0}'({1}) became illegal after rewrite",
2320 auto *rewrite = dyn_cast<ModifyOperationRewrite>(impl.rewrites[i].get());
2321 if (!rewrite)
2323 Operation *op = rewrite->getOperation();
2543 // rewrite patterns. The conversion behaves differently depending on the
2603 UnresolvedMaterializationRewrite *rewrite) {
2604 UnrealizedConversionCastOp op = rewrite->getOperation();
2610 if (const TypeConverter *converter = rewrite->getConverter()) {
2613 switch (rewrite->getMaterializationKind()) {
2617 rewrite->getOriginalType());