13#ifndef FORTRAN_OPTIMIZER_BUILDER_CHARACTER_H
14#define FORTRAN_OPTIMIZER_BUILDER_CHARACTER_H
16#include "flang/Optimizer/Builder/BoxValue.h"
17#include "flang/Optimizer/Builder/LowLevelIntrinsics.h"
18#include "flang/Optimizer/Builder/Runtime/Character.h"
24namespace fir::factory {
31 : builder{builder}, loc{loc} {}
54 mlir::Value lowerBound,
55 mlir::Type substringAddrType,
56 mlir::Value one = {});
93 std::pair<mlir::Value, mlir::Value>
createUnboxChar(mlir::Value boxChar);
132 static fir::CharacterType
getCharType(mlir::Type type);
153 mlir::Value len = {});
164 static bool isArray(mlir::Type type);
184 mlir::Value
getLength(mlir::Value memref);
199 mlir::Value createElementAddr(mlir::Value buffer, mlir::Value index);
200 mlir::Value createLoadCharAt(mlir::Value buff, mlir::Value index);
201 void createStoreCharAt(mlir::Value str, mlir::Value index, mlir::Value c);
205 mlir::Value createBlankConstantCode(fir::CharacterType type);
219mlir::Type getCharacterProcedureTupleType(mlir::Type funcPointerType);
227 mlir::Type tupleType,
228 mlir::Value addr, mlir::Value len);
234std::pair<mlir::Value, mlir::Value>
236 mlir::Value tuple,
bool openBoxProc =
true);
Expressions of type CHARACTER and with rank > 0.
Definition: BoxValue.h:170
Definition: BoxValue.h:77
Definition: BoxValue.h:478
Definition: FIRBuilder.h:55
Helper to facilitate lowering of CHARACTER in FIR.
Definition: Character.h:27
mlir::Value extractCodeFromSingleton(mlir::Value singleton)
Returns integer value held in a character singleton.
Definition: Character.cpp:695
fir::CharBoxValue createConcatenate(const fir::CharBoxValue &lhs, const fir::CharBoxValue &rhs)
Create lhs // rhs in temp obtained with fir.alloca.
Definition: Character.cpp:483
fir::CharBoxValue createCharacterTemp(mlir::Type type, mlir::Value len)
Definition: Character.cpp:366
fir::CharBoxValue createCharExtremum(bool predIsMin, llvm::ArrayRef< fir::CharBoxValue > opCBVs)
Create {max,min}(lhs,rhs) in temp obtained with fir.alloca.
Definition: Character.cpp:792
fir::ExtendedValue toExtendedValue(mlir::Value character, mlir::Value len={})
Definition: Character.cpp:122
fir::CharBoxValue createTempFrom(const fir::ExtendedValue &source)
Create a temporary with the same kind, length, and value as source.
Definition: Character.cpp:383
static fir::CharacterType getCharacterType(mlir::Type type)
Get fir.char<kind> type with the same kind as inside str.
Definition: Character.cpp:62
static fir::KindTy getCharacterOrSequenceKind(mlir::Type type)
Extract the kind of a character or array of character type.
Definition: Character.cpp:672
static bool isCharacterScalar(mlir::Type type)
Definition: Character.cpp:49
mlir::Value getLength(mlir::Value memref)
Definition: Character.cpp:725
mlir::Value createEmbox(const fir::CharBoxValue &str)
Definition: Character.cpp:198
static bool isArray(mlir::Type type)
Definition: Character.cpp:54
static bool hasConstantLengthInType(const fir::ExtendedValue &)
Definition: Character.cpp:676
void createPadding(const fir::CharBoxValue &str, mlir::Value lower, mlir::Value upper)
Definition: Character.cpp:353
fir::ExtendedValue cleanUpCharacterExtendedValue(const fir::ExtendedValue &)
fir::CharBoxValue toScalarCharacter(const fir::CharArrayBoxValue &)
Definition: Character.cpp:223
static fir::CharacterType getCharType(mlir::Type type)
Definition: Character.cpp:68
mlir::Value createLenTrim(const fir::CharBoxValue &str)
LEN_TRIM intrinsic.
Definition: Character.cpp:562
mlir::Value createSingletonFromCode(mlir::Value code, int kind)
Create fir.char<kind> singleton from code integer value.
Definition: Character.cpp:683
mlir::Value createBlankConstant(fir::CharacterType type)
Return blank character of given type !fir.char<kind>
Definition: Character.cpp:620
mlir::Value createEmboxChar(mlir::Value addr, mlir::Value len)
Definition: Character.cpp:640
mlir::Value readLengthFromBox(mlir::Value box)
Definition: Character.cpp:707
void createCopy(const fir::CharBoxValue &dest, const fir::CharBoxValue &src, mlir::Value count)
Definition: Character.cpp:320
static fir::KindTy getCharacterKind(mlir::Type type)
Extract the kind of a character type.
Definition: Character.cpp:666
std::pair< mlir::Value, mlir::Value > createUnboxChar(mlir::Value boxChar)
Unbox boxchar into (fir.ref<fir.char<kind>>, character length type).
Definition: Character.cpp:646
void createAssign(const fir::ExtendedValue &lhs, const fir::ExtendedValue &rhs)
Definition: Character.cpp:626
static bool isCharacterLiteral(mlir::Type type)
Definition: Character.cpp:658
mlir::Value genSubstringBase(mlir::Value stringRawAddr, mlir::Value lowerBound, mlir::Type substringAddrType, mlir::Value one={})
Definition: Character.cpp:507
CharacterExprHelper(FirOpBuilder &builder, mlir::Location loc)
Constructor.
Definition: Character.h:30
fir::CharBoxValue createSubstring(const fir::CharBoxValue &str, llvm::ArrayRef< mlir::Value > bounds)
Definition: Character.cpp:518
Definition: AbstractConverter.h:31