13#ifndef FORTRAN_OPTIMIZER_BUILDER_MUTABLEBOX_H
14#define FORTRAN_OPTIMIZER_BUILDER_MUTABLEBOX_H
16#include "flang/Optimizer/Builder/BoxValue.h"
17#include "flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h"
18#include "flang/Runtime/allocator-registry-consts.h"
19#include "llvm/ADT/StringRef.h"
47 mlir::ValueRange nonDeferredParams,
48 mlir::Value typeSourceBox = {},
49 unsigned allocator = kDefaultAllocator);
56 mlir::Location loc, mlir::Type type,
57 llvm::StringRef name = {},
58 mlir::Value sourceBox = {},
59 bool isPolymorphic =
false);
65 const fir::MutableBoxValue &box,
66 const fir::ExtendedValue &source,
67 mlir::ValueRange lbounds);
75 const fir::MutableBoxValue &box,
76 const fir::ExtendedValue &source,
77 mlir::ValueRange lbounds,
78 mlir::ValueRange ubounds);
85 const fir::MutableBoxValue &box,
86 bool polymorphicSetType =
true,
87 unsigned allocator = kDefaultAllocator);
102 mlir::Value oldAddress;
103 mlir::Value wasReallocated;
104 mlir::Value oldAddressWasAllocated;
118 mlir::ValueRange lenParams,
120 cuf::DataAttributeAttr dataAttr = {});
124 bool takeLboundsIfRealloc,
125 const MutableBoxReallocation &realloc,
126 cuf::DataAttributeAttr dataAttr = {});
132 const fir::MutableBoxValue &box);
134void genInlinedAllocation(fir::FirOpBuilder &builder, mlir::Location loc,
135 const fir::MutableBoxValue &box,
136 mlir::ValueRange lbounds, mlir::ValueRange extents,
137 mlir::ValueRange lenParams, llvm::StringRef allocName,
138 bool mustBeHeap =
false);
142mlir::Value
genFreemem(fir::FirOpBuilder &builder, mlir::Location loc,
143 const fir::MutableBoxValue &box);
149 const fir::MutableBoxValue &box);
157 const fir::MutableBoxValue &box,
158 bool mayBePolymorphic =
true,
159 bool preserveLowerBounds =
true);
165mlir::Value
getMutableIRBox(fir::FirOpBuilder &builder, mlir::Location loc,
166 const fir::MutableBoxValue &box);
172 const fir::MutableBoxValue &box);
178 const fir::MutableBoxValue &box);
194 fir::BaseBoxType boxTy, mlir::Value shape,
195 llvm::ArrayRef<mlir::Value> typeParams,
196 mlir::Value polymorphicMold);
Definition BoxValue.h:469
Definition FIRBuilder.h:66
Definition BoxValue.h:361
Definition BoxValue.h:446
mlir::Value genIsNotAllocatedOrAssociatedTest(fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box)
Definition MutableBox.cpp:504
mlir::Value genIsAllocatedOrAssociatedTest(fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box)
Definition MutableBox.cpp:497
void associateMutableBox(fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box, const fir::ExtendedValue &source, mlir::ValueRange lbounds)
Definition MutableBox.cpp:539
mlir::Value genFreemem(fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box)
Definition MutableBox.cpp:839
fir::ExtendedValue genMutableBoxRead(fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box, bool mayBePolymorphic=true, bool preserveLowerBounds=true)
Definition MutableBox.cpp:459
void genFreememIfAllocated(fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box)
Definition MutableBox.cpp:522
fir::MutableBoxValue createTempMutableBox(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type type, llvm::StringRef name={}, mlir::Value sourceBox={}, bool isPolymorphic=false)
Definition MutableBox.cpp:417
std::function< void(fir::ExtendedValue)> ReallocStorageHandlerFunc
Definition MutableBox.h:113
void disassociateMutableBox(fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box, bool polymorphicSetType=true, unsigned allocator=kDefaultAllocator)
Definition MutableBox.cpp:728
mlir::Value genNullBoxStorage(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type boxTy)
Definition MutableBox.cpp:1035
mlir::Value getAndEstablishBoxStorage(fir::FirOpBuilder &builder, mlir::Location loc, fir::BaseBoxType boxTy, mlir::Value shape, llvm::ArrayRef< mlir::Value > typeParams, mlir::Value polymorphicMold)
Definition MutableBox.cpp:1045
mlir::Value createUnallocatedBox(fir::FirOpBuilder &builder, mlir::Location loc, mlir::Type boxType, mlir::ValueRange nonDeferredParams, mlir::Value typeSourceBox={}, unsigned allocator=kDefaultAllocator)
Definition MutableBox.cpp:363
void associateMutableBoxWithRemap(fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box, const fir::ExtendedValue &source, mlir::ValueRange lbounds, mlir::ValueRange ubounds)
Definition MutableBox.cpp:625
void syncMutableBoxFromIRBox(fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box)
Definition MutableBox.cpp:1029
mlir::Value getMutableIRBox(fir::FirOpBuilder &builder, mlir::Location loc, const fir::MutableBoxValue &box)
Definition MutableBox.cpp:1023
Definition AbstractConverter.h:37
Definition AbstractConverter.h:32
Definition MutableBox.h:100