Lines Matching defs:box

52 /// If this turns out to cause performance regressions, a dedicated fir.box
53 /// "discretization pass" would make more sense to cover all the fir.box usage
132 const fir::MutableBoxValue &box,
136 box.isPointer()
141 llvm::SmallVector<mlir::Value> args{box.getAddr(), dimIndex, lowerBound,
153 const fir::MutableBoxValue &box,
156 box.isPointer()
166 args.push_back(builder.createConvert(loc, inputTypes[0], box.getAddr()));
169 kind = mlir::cast<fir::CharacterType>(box.getEleTy()).getFKind();
171 int rank = box.rank();
182 const fir::MutableBoxValue &box,
185 box.isPointer()
190 box.getAddr(), errorManager.hasStat, errorManager.errMsgAddr,
202 const fir::MutableBoxValue &box,
206 box.isPointer()
212 box.getAddr(), fir::getBase(source),
224 const fir::MutableBoxValue &box,
227 box.isPointer()
233 fir::factory::getMutableIRBox(builder, loc, box), fir::getBase(mold),
245 const fir::MutableBoxValue &box,
248 // Ensure fir.box is up-to-date before passing it to deallocate runtime.
249 mlir::Value boxAddress = fir::factory::getMutableIRBox(builder, loc, box);
253 if (box.isPolymorphic() || box.isUnlimitedPolymorphic()) {
254 callee = box.isPointer()
266 callee = box.isPointer()
414 const fir::MutableBoxValue &box) {
446 fir::factory::genInlinedAllocation(builder, loc, box, lbounds, extents,
471 const fir::MutableBoxValue &box) {
474 bool inlineAllocation = !box.isDerived() && !errorManager.hasStatSpec() &&
477 !box.isPointer();
483 genInlinedAllocation(alloc, box);
491 genAllocateObjectInit(box);
495 genSetType(alloc, box, loc);
496 genSetDeferredLengthParameters(alloc, box);
497 genAllocateObjectBounds(alloc, box);
500 stat = genRuntimeAllocate(builder, loc, box, errorManager);
504 genCudaAllocate(builder, loc, box, errorManager, alloc.getSymbol());
506 fir::factory::syncMutableBoxFromIRBox(builder, loc, box);
535 // Set length parameters in the box stored in boxAddr.
539 const fir::MutableBoxValue &box) {
545 if (box.isCharacter())
546 genRuntimeInitCharacter(builder, loc, box, lenParams[0]);
548 if (box.isDerived())
552 void genAllocateObjectInit(const fir::MutableBoxValue &box) {
553 if (box.isPointer()) {
559 builder, loc, box.getBoxTy(), box.nonDeferredLenParams());
560 builder.create<fir::StoreOp>(loc, nullPointer, box.getAddr());
562 assert(box.isAllocatable() && "must be an allocatable");
565 fir::factory::getMutableIRBox(builder, loc, box);
570 const fir::MutableBoxValue &box) {
589 genRuntimeSetBounds(builder, loc, box, dimIndex, lb, ub);
597 assert(sourceBox && "source expression should be lowered to one box");
608 genRuntimeSetBounds(builder, loc, box, dimIndex, lb, ub);
614 const fir::MutableBoxValue &box, bool isSource) {
619 genAllocateObjectInit(box);
625 box.isCharacter() && !box.hasNonDeferredLenParams();
629 genRuntimeAllocateApplyMold(builder, loc, box, exv,
632 genSetDeferredLengthParameters(alloc, box);
633 genAllocateObjectBounds(alloc, box);
637 genCudaAllocate(builder, loc, box, errorManager, alloc.getSymbol());
640 stat = genRuntimeAllocateSource(builder, loc, box, exv, errorManager);
642 stat = genRuntimeAllocate(builder, loc, box, errorManager);
645 fir::factory::syncMutableBoxFromIRBox(builder, loc, box);
652 void genInitDerived(const fir::MutableBoxValue &box, mlir::Value typeDescAddr,
655 box.isPointer()
664 args.push_back(builder.createConvert(loc, inputTypes[0], box.getAddr()));
678 void genInitIntrinsic(const fir::MutableBoxValue &box,
682 box.isPointer()
691 args.push_back(builder.createConvert(loc, inputTypes[0], box.getAddr()));
709 void genSetType(const Allocation &alloc, const fir::MutableBoxValue &box,
723 fir::isUnlimitedPolymorphicType(fir::getBase(box).getType())) {
726 builder, loc, box, lenParams[0],
731 box, typeSpec->AsIntrinsic()->category(),
744 genInitDerived(box, typeDescAddr, alloc.getSymbol().Rank());
757 const fir::MutableBoxValue &box,
779 loc, retTy, box.getAddr(), errmsg, stream, pinned, source, cudaAttr,
833 const fir::MutableBoxValue &box,
848 loc, retTy, box.getAddr(), errmsg, cudaAttr,
857 const fir::MutableBoxValue &box, ErrorManager &errorManager,
863 !box.isDerived() && !box.isPolymorphic() && !box.hasAssumedRank() &&
864 !box.isUnlimitedPolymorphic() && !errorManager.hasStatSpec() &&
865 !useAllocateRuntime && !box.isPointer();
871 mlir::Value ret = fir::factory::genFreemem(builder, loc, box);
882 genRuntimeDeallocate(builder, loc, box, errorManager, declaredTypeDesc);
884 stat = genCudaDeallocate(builder, loc, box, errorManager, *symbol);
885 fir::factory::syncMutableBoxFromIRBox(builder, loc, box);
894 const fir::MutableBoxValue &box, mlir::Location loc,
901 genDeallocate(builder, converter, loc, box, errorManager, declaredTypeDesc,
907 const fir::MutableBoxValue &box, mlir::Location loc,
911 fir::factory::genIsAllocatedOrAssociatedTest(builder, loc, box);
914 if (mlir::Type eleType = box.getEleTy();
915 mlir::isa<fir::RecordType>(eleType) && box.isPolymorphic()) {
918 genDeallocateBox(converter, box, loc, sym, declaredTypeDesc);
920 genDeallocateBox(converter, box, loc, sym);
950 fir::MutableBoxValue box =
953 if (box.isPolymorphic()) {
954 mlir::Type eleType = box.getEleTy();
963 builder, converter, loc, box, errorManager, declaredTypeDesc, &symbol);
1029 // Pointers to non contiguous arrays need to be represented with a fir.box to
1090 fir::MutableBoxValue box(boxAddr, nonDeferredParams, mutableProperties);
1093 fir::factory::disassociateMutableBox(builder, loc, box,
1096 return box;
1112 const fir::MutableBoxValue &box, const Fortran::lower::SomeExpr &source,
1116 fir::factory::disassociateMutableBox(builder, loc, box);
1117 cuf::genPointerSync(box.getAddr(), builder);
1122 fir::factory::associateMutableBox(builder, loc, box, rhs, lbounds);
1123 cuf::genPointerSync(box.getAddr(), builder);
1127 // typically be represented as a value of type `!fir.box`. However, an
1135 fir::factory::associateMutableBox(builder, loc, box, rhs, lbounds);
1154 const Fortran::semantics::Symbol &sym, mlir::Value box) {
1155 // Read length from fir.box (explicit expr cannot safely be re-evaluated
1159 builder.create<fir::LoadOp>(loc, fir::getBase(box)).getResult();
1169 fir::getBase(box));