1/* Header for Fortran 95 types backend support.
2 Copyright (C) 2002-2023 Free Software Foundation, Inc.
3 Contributed by Paul Brook <paul@nowt.org>
4 and Steven Bosscher <s.bosscher@student.tudelft.nl>
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 3, or (at your option) any later
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
21
22
23#ifndef GFC_BACKEND_H
24#define GFC_BACKEND_H
25
26
27extern GTY(()) tree gfc_array_index_type;
28extern GTY(()) tree gfc_array_range_type;
29extern GTY(()) tree gfc_character1_type_node;
30extern GTY(()) tree ppvoid_type_node;
31extern GTY(()) tree pvoid_type_node;
32extern GTY(()) tree prvoid_type_node;
33extern GTY(()) tree pchar_type_node;
34extern GTY(()) tree gfc_float128_type_node;
35extern GTY(()) tree gfc_complex_float128_type_node;
36
37/* logical_type_node is the Fortran LOGICAL type of default kind. In
38 addition to uses mandated by the Fortran standard, also prefer it
39 for compiler generated temporary variables, is it avoids some minor
40 issues with boolean_type_node (the C/C++ _Bool/bool). Namely:
41 - On x86, partial register stalls with 8/16 bit register access,
42 and length prefix changes.
43 - On s390 there is a compare with immediate and jump instruction,
44 but it works only with 32-bit quantities and not 8-bit such as
45 boolean_type_node.
46*/
47extern GTY(()) tree logical_type_node;
48extern GTY(()) tree logical_true_node;
49extern GTY(()) tree logical_false_node;
50
51/* This is the type used to hold the lengths of character variables.
52 It must be the same as the corresponding definition in gfortran.h. */
53extern GTY(()) tree gfc_charlen_type_node;
54
55
56/* The following flags give us information on the correspondence of
57 real (and complex) kinds with C floating-point types long double
58 and _Float128. */
59extern bool gfc_real16_is_float128;
60
61/* True if IEC 60559 *f128 APIs should be used for _Float128 rather than
62 libquadmath *q APIs. */
63extern bool gfc_real16_use_iec_60559;
64
65enum gfc_packed {
66 PACKED_NO = 0,
67 PACKED_PARTIAL,
68 PACKED_FULL,
69 PACKED_STATIC
70};
71
72/* trans-types.cc */
73void gfc_init_kinds (void);
74void gfc_init_types (void);
75void gfc_init_c_interop_kinds (void);
76
77tree get_dtype_type_node (void);
78tree gfc_get_int_type (int);
79tree gfc_get_real_type (int);
80tree gfc_get_complex_type (int);
81tree gfc_get_logical_type (int);
82tree gfc_get_char_type (int);
83tree gfc_get_pchar_type (int);
84tree gfc_get_character_type (int, gfc_charlen *);
85tree gfc_get_character_type_len (int, tree);
86tree gfc_get_character_type_len_for_eltype (tree, tree);
87
88tree gfc_sym_type (gfc_symbol *, bool is_bind_c_arg = false);
89tree gfc_get_cfi_type (int dimen, bool restricted);
90tree gfc_typenode_for_spec (gfc_typespec *, int c = 0);
91bool gfc_copy_dt_decls_ifequal (gfc_symbol *, gfc_symbol *, bool);
92
93tree gfc_get_function_type (gfc_symbol *, gfc_actual_arglist *args = NULL,
94 const char *fnspec = NULL);
95
96tree gfc_type_for_size (unsigned, int);
97tree gfc_type_for_mode (machine_mode, int);
98tree gfc_build_uint_type (int);
99
100tree gfc_get_element_type (tree);
101tree gfc_get_array_type_bounds (tree, int, int, tree *, tree *, int,
102 enum gfc_array_kind, bool);
103tree gfc_get_nodesc_array_type (tree, gfc_array_spec *, gfc_packed, bool);
104
105/* Add a field of given name and type to a UNION_TYPE or RECORD_TYPE. */
106tree gfc_add_field_to_struct (tree, tree, tree, tree **);
107
108/* Layout and output debugging info for a type. */
109void gfc_finish_type (tree);
110
111/* Some functions have an extra parameter for the return value. */
112bool gfc_return_by_reference (gfc_symbol *);
113
114/* Returns true if the array sym does not require a descriptor. */
115bool gfc_is_nodesc_array (gfc_symbol *);
116
117/* Return the DTYPE for an array. */
118tree gfc_get_dtype_rank_type (int, tree);
119tree gfc_get_dtype (tree, int *rank = NULL);
120
121tree gfc_get_caf_vector_type (int dim);
122tree gfc_get_caf_reference_type ();
123
124#endif
125

source code of gcc/fortran/trans-types.h