11#ifndef FORTRAN_RUNTIME_ALLOCATABLE_H_
12#define FORTRAN_RUNTIME_ALLOCATABLE_H_
14#include "flang/Runtime/descriptor-consts.h"
15#include "flang/Runtime/entry-names.h"
16#include "flang/Runtime/freestanding-tools.h"
18namespace Fortran::runtime {
30void RTDECL(AllocatableInitIntrinsic)(
31 Descriptor &, TypeCategory,
int kind,
int rank = 0,
int corank = 0);
32void RTDECL(AllocatableInitCharacter)(Descriptor &, SubscriptValue length = 0,
33 int kind = 1,
int rank = 0,
int corank = 0);
34void RTDECL(AllocatableInitDerived)(
35 Descriptor &,
const typeInfo::DerivedType &,
int rank = 0,
int corank = 0);
41void RTDECL(AllocatableInitIntrinsicForAllocate)(
42 Descriptor &, TypeCategory,
int kind,
int rank = 0,
int corank = 0);
43void RTDECL(AllocatableInitCharacterForAllocate)(Descriptor &,
44 SubscriptValue length = 0,
int kind = 1,
int rank = 0,
int corank = 0);
45void RTDECL(AllocatableInitDerivedForAllocate)(
46 Descriptor &,
const typeInfo::DerivedType &,
int rank = 0,
int corank = 0);
54int RTDECL(AllocatableCheckAllocated)(Descriptor &,
55 const Descriptor *errMsg =
nullptr,
const char *sourceFile =
nullptr,
61void RTDECL(AllocatableApplyMold)(
62 Descriptor &,
const Descriptor &mold,
int rank = 0);
66void RTDECL(AllocatableSetBounds)(
67 Descriptor &,
int zeroBasedDim, SubscriptValue lower, SubscriptValue upper);
70void RTDECL(AllocatableSetCoBounds)(Descriptor &,
int zeroBasedCoDim,
71 SubscriptValue lower, SubscriptValue upper = 0);
76void RTDECL(AllocatableSetDerivedLength)(
77 Descriptor &,
int which, SubscriptValue);
84int RTDECL(AllocatableCheckLengthParameter)(Descriptor &,
85 int which , SubscriptValue other,
86 bool hasStat =
false,
const Descriptor *errMsg =
nullptr,
87 const char *sourceFile =
nullptr,
int sourceLine = 0);
98#ifdef RT_DEVICE_COMPILATION
99int RTDECL(AllocatableAllocate)(Descriptor &,
100 std::int64_t *asyncObject =
nullptr,
bool hasStat =
false,
101 const Descriptor *errMsg =
nullptr,
const char *sourceFile =
nullptr,
102 int sourceLine = 0, MemcpyFct memcpyFct = &MemcpyWrapper);
104int RTDECL(AllocatableAllocate)(Descriptor &,
105 std::int64_t *asyncObject =
nullptr,
bool hasStat =
false,
106 const Descriptor *errMsg =
nullptr,
const char *sourceFile =
nullptr,
107 int sourceLine = 0, MemcpyFct memcpyFct = &Fortran::runtime::memcpy);
109int RTDECL(AllocatableAllocateSource)(Descriptor &,
const Descriptor &source,
110 bool hasStat =
false,
const Descriptor *errMsg =
nullptr,
111 const char *sourceFile =
nullptr,
int sourceLine = 0);
117std::int32_t RTDECL(MoveAlloc)(Descriptor &to, Descriptor &from,
118 const typeInfo::DerivedType *,
bool hasStat =
false,
119 const Descriptor *errMsg =
nullptr,
const char *sourceFile =
nullptr,
125int RTDECL(AllocatableDeallocate)(Descriptor &,
bool hasStat =
false,
126 const Descriptor *errMsg =
nullptr,
const char *sourceFile =
nullptr,
131int RTDECL(AllocatableDeallocatePolymorphic)(Descriptor &,
132 const typeInfo::DerivedType *,
bool hasStat =
false,
133 const Descriptor *errMsg =
nullptr,
const char *sourceFile =
nullptr,
137void RTDECL(AllocatableDeallocateNoFinal)(
138 Descriptor &,
const char *sourceFile =
nullptr,
int sourceLine = 0);