FLANG
DirectivesCommon.h
1//===-- Lower/DirectivesCommon.h --------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
10//
11//===----------------------------------------------------------------------===//
16//===----------------------------------------------------------------------===//
17
18#ifndef FORTRAN_LOWER_DIRECTIVES_COMMON_H
19#define FORTRAN_LOWER_DIRECTIVES_COMMON_H
20
21#include "flang/Evaluate/tools.h"
22#include "flang/Lower/AbstractConverter.h"
23#include "flang/Lower/Bridge.h"
24#include "flang/Lower/ConvertVariable.h"
25#include "flang/Lower/OpenACC.h"
26#include "flang/Lower/OpenMP.h"
27#include "flang/Lower/PFTBuilder.h"
28#include "flang/Lower/StatementContext.h"
29#include "flang/Lower/Support/Utils.h"
30#include "flang/Optimizer/Builder/DirectivesCommon.h"
31#include "flang/Optimizer/Builder/HLFIRTools.h"
32#include "flang/Optimizer/Dialect/FIRType.h"
33#include "flang/Parser/parse-tree.h"
34#include "flang/Semantics/tools.h"
35#include "mlir/IR/Value.h"
36#include <list>
37#include <type_traits>
38
39namespace Fortran {
40namespace lower {
41
44template <typename... TerminatorOps>
46 fir::FirOpBuilder &builder,
47 std::list<Fortran::lower::pft::Evaluation> &evaluationList) {
48 mlir::Region *region = &builder.getRegion();
49 for (Fortran::lower::pft::Evaluation &eval : evaluationList) {
50 if (eval.block) {
51 if (eval.block->empty()) {
52 eval.block->erase();
53 eval.block = builder.createBlock(region);
54 } else {
55 [[maybe_unused]] mlir::Operation &terminatorOp = eval.block->back();
56 assert(mlir::isa<TerminatorOps...>(terminatorOp) &&
57 "expected terminator op");
58 }
59 }
60 if (!eval.isDirective() && eval.hasNestedEvaluations())
61 createEmptyRegionBlocks<TerminatorOps...>(builder,
62 eval.getNestedEvaluations());
63 }
64}
65
67getDataOperandBaseAddr(Fortran::lower::AbstractConverter &converter,
68 fir::FirOpBuilder &builder,
69 Fortran::lower::SymbolRef sym, mlir::Location loc,
70 bool unwrapFirBox = true) {
71 return fir::factory::getDataOperandBaseAddr(
72 builder, converter.getSymbolAddress(sym),
73 Fortran::semantics::IsOptional(sym), loc, unwrapFirBox);
74}
75
76namespace detail {
77template <typename T> //
78T &&AsRvalueRef(T &&t) {
79 return std::move(t);
80}
81template <typename T> //
82T AsRvalueRef(T &t) {
83 return t;
84}
85template <typename T> //
86T AsRvalueRef(const T &t) {
87 return t;
88}
89
90// Helper class for stripping enclosing parentheses and a conversion that
91// preserves type category. This is used for triplet elements, which are
92// always of type integer(kind=8). The lower/upper bounds are converted to
93// an "index" type, which is 64-bit, so the explicit conversion to kind=8
94// (if present) is not needed. When it's present, though, it causes generated
95// names to contain "int(..., kind=8)".
97 template <Fortran::common::TypeCategory Category, typename T>
98 static Fortran::semantics::MaybeExpr visit_with_category(const T &x) {
100 if constexpr (Fortran::evaluate::IsSpecificIntrinsicType<Ty>) {
101 // GCC 7 workaround: Using Convert<Type<Category>, Category> in a
102 // parameter type of a SFINAE'd overload instantiates it and trips its
103 // static_assert. Use if constexpr instead of std::enable_if.
104 if constexpr (std::is_same_v<T,
106 return AsGenericExpr(AsRvalueRef(x.left()));
107 }
108 }
109 return std::nullopt;
110 }
111
112 template <Fortran::common::TypeCategory Category>
113 static Fortran::semantics::MaybeExpr visit(
115 return Fortran::common::visit(
116 [](auto &&s) { return visit_with_category<Category>(s); }, expr.u);
117 }
118 static Fortran::semantics::MaybeExpr
120 return Fortran::common::visit([](auto &&s) { return visit(s); }, expr.u);
121 }
122 template <typename T> //
123 static Fortran::semantics::MaybeExpr visit(const T &) {
124 return std::nullopt;
125 }
126};
127
128static inline Fortran::semantics::SomeExpr
129peelOuterConvert(Fortran::semantics::SomeExpr &expr) {
130 if (auto peeled = PeelConvert::visit(expr))
131 return *peeled;
132 return expr;
133}
134} // namespace detail
135
138template <typename BoundsOp, typename BoundsType>
140genBoundsOps(fir::FirOpBuilder &builder, mlir::Location loc,
143 const std::vector<Fortran::evaluate::Subscript> &subscripts,
144 std::stringstream &asFortran, fir::ExtendedValue &dataExv,
145 bool dataExvIsAssumedSize, fir::factory::AddrAndBoundsInfo &info,
146 bool treatIndexAsSection = false,
147 bool strideIncludeLowerExtent = false) {
148 int dimension = 0;
149 mlir::Type idxTy = builder.getIndexType();
150 mlir::Type boundTy = builder.getType<BoundsType>();
152
153 mlir::Value zero = builder.createIntegerConstant(loc, idxTy, 0);
154 mlir::Value one = builder.createIntegerConstant(loc, idxTy, 1);
155 const int dataExvRank = static_cast<int>(dataExv.rank());
156 mlir::Value cumulativeExtent = one;
157 for (const auto &subscript : subscripts) {
158 const auto *triplet{std::get_if<Fortran::evaluate::Triplet>(&subscript.u)};
159 if (triplet || treatIndexAsSection) {
160 if (dimension != 0)
161 asFortran << ',';
162 mlir::Value lbound, ubound, extent;
163 std::optional<std::int64_t> lval, uval;
164 mlir::Value baseLb =
165 fir::factory::readLowerBound(builder, loc, dataExv, dimension, one);
166 bool defaultLb = baseLb == one;
167 mlir::Value stride = one;
168 bool strideInBytes = false;
169
170 auto genSourceExtent = [&]() -> mlir::Value {
171 if (info.isPresent && mlir::isa<fir::BaseBoxType>(
172 fir::unwrapRefType(info.addr.getType()))) {
173 return builder
174 .genIfOp(loc, idxTy, info.isPresent, /*withElseRegion=*/true)
175 .genThen([&]() {
176 mlir::Value ext =
177 fir::factory::readExtent(builder, loc, dataExv, dimension);
178 fir::ResultOp::create(builder, loc, ext);
179 })
180 .genElse([&] {
181 mlir::Value zero = builder.createIntegerConstant(loc, idxTy, 0);
182 fir::ResultOp::create(builder, loc, zero);
183 })
184 .getResults()[0];
185 }
186 return fir::factory::readExtent(builder, loc, dataExv, dimension);
187 };
188
189 if (mlir::isa<fir::BaseBoxType>(
190 fir::unwrapRefType(info.addr.getType()))) {
191 if (info.isPresent) {
192 stride =
193 builder
194 .genIfOp(loc, idxTy, info.isPresent, /*withElseRegion=*/true)
195 .genThen([&]() {
196 mlir::Value box =
197 !fir::isBoxAddress(info.addr.getType())
198 ? info.addr
199 : fir::LoadOp::create(builder, loc, info.addr);
200 mlir::Value d =
201 builder.createIntegerConstant(loc, idxTy, dimension);
202 auto dimInfo = fir::BoxDimsOp::create(builder, loc, idxTy,
203 idxTy, idxTy, box, d);
204 fir::ResultOp::create(builder, loc,
205 dimInfo.getByteStride());
206 })
207 .genElse([&] {
208 mlir::Value zero =
209 builder.createIntegerConstant(loc, idxTy, 0);
210 fir::ResultOp::create(builder, loc, zero);
211 })
212 .getResults()[0];
213 } else {
214 mlir::Value box = !fir::isBoxAddress(info.addr.getType())
215 ? info.addr
216 : fir::LoadOp::create(builder, loc, info.addr);
217 mlir::Value d = builder.createIntegerConstant(loc, idxTy, dimension);
218 auto dimInfo =
219 fir::BoxDimsOp::create(builder, loc, idxTy, idxTy, idxTy, box, d);
220 stride = dimInfo.getByteStride();
221 }
222 strideInBytes = true;
223 }
224
225 Fortran::semantics::MaybeExpr lower;
226 if (triplet) {
227 lower = Fortran::evaluate::AsGenericExpr(triplet->lower());
228 } else {
229 // Case of IndirectSubscriptIntegerExpr
230 using IndirectSubscriptIntegerExpr =
231 Fortran::evaluate::IndirectSubscriptIntegerExpr;
232 using SubscriptInteger = Fortran::evaluate::SubscriptInteger;
234 std::get<IndirectSubscriptIntegerExpr>(subscript.u).value();
235 lower = Fortran::evaluate::AsGenericExpr(std::move(oneInt));
236 if (lower->Rank() > 0) {
237 mlir::emitError(
238 loc, "vector subscript cannot be used for an array section");
239 break;
240 }
241 }
242 if (lower) {
243 lval = Fortran::evaluate::ToInt64(*lower);
244 if (lval) {
245 if (defaultLb) {
246 lbound = builder.createIntegerConstant(loc, idxTy, *lval - 1);
247 } else {
248 mlir::Value lb = builder.createIntegerConstant(loc, idxTy, *lval);
249 lbound = mlir::arith::SubIOp::create(builder, loc, lb, baseLb);
250 }
251 asFortran << *lval;
252 } else {
253 mlir::Value lb =
254 fir::getBase(converter.genExprValue(loc, *lower, stmtCtx));
255 lb = builder.createConvert(loc, baseLb.getType(), lb);
256 lbound = mlir::arith::SubIOp::create(builder, loc, lb, baseLb);
257 asFortran << detail::peelOuterConvert(*lower).AsFortran();
258 }
259 } else {
260 // If the lower bound is not specified, then the section
261 // starts from offset 0 of the dimension.
262 // Note that the lowerbound in the BoundsOp is always 0-based.
263 lbound = zero;
264 }
265
266 if (!triplet) {
267 // If it is a scalar subscript, then the upper bound
268 // is equal to the lower bound, and the extent is one.
269 ubound = lbound;
270 extent = one;
271 } else {
272 asFortran << ':';
273 Fortran::semantics::MaybeExpr upper =
274 Fortran::evaluate::AsGenericExpr(triplet->upper());
275
276 if (upper) {
277 uval = Fortran::evaluate::ToInt64(*upper);
278 if (uval) {
279 if (defaultLb) {
280 ubound = builder.createIntegerConstant(loc, idxTy, *uval - 1);
281 } else {
282 mlir::Value ub = builder.createIntegerConstant(loc, idxTy, *uval);
283 ubound = mlir::arith::SubIOp::create(builder, loc, ub, baseLb);
284 }
285 asFortran << *uval;
286 } else {
287 mlir::Value ub =
288 fir::getBase(converter.genExprValue(loc, *upper, stmtCtx));
289 ub = builder.createConvert(loc, baseLb.getType(), ub);
290 ubound = mlir::arith::SubIOp::create(builder, loc, ub, baseLb);
291 asFortran << detail::peelOuterConvert(*upper).AsFortran();
292 }
293 }
294 if (lower && upper) {
295 if (lval && uval && *uval < *lval) {
296 mlir::emitError(loc, "zero sized array section");
297 break;
298 } else {
299 // Stride is mandatory in evaluate::Triplet. Make sure it's 1.
300 auto val = Fortran::evaluate::ToInt64(triplet->GetStride());
301 if (!val || *val != 1) {
302 mlir::emitError(loc, "stride cannot be specified on "
303 "an array section");
304 break;
305 }
306 }
307 }
308
309 extent = genSourceExtent();
310
311 if (dataExvIsAssumedSize && dimension + 1 == dataExvRank) {
312 extent = zero;
313 if (ubound && lbound) {
314 mlir::Value diff =
315 mlir::arith::SubIOp::create(builder, loc, ubound, lbound);
316 extent = mlir::arith::AddIOp::create(builder, loc, diff, one);
317 }
318 if (!ubound)
319 ubound = lbound;
320 }
321
322 if (!ubound) {
323 // ub = extent - 1
324 ubound = mlir::arith::SubIOp::create(builder, loc, extent, one);
325 }
326 }
327
328 // When the strideInBytes is true, it means the stride is from descriptor
329 // and this already includes the lower extents.
330 if (strideIncludeLowerExtent && !strideInBytes) {
331 stride = cumulativeExtent;
332 mlir::Value strideExtent = extent;
333 if (!triplet && dimension + 1 < dataExvRank)
334 strideExtent = genSourceExtent();
335 cumulativeExtent = builder.createOrFold<mlir::arith::MulIOp>(
336 loc, cumulativeExtent, strideExtent);
337 }
338
339 mlir::Value bound =
340 BoundsOp::create(builder, loc, boundTy, lbound, ubound, extent,
341 stride, strideInBytes, baseLb);
342 bounds.push_back(bound);
343 ++dimension;
344 }
345 }
346 return bounds;
347}
348
349namespace detail {
350template <typename Ref, typename Expr> //
351std::optional<Ref> getRef(Expr &&expr) {
352 if constexpr (std::is_same_v<llvm::remove_cvref_t<Expr>,
354 if (auto *ref = std::get_if<Ref>(&expr.u))
355 return *ref;
356 return std::nullopt;
357 } else {
358 auto maybeRef = Fortran::evaluate::ExtractDataRef(expr);
359 if (!maybeRef || !std::holds_alternative<Ref>(maybeRef->u))
360 return std::nullopt;
361 return std::get<Ref>(maybeRef->u);
362 }
363}
364} // namespace detail
365
366template <typename BoundsOp, typename BoundsType>
367fir::factory::AddrAndBoundsInfo gatherDataOperandAddrAndBounds(
368 Fortran::lower::AbstractConverter &converter, fir::FirOpBuilder &builder,
369 semantics::SemanticsContext &semaCtx,
370 Fortran::lower::StatementContext &stmtCtx,
371 Fortran::semantics::SymbolRef symbol,
372 const Fortran::semantics::MaybeExpr &maybeDesignator,
373 mlir::Location operandLocation, std::stringstream &asFortran,
374 llvm::SmallVector<mlir::Value> &bounds, bool treatIndexAsSection = false,
375 bool unwrapFirBox = true, bool genDefaultBounds = true,
376 bool strideIncludeLowerExtent = false,
377 bool loadAllocatableAndPointerComponent = true) {
378 using namespace Fortran;
379
380 fir::factory::AddrAndBoundsInfo info;
381
382 if (!maybeDesignator) {
383 info = getDataOperandBaseAddr(converter, builder, symbol, operandLocation,
384 unwrapFirBox);
385 asFortran << symbol->name().ToString();
386 return info;
387 }
388
389 semantics::SomeExpr designator = *maybeDesignator;
390
391 if ((designator.Rank() > 0 || treatIndexAsSection) &&
392 IsArrayElement(designator)) {
393 auto arrayRef = detail::getRef<evaluate::ArrayRef>(designator);
394 // This shouldn't fail after IsArrayElement(designator).
395 assert(arrayRef && "Expecting ArrayRef");
396
397 fir::ExtendedValue dataExv;
398 bool dataExvIsAssumedSize = false;
399
400 auto toMaybeExpr = [&](auto &&base) {
401 using BaseType = llvm::remove_cvref_t<decltype(base)>;
402 evaluate::ExpressionAnalyzer ea{semaCtx};
403
404 if constexpr (std::is_same_v<evaluate::NamedEntity, BaseType>) {
405 if (auto *ref = base.UnwrapSymbolRef())
406 return ea.Designate(evaluate::DataRef{*ref});
407 if (auto *ref = base.UnwrapComponent())
408 return ea.Designate(evaluate::DataRef{*ref});
409 llvm_unreachable("Unexpected NamedEntity");
410 } else {
411 static_assert(std::is_same_v<semantics::SymbolRef, BaseType>);
412 return ea.Designate(evaluate::DataRef{base});
413 }
414 };
415
416 auto arrayBase = toMaybeExpr(arrayRef->base());
417 assert(arrayBase);
418
419 if (auto comp = detail::getRef<evaluate::Component>(*arrayBase)) {
420 if (!loadAllocatableAndPointerComponent &&
421 semantics::IsAllocatableOrPointer(comp->symbol()))
422 dataExv = converter.genExprMutableBox(operandLocation, *arrayBase);
423 else
424 dataExv = converter.genExprAddr(operandLocation, *arrayBase, stmtCtx);
425 info.addr = fir::getBase(dataExv);
426 info.rawInput = info.addr;
427 asFortran << arrayBase->AsFortran();
428 } else {
429 const semantics::Symbol &sym = arrayRef->GetLastSymbol();
430 dataExvIsAssumedSize =
431 Fortran::semantics::IsAssumedSizeArray(sym.GetUltimate());
432 info = getDataOperandBaseAddr(converter, builder, sym, operandLocation,
433 unwrapFirBox);
434 dataExv = converter.getSymbolExtendedValue(sym);
435 asFortran << sym.name().ToString();
436 }
437
438 if (!arrayRef->subscript().empty()) {
439 asFortran << '(';
441 builder, operandLocation, converter, stmtCtx, arrayRef->subscript(),
442 asFortran, dataExv, dataExvIsAssumedSize, info, treatIndexAsSection,
443 strideIncludeLowerExtent);
444 }
445 asFortran << ')';
446 } else if (auto compRef = detail::getRef<evaluate::Component>(designator)) {
447 fir::ExtendedValue compExv;
448 if (!loadAllocatableAndPointerComponent &&
449 semantics::IsAllocatableOrPointer(compRef->symbol()))
450 compExv = converter.genExprMutableBox(operandLocation, designator);
451 else
452 compExv = converter.genExprAddr(operandLocation, designator, stmtCtx);
453 info.addr = fir::getBase(compExv);
454 info.rawInput = info.addr;
455 if (genDefaultBounds &&
456 mlir::isa<fir::SequenceType>(fir::unwrapRefType(info.addr.getType())))
458 builder, operandLocation, compExv,
459 /*isAssumedSize=*/false, strideIncludeLowerExtent);
460 asFortran << designator.AsFortran();
461
462 if (semantics::IsOptional(compRef->GetLastSymbol())) {
463 info.isPresent = fir::IsPresentOp::create(
464 builder, operandLocation, builder.getI1Type(), info.rawInput);
465 }
466
467 if (unwrapFirBox) {
468 if (auto loadOp =
469 mlir::dyn_cast_or_null<fir::LoadOp>(info.addr.getDefiningOp())) {
470 if (fir::isAllocatableType(loadOp.getType()) ||
471 fir::isPointerType(loadOp.getType())) {
472 info.boxType = info.addr.getType();
473 info.addr =
474 fir::BoxAddrOp::create(builder, operandLocation, info.addr);
475 }
476 info.rawInput = info.addr;
477 }
478 }
479
480 // If the component is an allocatable or pointer the result of
481 // genExprAddr will be the result of a fir.box_addr operation or
482 // a fir.box_addr has been inserted just before.
483 // Retrieve the box so we handle it like other descriptor.
484 if (auto boxAddrOp =
485 mlir::dyn_cast_or_null<fir::BoxAddrOp>(info.addr.getDefiningOp())) {
486 info.addr = boxAddrOp.getVal();
487 info.boxType = info.addr.getType();
488 info.rawInput = info.addr;
489 if (genDefaultBounds)
491 builder, operandLocation, compExv, info);
492 }
493 } else {
494 if (detail::getRef<evaluate::ArrayRef>(designator)) {
495 fir::ExtendedValue compExv =
496 converter.genExprAddr(operandLocation, designator, stmtCtx);
497 info.addr = fir::getBase(compExv);
498 info.rawInput = info.addr;
499 asFortran << designator.AsFortran();
500 } else if (auto symRef = detail::getRef<semantics::SymbolRef>(designator)) {
501 // Scalar or full array.
502 fir::ExtendedValue dataExv = converter.getSymbolExtendedValue(*symRef);
503 info = getDataOperandBaseAddr(converter, builder, *symRef,
504 operandLocation, unwrapFirBox);
505 if (genDefaultBounds && mlir::isa<fir::BaseBoxType>(
506 fir::unwrapRefType(info.addr.getType()))) {
507 info.boxType = fir::unwrapRefType(info.addr.getType());
509 builder, operandLocation, dataExv, info);
510 }
511 bool dataExvIsAssumedSize =
512 Fortran::semantics::IsAssumedSizeArray(symRef->get().GetUltimate());
513 if (genDefaultBounds && mlir::isa<fir::SequenceType>(
514 fir::unwrapRefType(info.addr.getType()))) {
516 builder, operandLocation, dataExv, dataExvIsAssumedSize,
517 strideIncludeLowerExtent);
518 }
519 if ((genDefaultBounds && fir::characterWithDynamicLen(
520 fir::unwrapRefType(info.addr.getType()))) ||
521 mlir::isa<fir::BoxCharType>(
522 fir::unwrapRefType(info.addr.getType()))) {
523 bounds = {fir::factory::genBoundsOpFromBoxChar<BoundsOp, BoundsType>(
524 builder, operandLocation, dataExv, info)};
525 }
526 asFortran << symRef->get().name().ToString();
527 } else { // Unsupported
528 llvm::report_fatal_error("Unsupported type of OpenACC operand");
529 }
530 }
531
532 return info;
533}
534
535} // namespace lower
536} // namespace Fortran
537
538#endif // FORTRAN_LOWER_DIRECTIVES_COMMON_H
Definition common.h:222
Definition type.h:61
Definition AbstractConverter.h:87
virtual fir::MutableBoxValue genExprMutableBox(mlir::Location loc, const SomeExpr &expr)=0
virtual mlir::Value getSymbolAddress(SymbolRef sym)=0
Get the mlir instance of a symbol.
virtual fir::ExtendedValue genExprValue(const SomeExpr &expr, StatementContext &context, mlir::Location *locPtr=nullptr)=0
Generate the computations of the expression to produce a value.
virtual fir::ExtendedValue genExprAddr(const SomeExpr &expr, StatementContext &context, mlir::Location *locPtr=nullptr, bool allowCoarray=false)=0
Definition StatementContext.h:46
Definition BoxValue.h:469
Definition FIRBuilder.h:66
mlir::Value createConvert(mlir::Location loc, mlir::Type toTy, mlir::Value val)
Lazy creation of fir.convert op.
Definition FIRBuilder.cpp:669
IfBuilder genIfOp(mlir::Location loc, mlir::TypeRange results, mlir::Value cdt, bool withElseRegion)
Definition FIRBuilder.h:589
mlir::Region & getRegion()
Get the current Region of the insertion point.
Definition FIRBuilder.h:120
mlir::Value createIntegerConstant(mlir::Location loc, mlir::Type integerType, std::int64_t i)
Definition FIRBuilder.cpp:151
Definition OpenACC.h:20
Definition ParserActions.h:24
llvm::SmallVector< mlir::Value > genBoundsOps(fir::FirOpBuilder &builder, mlir::Location loc, Fortran::lower::AbstractConverter &converter, Fortran::lower::StatementContext &stmtCtx, const std::vector< Fortran::evaluate::Subscript > &subscripts, std::stringstream &asFortran, fir::ExtendedValue &dataExv, bool dataExvIsAssumedSize, fir::factory::AddrAndBoundsInfo &info, bool treatIndexAsSection=false, bool strideIncludeLowerExtent=false)
Definition DirectivesCommon.h:140
void createEmptyRegionBlocks(fir::FirOpBuilder &builder, std::list< Fortran::lower::pft::Evaluation > &evaluationList)
Definition DirectivesCommon.h:45
Definition bit-population-count.h:20
llvm::SmallVector< mlir::Value > genBaseBoundsOps(fir::FirOpBuilder &builder, mlir::Location loc, fir::ExtendedValue dataExv, bool isAssumedSize, bool strideIncludeLowerExtent=false)
Definition DirectivesCommon.h:285
llvm::SmallVector< mlir::Value > genBoundsOpsFromBox(fir::FirOpBuilder &builder, mlir::Location loc, fir::ExtendedValue dataExv, AddrAndBoundsInfo &info)
Generate the bounds operation from the descriptor information.
Definition DirectivesCommon.h:218
mlir::Value readLowerBound(fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &box, unsigned dim, mlir::Value defaultValue)
Definition FIRBuilder.cpp:1079
mlir::Value readExtent(fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &box, unsigned dim)
Read or get the extent in dimension dim of the array described by box.
Definition FIRBuilder.cpp:1048
bool isBoxAddress(mlir::Type t)
Is t an address to fir.box or class type?
Definition FIRType.h:535
mlir::Value getBase(const ExtendedValue &exv)
Definition BoxValue.cpp:21
bool isPointerType(mlir::Type ty)
Definition FIRType.cpp:315
bool characterWithDynamicLen(mlir::Type t)
Returns true iff t is a fir.char type and has an unknown length.
Definition FIRType.h:263
bool isAllocatableType(mlir::Type ty)
Return true iff ty is the type of an ALLOCATABLE entity or value.
Definition FIRType.cpp:323
Definition expression.h:218
Definition variable.h:293
Definition DirectivesCommon.h:96
Definition PFTBuilder.h:222
Definition DirectivesCommon.h:31