Lines Matching full:region
36 Sinker(function_ref<bool(Operation *, Region *)> shouldMoveIntoRegion, in Sinker()
37 function_ref<void(Operation *, Region *)> moveIntoRegion, in Sinker()
47 /// Given a region and an op which dominates the region, returns true if all
48 /// users of the given op are dominated by the entry block of the region, and
49 /// thus the operation can be sunk into the region.
50 bool allUsersDominatedBy(Operation *op, Region *region);
52 /// Given a region and a top-level op (an op whose parent region is the given
53 /// region), determine whether the defining ops of the op's operands can be
54 /// sunk into the region.
57 void tryToSinkPredecessors(Operation *user, Region *region,
60 /// Iterate over all the ops in a region and try to sink their predecessors.
62 void sinkRegion(Region *region);
64 /// The callback to determine whether an op should be moved in to a region.
65 function_ref<bool(Operation *, Region *)> shouldMoveIntoRegion;
66 /// The calback to move an operation into the region.
67 function_ref<void(Operation *, Region *)> moveIntoRegion;
75 bool Sinker::allUsersDominatedBy(Operation *op, Region *region) { in allUsersDominatedBy() argument
76 assert(region->findAncestorOpInRegion(*op) == nullptr && in allUsersDominatedBy()
77 "expected op to be defined outside the region"); in allUsersDominatedBy()
79 // The user is dominated by the region if its containing block is dominated in allUsersDominatedBy()
80 // by the region's entry block. in allUsersDominatedBy()
81 return domInfo.dominates(®ion->front(), user->getBlock()); in allUsersDominatedBy()
85 void Sinker::tryToSinkPredecessors(Operation *user, Region *region, in tryToSinkPredecessors() argument
90 // Ignore block arguments and ops that are already inside the region. in tryToSinkPredecessors()
91 if (!op || op->getParentRegion() == region) in tryToSinkPredecessors()
95 // If the op's users are all in the region and it can be moved, then do so. in tryToSinkPredecessors()
96 if (allUsersDominatedBy(op, region) && shouldMoveIntoRegion(op, region)) { in tryToSinkPredecessors()
97 moveIntoRegion(op, region); in tryToSinkPredecessors()
105 void Sinker::sinkRegion(Region *region) { in sinkRegion() argument
106 // Initialize the work queue with all the ops in the region. in sinkRegion()
108 for (Operation &op : region->getOps()) in sinkRegion()
116 tryToSinkPredecessors(op, region, stack); in sinkRegion()
121 for (Region *region : regions) in sinkRegions()
122 if (!region->empty()) in sinkRegions()
123 sinkRegion(region); in sinkRegions()
129 function_ref<bool(Operation *, Region *)> shouldMoveIntoRegion, in controlFlowSink()
130 function_ref<void(Operation *, Region *)> moveIntoRegion) { in controlFlowSink()
136 SmallVectorImpl<Region *> ®ions) { in getSinglyExecutedRegionsToSink()