FLANG
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Fortran::lower::CallerInterface Class Reference

#include <flang/Lower/CallInterface.h>

Inheritance diagram for Fortran::lower::CallerInterface:
Fortran::lower::CallInterface< CallerInterface >

Public Types

using ExprVisitor = std::function< void(evaluate::Expr< evaluate::SomeType >, bool)>
 
- Public Types inherited from Fortran::lower::CallInterface< CallerInterface >
enum  PassEntityBy
 Enum the different ways an entity can be passed-by.
 
enum  Property
 
using FortranEntity = typename PassedEntityTypes< CallerInterface >::FortranEntity
 
using FirValue = typename PassedEntityTypes< CallerInterface >::FirValue
 

Public Member Functions

 CallerInterface (const Fortran::evaluate::ProcedureRef &p, Fortran::lower::AbstractConverter &c)
 
bool hasAlternateReturns () const
 CRTP callbacks.
 
std::string getMangledName () const
 
mlir::Location getCalleeLocation () const
 
Fortran::evaluate::characteristics::Procedure characterize () const
 
const Fortran::evaluate::ProcedureRefgetCallDescription () const
 
const Fortran::semantics::SubprogramDetailsgetInterfaceDetails () const
 
bool isMainProgram () const
 
bool isIndirectCall () const
 
bool requireDispatchCall () const
 
std::optional< unsigned > getPassArgIndex () const
 
mlir::Value getIfPassedArg () const
 
const Fortran::semantics::SymbolgetProcedureSymbol () const
 
const Fortran::semantics::SymbolgetDummySymbol (const PassedEntity &entity) const
 
void placeInput (const PassedEntity &passedEntity, mlir::Value arg)
 
void placeAddressAndLengthInput (const PassedEntity &passedEntity, mlir::Value addr, mlir::Value len)
 
mlir::Value getInput (const PassedEntity &passedEntity)
 Get lowered FIR argument given the Fortran argument.
 
const Fortran::evaluate::ProcedureDesignatorgetIfIndirectCall () const
 
llvm::ArrayRef< mlir::Value > getInputs () const
 Get the input vector once it is complete.
 
bool mustMapInterfaceSymbolsForResult () const
 
bool mustMapInterfaceSymbolsForDummyArgument (const PassedEntity &) const
 
void walkResultExtents (const ExprVisitor &) const
 Walk the result non-deferred extent specification expressions.
 
void walkResultLengths (const ExprVisitor &) const
 Walk the result non-deferred length specification expressions.
 
void walkDummyArgumentExtents (const PassedEntity &, const ExprVisitor &) const
 Walk non-deferred extent specification expressions of a dummy argument.
 
void walkDummyArgumentLengths (const PassedEntity &, const ExprVisitor &) const
 Walk non-deferred length specification expressions of a dummy argument.
 
mlir::Value getArgumentValue (const semantics::Symbol &sym) const
 
const Fortran::semantics::SymbolgetResultSymbol () const
 
mlir::Type getResultStorageType () const
 
mlir::Type getDummyArgumentType (const PassedEntity &) const
 Return FIR type of argument.
 
mlir::Type getHostAssociatedTy () const
 
- Public Member Functions inherited from Fortran::lower::CallInterface< CallerInterface >
mlir::func::FuncOp getFuncOp () const
 
std::size_t getNumFIRArguments () const
 Number of MLIR inputs/outputs of the created FuncOp.
 
std::size_t getNumFIRResults () const
 
llvm::SmallVector< mlir::Type > getResultType () const
 Return the MLIR output types.
 
llvm::ArrayRef< PassedEntity > getPassedArguments () const
 
std::optional< PassedEntity > getPassedResult () const
 
mlir::FunctionType genFunctionType ()
 Returns the mlir function type.
 
void determineInterface (bool isImplicit, const Fortran::evaluate::characteristics::Procedure &)
 
bool callerAllocateResult () const
 Does the caller need to allocate storage for the result ?
 
bool mustPassResult () const
 Is the Fortran result passed as an extra MLIR argument ?
 
bool mustSaveResult () const
 Must the MLIR result be saved with a fir.save_result ?
 
bool canBeCalledViaImplicitInterface () const
 Can the associated procedure be called via an implicit interface?
 
fir::FortranProcedureFlagsEnumAttr getProcedureAttrs (mlir::MLIRContext *) const
 

Static Public Member Functions

static constexpr bool hasHostAssociated ()
 

Additional Inherited Members

