FLANG
Public Member Functions | List of all members
Fortran::lower::AbstractConverter Class Referenceabstract

#include <flang/Lower/AbstractConverter.h>

Public Member Functions

virtual mlir::Value getSymbolAddress (SymbolRef sym)=0
 Get the mlir instance of a symbol.
 
virtual fir::ExtendedValue symBoxToExtendedValue (const Fortran::lower::SymbolBox &symBox)=0
 
virtual fir::ExtendedValue getSymbolExtendedValue (const Fortran::semantics::Symbol &sym, Fortran::lower::SymMap *symMap=nullptr)=0
 
virtual mlir::Value impliedDoBinding (llvm::StringRef name)=0
 Get the binding of an implied do variable by name.
 
virtual void copySymbolBinding (SymbolRef src, SymbolRef target)=0
 Copy the binding of src to target symbol.
 
virtual void bindSymbol (SymbolRef sym, const fir::ExtendedValue &exval)=0
 
virtual void overrideExprValues (const ExprToValueMap *)=0
 
void resetExprOverrides ()
 
virtual const ExprToValueMap * getExprOverrides ()=0
 
virtual bool lookupLabelSet (SymbolRef sym, pft::LabelSet &labelSet)=0
 Get the label set associated with a symbol.
 
virtual pft::EvaluationlookupLabel (pft::Label label)=0
 Get the code defined by a label.
 
virtual bool createHostAssociateVarClone (const Fortran::semantics::Symbol &sym, bool skipDefaultInit)=0
 
virtual void createHostAssociateVarCloneDealloc (const Fortran::semantics::Symbol &sym)=0
 
virtual void copyHostAssociateVar (const Fortran::semantics::Symbol &sym, mlir::OpBuilder::InsertPoint *copyAssignIP=nullptr, bool hostIsSource=true)=0
 
virtual void copyVar (mlir::Location loc, mlir::Value dst, mlir::Value src, fir::FortranVariableFlagsEnum attrs)=0
 
virtual bool isPresentShallowLookup (const Fortran::semantics::Symbol &sym)=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 llvm::StringRef getUniqueLitName (mlir::Location loc, std::unique_ptr< Fortran::lower::SomeExpr > expression, mlir::Type eleTy)=0
 
virtual fir::ExtendedValue genExprAddr (const SomeExpr &expr, StatementContext &context, mlir::Location *locPtr=nullptr)=0
 
fir::ExtendedValue genExprAddr (mlir::Location loc, const SomeExpr *expr, StatementContext &stmtCtx)
 Generate the address of the location holding the expression, expr.
 
fir::ExtendedValue genExprAddr (mlir::Location loc, const SomeExpr &expr, StatementContext &stmtCtx)
 
virtual fir::ExtendedValue genExprValue (const SomeExpr &expr, StatementContext &context, mlir::Location *locPtr=nullptr)=0
 Generate the computations of the expression to produce a value.
 
fir::ExtendedValue genExprValue (mlir::Location loc, const SomeExpr *expr, StatementContext &stmtCtx)
 Generate the computations of the expression, expr, to produce a value.
 
fir::ExtendedValue genExprValue (mlir::Location loc, const SomeExpr &expr, StatementContext &stmtCtx)
 
virtual fir::ExtendedValue genExprBox (mlir::Location loc, const SomeExpr &expr, StatementContext &stmtCtx)=0
 
virtual fir::MutableBoxValue genExprMutableBox (mlir::Location loc, const SomeExpr &expr)=0
 
virtual Fortran::evaluate::FoldingContextgetFoldingContext ()=0
 
virtual mlir::Value hostAssocTupleValue ()=0
 
virtual void bindHostAssocTuple (mlir::Value val)=0
 
virtual mlir::Value dummyArgsScopeValue () const =0
 
virtual bool isRegisteredDummySymbol (Fortran::semantics::SymbolRef symRef) const =0
 
virtual const Fortran::lower::pft::FunctionLikeUnitgetCurrentFunctionUnit () const =0
 Returns the FunctionLikeUnit being lowered, if any.
 
virtual mlir::Type genType (const SomeExpr &)=0
 Generate the type of an Expr.
 
virtual mlir::Type genType (SymbolRef)=0
 Generate the type of a Symbol.
 
virtual mlir::Type genType (Fortran::common::TypeCategory tc)=0
 Generate the type from a category.
 
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 Fortran::semantics::DerivedTypeSpec &)=0
 Generate the type from a DerivedTypeSpec.
 
virtual mlir::Type genType (const pft::Variable &)=0
 Generate the type from a Variable.
 
virtual void registerTypeInfo (mlir::Location loc, SymbolRef typeInfoSym, const Fortran::semantics::DerivedTypeSpec &typeSpec, fir::RecordType type)=0
 
