FLANG
|
#include <flang/Lower/VectorSubscripts.h>
Classes | |
struct | LoweredTriplet |
struct | LoweredVectorSubscript |
Public Types | |
using | ElementalGenerator = std::function< void(const fir::ExtendedValue &)> |
using | ElementalGeneratorWithBoolReturn = std::function< mlir::Value(const fir::ExtendedValue &)> |
using | LoweredSubscript = std::variant< mlir::Value, LoweredTriplet, LoweredVectorSubscript > |
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. | |
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:
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.
using Fortran::lower::VectorSubscriptBox::ElementalGenerator = std::function<void(const fir::ExtendedValue &)> |
Type of the callbacks that can be passed to work with the element addresses.
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.
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.