Lines Matching full:pointer

1 //===-- runtime/pointer.cpp -----------------------------------------------===//
9 #include "flang/Runtime/pointer.h"
22 void RTDEF(PointerNullifyIntrinsic)(Descriptor &pointer, TypeCategory category, in RTDEF()
25 pointer.Establish(TypeCode{category, kind}, in RTDEF()
30 void RTDEF(PointerNullifyCharacter)(Descriptor &pointer, SubscriptValue length, in RTDEF()
33 pointer.Establish( in RTDEF()
37 void RTDEF(PointerNullifyDerived)(Descriptor &pointer, in RTDEF()
40 pointer.Establish(derivedType, nullptr, rank, nullptr, CFI_attribute_pointer); in RTDEF()
43 void RTDEF(PointerSetBounds)(Descriptor &pointer, int zeroBasedDim, in RTDEF()
45 INTERNAL_CHECK(zeroBasedDim >= 0 && zeroBasedDim < pointer.rank()); in RTDEF()
46 pointer.GetDimension(zeroBasedDim).SetBounds(lower, upper); in RTDEF()
47 // The byte strides are computed when the pointer is allocated. in RTDEF()
53 Descriptor &pointer, int which, SubscriptValue x) { in RTDEF()
54 DescriptorAddendum *addendum{pointer.Addendum()}; in RTDEF()
60 Descriptor &pointer, const Descriptor &mold, int rank) { in RTDEF()
61 pointer.ApplyMold(mold, rank); in RTDEF()
64 void RTDEF(PointerAssociateScalar)(Descriptor &pointer, void *target) { in RTDEF()
65 pointer.set_base_addr(target); in RTDEF()
68 void RTDEF(PointerAssociate)(Descriptor &pointer, const Descriptor &target) { in RTDEF()
69 pointer = target; in RTDEF()
70 pointer.raw().attribute = CFI_attribute_pointer; in RTDEF()
73 void RTDEF(PointerAssociateLowerBounds)(Descriptor &pointer, in RTDEF()
75 pointer = target; in RTDEF()
76 pointer.raw().attribute = CFI_attribute_pointer; in RTDEF()
77 int rank{pointer.rank()}; in RTDEF()
81 Dimension &dim{pointer.GetDimension(j)}; in RTDEF()
89 void RTDEF(PointerAssociateRemapping)(Descriptor &pointer, in RTDEF()
92 pointer = target; in RTDEF()
93 pointer.raw().attribute = CFI_attribute_pointer; in RTDEF()
99 pointer.raw().rank = boundsRank; in RTDEF()
101 auto &dim{pointer.GetDimension(j)}; in RTDEF()
113 if (pointer.Elements() > target.Elements()) { in RTDEF()
115 "pointer (%zd > %zd)", in RTDEF()
116 pointer.Elements(), target.Elements()); in RTDEF()
118 if (auto *pointerAddendum{pointer.Addendum()}) { in RTDEF()
144 int RTDEF(PointerAllocate)(Descriptor &pointer, bool hasStat, in RTDEF()
147 if (!pointer.IsPointer()) { in RTDEF()
150 std::size_t elementBytes{pointer.ElementBytes()}; in RTDEF()
154 elementBytes = pointer.raw().elem_len = 0; in RTDEF()
156 std::size_t byteSize{pointer.Elements() * elementBytes}; in RTDEF()
161 pointer.set_base_addr(p); in RTDEF()
162 pointer.SetByteStrides(); in RTDEF()
164 if (const DescriptorAddendum * addendum{pointer.Addendum()}) { in RTDEF()
167 stat = Initialize(pointer, *derived, terminator, hasStat, errMsg); in RTDEF()
174 int RTDEF(PointerAllocateSource)(Descriptor &pointer, const Descriptor &source, in RTDEF()
178 pointer, hasStat, errMsg, sourceFile, sourceLine)}; in RTDEF()
181 DoFromSourceAssign(pointer, source, terminator); in RTDEF()
207 int RTDEF(PointerDeallocate)(Descriptor &pointer, bool hasStat, in RTDEF()
210 if (!pointer.IsPointer()) { in RTDEF()
213 if (!pointer.IsAllocated()) { in RTDEF()
217 !ValidatePointerPayload(pointer.raw())) { in RTDEF()
221 pointer.Destroy(/*finalize=*/true, /*destroyPointers=*/true, &terminator), in RTDEF()
225 int RTDEF(PointerDeallocatePolymorphic)(Descriptor &pointer, in RTDEF()
229 pointer, hasStat, errMsg, sourceFile, sourceLine)}; in RTDEF()
231 if (DescriptorAddendum * addendum{pointer.Addendum()}) { in RTDEF()
233 pointer.raw().type = derivedType ? CFI_type_struct : CFI_type_other; in RTDEF()
239 pointer.raw().type = CFI_type_other; in RTDEF()
245 bool RTDEF(PointerIsAssociated)(const Descriptor &pointer) { in RTDEF()
246 return pointer.raw().base_addr != nullptr; in RTDEF()
250 const Descriptor &pointer, const Descriptor *target) { in RTDEF()
252 return pointer.raw().base_addr != nullptr; in RTDEF()
258 int rank{pointer.rank()}; in RTDEF()
259 if (pointer.raw().base_addr != target->raw().base_addr || in RTDEF()
260 pointer.ElementBytes() != target->ElementBytes() || in RTDEF()
265 const Dimension &pDim{pointer.GetDimension(j)}; in RTDEF()