13#ifndef FORTRAN_LOWER_SUPPORT_UTILS_H
14#define FORTRAN_LOWER_SUPPORT_UTILS_H
16#include "flang/Common/indirection.h"
17#include "flang/Parser/char-block.h"
18#include "flang/Semantics/tools.h"
19#include "mlir/Dialect/Func/IR/FuncOps.h"
20#include "mlir/IR/BuiltinAttributes.h"
21#include "llvm/ADT/SmallSet.h"
22#include "llvm/ADT/StringRef.h"
29using SomeExpr = Fortran::evaluate::Expr<Fortran::evaluate::SomeType>;
45 return {cb.begin(), cb.size()};
50const A &removeIndirection(
const A &a) {
60static Fortran::lower::SomeExpr toEvExpr(
const A &x) {
61 return Fortran::evaluate::AsGenericExpr(Fortran::common::Clone(x));
64template <Fortran::common::TypeCategory FROM>
65static Fortran::lower::SomeExpr ignoreEvConvert(
69 return toEvExpr(x.left());
72static Fortran::lower::SomeExpr ignoreEvConvert(
const A &x) {
79inline Fortran::lower::SomeExpr
81 Fortran::common::TypeCategory::Integer, 8>> &x) {
82 return Fortran::common::visit(
83 [](
const auto &v) {
return ignoreEvConvert(v); }, x.u);
87unsigned getHashValue(
const Fortran::lower::SomeExpr *x);
88unsigned getHashValue(
const Fortran::evaluate::Component *x);
90bool isEqual(
const Fortran::lower::SomeExpr *x,
91 const Fortran::lower::SomeExpr *y);
92bool isEqual(
const Fortran::evaluate::Component *x,
93 const Fortran::evaluate::Component *y);
95template <
typename OpType,
typename OperandsStructType>
97 lower::AbstractConverter &converter, fir::FirOpBuilder &firOpBuilder,
98 lower::SymMap &symTable,
99 llvm::SetVector<const semantics::Symbol *> &allPrivatizedSymbols,
100 llvm::SmallPtrSet<const semantics::Symbol *, 16> &mightHaveReadHostSym,
101 const semantics::Symbol *symToPrivatize, OperandsStructType *clauseOps,
102 std::optional<llvm::omp::Directive> dir = std::nullopt,
103 bool forceHeapAllocationForPrivateDynamicArrays =
false);
110struct DenseMapInfo<const
Fortran::lower::SomeExpr *> {
111 static unsigned getHashValue(
const Fortran::lower::SomeExpr *v) {
112 return Fortran::lower::getHashValue(v);
114 static bool isEqual(
const Fortran::lower::SomeExpr *lhs,
115 const Fortran::lower::SomeExpr *rhs) {
116 return Fortran::lower::isEqual(lhs, rhs);
124 return Fortran::lower::getHashValue(v);
128 return Fortran::lower::isEqual(lhs, rhs);
Definition indirection.h:31
Definition AbstractConverter.h:87
Definition SymbolMap.h:181
Definition char-block.h:26
Definition FIRBuilder.h:59
Definition ParserActions.h:24
Definition bit-population-count.h:20
Definition AbstractConverter.h:37
Definition expression.h:210