FLANG
|
Classes | |
struct | AddrAndBoundsInfo |
class | AnyValueStack |
class | AnyVariableStack |
class | AnyVectorSubscriptStack |
class | CharacterExprHelper |
Helper to facilitate lowering of CHARACTER in FIR. More... | |
class | Complex |
Helper to facilitate lowering of COMPLEX manipulations in FIR. More... | |
struct | Counter |
class | DoLoopHelper |
Helper to build fir.do_loop Ops. More... | |
class | HomogeneousScalarStack |
struct | MutableBoxReallocation |
class | SimpleCopy |
Structure to hold the value of a single entity. More... | |
class | SSARegister |
class | TemporaryStorage |
Generic wrapper over the different sorts of temporary storages. More... | |
Typedefs | |
using | ReallocStorageHandlerFunc = std::function< void(fir::ExtendedValue)> |
Functions | |
llvm::SmallVector< mlir::Value > | getTypeParams (mlir::Location loc, FirOpBuilder &builder, const ExtendedValue &exv) |
llvm::SmallVector< mlir::Value > | getTypeParams (mlir::Location loc, FirOpBuilder &builder, ArrayLoadOp load) |
llvm::SmallVector< mlir::Value > | getExtents (mlir::Location loc, FirOpBuilder &builder, const ExtendedValue &box) |
mlir::Value | getExtentAtDimension (mlir::Location loc, FirOpBuilder &builder, const ExtendedValue &exv, unsigned dim) |
mlir::Type | getCharacterProcedureTupleType (mlir::Type funcPointerType) |
mlir::Value | createCharacterProcedureTuple (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type tupleType, mlir::Value addr, mlir::Value len) |
std::pair< mlir::Value, mlir::Value > | extractCharacterProcedureTuple (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value tuple, bool openBoxProc=true) |
fir::CharBoxValue | convertCharacterKind (fir::FirOpBuilder &builder, mlir::Location loc, fir::CharBoxValue srcBoxChar, int toKind) |
AddrAndBoundsInfo | getDataOperandBaseAddr (fir::FirOpBuilder &builder, mlir::Value symAddr, bool isOptional, mlir::Location loc) |
template<typename BoundsOp , typename BoundsType > | |
llvm::SmallVector< mlir::Value > | gatherBoundsOrBoundValues (fir::FirOpBuilder &builder, mlir::Location loc, fir::ExtendedValue dataExv, mlir::Value box, bool collectValuesOnly=false) |
template<typename BoundsOp , typename BoundsType > | |
llvm::SmallVector< mlir::Value > | genBoundsOpsFromBox (fir::FirOpBuilder &builder, mlir::Location loc, fir::ExtendedValue dataExv, AddrAndBoundsInfo &info) |
Generate the bounds operation from the descriptor information. | |
template<typename BoundsOp , typename BoundsType > | |
llvm::SmallVector< mlir::Value > | genBaseBoundsOps (fir::FirOpBuilder &builder, mlir::Location loc, fir::ExtendedValue dataExv, bool isAssumedSize) |
template<typename BoundsOp , typename BoundsType > | |
llvm::SmallVector< mlir::Value > | genImplicitBoundsOps (fir::FirOpBuilder &builder, AddrAndBoundsInfo &info, fir::ExtendedValue dataExv, bool dataExvIsAssumedSize, mlir::Location loc) |
constexpr llvm::StringRef | attrFortranArrayOffsets () |
template<typename B > | |
void | genCharacterCopy (mlir::Value src, mlir::Value srcLen, mlir::Value dst, mlir::Value dstLen, B &builder, mlir::Location loc) |
llvm::SmallVector< mlir::Value > | getExtents (mlir::Value shapeVal) |
llvm::SmallVector< mlir::Value > | getOrigins (mlir::Value shapeVal) |
template<typename B > | |
llvm::SmallVector< mlir::Value > | originateIndices (mlir::Location loc, B &builder, mlir::Type memTy, mlir::Value shapeVal, mlir::ValueRange indices) |
mlir::Value | readCharLen (fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &box) |
mlir::Value | readExtent (fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &box, unsigned dim) |
Read or get the extent in dimension dim of the array described by box . | |
mlir::Value | readLowerBound (fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &box, unsigned dim, mlir::Value defaultValue) |
llvm::SmallVector< mlir::Value > | readExtents (fir::FirOpBuilder &builder, mlir::Location loc, const fir::BoxValue &box) |
Read extents from box . | |
fir::ExtendedValue | readBoxValue (fir::FirOpBuilder &builder, mlir::Location loc, const fir::BoxValue &box) |
llvm::SmallVector< mlir::Value > | getNonDefaultLowerBounds (fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &exv) |
llvm::SmallVector< mlir::Value > | getNonDeferredLenParams (const fir::ExtendedValue &exv) |
fir::ExtendedValue | createStringLiteral (fir::FirOpBuilder &, mlir::Location, llvm::StringRef string) |
std::string | uniqueCGIdent (llvm::StringRef prefix, llvm::StringRef name) |
llvm::SmallVector< mlir::Value > | createExtents (fir::FirOpBuilder &builder, mlir::Location loc, fir::SequenceType seqTy) |
mlir::Value | locationToFilename (fir::FirOpBuilder &, mlir::Location) |
Generate a string literal containing the file name and return its address. | |
mlir::Value | locationToLineNo (fir::FirOpBuilder &, mlir::Location, mlir::Type) |
Generate a constant of the given type with the location line number. | |
fir::ExtendedValue | componentToExtendedValue (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value component) |
fir::ExtendedValue | arrayElementToExtendedValue (fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &array, mlir::Value element) |
fir::ExtendedValue | arraySectionElementToExtendedValue (fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &array, mlir::Value element, mlir::Value slice) |
void | genScalarAssignment (fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &lhs, const fir::ExtendedValue &rhs, bool needFinalization=false, bool isTemporaryLHS=false) |
void | genRecordAssignment (fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &lhs, const fir::ExtendedValue &rhs, bool needFinalization=false, bool isTemporaryLHS=false) |
mlir::TupleType | getRaggedArrayHeaderType (fir::FirOpBuilder &builder) |
mlir::Value | genLenOfCharacter (fir::FirOpBuilder &builder, mlir::Location loc, fir::ArrayLoadOp arrLoad, llvm::ArrayRef< mlir::Value > path, llvm::ArrayRef< mlir::Value > substring) |
mlir::Value | genLenOfCharacter (fir::FirOpBuilder &builder, mlir::Location loc, fir::SequenceType seqTy, mlir::Value memref, llvm::ArrayRef< mlir::Value > typeParams, llvm::ArrayRef< mlir::Value > path, llvm::ArrayRef< mlir::Value > substring) |
mlir::Value | createZeroValue (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type type) |
std::optional< std::int64_t > | getExtentFromTriplet (mlir::Value lb, mlir::Value ub, mlir::Value stride) |
Get the integer constants of triplet and compute the extent. | |
mlir::Value | genMaxWithZero (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value value) |
Generate max(value , 0) where value is a scalar integer. | |
mlir::Value | genCPtrOrCFunptrAddr (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value cPtr, mlir::Type ty) |
mlir::Value | genCDevPtrAddr (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value cDevPtr, mlir::Type ty) |
mlir::Value | genCPtrOrCFunptrValue (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Value cPtr) |
Get the C address value. | |
fir::BoxValue | createBoxValue (fir::FirOpBuilder &builder, mlir::Location loc, const fir::ExtendedValue &exv) |
mlir::Value | createNullBoxProc (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type boxType) |
Generate Null BoxProc for procedure pointer null initialization. | |
mlir::Value | createConvert (mlir::OpBuilder &, mlir::Location, mlir::Type, mlir::Value) |
void | setInternalLinkage (mlir::func::FuncOp) |
Set internal linkage attribute on a function. | |
llvm::SmallVector< mlir::Value > | elideExtentsAlreadyInType (mlir::Type type, mlir::ValueRange shape) |
llvm::SmallVector< mlir::Value > | elideLengthsAlreadyInType (mlir::Type type, mlir::ValueRange lenParams) |
uint64_t | getAllocaAddressSpace (mlir::DataLayout *dataLayout) |
Get the address space which should be used for allocas. | |
llvm::SmallVector< mlir::Value > | deduceOptimalExtents (mlir::ValueRange extents1, mlir::ValueRange extents2) |
mlir::func::FuncOp | getLlvmMemcpy (FirOpBuilder &builder) |
Get the LLVM intrinsic for memcpy . Use the 64 bit version. | |
mlir::func::FuncOp | getLlvmMemmove (FirOpBuilder &builder) |
Get the LLVM intrinsic for memmove . Use the 64 bit version. | |
mlir::func::FuncOp | getLlvmMemset (FirOpBuilder &builder) |
Get the LLVM intrinsic for memset . Use the 64 bit version. | |
mlir::func::FuncOp | getRealloc (FirOpBuilder &builder) |
Get the C standard library realloc function. | |
mlir::func::FuncOp | getLlvmGetRounding (FirOpBuilder &builder) |
Get the llvm.get.rounding intrinsic. | |
mlir::func::FuncOp | getLlvmSetRounding (FirOpBuilder &builder) |
Get the llvm.set.rounding intrinsic. | |
mlir::func::FuncOp | getLlvmInitTrampoline (FirOpBuilder &builder) |
Get the llvm.init.trampoline intrinsic. | |
mlir::func::FuncOp | getLlvmAdjustTrampoline (FirOpBuilder &builder) |
Get the llvm.adjust.trampoline intrinsic. | |
mlir::func::FuncOp | getFeclearexcept (FirOpBuilder &builder) |
Get the libm (fenv.h) feclearexcept function. | |
mlir::func::FuncOp | getFedisableexcept (FirOpBuilder &builder) |
Get the libm (fenv.h) fedisableexcept function. | |
mlir::func::FuncOp | getFeenableexcept (FirOpBuilder &builder) |
Get the libm (fenv.h) feenableexcept function. | |
mlir::func::FuncOp | getFegetexcept (FirOpBuilder &builder) |
Get the libm (fenv.h) fegetexcept function. | |
mlir::func::FuncOp | getFeraiseexcept (FirOpBuilder &builder) |
Get the libm (fenv.h) feraiseexcept function. | |
mlir::func::FuncOp | getFetestexcept (FirOpBuilder &builder) |
Get the libm (fenv.h) fetestexcept function. | |
mlir::Value | createUnallocatedBox (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type boxType, mlir::ValueRange nonDeferredParams, mlir::Value typeSourceBox={}, unsigned allocator=kDefaultAllocator) |
fir::MutableBoxValue | createTempMutableBox (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type type, llvm::StringRef name={}, mlir::Value sourceBox={}, bool isPolymorphic=false) |
void | associateMutableBox (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box, const fir::ExtendedValue &source, mlir::ValueRange lbounds) |
void | associateMutableBoxWithRemap (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box, const fir::ExtendedValue &source, mlir::ValueRange lbounds, mlir::ValueRange ubounds) |
void | disassociateMutableBox (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box, bool polymorphicSetType=true, unsigned allocator=kDefaultAllocator) |
MutableBoxReallocation | genReallocIfNeeded (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box, mlir::ValueRange shape, mlir::ValueRange lenParams, ReallocStorageHandlerFunc storageHandler={}) |
void | finalizeRealloc (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box, mlir::ValueRange lbounds, bool takeLboundsIfRealloc, const MutableBoxReallocation &realloc) |
void | genFreememIfAllocated (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box) |
void | genInlinedAllocation (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box, mlir::ValueRange lbounds, mlir::ValueRange extents, mlir::ValueRange lenParams, llvm::StringRef allocName, bool mustBeHeap=false) |
mlir::Value | genFreemem (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box) |
void | syncMutableBoxFromIRBox (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box) |
fir::ExtendedValue | genMutableBoxRead (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box, bool mayBePolymorphic=true, bool preserveLowerBounds=true) |
mlir::Value | getMutableIRBox (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box) |
mlir::Value | genIsAllocatedOrAssociatedTest (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box) |
mlir::Value | genIsNotAllocatedOrAssociatedTest (fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box) |
mlir::Value | genNullBoxStorage (fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type boxTy) |
A location to place directive utilities shared across multiple lowering and optimizer files, e.g. utilities shared in OpenMP and OpenACC.
using fir::factory::ReallocStorageHandlerFunc = typedef std::function<void(fir::ExtendedValue)> |
Type of a callback invoked on every storage pointer produced in different branches by genReallocIfNeeded(). The argument is an ExtendedValue for the storage pointer. For example, when genReallocIfNeeded() is used for a LHS allocatable array in an assignment, the callback performs the actual assignment via the given storage pointer, so we end up generating array_updates and array_merge_stores in each branch.
fir::ExtendedValue fir::factory::arrayElementToExtendedValue | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::ExtendedValue & | array, | ||
mlir::Value | element | ||
) |
Given the address of an array element and the ExtendedValue describing the array, returns the ExtendedValue describing the array element. The purpose is to propagate the LEN parameters of the array to the element. This can be used for elements of array
or array(i:j:k)
. If element
belongs to an array section arrayx
whose base is array
, arraySectionElementToExtendedValue must be used instead.
fir::ExtendedValue fir::factory::arraySectionElementToExtendedValue | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::ExtendedValue & | array, | ||
mlir::Value | element, | ||
mlir::Value | slice | ||
) |
Build the ExtendedValue for element
that is an element of an array or array section with array
base (array
or array(i:j:k)xy
). If it is an array section, slice
must be provided and be a fir::SliceOp that describes the section.
void fir::factory::associateMutableBox | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::MutableBoxValue & | box, | ||
const fir::ExtendedValue & | source, | ||
mlir::ValueRange | lbounds | ||
) |
Update a MutableBoxValue to describe entity source
(that must be in memory). If \lbounds is not empty, it is used to defined the MutableBoxValue lower bounds, otherwise, the lower bounds from source
are used.
void fir::factory::associateMutableBoxWithRemap | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::MutableBoxValue & | box, | ||
const fir::ExtendedValue & | source, | ||
mlir::ValueRange | lbounds, | ||
mlir::ValueRange | ubounds | ||
) |
Update a MutableBoxValue to describe entity source
(that must be in memory) with a new array layout given by lbounds
and ubounds
. source
must be known to be contiguous at compile time, or it must have rank 1 (constraint from Fortran 2018 standard 10.2.2.3 point 9).
fir::ExtendedValue fir::factory::componentToExtendedValue | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
mlir::Value | component | ||
) |
Return the extended value for a component of a derived type instance given the address of the component.
fir::BoxValue fir::factory::createBoxValue | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::ExtendedValue & | exv | ||
) |
Create a fir.box from a fir::ExtendedValue and wrap it in a fir::BoxValue to keep all the lower bound and explicit parameter information.
mlir::Value fir::factory::createCharacterProcedureTuple | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
mlir::Type | tupleType, | ||
mlir::Value | addr, | ||
mlir::Value | len | ||
) |
Create a tuple<addr, len> given addr
and len
as well as the tuple type argTy
. addr
must be any function address, and len
may be any integer or nullptr. Converts will be inserted if needed if \addr and len
types are not the same as the one inside the tuple type tupleType
.
mlir::Value fir::factory::createConvert | ( | mlir::OpBuilder & | builder, |
mlir::Location | loc, | ||
mlir::Type | toTy, | ||
mlir::Value | val | ||
) |
Convert a value to a new type. Return the value directly if it has the right type.
llvm::SmallVector< mlir::Value > fir::factory::createExtents | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
fir::SequenceType | seqTy | ||
) |
Lowers the extents from the sequence type to Values. Any unknown extents are lowered to undefined values.
fir::ExtendedValue fir::factory::createStringLiteral | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
llvm::StringRef | string | ||
) |
Create a !fir.char<1> string literal global and returns a fir::CharBoxValue with its address and length.
fir::MutableBoxValue fir::factory::createTempMutableBox | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
mlir::Type | type, | ||
llvm::StringRef | name = {} , |
||
mlir::Value | sourceBox = {} , |
||
bool | isPolymorphic = false |
||
) |
Create a MutableBoxValue for a temporary allocatable. The created MutableBoxValue wraps a fir.ref<fir.box<fir.heap<type>>> and is initialized to unallocated/diassociated status. An optional name can be given to the created !fir.ref<fir.box>.
mlir::Value fir::factory::createUnallocatedBox | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
mlir::Type | boxType, | ||
mlir::ValueRange | nonDeferredParams, | ||
mlir::Value | typeSourceBox = {} , |
||
unsigned | allocator = kDefaultAllocator |
||
) |
Create a fir.box of type boxType
that can be used to initialize an allocatable variable. Initialization of such variable has to be done at the beginning of the variable lifetime by storing the created box in the memory for the variable box. nonDeferredParams
must provide the non deferred LEN parameters so that they can already be placed in the unallocated box (inquiries about these parameters are legal even in unallocated state). typeSourceBox
provides the dynamic type information when the box is created for a polymorphic temporary.
mlir::Value fir::factory::createZeroValue | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
mlir::Type | type | ||
) |
Create the zero value of a given the numerical or logical type
(false
for logical types).
llvm::SmallVector< mlir::Value > fir::factory::deduceOptimalExtents | ( | mlir::ValueRange | extents1, |
mlir::ValueRange | extents2 | ||
) |
The two vectors of MLIR values have the following property: extents1
[i] must have the same value as extents2
[i] The function returns a new vector of MLIR values that preserves the same property vs extents1
and extents2
, but allows more optimizations. For example, if extents1[j] is a known constant, and extents2[j] is not, then result[j] is the MLIR value extents1[j].
void fir::factory::disassociateMutableBox | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::MutableBoxValue & | box, | ||
bool | polymorphicSetType = true , |
||
unsigned | allocator = kDefaultAllocator |
||
) |
Set the association status of a MutableBoxValue to disassociated/unallocated. Nothing is done with the entity that was previously associated/allocated. The function generates code that sets the address field of the MutableBoxValue to zero.
std::pair< mlir::Value, mlir::Value > fir::factory::extractCharacterProcedureTuple | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
mlir::Value | tuple, | ||
bool | openBoxProc = true |
||
) |
Given a tuple containing a character function address and its result length, extract the tuple into a pair of value <function address, result length>. If openBoxProc is true, the function address is extracted from the fir.boxproc, otherwise, the returned function address is the fir.boxproc.
llvm::SmallVector< mlir::Value > fir::factory::genBaseBoundsOps | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
fir::ExtendedValue | dataExv, | ||
bool | isAssumedSize | ||
) |
Generate bounds operation for base array without any subscripts provided.
mlir::Value fir::factory::genCDevPtrAddr | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
mlir::Value | cDevPtr, | ||
mlir::Type | ty | ||
) |
The type(C_DEVPTR) is defined as the derived type with only one component of C_PTR type. Get the C address from the C_PTR component.
void fir::factory::genCharacterCopy | ( | mlir::Value | src, |
mlir::Value | srcLen, | ||
mlir::Value | dst, | ||
mlir::Value | dstLen, | ||
B & | builder, | ||
mlir::Location | loc | ||
) |
Generate a character copy with optimized forms.
If the lengths are constant and equal, use load/store rather than a loop. Otherwise, if the lengths are constant and the input is longer than the output, generate a loop to move a truncated portion of the source to the destination. Finally, if the lengths are runtime values or the destination is longer than the source, move the entire source character and pad the destination with spaces as needed.
mlir::Value fir::factory::genCPtrOrCFunptrAddr | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
mlir::Value | cPtr, | ||
mlir::Type | ty | ||
) |
The type(C_PTR/C_FUNPTR) is defined as the derived type with only one component of integer 64, and the component is the C address. Get the C address.
mlir::Value fir::factory::genFreemem | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::MutableBoxValue & | box | ||
) |
Deallocate an mutable box storage with fir.freemem without calling any final procedures. The mutable box is not nullified.
void fir::factory::genFreememIfAllocated | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::MutableBoxValue & | box | ||
) |
Deallocate a mutable box with fir.freemem if it is allocated or associated. This only deallocates the storage and does not call finalization, the mutable box is not nullified.
mlir::Value fir::factory::genIsAllocatedOrAssociatedTest | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::MutableBoxValue & | box | ||
) |
Generate allocation or association status test and returns the resulting i1. This is testing this for a valid/non-null base address value.
mlir::Value fir::factory::genIsNotAllocatedOrAssociatedTest | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::MutableBoxValue & | box | ||
) |
Generate allocation or association status test and returns the resulting i1. This is testing this for a valid/non-null base address value.
mlir::Value fir::factory::genLenOfCharacter | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
fir::ArrayLoadOp | arrLoad, | ||
llvm::ArrayRef< mlir::Value > | path, | ||
llvm::ArrayRef< mlir::Value > | substring | ||
) |
Generate the, possibly dynamic, LEN of a CHARACTER. arrLoad
determines the base array. After applying path
, the result must be a reference to a !fir.char
type object. substring
must have 0, 1, or 2 members. The first member is the starting offset. The second is the ending offset.
fir::ExtendedValue fir::factory::genMutableBoxRead | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::MutableBoxValue & | box, | ||
bool | mayBePolymorphic = true , |
||
bool | preserveLowerBounds = true |
||
) |
Read all mutable properties into a normal symbol box. It is OK to call this on unassociated/unallocated boxes but any use of the resulting values will be undefined (only the base address will be guaranteed to be null).
mlir::Value fir::factory::genNullBoxStorage | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
mlir::Type | boxTy | ||
) |
Generate an unallocated box of the given boxTy
and store it into a temporary storage. Return address of the temporary storage.
void fir::factory::genRecordAssignment | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::ExtendedValue & | lhs, | ||
const fir::ExtendedValue & | rhs, | ||
bool | needFinalization = false , |
||
bool | isTemporaryLHS = false |
||
) |
Assign rhs
to lhs
. Both rhs
and lhs
must be scalar derived types. The assignment follows Fortran intrinsic assignment semantic for derived types (10.2.1.3 point 13).
void fir::factory::genScalarAssignment | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::ExtendedValue & | lhs, | ||
const fir::ExtendedValue & | rhs, | ||
bool | needFinalization = false , |
||
bool | isTemporaryLHS = false |
||
) |
Assign rhs
to lhs
. Both rhs
and lhs
must be scalars. The assignment follows Fortran intrinsic assignment semantic (10.2.1.3).
mlir::Type fir::factory::getCharacterProcedureTupleType | ( | mlir::Type | funcPointerType | ) |
Create a tuple<function type, length type> type to pass character functions as arguments along their length. The function type set in the tuple is the one provided by funcPointerType
.
mlir::Value fir::factory::getExtentAtDimension | ( | mlir::Location | loc, |
fir::FirOpBuilder & | builder, | ||
const ExtendedValue & | exv, | ||
unsigned | dim | ||
) |
Get exactly one extent for any array-like extended value, exv
. If exv
is not an array or has rank less then dim
, the result will be a nullptr.
llvm::SmallVector< mlir::Value > fir::factory::getExtents | ( | mlir::Location | loc, |
fir::FirOpBuilder & | builder, | ||
const ExtendedValue & | box | ||
) |
Get extents from box
. For fir::BoxValue and fir::MutableBoxValue, this will generate code to read the extents.
|
inline |
Get extents from fir.shape/fir.shape_shift op. Empty result if shapeVal
is empty or is a fir.shift.
mlir::Value fir::factory::getMutableIRBox | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::MutableBoxValue & | box | ||
) |
Returns the fir.ref<fir.box<T>> of a MutableBoxValue filled with the current association / allocation properties. If the fir.ref<fir.box> already exists and is-up to date, this is a no-op, otherwise, code will be generated to fill it.
Depending on the implementation, allocatable/pointer descriptor and the MutableBoxValue need to be synced before and after calls passing the descriptor. These calls will generate the syncing if needed or be no-op.
llvm::SmallVector< mlir::Value > fir::factory::getNonDefaultLowerBounds | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::ExtendedValue & | exv | ||
) |
Get the lower bounds of exv
. NB: returns an empty vector if the lower bounds are all ones, which is the default in Fortran.
llvm::SmallVector< mlir::Value > fir::factory::getNonDeferredLenParams | ( | const fir::ExtendedValue & | exv | ) |
Return LEN parameters associated to exv
that are not deferred (that are available without having to read any fir.box values). Empty if exv
has no LEN parameters or if they are all deferred.
|
inline |
Get origins from fir.shape_shift/fir.shift op. Empty result if shapeVal
is empty or is a fir.shape.
mlir::TupleType fir::factory::getRaggedArrayHeaderType | ( | fir::FirOpBuilder & | builder | ) |
Builds and returns the type of a ragged array header used to cache mask evaluations. RaggedArrayHeader is defined in flang/include/flang/Runtime/ragged.h.
llvm::SmallVector< mlir::Value > fir::factory::getTypeParams | ( | mlir::Location | loc, |
FirOpBuilder & | builder, | ||
ArrayLoadOp | load | ||
) |
Specialization of get type parameters for an ArrayLoadOp. An array load must either have all type parameters given as arguments or be a boxed value.
llvm::SmallVector< mlir::Value > fir::factory::getTypeParams | ( | mlir::Location | loc, |
fir::FirOpBuilder & | builder, | ||
const ExtendedValue & | exv | ||
) |
Generalized function to recover dependent type parameters. This does away with the distinction between deferred and non-deferred LEN type parameters (Fortran definition), since that categorization is irrelevant when getting all type parameters for a value of dependent type.
llvm::SmallVector< mlir::Value > fir::factory::originateIndices | ( | mlir::Location | loc, |
B & | builder, | ||
mlir::Type | memTy, | ||
mlir::Value | shapeVal, | ||
mlir::ValueRange | indices | ||
) |
Convert the normalized indices on array_fetch and array_update to the dynamic (and non-zero) origin required by array_coor. Do not adjust any trailing components in the path as they specify a particular path into the array value and must already correspond to the structure of an element.
fir::ExtendedValue fir::factory::readBoxValue | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::BoxValue & | box | ||
) |
Read a fir::BoxValue into an fir::UnboxValue, a fir::ArrayBoxValue or a fir::CharArrayBoxValue. This should only be called if the fir::BoxValue is known to be contiguous given the context (or if the resulting address will not be used). If the value is polymorphic, its dynamic type will be lost. This must not be used on unlimited polymorphic and assumed rank entities.
mlir::Value fir::factory::readCharLen | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::ExtendedValue & | box | ||
) |
Read or get character length from box
that must contain a character entity. If the length value is contained in the ExtendedValue, this will not generate any code, otherwise this will generate a read of the fir.box describing the entity.
mlir::Value fir::factory::readLowerBound | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::ExtendedValue & | box, | ||
unsigned | dim, | ||
mlir::Value | defaultValue | ||
) |
Read or get the lower bound in dimension dim
of the array described by box
. If the lower bound is left default in the ExtendedValue, defaultValue
will be returned.
void fir::factory::syncMutableBoxFromIRBox | ( | fir::FirOpBuilder & | builder, |
mlir::Location | loc, | ||
const fir::MutableBoxValue & | box | ||
) |
When the MutableBoxValue was passed as a fir.ref<fir.box> to a call that may have modified it, update the MutableBoxValue according to the fir.ref<fir.box> value.
std::string fir::factory::uniqueCGIdent | ( | llvm::StringRef | prefix, |
llvm::StringRef | name | ||
) |
Unique a compiler generated identifier. A short prefix should be provided to hint at the origin of the identifier.