Lines Matching full:region
1 //===- RegionUtils.cpp - Region-related transformation utilities ----------===//
33 Region ®ion) {
35 if (region.isAncestor(use.getOwner()->getParentRegion()))
41 Region ®ion, Region &limit, function_ref<void(OpOperand *)> callback) {
42 assert(limit.isAncestor(®ion) &&
43 "expected isolation limit to be an ancestor of the given region");
45 // Collect proper ancestors of `limit` upfront to avoid traversing the region
47 SmallPtrSet<Region *, 4> properAncestors;
53 region.walk([callback, &properAncestors](Operation *op) {
55 // Callback on values defined in a proper ancestor of region.
62 MutableArrayRef<Region> regions, function_ref<void(OpOperand *)> callback) {
63 for (Region ®ion : regions)
64 visitUsedValuesDefinedAbove(region, region, callback);
67 void mlir::getUsedValuesDefinedAbove(Region ®ion, Region &limit,
69 visitUsedValuesDefinedAbove(region, limit, [&](OpOperand *operand) {
74 void mlir::getUsedValuesDefinedAbove(MutableArrayRef<Region> regions,
76 for (Region ®ion : regions)
77 getUsedValuesDefinedAbove(region, region, values);
85 RewriterBase &rewriter, Region ®ion,
88 // Get initial list of values used within region but defined above.
90 mlir::getUsedValuesDefinedAbove(region, initialCapturedValues);
131 // so that they can be cloned into the region without violating use-def
137 Block *entryBlock = ®ion.front();
151 rewriter.createBlock(®ion, region.begin(), newArgTypes, newArgLocs);
157 return use.getOwner()->getBlock()->getParent() == ®ion;
184 MutableArrayRef<Region> regions) {
185 // Set of blocks found to be reachable within a given region.
190 SmallVector<Region *, 1> worklist;
192 for (Region ®ion : regions)
193 worklist.push_back(®ion);
195 Region *region = worklist.pop_back_val();
196 if (region->empty())
199 // If this is a single block region, just collect the nested regions.
200 if (std::next(region->begin()) == region->end()) {
201 for (Operation &op : region->front())
202 for (Region ®ion : op.getRegions())
203 worklist.push_back(®ion);
209 for (Block *block : depth_first_ext(®ion->front(), reachable))
214 for (Block &block : llvm::make_early_inc_range(*region)) {
224 for (Region ®ion : op.getRegions())
225 worklist.push_back(®ion);
249 // TODO: For results that are removable, e.g. for region based control flow,
257 // TODO: For results that are removable, e.g. for region based control flow,
315 static void propagateLiveness(Region ®ion, LiveMap &liveMap);
343 for (Region ®ion : op->getRegions())
344 propagateLiveness(region, liveMap);
363 static void propagateLiveness(Region ®ion, LiveMap &liveMap) {
364 if (region.empty())
367 for (Block *block : llvm::post_order(®ion.front())) {
376 // from region control flow operations.
414 MutableArrayRef<Region> regions,
417 for (Region ®ion : regions) {
418 if (region.empty())
420 bool hasSingleBlock = llvm::hasSingleElement(region);
427 for (Block *block : llvm::post_order(®ion.front())) {
445 for (Block &block : llvm::drop_begin(region.getBlocks(), 1)) {
471 MutableArrayRef<Region> regions) {
476 for (Region ®ion : regions)
477 propagateLiveness(region, liveMap);
846 /// Identify identical blocks within the given region and merge them, inserting
850 Region ®ion) {
851 if (region.empty() || llvm::hasSingleElement(region))
858 for (Block &block : llvm::drop_begin(region, 1))
874 [](Region ®ion) { return !region.empty(); });
906 MutableArrayRef<Region> regions) {
907 llvm::SmallSetVector<Region *, 1> worklist;
908 for (auto ®ion : regions)
909 worklist.insert(®ion);
912 Region *region = worklist.pop_back_val();
913 if (succeeded(mergeIdenticalBlocks(rewriter, *region))) {
914 worklist.insert(region);
919 for (Block &block : *region)
1013 MutableArrayRef<Region> regions) {
1014 llvm::SmallSetVector<Region *, 1> worklist;
1015 for (Region ®ion : regions)
1016 worklist.insert(®ion);
1019 Region *region = worklist.pop_back_val();
1022 for (Block &block : *region) {
1027 for (Region &nestedRegion : op.getRegions())
1035 // Region Simplification
1043 MutableArrayRef<Region> regions,