- Protected Member Functions inherited from Fortran::lower::CallInterface< CallerInterface >
 CallInterface (Fortran::lower::AbstractConverter &c)
 
CallerInterfaceside ()
 CRTP handle.
 
const CallerInterfaceside () const
 
void declare ()
 
void mapPassedEntities ()
 
void mapBackInputToPassedEntity (const FirPlaceHolder &, FirValue)
 
- Protected Attributes inherited from Fortran::lower::CallInterface< CallerInterface >
llvm::SmallVector< FirPlaceHolder > outputs
 
llvm::SmallVector< FirPlaceHolder > inputs
 
mlir::func::FuncOp func
 
llvm::SmallVector< PassedEntity > passedArguments
 
std::optional< PassedEntity > passedResult
 
bool saveResult
 
Fortran::lower::AbstractConverterconverter
 
std::optional< Fortran::evaluate::characteristics::Procedurecharacteristic
 

Detailed Description

The CallerInterface provides the helpers needed by CallInterface (getting the characteristic...) and a safe way for the user to place the mlir::Value arguments into the input vector once they are lowered.

Member Typedef Documentation

◆ ExprVisitor

Visitor for specification expression. Boolean indicate the specification expression is for the last extent of an assumed size array.

Member Function Documentation

◆ getArgumentValue()

mlir::Value Fortran::lower::CallerInterface::getArgumentValue ( const semantics::Symbol sym) const

Get the mlir::Value that is passed as argument sym of the function being called. The arguments must have been placed before calling this function.

◆ getDummySymbol()

const Fortran::semantics::Symbol * Fortran::lower::CallerInterface::getDummySymbol ( const PassedEntity &  entity) const

Return the dummy argument symbol if this is a call to a user defined procedure with explicit interface. Returns nullptr if there is no user defined explicit interface.

◆ getIfIndirectCall()

const Fortran::evaluate::ProcedureDesignator * Fortran::lower::CallerInterface::getIfIndirectCall ( ) const

If this is a call to a procedure pointer or dummy, returns the related procedure designator. Nullptr otherwise.

◆ getIfPassedArg()

mlir::Value Fortran::lower::CallerInterface::getIfPassedArg ( ) const

Get the passed-object if any. Crashes if there is a passed object but it was not placed in the inputs yet. Return a null value otherwise.

◆ getInterfaceDetails()

const Fortran::semantics::SubprogramDetails * Fortran::lower::CallerInterface::getInterfaceDetails ( ) const

Get the SubprogramDetails that defines the interface of this call if it is known at the call site. Return nullptr if it is not known.

◆ getPassArgIndex()

std::optional< unsigned > Fortran::lower::CallerInterface::getPassArgIndex ( ) const

Get the passed-object argument index. nullopt if there is no passed-object index.

◆ getProcedureSymbol()

const Fortran::semantics::Symbol * Fortran::lower::CallerInterface::getProcedureSymbol ( ) const

Return the procedure symbol if this is a call to a user defined procedure.

◆ getResultStorageType()

mlir::Type Fortran::lower::CallerInterface::getResultStorageType ( ) const

If some storage needs to be allocated for the result, returns the storage type.

◆ getResultSymbol()

const Fortran::semantics::Symbol & Fortran::lower::CallerInterface::getResultSymbol ( ) const

Returns the symbol for the result in the explicit interface. If this is called on an intrinsic or function without explicit interface, this will crash.

◆ isIndirectCall()

bool Fortran::lower::CallerInterface::isIndirectCall ( ) const

Returns true if this is a call to a procedure pointer of a dummy procedure.

◆ mustMapInterfaceSymbolsForDummyArgument()

bool Fortran::lower::CallerInterface::mustMapInterfaceSymbolsForDummyArgument ( const PassedEntity &  arg) const

Must the caller map function interface symbols in order to evaluate the specification expressions of a given dummy argument?

◆ mustMapInterfaceSymbolsForResult()

bool Fortran::lower::CallerInterface::mustMapInterfaceSymbolsForResult ( ) const

Does the caller must map function interface symbols in order to evaluate the result specification expressions (extents and lengths) ? If needed, this mapping must be done after argument lowering, and before the call itself.

◆ placeInput()

void Fortran::lower::CallerInterface::placeInput ( const PassedEntity &  passedEntity,
mlir::Value  arg 
)

Helpers to place the lowered arguments at the right place once they have been lowered.

◆ requireDispatchCall()

bool Fortran::lower::CallerInterface::requireDispatchCall ( ) const

Returns true if this is a call of a type-bound procedure with a polymorphic entity.


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