Lines Matching refs:fir
19 static fir::CharacterType getCharacterType(mlir::Type type) { in getCharacterType()
20 if (auto boxType = type.dyn_cast<fir::BoxCharType>()) in getCharacterType()
22 if (auto refType = type.dyn_cast<fir::ReferenceType>()) in getCharacterType()
24 if (auto seqType = type.dyn_cast<fir::SequenceType>()) { in getCharacterType()
28 if (auto charType = type.dyn_cast<fir::CharacterType>()) in getCharacterType()
33 static fir::CharacterType getCharacterType(const fir::CharBoxValue &box) { in getCharacterType()
37 static bool needToMaterialize(const fir::CharBoxValue &box) { in needToMaterialize()
38 return box.getBuffer().getType().isa<fir::SequenceType>() || in needToMaterialize()
39 box.getBuffer().getType().isa<fir::CharacterType>(); in needToMaterialize()
42 static std::optional<fir::SequenceType::Extent>
43 getCompileTimeLength(const fir::CharBoxValue &box) { in getCompileTimeLength()
46 if (type.isa<fir::CharacterType>()) in getCompileTimeLength()
48 if (auto refType = type.dyn_cast<fir::ReferenceType>()) in getCompileTimeLength()
50 if (auto seqType = type.dyn_cast<fir::SequenceType>()) { in getCompileTimeLength()
53 if (shape[0] != fir::SequenceType::getUnknownExtent()) in getCompileTimeLength()
59 fir::CharBoxValue Fortran::lower::CharacterExprHelper::materializeValue( in materializeValue()
60 const fir::CharBoxValue &str) { in materializeValue()
63 auto variable = builder.create<fir::AllocaOp>(loc, str.getBuffer().getType()); in materializeValue()
64 builder.create<fir::StoreOp>(loc, str.getBuffer(), variable); in materializeValue()
68 fir::CharBoxValue
76 fir::ExtendedValue
85 if (auto refType = type.dyn_cast<fir::ReferenceType>()) in toExtendedValue()
88 if (auto arrayType = type.dyn_cast<fir::SequenceType>()) { in toExtendedValue()
92 if (!resultLen && cstLen != fir::SequenceType::getUnknownExtent()) in toExtendedValue()
96 llvm::ArrayRef<fir::SequenceType::Extent>{shape}.drop_front(); in toExtendedValue()
99 if (extent == fir::SequenceType::getUnknownExtent()) in toExtendedValue()
109 } else if (type.isa<fir::CharacterType>()) { in toExtendedValue()
112 } else if (auto boxCharType = type.dyn_cast<fir::BoxCharType>()) { in toExtendedValue()
115 builder.create<fir::UnboxCharOp>(loc, refType, lenType, character); in toExtendedValue()
119 } else if (type.isa<fir::BoxType>()) { in toExtendedValue()
128 return fir::CharArrayBoxValue{base, resultLen, extents}; in toExtendedValue()
129 return fir::CharBoxValue{base, resultLen}; in toExtendedValue()
134 const fir::CharBoxValue &box) const { in getReferenceType()
139 Fortran::lower::CharacterExprHelper::createEmbox(const fir::CharBoxValue &box) { in createEmbox()
145 auto boxCharType = fir::BoxCharType::get(builder.getContext(), kind); in createEmbox()
157 return builder.create<fir::EmboxCharOp>(loc, boxCharType, buff, len); in createEmbox()
161 const fir::CharBoxValue &str, mlir::Value index) { in createLoadCharAt()
164 if (str.getBuffer().getType().isa<fir::CharacterType>()) in createLoadCharAt()
166 auto addr = builder.create<fir::CoordinateOp>(loc, getReferenceType(str), in createLoadCharAt()
168 return builder.create<fir::LoadOp>(loc, addr); in createLoadCharAt()
172 const fir::CharBoxValue &str, mlir::Value index, mlir::Value c) { in createStoreCharAt()
174 auto addr = builder.create<fir::CoordinateOp>(loc, getReferenceType(str), in createStoreCharAt()
176 builder.create<fir::StoreOp>(loc, c, addr); in createStoreCharAt()
180 const fir::CharBoxValue &dest, const fir::CharBoxValue &src, in createCopy()
190 const fir::CharBoxValue &str, mlir::Value lower, mlir::Value upper) { in createPadding()
200 fir::CharBoxValue
203 assert(type.isa<fir::CharacterType>() && "expected fir character type"); in createTemp()
211 const fir::CharBoxValue &lhs, const fir::CharBoxValue &rhs) { in createLengthOneAssign()
216 val = builder.create<fir::LoadOp>(loc, val); in createLengthOneAssign()
219 if (auto seqTy = valTy.dyn_cast<fir::SequenceType>()) { in createLengthOneAssign()
222 val = builder.create<fir::ExtractValueOp>(loc, valTy, val, zero); in createLengthOneAssign()
224 auto addrTy = fir::ReferenceType::get(valTy); in createLengthOneAssign()
226 assert(fir::dyn_cast_ptrEleTy(addr.getType()) == val.getType()); in createLengthOneAssign()
227 builder.create<fir::StoreOp>(loc, val, addr); in createLengthOneAssign()
231 const fir::CharBoxValue &lhs, const fir::CharBoxValue &rhs) { in createAssign()
249 fir::CharBoxValue safeRhs = rhs; in createAssign()
276 fir::CharBoxValue Fortran::lower::CharacterExprHelper::createConcatenate( in createConcatenate()
277 const fir::CharBoxValue &lhs, const fir::CharBoxValue &rhs) { in createConcatenate()
296 fir::CharBoxValue Fortran::lower::CharacterExprHelper::createSubstring( in createSubstring()
297 const fir::CharBoxValue &box, llvm::ArrayRef<mlir::Value> bounds) { in createSubstring()
319 auto substringRef = builder.create<fir::CoordinateOp>( in createSubstring()
343 const fir::CharBoxValue &str) { in createLenTrim()
355 auto iterWhile = builder.create<fir::IterWhileOp>( in createLenTrim()
366 builder.create<fir::ResultOp>(loc, results); in createLenTrim()
378 assert(type.isa<fir::CharacterType>() && "expected fir character type"); in createTemp()
380 fir::SequenceType::Shape shape{len}; in createTemp()
381 auto seqType = fir::SequenceType::get(shape, type); in createTemp()
382 return builder.create<fir::AllocaOp>(loc, seqType); in createTemp()
388 fir::CharacterType type) { in createBlankConstantCode()
395 fir::CharacterType type) { in createBlankConstant()
430 createAssign(fir::CharBoxValue{lptr, llen}, fir::CharBoxValue{rptr, rlen}); in createAssign()
443 return createEmbox(fir::CharBoxValue{addr, len}); in createEmboxChar()
467 if (auto seqType = type.dyn_cast<fir::SequenceType>()) in isCharacterLiteral()
469 seqType.getEleTy().isa<fir::CharacterType>(); in isCharacterLiteral()
474 if (type.isa<fir::BoxCharType>()) in isCharacter()
476 if (auto refType = type.dyn_cast<fir::ReferenceType>()) in isCharacter()
478 if (auto seqType = type.dyn_cast<fir::SequenceType>()) in isCharacter()
481 return type.isa<fir::CharacterType>(); in isCharacter()