FLANG
ConvertExprToHLFIR.h
1//===-- Lower/ConvertExprToHLFIR.h -- lowering of expressions ----*- 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//===----------------------------------------------------------------------===//
15//===----------------------------------------------------------------------===//
16
17#ifndef FORTRAN_LOWER_CONVERTEXPRTOHLFIR_H
18#define FORTRAN_LOWER_CONVERTEXPRTOHLFIR_H
19
20#include "flang/Lower/StatementContext.h"
21#include "flang/Lower/Support/Utils.h"
22#include "flang/Optimizer/Builder/FIRBuilder.h"
23#include "flang/Optimizer/Builder/HLFIRTools.h"
24
25namespace mlir {
26class Location;
27} // namespace mlir
28
29namespace hlfir {
30class ElementalAddrOp;
31}
32
33namespace Fortran::lower {
34
36class SymMap;
37
38hlfir::EntityWithAttributes
39convertExprToHLFIR(mlir::Location loc, Fortran::lower::AbstractConverter &,
40 const Fortran::lower::SomeExpr &, Fortran::lower::SymMap &,
41 Fortran::lower::StatementContext &);
42
43inline fir::ExtendedValue translateToExtendedValue(
44 mlir::Location loc, fir::FirOpBuilder &builder, hlfir::Entity entity,
45 Fortran::lower::StatementContext &context, bool contiguityHint = false) {
46 auto [exv, exvCleanup] =
47 hlfir::translateToExtendedValue(loc, builder, entity, contiguityHint);
48 if (exvCleanup)
49 context.attachCleanup(*exvCleanup);
50 return exv;
51}
52
55fir::ExtendedValue convertExprToBox(mlir::Location loc,
56 Fortran::lower::AbstractConverter &,
57 const Fortran::lower::SomeExpr &,
58 Fortran::lower::SymMap &,
59 Fortran::lower::StatementContext &);
60fir::ExtendedValue convertToBox(mlir::Location loc,
61 Fortran::lower::AbstractConverter &,
62 hlfir::Entity entity,
63 Fortran::lower::StatementContext &,
64 mlir::Type fortranType, unsigned corank = 0);
65
91fir::ExtendedValue convertExprToAddress(mlir::Location loc,
92 Fortran::lower::AbstractConverter &,
93 const Fortran::lower::SomeExpr &,
94 Fortran::lower::SymMap &,
95 Fortran::lower::StatementContext &);
96fir::ExtendedValue convertToAddress(mlir::Location loc,
97 Fortran::lower::AbstractConverter &,
98 hlfir::Entity entity,
99 Fortran::lower::StatementContext &,
100 mlir::Type fortranType);
101
103fir::ExtendedValue convertExprToValue(mlir::Location loc,
104 Fortran::lower::AbstractConverter &,
105 const Fortran::lower::SomeExpr &,
106 Fortran::lower::SymMap &,
107 Fortran::lower::StatementContext &);
108fir::ExtendedValue convertToValue(mlir::Location loc,
109 Fortran::lower::AbstractConverter &,
110 hlfir::Entity entity,
111 Fortran::lower::StatementContext &);
112
113fir::ExtendedValue convertDataRefToValue(mlir::Location loc,
114 Fortran::lower::AbstractConverter &,
115 const Fortran::evaluate::DataRef &,
116 Fortran::lower::SymMap &,
117 Fortran::lower::StatementContext &);
118
122fir::MutableBoxValue
123convertExprToMutableBox(mlir::Location loc, Fortran::lower::AbstractConverter &,
124 const Fortran::lower::SomeExpr &,
125 Fortran::lower::SymMap &);
135 mlir::Location loc, Fortran::lower::AbstractConverter &,
136 const Fortran::lower::SomeExpr &, Fortran::lower::SymMap &,
137 Fortran::lower::StatementContext &);
138
144 mlir::Location loc, Fortran::lower::AbstractConverter &converter,
145 const Fortran::lower::SomeExpr &expr, Fortran::lower::SymMap &symMap,
146 Fortran::lower::StatementContext &stmtCtx);
147
148} // namespace Fortran::lower
149
150#endif // FORTRAN_LOWER_CONVERTEXPRTOHLFIR_H
Definition AbstractConverter.h:87
void attachCleanup(CleanupFunction cuf)
Append a cleanup function to the "list" of cleanup functions.
Definition StatementContext.h:69
Definition SymbolMap.h:181
Definition ParserActions.h:24
hlfir::Entity genVectorSubscriptedDesignatorFirstElementAddress(mlir::Location loc, Fortran::lower::AbstractConverter &converter, const Fortran::lower::SomeExpr &expr, Fortran::lower::SymMap &symMap, Fortran::lower::StatementContext &stmtCtx)
Definition ConvertExprToHLFIR.cpp:2366
fir::MutableBoxValue convertExprToMutableBox(mlir::Location loc, Fortran::lower::AbstractConverter &, const Fortran::lower::SomeExpr &, Fortran::lower::SymMap &)
Definition ConvertExprToHLFIR.cpp:2340
fir::ExtendedValue convertExprToAddress(mlir::Location loc, Fortran::lower::AbstractConverter &, const Fortran::lower::SomeExpr &, Fortran::lower::SymMap &, Fortran::lower::StatementContext &)
Definition ConvertExprToHLFIR.cpp:2302
hlfir::ElementalAddrOp convertVectorSubscriptedExprToElementalAddr(mlir::Location loc, Fortran::lower::AbstractConverter &, const Fortran::lower::SomeExpr &, Fortran::lower::SymMap &, Fortran::lower::StatementContext &)
Definition ConvertExprToHLFIR.cpp:2358
fir::ExtendedValue convertExprToValue(mlir::Location loc, Fortran::lower::AbstractConverter &, const Fortran::lower::SomeExpr &, Fortran::lower::SymMap &, Fortran::lower::StatementContext &)
Lower an evaluate::Expr to a fir::ExtendedValue value.
Definition ConvertExprToHLFIR.cpp:2322
fir::ExtendedValue convertExprToBox(mlir::Location loc, Fortran::lower::AbstractConverter &, const Fortran::lower::SomeExpr &, Fortran::lower::SymMap &, Fortran::lower::StatementContext &)
Definition ConvertExprToHLFIR.cpp:2280
Definition AbstractConverter.h:32