Lines Matching defs:shape
29 hlfir::getExplicitExtentsFromShape(mlir::Value shape,
32 auto *shapeOp = shape.getDefiningOp();
45 fir::ShapeType shapeTy = mlir::cast<fir::ShapeType>(shape.getType());
51 auto op = builder.create<hlfir::GetExtentOp>(shape.getLoc(), shape, i);
55 builder.createIntegerConstant(shape.getLoc(), indexTy, extent);
60 TODO(shape.getLoc(), "read fir.shape to get extents");
67 if (mlir::Value shape = var.getShape())
75 getExplicitLboundsFromShape(mlir::Value shape) {
77 auto *shapeOp = shape.getDefiningOp();
87 TODO(shape.getLoc(), "read fir.shape to get lower bounds");
93 if (mlir::Value shape = var.getShape())
94 return getExplicitLboundsFromShape(shape);
201 static bool isShapeWithLowerBounds(mlir::Value shape) {
202 if (!shape)
204 auto shapeTy = shape.getType();
268 mlir::Value shape{};
270 shape = genShape(loc, builder, value);
291 return builder.create<hlfir::AssociateOp>(loc, source, shape, lenParams,
295 return builder.create<hlfir::AssociateOp>(loc, source, name, shape, lenParams,
342 mlir::Value shape =
354 builder.create<fir::EmboxOp>(loc, boxType, addr, shape,
443 mlir::Value shape) {
444 assert((mlir::isa<fir::ShapeShiftType>(shape.getType()) ||
445 mlir::isa<fir::ShapeType>(shape.getType())) &&
446 "shape must contain extents");
447 auto extents = hlfir::getExplicitExtentsFromShape(shape, builder);
448 auto lowers = getExplicitLboundsFromShape(shape);
465 mlir::Value shape,
468 if (shape)
469 lbounds = getExplicitLboundsFromShape(shape);
523 // Use the type shape information, and/or the fir.box/fir.class shape
552 if (auto shape = tryRetrievingShapeOrShift(entity)) {
553 if (mlir::isa<fir::ShapeType>(shape.getType()))
554 return shape;
555 if (mlir::isa<fir::ShapeShiftType>(shape.getType()))
556 if (auto s = shape.getDefiningOp<fir::ShapeShiftOp>())
561 // There is no shape lying around for this entity. Retrieve the extents and
562 // build a new fir.shape.
569 mlir::Value shape) {
571 hlfir::getExplicitExtentsFromShape(shape, builder);
581 if (auto shape = tryRetrievingShapeOrShift(entity)) {
582 auto extents = hlfir::getExplicitExtentsFromShape(shape, builder);
591 // Use the type shape information, and/or the fir.box/fir.class shape
597 TODO(loc, "get extent from HLFIR expr without producer holding the shape");
604 if (auto shape = tryRetrievingShapeOrShift(entity)) {
605 auto lbounds = getExplicitLboundsFromShape(shape);
687 // Return a "shape" that can be used in fir.embox/fir.rebox with \p exv base.
690 mlir::Value shape) {
691 if (!shape)
692 return shape;
693 // fir.rebox does not need and does not accept extents (fir.shape or
698 !mlir::isa<fir::ShiftType>(shape.getType()))
700 return shape;
779 mlir::Value shape, bool isPolymorphic) {
780 unsigned rank = mlir::cast<fir::ShapeType>(shape.getType()).getRank();
782 if (auto shapeOp = shape.getDefiningOp<fir::ShapeOp>())
792 mlir::Value shape, mlir::ValueRange typeParams,
796 exprType = getArrayExprType(elementType, shape, !!polymorphicMold);
798 loc, exprType, shape, polymorphicMold, typeParams, isUnordered);
1124 /// hlfir.elemental_addr %shape : !fir.shape<1> {
1134 /// %expr = hlfir.elemental %shape : (!fir.shape<1>) -> hlfir.expr<?xT> {
1188 mlir::Value shape{};
1217 shape = hlfir::genShape(loc, builder, mold);
1218 auto extents = hlfir::getIndexExtents(loc, builder, shape);
1224 /*shape=*/std::nullopt, lenParams);
1228 builder.create<hlfir::DeclareOp>(loc, alloc, tmpName, shape, lenParams,
1249 mlir::Value shape{};
1258 shape = hlfir::genShape(loc, builder, mold);
1259 auto extents = hlfir::getIndexExtents(loc, builder, shape);
1264 /*shape=*/std::nullopt, lenParams);
1267 builder.create<hlfir::DeclareOp>(loc, alloc, tmpName, shape, lenParams,
1284 loc, res.getAddr(), ".temp.kindconvert", /*shape=*/nullptr,
1323 mlir::Value shape = hlfir::genShape(loc, builder, source);
1338 hlfir::genElementalOp(loc, builder, toType, shape, lenParams, genKernel,
1346 assert(shapeOp && "associate shape must be a fir.shape");
1379 hlfir::EvaluateInMemoryOp evalInMem, mlir::Value shape,
1383 hlfir::getIndexExtents(loc, builder, shape);
1398 loc, temp, tmpName, shape, typeParams,
1429 mlir::Value shape = hlfir::genShape(loc, builder, entity);
1431 hlfir::getExplicitExtentsFromShape(shape, builder);
1432 if (shape.getUses().empty())
1433 shape.getDefiningOp()->erase();