FLANG
ComponentPath.h
1//===-- ComponentPath.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#ifndef FORTRAN_LOWER_COMPONENTPATH_H
10#define FORTRAN_LOWER_COMPONENTPATH_H
11
12#include "flang/Lower/IterationSpace.h"
13#include "llvm/ADT/SmallVector.h"
14#include <optional>
15
16namespace fir {
17class ArrayLoadOp;
18}
19namespace Fortran::evaluate {
20class ArrayRef;
21}
22
23namespace Fortran::lower {
24
25namespace details {
27} // namespace details
28
29using PathComponent =
30 std::variant<const evaluate::ArrayRef *, const evaluate::Component *,
32
39public:
40 using ExtendRefFunc = std::function<mlir::Value(const mlir::Value &)>;
41
42 ComponentPath(bool isImplicit) { setPC(isImplicit); }
43 ComponentPath(bool isImplicit, const evaluate::Substring *ss)
44 : substring(ss) {
45 setPC(isImplicit);
46 }
47 ComponentPath() = delete;
48
49 bool isSlice() const { return !trips.empty() || hasComponents(); }
50 bool hasComponents() const { return !suffixComponents.empty(); }
51 void clear();
52
53 bool hasExtendCoorRef() const { return extendCoorRef.has_value(); }
54 ExtendRefFunc getExtendCoorRef() const;
55 void resetExtendCoorRef() { extendCoorRef = std::nullopt; }
56 void resetPC();
57
59 const evaluate::Substring *substring = nullptr;
60 bool applied = false;
61
62 llvm::SmallVector<mlir::Value> prefixComponents;
64 llvm::SmallVector<mlir::Value> suffixComponents;
65 std::function<IterationSpace(const IterationSpace &)> pc;
66
72 std::optional<ExtendRefFunc> extendCoorRef;
73
74private:
75 void setPC(bool isImplicit);
76};
77
81
82} // namespace Fortran::lower
83
84#endif // FORTRAN_LOWER_COMPONENTPATH_H
Definition: variable.h:208
Definition: variable.h:369
Definition: variable.h:74
Definition: variable.h:316
Definition: ComponentPath.h:38
std::optional< ExtendRefFunc > extendCoorRef
Definition: ComponentPath.h:72
Definition: IterationSpace.h:47
Definition: ComponentPath.h:26
Definition: OpenACC.h:20
Definition: call.h:34
Definition: AbstractConverter.h:59
bool isRankedArrayAccess(const Fortran::evaluate::ArrayRef &x)
Definition: ComponentPath.cpp:37
Definition: AbstractConverter.h:31