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

#include <flang/Lower/IterationSpace.h>

Public Types

using IterSpaceDim = std::tuple< FrontEndSymbol, FrontEndExpr, FrontEndExpr, FrontEndExpr >
 
using ConcurrentSpec = std::pair< llvm::SmallVector< IterSpaceDim >, FrontEndExpr >
 
using ArrayBases = ExplicitSpaceArrayBases
 

Public Member Functions

bool isActive () const
 
StatementContextstmtContext ()
 Get the statement context.
 
void pushLevel ()
 Open a new construct. The analysis phase starts here.
 
void popLevel ()
 Close the construct.
 
void addSymbol (FrontEndSymbol sym)
 Add new concurrent header control variable symbol.
 
void exprBase (FrontEndExpr x, bool lhs)
 Collect array bases from the expression, x.
 
void endAssign ()
 Called at the end of a assignment statement.
 
llvm::SmallVector< FrontEndSymbolcollectAllSymbols ()
 Return all the active control variables on the stack.
 
void enter ()
 Enter a FORALL context.
 
void leave ()
 Leave a FORALL context.
 
void pushLoopNest (std::function< void()> lambda)
 
mlir::ValueRange getInnerArgs () const
 Get the inner arguments that correspond to the output arrays.
 
void setInnerArgs (llvm::ArrayRef< mlir::BlockArgument > args)
 Set the inner arguments for the next loop level.
 
void resetInnerArgs ()
 Reset the outermost array_load arguments to the loop nest.
 
void setOuterLoop (fir::DoLoopOp loop)
 Capture the current outermost loop.
 
void setInnerArg (size_t offset, mlir::Value val)
 Sets the inner loop argument at position offset to val.
 
llvm::SmallVector< mlir::Type > innerArgTypes () const
 Get the types of the output arrays.
 
void bindLoad (ArrayBases base, fir::ArrayLoadOp load)
 
fir::ArrayLoadOp findBinding (const ArrayBases &base)
 
std::optional< size_t > findArgPosition (fir::ArrayLoadOp load)
 load must be a LHS array_load. Returns std::nullopt on error.
 
bool isLHS (fir::ArrayLoadOp load)
 
mlir::Value findArgumentOfLoad (fir::ArrayLoadOp load)
 
size_t argPosition (mlir::Value arg)
 
std::optional< fir::ArrayLoadOp > getLhsLoad (size_t i)
 
fir::DoLoopOp getOuterLoop ()
 Return the outermost loop in this FORALL nest.
 
StatementContextoutermostContext ()
 Return the statement context for the entire, outermost FORALL construct.
 
void genLoopNest ()
 Generate the explicit loop nest.
 
void resetBindings ()
 Clear the array_load bindings.
 
std::size_t getCounter () const
 Get the current counter value.
 
void incrementCounter ()
 Increment the counter value to the next assignment statement.
 
bool isOutermostForall () const
 
void attachLoopCleanup (std::function< void(fir::FirOpBuilder &builder)> fn)
 
LLVM_DUMP_METHOD void dump () const
 
void finalizeContext ()
 Finalize the current body statement context.
 
void appendLoops (const llvm::SmallVector< fir::DoLoopOp > &loops)
 
void clearLoops ()
 
llvm::SmallVector< llvm::SmallVector< fir::DoLoopOp > > getLoopStack () const
 

Friends

void createArrayLoads (AbstractConverter &converter, ExplicitIterSpace &esp, SymMap &symMap)
 
void createArrayMergeStores (AbstractConverter &converter, ExplicitIterSpace &esp)
 
llvm::raw_ostream & operator<< (llvm::raw_ostream &, const ExplicitIterSpace &)
 

Detailed Description

Fortran also allows arrays to be evaluated under constructs which allow the user to explicitly specify the iteration space using concurrent-control expressions. These constructs allow the user to define both an iteration space and explicit access vectors on arrays. These need not be isomorphic. The explicit iteration spaces may be conditionalized (conjunctively) with an "and" structure and may be found in FORALL (and DO CONCURRENT) constructs.

This class is used in the bridge to collect a stack of lists of concurrent-control expressions to be used to generate the iteration space and associated masks (if any) for a set of nested FORALL constructs around assignment and WHERE constructs.

Member Function Documentation

◆ bindLoad()

void Fortran::lower::ExplicitIterSpace::bindLoad ( ArrayBases  base,
fir::ArrayLoadOp  load 
)
inline

Create a binding between an Ev::Expr node pointer and a fir::array_load op. This bindings will be used when generating the IR.

◆ findArgumentOfLoad()

mlir::Value Fortran::lower::ExplicitIterSpace::findArgumentOfLoad ( fir::ArrayLoadOp  load)
inline

load must be a LHS array_load. Determine the threaded inner argument corresponding to this load.

◆ isActive()

bool Fortran::lower::ExplicitIterSpace::isActive ( ) const
inline

Is a FORALL context presently active? If we are lowering constructs/statements nested within a FORALL, then a FORALL context is active.

Friends And Related Function Documentation

◆ createArrayLoads

void createArrayLoads ( AbstractConverter converter,
ExplicitIterSpace esp,
SymMap symMap 
)
friend

Create all the array_load ops for the explicit iteration space context. The nest of FORALLs must have been analyzed a priori.

◆ createArrayMergeStores

void createArrayMergeStores ( AbstractConverter converter,
ExplicitIterSpace esp 
)
friend

Create the array_merge_store ops after the explicit iteration space context is conmpleted.


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