13#ifndef FORTRAN_LOWER_ABSTRACTCONVERTER_H
14#define FORTRAN_LOWER_ABSTRACTCONVERTER_H
16#include "flang/Common/Fortran.h"
18#include "flang/Lower/PFTDefs.h"
19#include "flang/Optimizer/Builder/BoxValue.h"
20#include "flang/Optimizer/Dialect/FIRAttr.h"
21#include "flang/Semantics/symbol.h"
22#include "mlir/IR/Builders.h"
23#include "mlir/IR/BuiltinOps.h"
24#include "mlir/IR/Operation.h"
25#include "llvm/ADT/ArrayRef.h"
64struct FunctionLikeUnit;
69using TypeConstructionStack =
70 llvm::DenseMap<const Fortran::semantics::Scope *, mlir::Type>;
73using ExprToValueMap = llvm::DenseMap<const SomeExpr *, mlir::Value>;
114 virtual const ExprToValueMap *getExprOverrides() = 0;
128 bool skipDefaultInit) = 0;
143 mlir::OpBuilder::InsertPoint *copyAssignIP =
nullptr,
144 bool hostIsSource =
true) = 0;
146 virtual void copyVar(mlir::Location loc, mlir::Value dst, mlir::Value src,
147 fir::FortranVariableFlagsEnum attrs) = 0;
163 llvm::SetVector<const Fortran::semantics::Symbol *> &symbolSet,
164 Fortran::semantics::Symbol::Flag flag,
bool collectSymbols =
true,
165 bool collectHostAssociatedSymbols =
false) = 0;
173 virtual llvm::StringRef
175 std::unique_ptr<Fortran::lower::SomeExpr> expression,
176 mlir::Type eleTy) = 0;
188 mlir::Location *locPtr =
nullptr) = 0;
203 mlir::Location *locPtr =
nullptr) = 0;
265 virtual mlir::Type
genType(Fortran::common::TypeCategory tc) = 0;
268 genType(Fortran::common::TypeCategory tc,
int kind,
280 fir::RecordType type) = 0;
328 : loweringOptions(loweringOptions) {}
337 bool unstructuredContext =
true) = 0;
341 return loweringOptions;
Definition: AbstractConverter.h:82
virtual mlir::Value impliedDoBinding(llvm::StringRef name)=0
Get the binding of an implied do variable by name.
virtual void copyHostAssociateVar(const Fortran::semantics::Symbol &sym, mlir::OpBuilder::InsertPoint *copyAssignIP=nullptr, bool hostIsSource=true)=0
virtual mlir::Location genLocation(const Fortran::parser::CharBlock &)=0
Generate the location as converted from a CharBlock.
virtual pft::Evaluation * lookupLabel(pft::Label label)=0
Get the code defined by a label.
virtual mlir::MLIRContext & getMLIRContext()=0
Get the MLIRContext.
virtual fir::MutableBoxValue genExprMutableBox(mlir::Location loc, const SomeExpr &expr)=0
fir::ExtendedValue genExprAddr(mlir::Location loc, const SomeExpr *expr, StatementContext &stmtCtx)
Generate the address of the location holding the expression, expr.
Definition: AbstractConverter.h:191
virtual mlir::Value getSymbolAddress(SymbolRef sym)=0
Get the mlir instance of a symbol.
virtual mlir::Location getCurrentLocation()=0
Get the converter's current location.
virtual Fortran::lower::SymbolBox lookupOneLevelUpSymbol(const Fortran::semantics::Symbol &sym)=0
virtual llvm::StringRef getUniqueLitName(mlir::Location loc, std::unique_ptr< Fortran::lower::SomeExpr > expression, mlir::Type eleTy)=0
virtual std::string mangleName(std::string &)=0
Unique a compiler generated name (add a containing scope specific prefix)
virtual mlir::Location genUnknownLocation()=0
Generate a dummy location.
virtual mlir::ModuleOp getModuleOp()=0
Get the ModuleOp.
virtual bool createHostAssociateVarClone(const Fortran::semantics::Symbol &sym, bool skipDefaultInit)=0
virtual mlir::Type genType(const SomeExpr &)=0
Generate the type of an Expr.
virtual bool isPresentShallowLookup(const Fortran::semantics::Symbol &sym)=0
virtual fir::ExtendedValue genExprValue(const SomeExpr &expr, StatementContext &context, mlir::Location *locPtr=nullptr)=0
Generate the computations of the expression to produce a value.
virtual fir::ExtendedValue genExprBox(mlir::Location loc, const SomeExpr &expr, StatementContext &stmtCtx)=0
virtual void overrideExprValues(const ExprToValueMap *)=0
virtual fir::FirOpBuilder & getFirOpBuilder()=0
Get the OpBuilder.
virtual mlir::Type genType(SymbolRef)=0
Generate the type of a Symbol.
virtual void registerTypeInfo(mlir::Location loc, SymbolRef typeInfoSym, const Fortran::semantics::DerivedTypeSpec &typeSpec, fir::RecordType type)=0
virtual mlir::Type genType(Fortran::common::TypeCategory tc, int kind, llvm::ArrayRef< std::int64_t > lenParameters=std::nullopt)=0
Generate the type from a category and kind and length parameters.
virtual mlir::Type genType(const pft::Variable &)=0
Generate the type from a Variable.
virtual const Fortran::semantics::Scope & getCurrentScope()=0
Get the converter's current scope.
virtual std::string getRecordTypeFieldName(const Fortran::semantics::Symbol &component)=0
virtual void genEval(pft::Evaluation &eval, bool unstructuredContext=true)=0
Generate IR for Evaluation eval.
virtual TypeConstructionStack & getTypeConstructionStack()=0
virtual void bindHostAssocTuple(mlir::Value val)=0
virtual const Fortran::lower::pft::FunctionLikeUnit * getCurrentFunctionUnit() const =0
Returns the FunctionLikeUnit being lowered, if any.
virtual mlir::Value hostAssocTupleValue()=0
virtual void copySymbolBinding(SymbolRef src, SymbolRef target)=0
Copy the binding of src to target symbol.
virtual Fortran::evaluate::FoldingContext & getFoldingContext()=0
virtual void bindSymbol(SymbolRef sym, const fir::ExtendedValue &exval)=0
virtual mlir::SymbolTable * getMLIRSymbolTable()=0
virtual mlir::Type genType(const Fortran::semantics::DerivedTypeSpec &)=0
Generate the type from a DerivedTypeSpec.
virtual mlir::Type genType(Fortran::common::TypeCategory tc)=0
Generate the type from a category.
virtual mlir::Value dummyArgsScopeValue() const =0
virtual void collectSymbolSet(pft::Evaluation &eval, llvm::SetVector< const Fortran::semantics::Symbol * > &symbolSet, Fortran::semantics::Symbol::Flag flag, bool collectSymbols=true, bool collectHostAssociatedSymbols=false)=0
virtual fir::ExtendedValue genExprAddr(const SomeExpr &expr, StatementContext &context, mlir::Location *locPtr=nullptr)=0
virtual bool isRegisteredDummySymbol(Fortran::semantics::SymbolRef symRef) const =0
fir::ExtendedValue genExprValue(mlir::Location loc, const SomeExpr *expr, StatementContext &stmtCtx)
Generate the computations of the expression, expr, to produce a value.
Definition: AbstractConverter.h:206
virtual std::string mangleName(const Fortran::semantics::DerivedTypeSpec &)=0
Unique a derived type (add a containing scope specific prefix)
const Fortran::lower::LoweringOptions & getLoweringOptions() const
Return options controlling lowering behavior.
Definition: AbstractConverter.h:340
virtual bool lookupLabelSet(SymbolRef sym, pft::LabelSet &labelSet)=0
Get the label set associated with a symbol.
virtual std::string mangleName(const Fortran::semantics::Symbol &)=0
Unique a symbol (add a containing scope specific prefix)
virtual const fir::KindMapping & getKindMap()=0
Get the KindMap.
Definition: LoweringOptions.h:34
Definition: StatementContext.h:46
Definition: SymbolMap.h:146
Definition: char-block.h:28
Definition: BoxValue.h:478
Definition: FIRBuilder.h:55
Definition: KindMapping.h:48
Definition: BoxValue.h:360
Definition: bit-population-count.h:20
Definition: AbstractConverter.h:31
Definition: AbstractConverter.h:27
Definition: variable.h:47
Definition: SymbolMap.h:52
Definition: PFTBuilder.h:216
Definition: PFTBuilder.h:605
Definition: PFTBuilder.h:400