xref: /llvm-project/flang/include/flang/Runtime/support.h (revision f49d26bc7766a6589bdbfc6fd752665ae5643b62)
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/ISO_Fortran_binding_wrapper.h"
14 #include "flang/Runtime/entry-names.h"
15 #include <cstddef>
16 #include <cstdint>
17 
18 namespace Fortran::runtime {
19 
20 class Descriptor;
21 
22 namespace typeInfo {
23 class DerivedType;
24 }
25 
26 enum class LowerBoundModifier : int {
27   Preserve = 0,
28   SetToOnes = 1,
29   SetToZeroes = 2
30 };
31 
32 extern "C" {
33 
34 // Predicate: is the storage described by a Descriptor contiguous in memory?
35 bool RTDECL(IsContiguous)(const Descriptor &);
36 
37 // Predicate: is this descriptor describing an assumed-size array?
38 bool RTDECL(IsAssumedSize)(const Descriptor &);
39 
40 // Copy "from" descriptor into "to" descriptor and update "to" dynamic type,
41 // CFI_attribute, and lower bounds according to the other arguments.
42 // "newDynamicType" may be a null pointer in which case "to" dynamic type is the
43 // one of "from".
44 void RTDECL(CopyAndUpdateDescriptor)(Descriptor &to, const Descriptor &from,
45     const typeInfo::DerivedType *newDynamicType,
46     ISO::CFI_attribute_t newAttribute, enum LowerBoundModifier newLowerBounds);
47 
48 } // extern "C"
49 } // namespace Fortran::runtime
50 #endif // FORTRAN_RUNTIME_SUPPORT_H_
51