virtual TypeConstructionStack & getTypeConstructionStack ()=0
 
virtual mlir::Location getCurrentLocation ()=0
 Get the converter's current location.
 
virtual mlir::Location genUnknownLocation ()=0
 Generate a dummy location.
 
virtual mlir::Location genLocation (const Fortran::parser::CharBlock &)=0
 Generate the location as converted from a CharBlock.
 
virtual const Fortran::semantics::ScopegetCurrentScope ()=0
 Get the converter's current scope.
 
virtual fir::FirOpBuildergetFirOpBuilder ()=0
 Get the OpBuilder.
 
virtual mlir::ModuleOp getModuleOp ()=0
 Get the ModuleOp.
 
virtual mlir::MLIRContext & getMLIRContext ()=0
 Get the MLIRContext.
 
virtual std::string mangleName (const Fortran::semantics::Symbol &)=0
 Unique a symbol (add a containing scope specific prefix)
 
virtual std::string mangleName (const Fortran::semantics::DerivedTypeSpec &)=0
 Unique a derived type (add a containing scope specific prefix)
 
virtual std::string mangleName (std::string &)=0
 Unique a compiler generated name (add a containing scope specific prefix)
 
virtual std::string getRecordTypeFieldName (const Fortran::semantics::Symbol &component)=0
 
virtual const fir::KindMappinggetKindMap ()=0
 Get the KindMap.
 
virtual Fortran::lower::StatementContextgetFctCtx ()=0
 
 AbstractConverter (const Fortran::lower::LoweringOptions &loweringOptions)
 
virtual void genEval (pft::Evaluation &eval, bool unstructuredContext=true)=0
 Generate IR for Evaluation eval.
 
const Fortran::lower::LoweringOptionsgetLoweringOptions () const
 Return options controlling lowering behavior.
 
virtual Fortran::lower::SymbolBox lookupOneLevelUpSymbol (const Fortran::semantics::Symbol &sym)=0
 
virtual mlir::SymbolTable * getMLIRSymbolTable ()=0
 

Detailed Description

The abstract interface for converter implementations to lower Fortran front-end fragments such as expressions, types, etc. to the FIR dialect of MLIR.

Member Function Documentation

◆ bindHostAssocTuple()

virtual void Fortran::lower::AbstractConverter::bindHostAssocTuple ( mlir::Value  val)
pure virtual

Record a binding for the ssa-value of the host assoications tuple for this function.

◆ bindSymbol()

virtual void Fortran::lower::AbstractConverter::bindSymbol ( SymbolRef  sym,
const fir::ExtendedValue exval 
)
pure virtual

Binds the symbol to an fir extended value. The symbol binding will be added or replaced at the inner-most level of the local symbol map.

◆ collectSymbolSet()

virtual void Fortran::lower::AbstractConverter::collectSymbolSet ( pft::Evaluation eval,
llvm::SetVector< const Fortran::semantics::Symbol * > &  symbolSet,
Fortran::semantics::Symbol::Flag  flag,
bool  collectSymbols = true,
bool  collectHostAssociatedSymbols = false 
)
pure virtual

Collect the set of symbols with flag in eval region if collectSymbols is true. Otherwise, collect the set of the host symbols with flag of the associated symbols in eval region if collectHostAssociatedSymbols is true. This allows gathering host association details of symbols particularly in nested directives irrespective of flag , and can be useful where host association details are needed in flag-agnostic manner.

◆ copyHostAssociateVar()

virtual void Fortran::lower::AbstractConverter::copyHostAssociateVar ( const Fortran::semantics::Symbol sym,
mlir::OpBuilder::InsertPoint *  copyAssignIP = nullptr,
bool  hostIsSource = true 
)
pure virtual

For a host-associated symbol (a symbol associated with another symbol from an enclosing scope), either:

  • if hostIsSource == true: copy sym's value from its corresponding host symbol,
  • if hostIsSource == false: copy sym's value to its corresponding host symbol.

◆ createHostAssociateVarClone()

virtual bool Fortran::lower::AbstractConverter::createHostAssociateVarClone ( const Fortran::semantics::Symbol sym,
bool  skipDefaultInit 
)
pure virtual

For a given symbol which is host-associated, create a clone using parameters from the host-associated symbol. The clone is default initialized if its type has any default initialization unless skipDefaultInit is set.

◆ dummyArgsScopeValue()

virtual mlir::Value Fortran::lower::AbstractConverter::dummyArgsScopeValue ( ) const
pure virtual

Returns fir.dummy_scope operation's result value to be used as dummy_scope operand of hlfir.declare operations for the dummy arguments of this function.

◆ genExprAddr()

