FLANG
runtime-type-info.h
1//===-- include/flang/Semantics/runtime-type-info.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// BuildRuntimeDerivedTypeTables() translates the scopes of derived types
10// and parameterized derived type instantiations into the type descriptions
11// defined in module/__fortran_type_info.f90, packaging these descriptions
12// as static initializers for compiler-created objects.
13
14#ifndef FORTRAN_SEMANTICS_RUNTIME_TYPE_INFO_H_
15#define FORTRAN_SEMANTICS_RUNTIME_TYPE_INFO_H_
16
17#include "flang/Semantics/symbol.h"
18#include <map>
19#include <set>
20#include <string>
21
22namespace llvm {
23class raw_ostream;
24}
25
26namespace Fortran::semantics {
27
29 Scope *schemata{nullptr};
30 std::set<std::string> names;
31};
32
33RuntimeDerivedTypeTables BuildRuntimeDerivedTypeTables(SemanticsContext &);
34
37constexpr char typeInfoBuiltinModule[]{"__fortran_type_info"};
38
41constexpr char typeDescriptorTypeName[]{"derivedtype"};
42
45constexpr char sizeInBytesCompName[]{"sizeinbytes"};
46
49constexpr char bindingDescCompName[]{"binding"};
50
53constexpr char procCompName[]{"proc"};
54
55SymbolVector CollectBindings(const Scope &dtScope);
56
57enum NonTbpDefinedIoFlags {
58 IsDtvArgPolymorphic = 1 << 0,
59 DefinedIoInteger8 = 1 << 1,
60};
61
63 const Symbol *subroutine;
64 common::DefinedIo definedIo;
65 std::uint8_t flags;
66};
67
68std::multimap<const Symbol *, NonTbpDefinedIo>
69CollectNonTbpDefinedIoGenericInterfaces(
70 const Scope &, bool useRuntimeTypeInfoEntries);
71
72bool ShouldIgnoreRuntimeTypeInfoNonTbpGenericInterfaces(
73 const Scope &, const DerivedTypeSpec *);
74bool ShouldIgnoreRuntimeTypeInfoNonTbpGenericInterfaces(
75 const Scope &, const DeclTypeSpec *);
76bool ShouldIgnoreRuntimeTypeInfoNonTbpGenericInterfaces(
77 const Scope &, const Symbol *);
78
79} // namespace Fortran::semantics
80#endif // FORTRAN_SEMANTICS_RUNTIME_TYPE_INFO_H_
Definition scope.h:68
Definition semantics.h:67
Definition symbol.h:910
Definition runtime-type-info.h:62
Definition runtime-type-info.h:28