FLANG
Fortran::lower::VectorSubscriptBox Class Reference

#include <flang/Lower/VectorSubscripts.h>

Classes

struct  LoweredTriplet
struct  LoweredVectorSubscript

Public Types

using ElementalGenerator = std::function<void(const fir::ExtendedValue &)>
using ElementalGeneratorWithBoolReturn
using LoweredSubscript
using MaybeSubstring = llvm::SmallVector<mlir::Value, 2>

Public Member Functions

 VectorSubscriptBox (fir::ExtendedValue &&loweredBase, llvm::SmallVector< LoweredSubscript, 16 > &&loweredSubscripts, llvm::SmallVector< mlir::Value > &&componentPath, MaybeSubstring substringBounds, mlir::Type elementType)
void loopOverElements (fir::FirOpBuilder &builder, mlir::Location loc, const ElementalGenerator &elementalGenerator)
mlir::Value loopOverElementsWhile (fir::FirOpBuilder &builder, mlir::Location loc, const ElementalGeneratorWithBoolReturn &elementalGenerator, mlir::Value initialCondition)
mlir::Type getElementType ()
 Return the type of the elements of the array section.

Detailed Description

VectorSubscriptBox is a lowered representation for any Designator<T> that contain at least one vector subscript.

A designator `xa(i,j)b(1:foo():1, vector, k)cd(m)e1 Is lowered into:

  • an ExtendedValue for ranked base (xa(i,j)b)
  • mlir:Values and ExtendedValues for the triplet, vector subscript and scalar subscripts of the ranked array reference (1:foo():1, vector, k)
  • a list of fir.field_index and scalar integers mlir::Value for the component path at the right of the ranked array ref (cd(m)e).

This representation allows later creating loops over the designator elements and fir.array_coor to get the element addresses without re-evaluating any sub-expressions.

Member Typedef Documentation

◆ ElementalGenerator

Type of the callbacks that can be passed to work with the element addresses.

◆ ElementalGeneratorWithBoolReturn

using Fortran::lower::VectorSubscriptBox::ElementalGeneratorWithBoolReturn
Initial value:
std::function<mlir::Value(const fir::ExtendedValue &)>
Definition BoxValue.h:478

◆ LoweredSubscript

using Fortran::lower::VectorSubscriptBox::LoweredSubscript
Initial value:
std::variant<mlir::Value, LoweredTriplet, LoweredVectorSubscript>

Member Function Documentation

◆ loopOverElements()

void Fortran::lower::VectorSubscriptBox::loopOverElements ( fir::FirOpBuilder & builder,
mlir::Location loc,
const ElementalGenerator & elementalGenerator )

Loop over the elements described by the VectorSubscriptBox, and call elementalGenerator inside the loops with the element addresses.

◆ loopOverElementsWhile()

mlir::Value Fortran::lower::VectorSubscriptBox::loopOverElementsWhile ( fir::FirOpBuilder & builder,
mlir::Location loc,
const ElementalGeneratorWithBoolReturn & elementalGenerator,
mlir::Value initialCondition )

Loop over the elements described by the VectorSubscriptBox while a condition is true, and call elementalGenerator inside the loops with the element addresses. The initial condition value is initialCondition, and then it is the result of elementalGenerator. The value of the condition after the loops is returned.


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