OSDN Git Service

* Fix for g++/15861
[pf3gnuchains/gcc-fork.git] / gcc / fortran / trans-types.h
1 /* Header for Fortran 95 types backend support.
2    Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
3    Contributed by Paul Brook <paul@nowt.org>
4    and Steven Bosscher <s.bosscher@student.tudelft.nl>
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
11 version.
12
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING.  If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 02111-1307, USA.  */
22
23
24 #ifndef GFC_BACKEND_H
25 #define GFC_BACKEND_H
26
27 enum
28 {
29   F95_INT1_TYPE,
30   F95_INT2_TYPE,
31   F95_INT4_TYPE,
32   F95_INT8_TYPE,
33   F95_INT16_TYPE,
34   F95_REAL4_TYPE,
35   F95_REAL8_TYPE,
36   F95_REAl16_TYPE,
37   F95_COMPLEX4_TYPE,
38   F95_COMPLEX8_TYPE,
39   F95_COMPLEX16_TYPE,
40   F95_LOGICAL1_TYPE,
41   F95_LOGICAL2_TYPE,
42   F95_LOGICAL4_TYPE,
43   F95_LOGICAL8_TYPE,
44   F95_LOGICAL16_TYPE,
45   F95_CHARACTER1_TYPE,
46   NUM_F95_TYPES
47 };
48
49 #define GFC_DTYPE_RANK_MASK 0x07
50 #define GFC_DTYPE_TYPE_SHIFT 3
51 #define GFC_DTYPE_TYPE_MASK 0x38
52 #define GFC_DTYPE_SIZE_SHIFT 6
53
54 enum
55 {
56   GFC_DTYPE_UNKNOWN = 0,
57   GFC_DTYPE_INTEGER,
58   GFC_DTYPE_LOGICAL,
59   GFC_DTYPE_REAL,
60   GFC_DTYPE_COMPLEX,
61   GFC_DTYPE_DERIVED,
62   GFC_DTYPE_CHARACTER
63 };
64
65 extern GTY(()) tree gfc_type_nodes[NUM_F95_TYPES];
66
67 extern GTY(()) tree gfc_array_index_type;
68 extern GTY(()) tree ppvoid_type_node;
69 extern GTY(()) tree pvoid_type_node;
70 extern GTY(()) tree pchar_type_node;
71
72 #define gfc_int1_type_node  gfc_type_nodes[F95_INT1_TYPE]
73 #define gfc_int2_type_node  gfc_type_nodes[F95_INT2_TYPE]
74 #define gfc_int4_type_node  gfc_type_nodes[F95_INT4_TYPE]
75 #define gfc_int8_type_node  gfc_type_nodes[F95_INT8_TYPE]
76 #define gfc_int16_type_node gfc_type_nodes[F95_INT16_TYPE]
77
78 #define gfc_real4_type_node  gfc_type_nodes[F95_REAL4_TYPE]
79 #define gfc_real8_type_node  gfc_type_nodes[F95_REAL8_TYPE]
80 #define gfc_real16_type_node gfc_type_nodes[F95_REAL16_TYPE]
81
82 #define gfc_complex4_type_node  gfc_type_nodes[F95_COMPLEX4_TYPE]
83 #define gfc_complex8_type_node  gfc_type_nodes[F95_COMPLEX8_TYPE]
84 #define gfc_complex16_type_node gfc_type_nodes[F95_COMPLEX16_TYPE]
85
86 #define gfc_logical1_type_node  gfc_type_nodes[F95_LOGICAL1_TYPE]
87 #define gfc_logical2_type_node  gfc_type_nodes[F95_LOGICAL2_TYPE]
88 #define gfc_logical4_type_node  gfc_type_nodes[F95_LOGICAL4_TYPE]
89 #define gfc_logical8_type_node  gfc_type_nodes[F95_LOGICAL8_TYPE]
90 #define gfc_logical16_type_node gfc_type_nodes[F95_LOGICAL16_TYPE]
91
92 #define gfc_character1_type_node gfc_type_nodes[F95_CHARACTER1_TYPE]
93
94 #define gfc_strlen_kind 4
95 #define gfc_strlen_type_node gfc_int4_type_node
96
97 /* These C-specific types are used while building builtin function decls.
98    For now it doesn't really matter what these are defined to as we don't
99    need any of the builtins that use them.  */
100 #define intmax_type_node gfc_int8_type_node
101 #define string_type_node pchar_type_node
102 #define const_string_type_node pchar_type_node
103
104 /* be-function.c */
105 void gfc_convert_function_code (gfc_namespace *);
106
107 /* trans-types.c */
108 void gfc_init_types (void);
109
110 tree gfc_get_int_type (int);
111 tree gfc_get_real_type (int);
112 tree gfc_get_complex_type (int);
113 tree gfc_get_logical_type (int);
114 tree gfc_get_character_type (int, gfc_charlen *);
115
116 tree gfc_sym_type (gfc_symbol *);
117 tree gfc_typenode_for_spec (gfc_typespec *);
118
119 tree gfc_get_function_type (gfc_symbol *);
120
121 tree gfc_type_for_size (unsigned, int);
122 tree gfc_type_for_mode (enum machine_mode, int);
123 tree gfc_unsigned_type (tree);
124 tree gfc_signed_type (tree);
125 tree gfc_signed_or_unsigned_type (int, tree);
126
127 tree gfc_get_element_type (tree);
128 tree gfc_get_array_type_bounds (tree, int, tree *, tree *, int);
129 tree gfc_get_nodesc_array_type (tree, gfc_array_spec *, int);
130
131 /* Add a field of given name and type to a UNION_TYPE or RECORD_TYPE.  */
132 tree gfc_add_field_to_struct (tree *, tree, tree, tree);
133
134 /* Layout and output debugging info for a type.  */
135 void gfc_finish_type (tree);
136
137 /* Some functions have an extra parameter for the return value.  */
138 int gfc_return_by_reference (gfc_symbol *);
139
140 /* Returns true if the array sym does not require a descriptor.  */
141 int gfc_is_nodesc_array (gfc_symbol *);
142
143 #endif