Lines Matching +defs:region +defs:end
55 /// must not be masked. This structure analyzes the region evaluating the
59 MaskedArrayExpr(mlir::Location loc, mlir::Region ®ion,
83 /// Helper to clone the clean-ups of the masked expr region terminator.
90 mlir::Region ®ion;
157 /// Are there any leaf region in the node that must be saved in the current
162 /// Should this node be evaluated in the current run? Saving a region in a
167 /// Generate a scalar value yielded by an ordered assignment tree region.
168 /// If the value was not saved in a previous run, this clone the region
177 mlir::Region ®ion,
180 /// Generate an entity yielded by an ordered assignment tree region, and
183 /// this will return the saved value if the region was saved in a previous
186 generateYieldedEntity(mlir::Region ®ion,
214 mlir::Value generateMaskedEntity(mlir::Location loc, mlir::Region ®ion) {
215 MaskedArrayExpr maskedExpr(loc, region, /*isOuterMaskExpr=*/!whereLoopNest);
232 std::optional<ValueAndCleanUp> getIfSaved(mlir::Region ®ion);
254 fir::factory::TemporaryStorage *insertSavedEntity(mlir::Region ®ion,
257 savedEntities.insert(std::make_pair(®ion, std::forward<T>(temp)));
568 // Create an "else" region for the current where/elsewhere fir.if.
574 auto end = builder.create<fir::ResultOp>(loc);
575 builder.setInsertionPoint(end);
623 OrderedAssignmentRewriter::getIfSaved(mlir::Region ®ion) {
624 mlir::Location loc = region.getParentOp()->getLoc();
625 // If the region was saved in the same run, use the value that was evaluated
630 if (auto savedInSameRun = savedInCurrentRunBeforeUse.find(®ion);
631 savedInSameRun != savedInCurrentRunBeforeUse.end())
633 // If the region was saved in a previous run, fetch the saved value.
634 if (auto temp = savedEntities.find(®ion); temp != savedEntities.end()) {
641 static hlfir::YieldOp getYield(mlir::Region ®ion) {
643 region.back().getOperations().back());
644 assert(yield && "region computing entities must end with a YieldOp");
650 mlir::Region ®ion, std::optional<mlir::Type> castToType) {
651 mlir::Location loc = region.getParentOp()->getLoc();
652 if (auto maybeValueAndCleanUp = getIfSaved(region))
654 // Otherwise, evaluate the region now.
659 mlir::Value maskedValue = generateMaskedEntity(loc, region);
663 auto oldYield = getYield(region);
675 region.walk([&](mlir::Operation *op) -> mlir::WalkResult {
689 assert(region.hasOneBlock() && "region must contain one block");
690 for (auto &op : region.back().without_terminator())
713 mlir::Region ®ion, std::optional<mlir::Type> castToType) {
714 mlir::Location loc = region.getParentOp()->getLoc();
715 auto [value, maybeYield] = generateYieldedEntity(region, castToType);
729 if (auto temp = savedEntities.find(&lhsRegion); temp != savedEntities.end()) {
825 assert(cleanupRegion->hasOneBlock() && "region must contain one block");
908 MaskedArrayExpr::MaskedArrayExpr(mlir::Location loc, mlir::Region ®ion,
910 : loc{loc}, region{region}, isOuterMaskExpr{isOuterMaskExpr} {
911 mlir::Operation &terminator = region.back().back();
935 for (mlir::Operation &op : region.back().without_terminator())
949 for (mlir::Operation &op : region.back().without_terminator())
966 mlir::Operation &terminator = region.back().back();
990 for (mlir::Operation &op : region.back().without_terminator())
996 mlir::Operation &terminator = region.back().back();
1023 // Clone the clean-ups from the region itself, except for the destroy
1025 mlir::Operation &terminator = region.back().back();
1053 llvm::reverse(region.back().without_terminator()))
1063 // For the outer mask, the region clean-ups must be generated
1071 getAssignIfLeftHandSideRegion(mlir::Region ®ion) {
1072 auto assign = mlir::dyn_cast<hlfir::RegionAssignOp>(region.getParentOp());
1073 if (assign && (&assign.getLhsRegion() == ®ion))
1133 mlir::Region ®ion = *savedEntity.yieldRegion;
1136 getAssignIfLeftHandSideRegion(region)) {
1143 mlir::Location loc = region.getParentOp()->getLoc();
1144 // Evaluate the region inside the loop nest (if any).
1145 auto [clonedValue, oldYield] = generateYieldedEntity(region);
1157 region, fir::factory::SimpleCopy(loc, builder, entity, tempName));
1175 temp = insertSavedEntity(region,
1187 region, fir::factory::AnyValueStack{loc, builder, entityType});
1204 savedInCurrentRunBeforeUse.try_emplace(®ion, entity, oldYield);
1209 mlir::isa<hlfir::RegionAssignOp>(region.getParentOp())) {
1218 builder.setInsertionPointAfter(region.getParentOp());
1235 mlir::Region ®ion = *savedEntity.yieldRegion;
1236 mlir::Location loc = region.getParentOp()->getLoc();
1237 LhsValueAndCleanUp loweredLhs = generateYieldedLHS(loc, region);
1255 insertSavedEntity(region, fir::factory::AnyVectorSubscriptStack{
1275 temp = insertSavedEntity(region, fir::factory::SSARegister{});
1280 region, fir::factory::AnyVariableStack{loc, builder,