comparison gcc/ada/gcc-interface/gigi.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
4 * * 4 * *
5 * G I G I * 5 * G I G I *
6 * * 6 * *
7 * C Header File * 7 * C Header File *
8 * * 8 * *
9 * Copyright (C) 1992-2017, Free Software Foundation, Inc. * 9 * Copyright (C) 1992-2018, Free Software Foundation, Inc. *
10 * * 10 * *
11 * GNAT is free software; you can redistribute it and/or modify it under * 11 * GNAT is free software; you can redistribute it and/or modify it under *
12 * terms of the GNU General Public License as published by the Free Soft- * 12 * terms of the GNU General Public License as published by the Free Soft- *
13 * ware Foundation; either version 3, or (at your option) any later ver- * 13 * ware Foundation; either version 3, or (at your option) any later ver- *
14 * sion. GNAT is distributed in the hope that it will be useful, but WITH- * 14 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
75 extern tree end_stmt_group (void); 75 extern tree end_stmt_group (void);
76 76
77 /* Set the BLOCK node corresponding to the current code group to GNU_BLOCK. */ 77 /* Set the BLOCK node corresponding to the current code group to GNU_BLOCK. */
78 extern void set_block_for_group (tree); 78 extern void set_block_for_group (tree);
79 79
80 /* Add a declaration statement for GNU_DECL to the current BLOCK_STMT node. 80 /* Add a declaration statement for GNU_DECL to the current statement group.
81 Get SLOC from GNAT_ENTITY. */ 81 Get the SLOC to be put onto the statement from GNAT_NODE. */
82 extern void add_decl_expr (tree gnu_decl, Entity_Id gnat_entity); 82 extern void add_decl_expr (tree gnu_decl, Node_Id gnat_node);
83 83
84 /* Mark nodes rooted at T with TREE_VISITED and types as having their 84 /* Mark nodes rooted at T with TREE_VISITED and types as having their
85 sized gimplified. We use this to indicate all variable sizes and 85 sized gimplified. We use this to indicate all variable sizes and
86 positions in global types may not be shared by any subprogram. */ 86 positions in global types may not be shared by any subprogram. */
87 extern void mark_visited (tree t); 87 extern void mark_visited (tree t);
107 be elaborated at the point of its definition, but do nothing else. */ 107 be elaborated at the point of its definition, but do nothing else. */
108 extern void elaborate_entity (Entity_Id gnat_entity); 108 extern void elaborate_entity (Entity_Id gnat_entity);
109 109
110 /* Get the unpadded version of a GNAT type. */ 110 /* Get the unpadded version of a GNAT type. */
111 extern tree get_unpadded_type (Entity_Id gnat_entity); 111 extern tree get_unpadded_type (Entity_Id gnat_entity);
112
113 /* Return whether the E_Subprogram_Type/E_Function/E_Procedure GNAT_ENTITY is
114 a C++ imported method or equivalent. */
115 extern bool is_cplusplus_method (Entity_Id gnat_entity);
116 112
117 /* Create a record type that contains a SIZE bytes long field of TYPE with a 113 /* Create a record type that contains a SIZE bytes long field of TYPE with a
118 starting bit position so that it is aligned to ALIGN bits, and leaving at 114 starting bit position so that it is aligned to ALIGN bits, and leaving at
119 least ROOM bytes free before the field. BASE_ALIGN is the alignment the 115 least ROOM bytes free before the field. BASE_ALIGN is the alignment the
120 record is guaranteed to get. GNAT_NODE is used for the position of the 116 record is guaranteed to get. GNAT_NODE is used for the position of the
149 extern tree maybe_pad_type (tree type, tree size, unsigned int align, 145 extern tree maybe_pad_type (tree type, tree size, unsigned int align,
150 Entity_Id gnat_entity, bool is_component_type, 146 Entity_Id gnat_entity, bool is_component_type,
151 bool is_user_type, bool definition, 147 bool is_user_type, bool definition,
152 bool set_rm_size); 148 bool set_rm_size);
153 149
150 /* Return true if padded TYPE was built with an RM size. */
151 extern bool pad_type_has_rm_size (tree type);
152
154 /* Return a copy of the padded TYPE but with reverse storage order. */ 153 /* Return a copy of the padded TYPE but with reverse storage order. */
155 extern tree set_reverse_storage_order_on_pad_type (tree type); 154 extern tree set_reverse_storage_order_on_pad_type (tree type);
156 155
157 enum alias_set_op 156 enum alias_set_op
158 { 157 {
212 /* Destroy data structures of the decl.c module. */ 211 /* Destroy data structures of the decl.c module. */
213 extern void destroy_gnat_decl (void); 212 extern void destroy_gnat_decl (void);
214 213
215 /* Highest number in the front-end node table. */ 214 /* Highest number in the front-end node table. */
216 extern int max_gnat_nodes; 215 extern int max_gnat_nodes;
217
218 /* Current node being treated, in case abort called. */
219 extern Node_Id error_gnat_node;
220 216
221 /* True when gigi is being called on an analyzed but unexpanded 217 /* True when gigi is being called on an analyzed but unexpanded
222 tree, and the only purpose of the call is to properly annotate 218 tree, and the only purpose of the call is to properly annotate
223 types with representation information. */ 219 types with representation information. */
224 extern bool type_annotate_only; 220 extern bool type_annotate_only;
284 280
285 /* Convert SLOC into LOCUS. Return true if SLOC corresponds to a source code 281 /* Convert SLOC into LOCUS. Return true if SLOC corresponds to a source code
286 location and false if it doesn't. If CLEAR_COLUMN is true, set the column 282 location and false if it doesn't. If CLEAR_COLUMN is true, set the column
287 information to 0. */ 283 information to 0. */
288 extern bool Sloc_to_locus (Source_Ptr Sloc, location_t *locus, 284 extern bool Sloc_to_locus (Source_Ptr Sloc, location_t *locus,
289 bool clear_column = false); 285 bool clear_column = false, const_tree decl = 0);
290 286
291 /* Post an error message. MSG is the error message, properly annotated. 287 /* Post an error message. MSG is the error message, properly annotated.
292 NODE is the node at which to post the error and the node to use for the 288 NODE is the node at which to post the error and the node to use for the
293 '&' substitution. */ 289 '&' substitution. */
294 extern void post_error (const char *msg, Node_Id node); 290 extern void post_error (const char *msg, Node_Id node);
543 extern int gnat_types_compatible_p (tree t1, tree t2); 539 extern int gnat_types_compatible_p (tree t1, tree t2);
544 540
545 /* Return true if EXPR is a useless type conversion. */ 541 /* Return true if EXPR is a useless type conversion. */
546 extern bool gnat_useless_type_conversion (tree expr); 542 extern bool gnat_useless_type_conversion (tree expr);
547 543
548 /* Return true if T, a FUNCTION_TYPE, has the specified list of flags. */ 544 /* Return true if T, a {FUNCTION,METHOD}_TYPE, has the specified flags. */
549 extern bool fntype_same_flags_p (const_tree, tree, bool, bool, bool); 545 extern bool fntype_same_flags_p (const_tree, tree, bool, bool, bool);
550 546
551 /* Create an expression whose value is that of EXPR, 547 /* Create an expression whose value is that of EXPR,
552 converted to type TYPE. The TREE_TYPE of the value 548 converted to type TYPE. The TREE_TYPE of the value
553 is always TYPE. This function implements all reasonable 549 is always TYPE. This function implements all reasonable
1070 /* Return the smallest power of 2 larger than X. */ 1066 /* Return the smallest power of 2 larger than X. */
1071 1067
1072 static inline unsigned HOST_WIDE_INT 1068 static inline unsigned HOST_WIDE_INT
1073 ceil_pow2 (unsigned HOST_WIDE_INT x) 1069 ceil_pow2 (unsigned HOST_WIDE_INT x)
1074 { 1070 {
1075 return (unsigned HOST_WIDE_INT) 1 << (floor_log2 (x - 1) + 1); 1071 return (unsigned HOST_WIDE_INT) 1 << ceil_log2 (x);
1076 } 1072 }
1077 1073
1078 /* Return true if EXP, a CALL_EXPR, is an atomic load. */ 1074 /* Return true if EXP, a CALL_EXPR, is an atomic load. */
1079 1075
1080 static inline bool 1076 static inline bool
1081 call_is_atomic_load (tree exp) 1077 call_is_atomic_load (tree exp)
1082 { 1078 {
1083 tree fndecl = get_callee_fndecl (exp); 1079 tree fndecl = get_callee_fndecl (exp);
1084 1080
1085 if (!(fndecl && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)) 1081 if (!(fndecl && fndecl_built_in_p (fndecl, BUILT_IN_NORMAL)))
1086 return false; 1082 return false;
1087 1083
1088 enum built_in_function code = DECL_FUNCTION_CODE (fndecl); 1084 enum built_in_function code = DECL_FUNCTION_CODE (fndecl);
1089 return BUILT_IN_ATOMIC_LOAD_N <= code && code <= BUILT_IN_ATOMIC_LOAD_16; 1085 return BUILT_IN_ATOMIC_LOAD_N <= code && code <= BUILT_IN_ATOMIC_LOAD_16;
1090 } 1086 }
1167 if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type) && TYPE_DEBUG_TYPE (type)) 1163 if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type) && TYPE_DEBUG_TYPE (type))
1168 type = TYPE_DEBUG_TYPE (type); 1164 type = TYPE_DEBUG_TYPE (type);
1169 1165
1170 return type; 1166 return type;
1171 } 1167 }
1168
1169 /* Like build_qualified_type, but TYPE_QUALS is added to the existing
1170 qualifiers on TYPE. */
1171
1172 static inline tree
1173 change_qualified_type (tree type, int type_quals)
1174 {
1175 /* Qualifiers must be put on the associated array type. */
1176 if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE)
1177 return type;
1178
1179 return build_qualified_type (type, TYPE_QUALS (type) | type_quals);
1180 }