FLANG
Public Types | Public Member Functions | Friends | List of all members
Fortran::lower::SymMap Class Reference

#include <flang/Lower/SymbolMap.h>

Public Types

using AcDoVar = llvm::StringRef
 

Public Member Functions

 SymMap (const SymMap &)=delete
 
void pushScope ()
 
void popScope ()
 
void addSymbol (semantics::SymbolRef sym, const fir::ExtendedValue &ext, bool force=false)
 Add an extended value to the symbol table.
 
void addSymbol (semantics::SymbolRef sym, mlir::Value value, bool force=false)
 Add a trivial symbol mapping to an address.
 
void addCharSymbol (semantics::SymbolRef sym, mlir::Value value, mlir::Value len, bool force=false)
 Add a scalar CHARACTER mapping to an (address, len).
 
void addCharSymbol (semantics::SymbolRef sym, const SymbolBox::Char &value, bool force=false)
 
void addSymbolWithShape (semantics::SymbolRef sym, mlir::Value value, llvm::ArrayRef< mlir::Value > shape, bool force=false)
 Add an array mapping with (address, shape).
 
void addSymbolWithShape (semantics::SymbolRef sym, const SymbolBox::FullDim &value, bool force=false)
 
void addCharSymbolWithShape (semantics::SymbolRef sym, mlir::Value value, mlir::Value len, llvm::ArrayRef< mlir::Value > shape, bool force=false)
 Add an array of CHARACTER mapping.
 
void addCharSymbolWithShape (semantics::SymbolRef sym, const SymbolBox::CharFullDim &value, bool force=false)
 
void addSymbolWithBounds (semantics::SymbolRef sym, mlir::Value value, llvm::ArrayRef< mlir::Value > extents, llvm::ArrayRef< mlir::Value > lbounds, bool force=false)
 Add an array mapping with bounds notation.
 
void addSymbolWithBounds (semantics::SymbolRef sym, const SymbolBox::FullDim &value, bool force=false)
 
void addCharSymbolWithBounds (semantics::SymbolRef sym, mlir::Value value, mlir::Value len, llvm::ArrayRef< mlir::Value > extents, llvm::ArrayRef< mlir::Value > lbounds, bool force=false)
 Add an array of CHARACTER with bounds notation.
 
void addCharSymbolWithBounds (semantics::SymbolRef sym, const SymbolBox::CharFullDim &value, bool force=false)
 
void addAllocatableOrPointer (semantics::SymbolRef sym, fir::MutableBoxValue box, bool force=false)
 
void addBoxSymbol (semantics::SymbolRef sym, mlir::Value irBox, llvm::ArrayRef< mlir::Value > lbounds, llvm::ArrayRef< mlir::Value > explicitParams, llvm::ArrayRef< mlir::Value > explicitExtents, bool force=false)
 
void addBoxSymbol (semantics::SymbolRef sym, const SymbolBox::Box &value, bool force=false)
 
SymbolBox lookupSymbol (semantics::SymbolRef sym)
 Find symbol and return its value if it appears in the current mappings.
 
SymbolBox lookupSymbol (const semantics::Symbol *sym)
 
SymbolBox shallowLookupSymbol (semantics::SymbolRef sym)
 
SymbolBox shallowLookupSymbol (const semantics::Symbol *sym)
 
SymbolBox lookupOneLevelUpSymbol (semantics::SymbolRef sym)
 
SymbolBox lookupOneLevelUpSymbol (const semantics::Symbol *sym)
 
void pushImpliedDoBinding (AcDoVar var, mlir::Value value)
 Add a new binding from the ac-do-variable var to value.
 
void popImpliedDoBinding ()
 Pop the most recent implied do binding off the stack.
 
mlir::Value lookupImpliedDo (AcDoVar var)
 
void clear ()
 Remove all symbols from the map.
 
LLVM_DUMP_METHOD void dump () const
 Dump the map. For debugging.
 
void addVariableDefinition (semantics::SymbolRef symRef, fir::FortranVariableOpInterface definingOp, bool force=false)
 
void copySymbolBinding (semantics::SymbolRef src, semantics::SymbolRef target)
 
std::optional< fir::FortranVariableOpInterface > lookupVariableDefinition (semantics::SymbolRef sym)
 

Friends

llvm::raw_ostream & operator<< (llvm::raw_ostream &os, const SymMap &symMap)
 

Detailed Description

Helper class to map front-end symbols to their MLIR representation. This provides a way to lookup the ssa-values that comprise a Fortran symbol's runtime attributes. These attributes include its address, its dynamic size, dynamic bounds information for non-scalar entities, dynamic type parameters, etc.

Member Function Documentation

◆ lookupImpliedDo()

mlir::Value Fortran::lower::SymMap::lookupImpliedDo ( AcDoVar  var)

Lookup the ac-do-variable and return the Value it is bound to. If the variable is not found, returns a null Value.

◆ lookupOneLevelUpSymbol()

Fortran::lower::SymbolBox Fortran::lower::SymMap::lookupOneLevelUpSymbol ( semantics::SymbolRef  sym)

Find symbol and return its value if it appears in the one level up map such as for the host variable in host-association in OpenMP code.

Skip one level when looking up the symbol. The use case is such as looking up the host variable symbol box by skipping the associated level in host-association in OpenMP code.

◆ shallowLookupSymbol()

Fortran::lower::SymbolBox Fortran::lower::SymMap::shallowLookupSymbol ( semantics::SymbolRef  sym)

Find symbol and return its value if it appears in the inner-most level map.


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