14#ifndef FORTRAN_OPTIMIZER_HLFIR_HLFIRDIALECT_H
15#define FORTRAN_OPTIMIZER_HLFIR_HLFIRDIALECT_H
17#include "flang/Optimizer/Dialect/FIRType.h"
21bool isFortranVariableType(mlir::Type);
22bool isFortranScalarCharacterType(mlir::Type);
23bool isFortranScalarCharacterExprType(mlir::Type);
24bool isFortranArrayCharacterExprType(mlir::Type);
27#include "flang/Optimizer/HLFIR/HLFIRDialect.h.inc"
29#include "flang/Optimizer/HLFIR/HLFIREnums.h.inc"
31#define GET_TYPEDEF_CLASSES
32#include "flang/Optimizer/HLFIR/HLFIRTypes.h.inc"
34#define GET_ATTRDEF_CLASSES
35#include "flang/Optimizer/HLFIR/HLFIRAttributes.h.inc"
39inline mlir::Type getFortranElementType(mlir::Type type) {
42 if (
auto exprType = mlir::dyn_cast<hlfir::ExprType>(type))
43 return exprType.getEleTy();
44 if (
auto boxCharType = mlir::dyn_cast<fir::BoxCharType>(type))
45 return boxCharType.getEleTy();
51inline mlir::Type getFortranElementOrSequenceType(mlir::Type type) {
53 if (
auto exprType = mlir::dyn_cast<hlfir::ExprType>(type)) {
54 if (exprType.isArray())
55 return fir::SequenceType::get(exprType.getShape(), exprType.getEleTy());
56 return exprType.getEleTy();
58 if (
auto boxCharType = mlir::dyn_cast<fir::BoxCharType>(type))
59 return boxCharType.getEleTy();
65mlir::Type getExprType(mlir::Type variableType);
71mlir::Type getVariableType(hlfir::ExprType exprType);
74inline bool isBoxAddressType(mlir::Type type) {
76 return type && mlir::isa<fir::BaseBoxType>(type);
80inline bool isBoxAddressOrValueType(mlir::Type type) {
81 return mlir::isa<fir::BaseBoxType>(fir::unwrapRefType(type));
84inline bool isPolymorphicType(mlir::Type type) {
85 if (
auto exprType = mlir::dyn_cast<hlfir::ExprType>(type))
86 return exprType.isPolymorphic();
91inline bool isFortranProcedurePointerType(mlir::Type type) {
95inline bool isFortranPointerObjectType(mlir::Type type) {
98 return boxTy && boxTy.isPointer();
103inline bool isFortranProcedureValue(mlir::Type type) {
104 return mlir::isa<fir::BoxProcType>(type) ||
105 (mlir::isa<mlir::TupleType>(type) &&
110inline bool isFortranValueType(mlir::Type type) {
112 isFortranProcedureValue(type);
116inline bool isFortranValue(mlir::Value value) {
117 return isFortranValueType(value.getType());
128inline bool isFortranEntity(mlir::Value value) {
129 return isFortranValue(value) || isFortranVariableType(value.getType());
132bool isFortranScalarNumericalType(mlir::Type);
133bool isFortranNumericalArrayObject(mlir::Type);
134bool isFortranNumericalOrLogicalArrayObject(mlir::Type);
135bool isFortranArrayObject(mlir::Type);
136bool isFortranLogicalArrayObject(mlir::Type);
137bool isPassByRefOrIntegerType(mlir::Type);
138bool isI1Type(mlir::Type);
140bool isMaskArgument(mlir::Type);
141bool isPolymorphicObject(mlir::Type);
145mlir::Value genExprShape(mlir::OpBuilder &builder,
const mlir::Location &loc,
146 const hlfir::ExprType &expr);
153bool mayHaveAllocatableComponent(mlir::Type ty);
156bool isFortranIntegerScalarOrArrayObject(mlir::Type type);
mlir::Type unwrapPassByRefType(mlir::Type t)
Definition FIRType.h:314
bool isCharacterProcedureTuple(mlir::Type type, bool acceptRawFunc=true)
Is this tuple type holding a character function and its result length?
Definition FIRType.cpp:1440
mlir::Type dyn_cast_ptrEleTy(mlir::Type t)
Definition FIRType.cpp:257
bool isPolymorphicType(mlir::Type ty)
Definition FIRType.cpp:410
bool isBoxProcAddressType(mlir::Type t)
Is this a fir.boxproc address type?
Definition FIRType.h:546
bool isa_trivial(mlir::Type t)
Definition FIRType.h:239
mlir::Type unwrapSequenceType(mlir::Type t)
If t is a SequenceType return its element type, otherwise return t.
Definition FIRType.h:297