Lines Matching defs:rewrites
253 /// This is useful when saving and undoing a set of rewrites.
260 /// The current number of rewrites performed.
271 // IR rewrites
278 /// user through the rewriter API) in `IRRewrite` objects. Some kind of rewrites
285 /// block rewrites, then all operation rewrites.
287 // Block rewrites
294 // Operation rewrites
820 /// rewrite type and operation among the given rewrites.
822 static bool hasRewrite(R &&rewrites, Operation *op) {
823 return any_of(std::forward<R>(rewrites), [&](auto &rewrite) {
830 /// rewrite type and block among the given rewrites.
832 static bool hasRewrite(R &&rewrites, Block *block) {
833 return any_of(std::forward<R>(rewrites), [&](auto &rewrite) {
857 /// Apply all requested operation rewrites. This method is invoked when the
868 rewrites.push_back(
872 /// Undo the rewrites (motions, splits) one by one in reverse order until
873 /// "numRewritesToKeep" rewrites remains.
1025 SmallVector<std::unique_ptr<IRRewrite>> rewrites;
1183 // Commit all rewrites.
1185 // Note: New rewrites may be added during the "commit" phase and the
1186 // `rewrites` vector may reallocate.
1187 for (size_t i = 0; i < rewrites.size(); ++i)
1188 rewrites[i]->commit(rewriter);
1190 // Clean up all rewrites.
1191 for (auto &rewrite : rewrites)
1199 return RewriterState(rewrites.size(), ignoredOps.size(), replacedOps.size());
1203 // Undo any rewrites.
1216 llvm::reverse(llvm::drop_begin(rewrites, numRewritesToKeep)))
1218 rewrites.resize(numRewritesToKeep);
1327 if (hasRewrite<BlockTypeConversionRewrite>(rewrites, block))
1683 // object and will be actually destroyed when rewrites are applied. This
1819 llvm::reverse(impl->rewrites), [&](std::unique_ptr<IRRewrite> &rewrite) {
1823 assert(it != impl->rewrites.rend() && "no root update started on op");
1825 int updateIdx = std::prev(impl->rewrites.rend()) - it;
1826 impl->rewrites.erase(impl->rewrites.begin() + updateIdx);
2110 for (unsigned i = curState.numRewrites, e = rewriterImpl.rewrites.size();
2113 dyn_cast<CreateOperationRewrite>(rewriterImpl.rewrites[i].get());
2211 auto newRewrites = llvm::drop_begin(impl.rewrites, curState.numRewrites);
2245 BlockRewrite *rewrite = dyn_cast<BlockRewrite>(impl.rewrites[i].get());
2276 for (unsigned i = state.numRewrites, e = impl.rewrites.size(); i != e;
2279 dyn_cast<CreateOperationRewrite>(impl.rewrites[i].get());
2302 auto *createOp = dyn_cast<CreateOperationRewrite>(impl.rewrites[i].get());
2320 auto *rewrite = dyn_cast<ModifyOperationRewrite>(impl.rewrites[i].get());
2535 /// In this mode, operations are analyzed for legality. No actual rewrites are
2669 // Convert each operation and discard rewrites on failure.
2677 // After a successful conversion, apply rewrites.
3061 /// Create a default conversion pattern that rewrites the type signature of a