FLANG
support.h
1//===-- include/flang/Runtime/support.h -------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// Defines APIs for runtime support code for lowering.
10#ifndef FORTRAN_RUNTIME_SUPPORT_H_
11#define FORTRAN_RUNTIME_SUPPORT_H_
12
13#include "flang/Common/ISO_Fortran_binding_wrapper.h"
14#include "flang/Runtime/entry-names.h"
15#include <cstddef>
16
17namespace Fortran::runtime {
18
19class Descriptor;
20
21namespace typeInfo {
22class DerivedType;
23}
24
25enum class LowerBoundModifier : int {
26 Preserve = 0,
27 SetToOnes = 1,
28 SetToZeroes = 2
29};
30
31extern "C" {
32
33// Predicate: is the storage described by a Descriptor contiguous in memory?
34bool RTDECL(IsContiguous)(const Descriptor &);
35
36// Predicate: is the storage described by a Descriptor contiguous in memory
37// up to the given dimension?
38bool RTDECL(IsContiguousUpTo)(const Descriptor &, int);
39
40// Predicate: is this descriptor describing an assumed-size array?
41bool RTDECL(IsAssumedSize)(const Descriptor &);
42
43// Copy "from" descriptor into "to" descriptor and update "to" dynamic type,
44// CFI_attribute, and lower bounds according to the other arguments.
45// "newDynamicType" may be a null pointer in which case "to" dynamic type is the
46// one of "from".
47void RTDECL(CopyAndUpdateDescriptor)(Descriptor &to, const Descriptor &from,
48 const typeInfo::DerivedType *newDynamicType,
49 ISO::CFI_attribute_t newAttribute, enum LowerBoundModifier newLowerBounds);
50
51} // extern "C"
52} // namespace Fortran::runtime
53#endif // FORTRAN_RUNTIME_SUPPORT_H_