virtual fir::ExtendedValue Fortran::lower::AbstractConverter::genExprAddr ( const SomeExpr expr,
StatementContext context,
mlir::Location *  locPtr = nullptr 
)
pure virtual

Generate the address of the location holding the expression, expr. If expr is a Designator that is not compile time contiguous, the address returned is the one of a contiguous temporary storage holding the expression value. The clean-up for this temporary is added to context.

◆ genExprBox()

virtual fir::ExtendedValue Fortran::lower::AbstractConverter::genExprBox ( mlir::Location  loc,
const SomeExpr expr,
StatementContext stmtCtx 
)
pure virtual

Generate or get a fir.box describing the expression. If SomeExpr is a Designator, the fir.box describes an entity over the Designator base storage without making a temporary.

◆ genExprMutableBox()

virtual fir::MutableBoxValue Fortran::lower::AbstractConverter::genExprMutableBox ( mlir::Location  loc,
const SomeExpr expr 
)
pure virtual

Generate the address of the box describing the variable designated by the expression. The expression must be an allocatable or pointer designator.

◆ getFoldingContext()

virtual Fortran::evaluate::FoldingContext & Fortran::lower::AbstractConverter::getFoldingContext ( )
pure virtual

Get FoldingContext that is required for some expression analysis.

◆ getMLIRSymbolTable()

virtual mlir::SymbolTable * Fortran::lower::AbstractConverter::getMLIRSymbolTable ( )
pure virtual

Return the mlir::SymbolTable associated to the ModuleOp. Look-ups are faster using it than using module.lookup<>, but the module op should be queried in case of failure because this symbol table is not guaranteed to contain all the symbols from the ModuleOp (the symbol table should always be provided to the builder helper creating globals and functions in order to be in sync).

◆ getRecordTypeFieldName()

virtual std::string Fortran::lower::AbstractConverter::getRecordTypeFieldName ( const Fortran::semantics::Symbol component)
pure virtual

Return the field name for a derived type component inside a fir.record type.

◆ getTypeConstructionStack()

virtual TypeConstructionStack & Fortran::lower::AbstractConverter::getTypeConstructionStack ( )
pure virtual

Get stack of derived type in construction. This is an internal entry point for the type conversion utility to allow lowering recursive derived types.

◆ getUniqueLitName()

virtual llvm::StringRef Fortran::lower::AbstractConverter::getUniqueLitName ( mlir::Location  loc,
std::unique_ptr< Fortran::lower::SomeExpr expression,
mlir::Type  eleTy 
)
pure virtual

For the given literal constant expression, returns a unique name that can be used to create a global object to represent this literal constant. It will return the same name for equivalent literal constant expressions. eleTy specifies the data type of the constant elements. For array constants it specifies the array's element type.

◆ hostAssocTupleValue()

virtual mlir::Value Fortran::lower::AbstractConverter::hostAssocTupleValue ( )
pure virtual

Host associated variables are grouped as a tuple. This returns that value, which is itself a reference. Use bindTuple() to set this value.

◆ isPresentShallowLookup()

virtual bool Fortran::lower::AbstractConverter::isPresentShallowLookup ( const Fortran::semantics::Symbol sym)
pure virtual

For a given symbol, check if it is present in the inner-most level of the symbol map.

◆ isRegisteredDummySymbol()

virtual bool Fortran::lower::AbstractConverter::isRegisteredDummySymbol ( Fortran::semantics::SymbolRef  symRef) const
pure virtual

Returns true if the given symbol is a dummy argument of this function. Note that it returns false for all the symbols after all the variables are instantiated for this function, i.e. it can only be used reliably during the instatiation of the variables.

◆ lookupOneLevelUpSymbol()

virtual Fortran::lower::SymbolBox Fortran::lower::AbstractConverter::lookupOneLevelUpSymbol ( const Fortran::semantics::Symbol sym)
pure virtual

Find the symbol in one level up of symbol map such as for host-association in OpenMP code or return null.

◆ overrideExprValues()

virtual void Fortran::lower::AbstractConverter::overrideExprValues ( const ExprToValueMap *  )
pure virtual

Override lowering of expression with pre-lowered values. Associate mlir::Value to evaluate::Expr. All subsequent call to genExprXXX() will replace any occurrence of an overridden expression in the expression tree by the pre-lowered values.

◆ registerTypeInfo()

virtual void Fortran::lower::AbstractConverter::registerTypeInfo ( mlir::Location  loc,
SymbolRef  typeInfoSym,
const Fortran::semantics::DerivedTypeSpec typeSpec,
fir::RecordType  type 
)
pure virtual

Register a runtime derived type information object symbol to ensure its object will be generated as a global.


The documentation for this class was generated from the following file: