FLANG
|
#include <flang/Lower/CallInterface.h>
Public Types | |
using | ExprVisitor = std::function< void(evaluate::Expr< evaluate::SomeType >, bool)> |
![]() | |
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::ProcedureRef & | getCallDescription () const |
const Fortran::semantics::SubprogramDetails * | getInterfaceDetails () const |
bool | isMainProgram () const |
bool | isIndirectCall () const |
bool | requireDispatchCall () const |
std::optional< unsigned > | getPassArgIndex () const |
mlir::Value | getIfPassedArg () const |
const Fortran::semantics::Symbol * | getProcedureSymbol () const |
const Fortran::semantics::Symbol * | getDummySymbol (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::ProcedureDesignator * | getIfIndirectCall () 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::Symbol & | getResultSymbol () const |
mlir::Type | getResultStorageType () const |
mlir::Type | getDummyArgumentType (const PassedEntity &) const |
Return FIR type of argument. | |
mlir::Type | getHostAssociatedTy () const |
![]() | |
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 | |
![]() | |
CallInterface (Fortran::lower::AbstractConverter &c) | |
CallerInterface & | side () |
CRTP handle. | |
const CallerInterface & | side () const |
void | declare () |
void | mapPassedEntities () |
void | mapBackInputToPassedEntity (const FirPlaceHolder &, FirValue) |
![]() | |
llvm::SmallVector< FirPlaceHolder > | outputs |
llvm::SmallVector< FirPlaceHolder > | inputs |
mlir::func::FuncOp | func |
llvm::SmallVector< PassedEntity > | passedArguments |
std::optional< PassedEntity > | passedResult |
bool | saveResult |
Fortran::lower::AbstractConverter & | converter |
std::optional< Fortran::evaluate::characteristics::Procedure > | characteristic |
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.
using Fortran::lower::CallerInterface::ExprVisitor = std::function<void(evaluate::Expr<evaluate::SomeType>, bool)> |
Visitor for specification expression. Boolean indicate the specification expression is for the last extent of an assumed size array.
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.
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.
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.
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.
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.
std::optional< unsigned > Fortran::lower::CallerInterface::getPassArgIndex | ( | ) | const |
Get the passed-object argument index. nullopt if there is no passed-object index.
const Fortran::semantics::Symbol * Fortran::lower::CallerInterface::getProcedureSymbol | ( | ) | const |
Return the procedure symbol if this is a call to a user defined procedure.
mlir::Type Fortran::lower::CallerInterface::getResultStorageType | ( | ) | const |
If some storage needs to be allocated for the result, returns the storage type.
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.
bool Fortran::lower::CallerInterface::isIndirectCall | ( | ) | const |
Returns true if this is a call to a procedure pointer of a dummy procedure.
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?
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.
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.
bool Fortran::lower::CallerInterface::requireDispatchCall | ( | ) | const |
Returns true if this is a call of a type-bound procedure with a polymorphic entity.