1 //===-- ComponentPath.cpp -------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "flang/Lower/ComponentPath.h"
12 Fortran::lower::IterationSpace(const Fortran::lower::IterationSpace
&)>
14 return [](const Fortran::lower::IterationSpace
&s
) { return s
; };
18 Fortran::lower::IterationSpace(const Fortran::lower::IterationSpace
&)>
20 return [](const Fortran::lower::IterationSpace
&s
) {
21 Fortran::lower::IterationSpace
newIters(s
);
22 newIters
.clearIndices();
27 void Fortran::lower::ComponentPath::clear() {
31 prefixComponents
.clear();
33 suffixComponents
.clear();
34 pc
= getIdentityFunc();
37 bool Fortran::lower::isRankedArrayAccess(const Fortran::evaluate::ArrayRef
&x
) {
38 for (const Fortran::evaluate::Subscript
&sub
: x
.subscript()) {
39 if (Fortran::common::visit(
40 Fortran::common::visitors
{
41 [&](const Fortran::evaluate::Triplet
&) { return true; },
42 [&](const Fortran::evaluate::IndirectSubscriptIntegerExpr
&e
) {
43 return e
.value().Rank() > 0;
51 void Fortran::lower::ComponentPath::resetPC() { pc
= getIdentityFunc(); }
53 void Fortran::lower::ComponentPath::setPC(bool isImplicit
) {
54 pc
= isImplicit
? getIdentityFunc() : getNullaryFunc();
58 Fortran::lower::ComponentPath::ExtendRefFunc
59 Fortran::lower::ComponentPath::getExtendCoorRef() const {
60 return hasExtendCoorRef() ? *extendCoorRef
: [](mlir::Value v
) { return v
; };