Lines Matching defs:box
36 // Convert FIR type to LLVM without turning fir.box<T> into memory
63 /// values, particularly to fit them from abstract box types to the
96 /// Construct code sequence to extract the specific value from a `fir.box`.
98 mlir::Location loc, TypePair boxTy, mlir::Value box, mlir::Type resultTy,
100 if (mlir::isa<mlir::LLVM::LLVMPointerType>(box.getType())) {
103 loc, pty, boxTy.llvm, box,
111 return rewriter.create<mlir::LLVM::ExtractValueOp>(loc, box, boxValue);
115 /// from a box.
118 mlir::Value box, mlir::Value dim,
121 loadDimFieldFromBox(loc, boxTy, box, dim, 0, retTys[0], rewriter);
123 loadDimFieldFromBox(loc, boxTy, box, dim, 1, retTys[1], rewriter);
125 loadDimFieldFromBox(loc, boxTy, box, dim, 2, retTys[2], rewriter);
131 mlir::Value box, int dim, mlir::ConversionPatternRewriter &rewriter) const {
133 getDimFieldFromBox(loc, boxTy, box, dim, 0, retTys[0], rewriter);
135 getDimFieldFromBox(loc, boxTy, box, dim, 1, retTys[1], rewriter);
137 getDimFieldFromBox(loc, boxTy, box, dim, 2, retTys[2], rewriter);
142 mlir::Location loc, TypePair boxTy, mlir::Value box, mlir::Value dim,
144 assert(mlir::isa<mlir::LLVM::LLVMPointerType>(box.getType()) &&
147 mlir::LLVM::GEPOp p = genGEP(loc, boxTy.llvm, rewriter, box, 0,
155 mlir::Location loc, TypePair boxTy, mlir::Value box, int dim, int off,
157 if (mlir::isa<mlir::LLVM::LLVMPointerType>(box.getType())) {
158 mlir::LLVM::GEPOp p = genGEP(loc, boxTy.llvm, rewriter, box, 0,
165 loc, box, llvm::ArrayRef<std::int64_t>{kDimsPosInBox, dim, off});
169 mlir::Location loc, TypePair boxTy, mlir::Value box, unsigned dim,
172 return getDimFieldFromBox(loc, boxTy, box, dim, kDimStridePos, idxTy,
176 /// Read base address from a fir.box. Returned address has type ty.
178 mlir::Location loc, TypePair boxTy, mlir::Value box,
181 return getValueFromBox(loc, boxTy, box, resultTy, rewriter, kAddrPosInBox);
185 mlir::Location loc, mlir::Type resultTy, TypePair boxTy, mlir::Value box,
187 return getValueFromBox(loc, boxTy, box, resultTy, rewriter, kElemLenPosInBox);
190 /// Read base address from a fir.box. Returned address has type ty.
192 mlir::Location loc, TypePair boxTy, mlir::Value box,
195 return getValueFromBox(loc, boxTy, box, resultTy, rewriter, kRankPosInBox);
198 /// Read the extra field from a fir.box.
200 mlir::Location loc, TypePair boxTy, mlir::Value box,
203 return getValueFromBox(loc, boxTy, box, resultTy, rewriter, kExtraPosInBox);
220 "request for invalid box element type");
226 // Return LLVM type of the object described by a fir.box of \p boxType.
230 assert(objectType && "boxType must be a box type");
234 /// Read the address of the type descriptor from a box.
236 mlir::Location loc, TypePair boxTy, mlir::Value box,
240 return getValueFromBox(loc, boxTy, box, tdescType, rewriter, typeDescFieldId);
243 // Load the attribute from the \p box and perform a check against \p maskValue
246 mlir::Location loc, TypePair boxTy, mlir::Value box,
250 getValueFromBox(loc, boxTy, box, attrTy, rewriter, kAttributePosInBox);
260 mlir::Location loc, TypePair boxTy, mlir::Value box,
273 mlir::Value rawRank = getRankFromBox(loc, boxTy, box, rewriter);