Make-lang.in (GNATLIBFLAGS): Add -W -Wall.
[gcc.git] / gcc / ada / gigi.h
1 /****************************************************************************
2 * *
3 * GNAT COMPILER COMPONENTS *
4 * *
5 * G I G I *
6 * *
7 * C Header File *
8 * *
9 * $Revision: 1.2 $
10 * *
11 * Copyright (C) 1992-2001 Free Software Foundation, Inc. *
12 * *
13 * GNAT is free software; you can redistribute it and/or modify it under *
14 * terms of the GNU General Public License as published by the Free Soft- *
15 * ware Foundation; either version 2, or (at your option) any later ver- *
16 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
17 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
19 * for more details. You should have received a copy of the GNU General *
20 * Public License distributed with GNAT; see file COPYING. If not, write *
21 * to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, *
22 * MA 02111-1307, USA. *
23 * *
24 * As a special exception, if you link this file with other files to *
25 * produce an executable, this file does not by itself cause the resulting *
26 * executable to be covered by the GNU General Public License. This except- *
27 * ion does not however invalidate any other reasons why the executable *
28 * file might be covered by the GNU Public License. *
29 * *
30 * GNAT was originally developed by the GNAT team at New York University. *
31 * It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). *
32 * *
33 ****************************************************************************/
34
35 /* Declare all functions and types used by gigi. */
36
37 /* See if DECL has an RTL that is indirect via a pseudo-register or a
38 memory location and replace it with an indirect reference if so.
39 This improves the debugger's ability to display the value. */
40 extern void adjust_decl_rtl PARAMS ((tree));
41
42 /* Record the current code position in GNAT_NODE. */
43 extern void record_code_position PARAMS ((Node_Id));
44
45 /* Insert the code for GNAT_NODE at the position saved for that node. */
46 extern void insert_code_for PARAMS ((Node_Id));
47
48 /* Routine called by gcc for emitting a stack check. GNU_EXPR is the
49 expression that contains the last address on the stack to check. */
50 extern tree emit_stack_check PARAMS ((tree));
51
52 /* Make a TRANSFORM_EXPR to later expand GNAT_NODE into code. */
53 extern tree make_transform_expr PARAMS ((Node_Id));
54
55 /* Update the setjmp buffer BUF with the current stack pointer. We assume
56 here that a __builtin_setjmp was done to BUF. */
57 extern void update_setjmp_buf PARAMS ((tree));
58
59 /* GNU_TYPE is a type. Determine if it should be passed by reference by
60 default. */
61 extern int default_pass_by_ref PARAMS ((tree));
62
63 /* GNU_TYPE is the type of a subprogram parameter. Determine from the type if
64 it should be passed by reference. */
65 extern int must_pass_by_ref PARAMS ((tree));
66
67 /* Elaboration routines for the front end */
68 extern void elab_all_gnat PARAMS ((void));
69
70 /* Emit a label UNITNAME_LABEL and specify that it is part of source
71 file FILENAME. If this is being written for SGI's Workshop
72 debugger, and we are writing Dwarf2 debugging information, add
73 additional debug info. */
74 extern void emit_unit_label PARAMS ((char *, char *));
75
76 /* Initialize DUMMY_NODE_TABLE. */
77 extern void init_dummy_type PARAMS ((void));
78
79 /* Given GNAT_ENTITY, a GNAT defining identifier node, which denotes some Ada
80 entity, this routine returns the equivalent GCC tree for that entity
81 (an ..._DECL node) and associates the ..._DECL node with the input GNAT
82 defining identifier.
83
84 If GNAT_ENTITY is a variable or a constant declaration, GNU_EXPR gives its
85 initial value (in GCC tree form). This is optional for variables.
86 For renamed entities, GNU_EXPR gives the object being renamed.
87
88 DEFINITION is nonzero if this call is intended for a definition. This is
89 used for separate compilation where it necessary to know whether an
90 external declaration or a definition should be created if the GCC equivalent
91 was not created previously. The value of 1 is normally used for a non-zero
92 DEFINITION, but a value of 2 is used in special circumstances, defined in
93 the code. */
94 extern tree gnat_to_gnu_entity PARAMS ((Entity_Id, tree, int));
95
96 /* Given GNAT_ENTITY, an entity in the incoming GNAT tree, return a
97 GCC type corresponding to that entity. GNAT_ENTITY is assumed to
98 refer to an Ada type. */
99 extern tree gnat_to_gnu_type PARAMS ((Entity_Id));
100
101 /* Given GNAT_ENTITY, elaborate all expressions that are required to
102 be elaborated at the point of its definition, but do nothing else. */
103 extern void elaborate_entity PARAMS ((Entity_Id));
104
105 /* Mark GNAT_ENTITY as going out of scope at this point. Recursively mark
106 any entities on its entity chain similarly. */
107 extern void mark_out_of_scope PARAMS ((Entity_Id));
108
109 /* Make a dummy type corresponding to GNAT_TYPE. */
110 extern tree make_dummy_type PARAMS ((Entity_Id));
111
112 /* Get the unpadded version of a GNAT type. */
113 extern tree get_unpadded_type PARAMS ((Entity_Id));
114
115 /* Called when we need to protect a variable object using a save_expr. */
116 extern tree maybe_variable PARAMS ((tree, Node_Id));
117
118 /* Create a record type that contains a field of TYPE with a starting bit
119 position so that it is aligned to ALIGN bits. */
120 /* Create a record type that contains a field of TYPE with a starting bit
121 position so that it is aligned to ALIGN bits and is SIZE bytes long. */
122 extern tree make_aligning_type PARAMS ((tree, int, tree));
123
124 /* Given a GNU tree and a GNAT list of choices, generate an expression to test
125 the value passed against the list of choices. */
126 extern tree choices_to_gnu PARAMS ((tree, Node_Id));
127
128 /* Given a type T, a FIELD_DECL F, and a replacement value R,
129 return a new type with all size expressions that contain F
130 updated by replacing F with R. This is identical to GCC's
131 substitute_in_type except that it knows about TYPE_INDEX_TYPE. */
132 extern tree gnat_substitute_in_type PARAMS ((tree, tree, tree));
133
134 /* Return the "RM size" of GNU_TYPE. This is the actual number of bits
135 needed to represent the object. */
136 extern tree rm_size PARAMS ((tree));
137
138 /* Given GNU_ID, an IDENTIFIER_NODE containing a name and SUFFIX, a
139 string, return a new IDENTIFIER_NODE that is the concatenation of
140 the name in GNU_ID and SUFFIX. */
141 extern tree concat_id_with_name PARAMS ((tree, const char *));
142
143 /* Return the name to be used for GNAT_ENTITY. If a type, create a
144 fully-qualified name, possibly with type information encoding.
145 Otherwise, return the name. */
146 extern tree get_entity_name PARAMS ((Entity_Id));
147
148 /* Return a name for GNAT_ENTITY concatenated with two underscores and
149 SUFFIX. */
150 extern tree create_concat_name PARAMS ((Entity_Id, const char *));
151
152 /* Flag indicating whether file names are discarded in exception messages */
153 extern int discard_file_names;
154
155 /* If true, then gigi is being called on an analyzed but unexpanded
156 tree, and the only purpose of the call is to properly annotate
157 types with representation information */
158 extern int type_annotate_only;
159
160 /* Current file name without path */
161 extern const char *ref_filename;
162
163 /* List of TREE_LIST nodes representing a block stack. TREE_VALUE
164 of each gives the variable used for the setjmp buffer in the current
165 block, if any. */
166 extern tree gnu_block_stack;
167
168 /* For most front-ends, this is the parser for the language. For us, we
169 process the GNAT tree. */
170 extern int yyparse PARAMS ((void));
171
172 /* This is the main program of the back-end. It sets up all the table
173 structures and then generates code. */
174
175 extern void gigi PARAMS ((Node_Id, int, int, struct Node *,
176 Node_Id *, Node_Id *,
177 struct Elist_Header *,
178 struct Elmt_Item *,
179 struct String_Entry *,
180 Char_Code *,
181 struct List_Header *,
182 Int, char *,
183 Entity_Id, Entity_Id, Entity_Id,
184 Int));
185
186 /* This function is the driver of the GNAT to GCC tree transformation process.
187 GNAT_NODE is the root of some gnat tree. It generates code for that
188 part of the tree. */
189 extern void gnat_to_code PARAMS ((Node_Id));
190
191 /* GNAT_NODE is the root of some GNAT tree. Return the root of the
192 GCC tree corresponding to that GNAT tree. Normally, no code is generated;
193 we just return an equivalent tree which is used elsewhere to generate
194 code. */
195 extern tree gnat_to_gnu PARAMS ((Node_Id));
196
197 /* Do the processing for the declaration of a GNAT_ENTITY, a type. If
198 a separate Freeze node exists, delay the bulk of the processing. Otherwise
199 make a GCC type for GNAT_ENTITY and set up the correspondance. */
200
201 extern void process_type PARAMS ((Entity_Id));
202
203 /* Determine the input_filename and the lineno from the source location
204 (Sloc) of GNAT_NODE node. Set the global variable input_filename and
205 lineno. If WRITE_NOTE_P is true, emit a line number note. */
206 extern void set_lineno PARAMS ((Node_Id, int));
207
208 /* Post an error message. MSG is the error message, properly annotated.
209 NODE is the node at which to post the error and the node to use for the
210 "&" substitution. */
211 extern void post_error PARAMS ((const char *, Node_Id));
212
213 /* Similar, but NODE is the node at which to post the error and ENT
214 is the node to use for the "&" substitution. */
215 extern void post_error_ne PARAMS ((const char *, Node_Id, Entity_Id));
216
217 /* Similar, but NODE is the node at which to post the error, ENT is the node
218 to use for the "&" substitution, and N is the number to use for the ^. */
219 extern void post_error_ne_num PARAMS ((const char *, Node_Id, Entity_Id,
220 int));
221
222 /* Similar to post_error_ne_num, but T is a GCC tree representing the number
223 to write. If the tree represents a constant that fits within a
224 host integer, the text inside curly brackets in MSG will be output
225 (presumably including a '^'). Otherwise that text will not be output
226 and the text inside square brackets will be output instead. */
227 extern void post_error_ne_tree PARAMS ((const char *, Node_Id, Entity_Id,
228 tree));
229
230 /* Similar to post_error_ne_tree, except that NUM is a second
231 integer to write in the message. */
232 extern void post_error_ne_tree_2 PARAMS ((const char *, Node_Id, Entity_Id,
233 tree, int));
234
235 /* Set the node for a second '&' in the error message. */
236 extern void set_second_error_entity PARAMS ((Entity_Id));
237
238 /* Surround EXP with a SAVE_EXPR, but handle unconstrained objects specially
239 since it doesn't make any sense to put them in a SAVE_EXPR. */
240 extern tree make_save_expr PARAMS ((tree));
241
242 /* Signal abort, with "Gigi abort" as the error label, and error_gnat_node
243 as the relevant node that provides the location info for the error.
244 The single parameter CODE is an integer code that is included in the
245 additional error message generated. */
246 extern void gigi_abort PARAMS ((int)) ATTRIBUTE_NORETURN;
247
248 /* Initialize the table that maps GNAT codes to GCC codes for simple
249 binary and unary operations. */
250 extern void init_code_table PARAMS ((void));
251
252 /* Current node being treated, in case gigi_abort or Check_Elaboration_Code
253 called. */
254 extern Node_Id error_gnat_node;
255
256 /* This is equivalent to stabilize_reference in GCC's tree.c, but we know
257 how to handle our new nodes and we take an extra argument that says
258 whether to force evaluation of everything. */
259
260 extern tree gnat_stabilize_reference PARAMS ((tree, int));
261
262 /* Highest number in the front-end node table. */
263 extern int max_gnat_nodes;
264
265 /* If nonzero, pretend we are allocating at global level. */
266 extern int force_global;
267
268 /* Standard data type sizes. Most of these are not used. */
269
270 #ifndef CHAR_TYPE_SIZE
271 #define CHAR_TYPE_SIZE BITS_PER_UNIT
272 #endif
273
274 #ifndef SHORT_TYPE_SIZE
275 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
276 #endif
277
278 #ifndef INT_TYPE_SIZE
279 #define INT_TYPE_SIZE BITS_PER_WORD
280 #endif
281
282 #ifndef LONG_TYPE_SIZE
283 #define LONG_TYPE_SIZE BITS_PER_WORD
284 #endif
285
286 #ifndef LONG_LONG_TYPE_SIZE
287 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
288 #endif
289
290 #ifndef FLOAT_TYPE_SIZE
291 #define FLOAT_TYPE_SIZE BITS_PER_WORD
292 #endif
293
294 #ifndef DOUBLE_TYPE_SIZE
295 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
296 #endif
297
298 #ifndef LONG_DOUBLE_TYPE_SIZE
299 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
300 #endif
301
302 /* The choice of SIZE_TYPE here is very problematic. We need a signed
303 type whose bit width is Pmode. Assume "long" is such a type here. */
304 #undef SIZE_TYPE
305 #define SIZE_TYPE "long int"
306
307 \f
308 /* Data structures used to represent attributes. */
309
310 enum attr_type {ATTR_MACHINE_ATTRIBUTE, ATTR_LINK_ALIAS,
311 ATTR_LINK_SECTION, ATTR_WEAK_EXTERNAL};
312
313 struct attrib
314 {
315 struct attrib *next;
316 enum attr_type type;
317 tree name;
318 tree arg;
319 Node_Id error_point;
320 };
321
322 /* Define the entries in the standard data array. */
323 enum standard_datatypes
324 {
325 /* Various standard data types and nodes. */
326 ADT_longest_float_type,
327 ADT_void_type_decl,
328
329 /* The type of an exception. */
330 ADT_except_type,
331
332 /* Type declaration node <==> typedef void *T */
333 ADT_ptr_void_type,
334
335 /* Function type declaration -- void T() */
336 ADT_void_ftype,
337
338 /* Type declaration node <==> typedef void *T() */
339 ADT_ptr_void_ftype,
340
341 /* A function declaration node for a run-time function for allocating memory.
342 Ada allocators cause calls to this function to be generated. */
343 ADT_malloc_decl,
344
345 /* Likewise for freeing memory. */
346 ADT_free_decl,
347
348 /* Types and decls used by our temporary exception mechanism. See
349 init_gigi_decls for details. */
350 ADT_jmpbuf_type,
351 ADT_jmpbuf_ptr_type,
352 ADT_get_jmpbuf_decl,
353 ADT_set_jmpbuf_decl,
354 ADT_get_excptr_decl,
355 ADT_setjmp_decl,
356 ADT_longjmp_decl,
357 ADT_raise_nodefer_decl,
358 ADT_raise_constraint_error_decl,
359 ADT_raise_program_error_decl,
360 ADT_raise_storage_error_decl,
361 ADT_LAST};
362
363 extern tree gnat_std_decls[(int) ADT_LAST];
364
365 #define longest_float_type_node gnat_std_decls[(int) ADT_longest_float_type]
366 #define void_type_decl_node gnat_std_decls[(int) ADT_void_type_decl]
367 #define except_type_node gnat_std_decls[(int) ADT_except_type]
368 #define ptr_void_type_node gnat_std_decls[(int) ADT_ptr_void_type]
369 #define void_ftype gnat_std_decls[(int) ADT_void_ftype]
370 #define ptr_void_ftype gnat_std_decls[(int) ADT_ptr_void_ftype]
371 #define malloc_decl gnat_std_decls[(int) ADT_malloc_decl]
372 #define free_decl gnat_std_decls[(int) ADT_free_decl]
373 #define jmpbuf_type gnat_std_decls[(int) ADT_jmpbuf_type]
374 #define jmpbuf_ptr_type gnat_std_decls[(int) ADT_jmpbuf_ptr_type]
375 #define get_jmpbuf_decl gnat_std_decls[(int) ADT_get_jmpbuf_decl]
376 #define set_jmpbuf_decl gnat_std_decls[(int) ADT_set_jmpbuf_decl]
377 #define get_excptr_decl gnat_std_decls[(int) ADT_get_excptr_decl]
378 #define setjmp_decl gnat_std_decls[(int) ADT_setjmp_decl]
379 #define longjmp_decl gnat_std_decls[(int) ADT_longjmp_decl]
380 #define raise_nodefer_decl gnat_std_decls[(int) ADT_raise_nodefer_decl]
381 #define raise_constraint_error_decl \
382 gnat_std_decls[(int) ADT_raise_constraint_error_decl]
383 #define raise_program_error_decl \
384 gnat_std_decls[(int) ADT_raise_program_error_decl]
385 #define raise_storage_error_decl \
386 gnat_std_decls[(int) ADT_raise_storage_error_decl]
387
388 /* Routines expected by the gcc back-end. They must have exactly the same
389 prototype and names as below. */
390
391 /* Returns non-zero if we are currently in the global binding level */
392 extern int global_bindings_p PARAMS ((void));
393
394 /* Returns the list of declarations in the current level. Note that this list
395 is in reverse order (it has to be so for back-end compatibility). */
396 extern tree getdecls PARAMS ((void));
397
398 /* Nonzero if the current level needs to have a BLOCK made. */
399 extern int kept_level_p PARAMS ((void));
400
401 /* Enter a new binding level. The input parameter is ignored, but has to be
402 specified for back-end compatibility. */
403 extern void pushlevel PARAMS ((int));
404
405 /* Exit a binding level.
406 Pop the level off, and restore the state of the identifier-decl mappings
407 that were in effect when this level was entered.
408
409 If KEEP is nonzero, this level had explicit declarations, so
410 and create a "block" (a BLOCK node) for the level
411 to record its declarations and subblocks for symbol table output.
412
413 If FUNCTIONBODY is nonzero, this level is the body of a function,
414 so create a block as if KEEP were set and also clear out all
415 label names.
416
417 If REVERSE is nonzero, reverse the order of decls before putting
418 them into the BLOCK. */
419 extern tree poplevel PARAMS ((int,int, int));
420
421 /* Insert BLOCK at the end of the list of subblocks of the
422 current binding level. This is used when a BIND_EXPR is expanded,
423 to handle the BLOCK node inside the BIND_EXPR. */
424 extern void insert_block PARAMS ((tree));
425
426 /* Set the BLOCK node for the innermost scope
427 (the one we are currently in). */
428 extern void set_block PARAMS ((tree));
429
430 /* Records a ..._DECL node DECL as belonging to the current lexical scope.
431 Returns the ..._DECL node. */
432 extern tree pushdecl PARAMS ((tree));
433
434 /* Create the predefined scalar types such as `integer_type_node' needed
435 in the gcc back-end and initialize the global binding level. */
436 extern void gnat_init_decl_processing PARAMS ((void));
437 extern void init_gigi_decls PARAMS ((tree, tree));
438
439 /* Return an integer type with the number of bits of precision given by
440 PRECISION. UNSIGNEDP is nonzero if the type is unsigned; otherwise
441 it is a signed type. */
442 extern tree type_for_size PARAMS ((unsigned, int));
443
444 /* Return a data type that has machine mode MODE. UNSIGNEDP selects
445 an unsigned type; otherwise a signed type is returned. */
446 extern tree type_for_mode PARAMS ((enum machine_mode, int));
447
448 /* Return the unsigned version of a TYPE_NODE, a scalar type. */
449 extern tree unsigned_type PARAMS ((tree));
450
451 /* Return the signed version of a TYPE_NODE, a scalar type. */
452 extern tree signed_type PARAMS ((tree));
453
454 /* Return a type the same as TYPE except unsigned or signed according to
455 UNSIGNEDP. */
456 extern tree signed_or_unsigned_type PARAMS ((int, tree));
457
458 /* This routine is called in tree.c to print an error message for invalid use
459 of an incomplete type. */
460 extern void incomplete_type_error PARAMS ((tree, tree));
461
462 /* This function is called indirectly from toplev.c to handle incomplete
463 declarations, i.e. VAR_DECL nodes whose DECL_SIZE is zero. To be precise,
464 compile_file in toplev.c makes an indirect call through the function pointer
465 incomplete_decl_finalize_hook which is initialized to this routine in
466 init_decl_processing. */
467 extern void finish_incomplete_decl PARAMS ((tree));
468
469 /* Create an expression whose value is that of EXPR,
470 converted to type TYPE. The TREE_TYPE of the value
471 is always TYPE. This function implements all reasonable
472 conversions; callers should filter out those that are
473 not permitted by the language being compiled. */
474 extern tree convert PARAMS ((tree, tree));
475
476 /* Routines created solely for the tree translator's sake. Their prototypes
477 can be changed as desired. */
478
479 /* GNAT_ENTITY is a GNAT tree node for a defining identifier.
480 GNU_DECL is the GCC tree which is to be associated with
481 GNAT_ENTITY. Such gnu tree node is always an ..._DECL node.
482 If NO_CHECK is nonzero, the latter check is suppressed.
483 If GNU_DECL is zero, a previous association is to be reset. */
484 extern void save_gnu_tree PARAMS ((Entity_Id, tree, int));
485
486 /* GNAT_ENTITY is a GNAT tree node for a defining identifier.
487 Return the ..._DECL node that was associated with it. If there is no tree
488 node associated with GNAT_ENTITY, abort. */
489 extern tree get_gnu_tree PARAMS ((Entity_Id));
490
491 /* Return nonzero if a GCC tree has been associated with GNAT_ENTITY. */
492 extern int present_gnu_tree PARAMS ((Entity_Id));
493
494 /* Initialize tables for above routines. */
495 extern void init_gnat_to_gnu PARAMS ((void));
496
497 /* Given a record type (RECORD_TYPE) and a chain of FIELD_DECL
498 nodes (FIELDLIST), finish constructing the record or union type.
499 If HAS_REP is nonzero, this record has a rep clause; don't call
500 layout_type but merely set the size and alignment ourselves.
501 If DEFER_DEBUG is nonzero, do not call the debugging routines
502 on this type; it will be done later. */
503 extern void finish_record_type PARAMS ((tree, tree, int, int));
504
505 /* Returns a FUNCTION_TYPE node. RETURN_TYPE is the type returned by the
506 subprogram. If it is void_type_node, then we are dealing with a procedure,
507 otherwise we are dealing with a function. PARAM_DECL_LIST is a list of
508 PARM_DECL nodes that are the subprogram arguments. CICO_LIST is the
509 copy-in/copy-out list to be stored into TYPE_CI_CO_LIST.
510 RETURNS_UNCONSTRAINED is nonzero if the function returns an unconstrained
511 object. RETURNS_BY_REF is nonzero if the function returns by reference.
512 RETURNS_WITH_DSP is nonzero if the function is to return with a
513 depressed stack pointer. */
514 extern tree create_subprog_type PARAMS ((tree, tree, tree, int, int,
515 int));
516
517 /* Return a copy of TYPE, but safe to modify in any way. */
518 extern tree copy_type PARAMS ((tree));
519
520 /* Return an INTEGER_TYPE of SIZETYPE with range MIN to MAX and whose
521 TYPE_INDEX_TYPE is INDEX. */
522 extern tree create_index_type PARAMS ((tree, tree, tree));
523
524 /* Return a TYPE_DECL node. TYPE_NAME gives the name of the type (a character
525 string) and TYPE is a ..._TYPE node giving its data type.
526 ARTIFICIAL_P is nonzero if this is a declaration that was generated
527 by the compiler. DEBUG_INFO_P is nonzero if we need to write debugging
528 information about this type. */
529 extern tree create_type_decl PARAMS ((tree, tree, struct attrib *,
530 int, int));
531
532 /* Returns a GCC VAR_DECL node. VAR_NAME gives the name of the variable.
533 ASM_NAME is its assembler name (if provided). TYPE is
534 its data type (a GCC ..._TYPE node). VAR_INIT is the GCC tree for an
535 optional initial expression; NULL_TREE if none.
536
537 CONST_FLAG is nonzero if this variable is constant.
538
539 PUBLIC_FLAG is nonzero if this definition is to be made visible outside of
540 the current compilation unit. This flag should be set when processing the
541 variable definitions in a package specification. EXTERN_FLAG is nonzero
542 when processing an external variable declaration (as opposed to a
543 definition: no storage is to be allocated for the variable here).
544 STATIC_FLAG is only relevant when not at top level. In that case
545 it indicates whether to always allocate storage to the variable. */
546 extern tree create_var_decl PARAMS ((tree, tree, tree, tree, int,
547 int, int, int,
548 struct attrib *));
549
550 /* Given a DECL and ATTR_LIST, apply the listed attributes. */
551 extern void process_attributes PARAMS ((tree, struct attrib *));
552
553 /* Obtain any pending elaborations and clear the old list. */
554 extern tree get_pending_elaborations PARAMS ((void));
555
556 /* Return nonzero if there are pending elaborations. */
557 extern int pending_elaborations_p PARAMS ((void));
558
559 /* Save a copy of the current pending elaboration list and make a new
560 one. */
561 extern void push_pending_elaborations PARAMS ((void));
562
563 /* Pop the stack of pending elaborations. */
564 extern void pop_pending_elaborations PARAMS ((void));
565
566 /* Return the current position in pending_elaborations so we can insert
567 elaborations after that point. */
568 extern tree get_elaboration_location PARAMS ((void));
569
570 /* Insert the current elaborations after ELAB, which is in some elaboration
571 list. */
572 extern void insert_elaboration_list PARAMS ((tree));
573
574 /* Add some pending elaborations to the current list. */
575 extern void add_pending_elaborations PARAMS ((tree, tree));
576
577 /* Returns a FIELD_DECL node. FIELD_NAME the field name, FIELD_TYPE is its
578 type, and RECORD_TYPE is the type of the parent. PACKED is nonzero if
579 this field is in a record type with a "pragma pack". If SIZE is nonzero
580 it is the specified size for this field. If POS is nonzero, it is the bit
581 position. If ADDRESSABLE is nonzero, it means we are allowed to take
582 the address of this field for aliasing purposes. */
583 extern tree create_field_decl PARAMS ((tree, tree, tree, int,
584 tree, tree, int));
585
586 /* Returns a PARM_DECL node. PARAM_NAME is the name of the parameter,
587 PARAM_TYPE is its type. READONLY is nonzero if the parameter is
588 readonly (either an IN parameter or an address of a pass-by-ref
589 parameter). */
590 extern tree create_param_decl PARAMS ((tree, tree, int));
591
592 /* Returns a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
593 ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
594 node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
595 PARM_DECL nodes chained through the TREE_CHAIN field).
596
597 INLINE_FLAG, PUBLIC_FLAG, and EXTERN_FLAG are used to set the appropriate
598 fields in the FUNCTION_DECL. */
599 extern tree create_subprog_decl PARAMS ((tree, tree, tree, tree, int,
600 int, int, struct attrib *));
601
602 /* Returns a LABEL_DECL node for LABEL_NAME. */
603 extern tree create_label_decl PARAMS ((tree));
604
605 /* Set up the framework for generating code for SUBPROG_DECL, a subprogram
606 body. This routine needs to be invoked before processing the declarations
607 appearing in the subprogram. */
608 extern void begin_subprog_body PARAMS ((tree));
609
610 /* Finish the definition of the current subprogram and compile it all the way
611 to assembler language output. */
612 extern void end_subprog_body PARAMS ((void));
613
614 /* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE.
615 EXPR is an expression that we can use to locate any PLACEHOLDER_EXPRs.
616 Return a constructor for the template. */
617 extern tree build_template PARAMS ((tree, tree, tree));
618
619 /* Build a VMS descriptor from a Mechanism_Type, which must specify
620 a descriptor type, and the GCC type of an object. Each FIELD_DECL
621 in the type contains in its DECL_INITIAL the expression to use when
622 a constructor is made for the type. GNAT_ENTITY is a gnat node used
623 to print out an error message if the mechanism cannot be applied to
624 an object of that type and also for the name. */
625
626 extern tree build_vms_descriptor PARAMS ((tree, Mechanism_Type,
627 Entity_Id));
628
629 /* Build a type to be used to represent an aliased object whose nominal
630 type is an unconstrained array. This consists of a RECORD_TYPE containing
631 a field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an
632 ARRAY_TYPE. If ARRAY_TYPE is that of the unconstrained array, this
633 is used to represent an arbitrary unconstrained object. Use NAME
634 as the name of the record. */
635 extern tree build_unc_object_type PARAMS ((tree, tree, tree));
636
637 /* Update anything previously pointing to OLD_TYPE to point to NEW_TYPE. In
638 the normal case this is just two adjustments, but we have more to do
639 if NEW is an UNCONSTRAINED_ARRAY_TYPE. */
640 extern void update_pointer_to PARAMS ((tree, tree));
641
642 /* EXP is an expression for the size of an object. If this size contains
643 discriminant references, replace them with the maximum (if MAX_P) or
644 minimum (if ! MAX_P) possible value of the discriminant. */
645 extern tree max_size PARAMS ((tree, int));
646
647 /* Remove all conversions that are done in EXP. This includes converting
648 from a padded type or converting to a left-justified modular type. */
649 extern tree remove_conversions PARAMS ((tree));
650
651 /* If EXP's type is an UNCONSTRAINED_ARRAY_TYPE, return an expression that
652 refers to the underlying array. If its type has TYPE_CONTAINS_TEMPLATE_P,
653 likewise return an expression pointing to the underlying array. */
654 extern tree maybe_unconstrained_array PARAMS ((tree));
655
656 /* Return an expression that does an unchecked converstion of EXPR to TYPE. */
657 extern tree unchecked_convert PARAMS ((tree, tree));
658
659 /* Prepare expr to be an argument of a TRUTH_NOT_EXPR or other logical
660 operation.
661
662 This preparation consists of taking the ordinary
663 representation of an expression expr and producing a valid tree
664 boolean expression describing whether expr is nonzero. We could
665 simply always do build_binary_op (NE_EXPR, expr, integer_zero_node, 1),
666 but we optimize comparisons, &&, ||, and !.
667
668 The resulting type should always be the same as the input type.
669 This function is simpler than the corresponding C version since
670 the only possible operands will be things of Boolean type. */
671 extern tree truthvalue_conversion PARAMS((tree));
672
673 /* Return the base type of TYPE. */
674 extern tree get_base_type PARAMS((tree));
675
676 /* Likewise, but only return types known at Ada source. */
677 extern tree get_ada_base_type PARAMS((tree));
678
679 /* EXP is a GCC tree representing an address. See if we can find how
680 strictly the object at that address is aligned. Return that alignment
681 strictly the object at that address is aligned. Return that alignment
682 in bits. If we don't know anything about the alignment, return 0. */
683 extern unsigned int known_alignment PARAMS((tree));
684
685 /* Make a binary operation of kind OP_CODE. RESULT_TYPE is the type
686 desired for the result. Usually the operation is to be performed
687 in that type. For MODIFY_EXPR and ARRAY_REF, RESULT_TYPE may be 0
688 in which case the type to be used will be derived from the operands. */
689 extern tree build_binary_op PARAMS((enum tree_code, tree, tree, tree));
690
691 /* Similar, but make unary operation. */
692 extern tree build_unary_op PARAMS((enum tree_code, tree, tree));
693
694 /* Similar, but for COND_EXPR. */
695 extern tree build_cond_expr PARAMS((tree, tree, tree, tree));
696
697 /* Build a CALL_EXPR to call FUNDECL with one argument, ARG. Return
698 the CALL_EXPR. */
699 extern tree build_call_1_expr PARAMS((tree, tree));
700
701 /* Build a CALL_EXPR to call FUNDECL with two argument, ARG1 & ARG2. Return
702 the CALL_EXPR. */
703 extern tree build_call_2_expr PARAMS((tree, tree, tree));
704
705 /* Likewise to call FUNDECL with no arguments. */
706 extern tree build_call_0_expr PARAMS((tree));
707
708 /* Call a function FCN that raises an exception and pass the line
709 number and file name, if requested. */
710 extern tree build_call_raise PARAMS((tree));
711
712 /* Return a CONSTRUCTOR of TYPE whose list is LIST. */
713 extern tree build_constructor PARAMS((tree, tree));
714
715 /* Return a COMPONENT_REF to access a field that is given by COMPONENT,
716 an IDENTIFIER_NODE giving the name of the field, FIELD, a FIELD_DECL,
717 for the field, or both. */
718 extern tree build_component_ref PARAMS((tree, tree, tree));
719
720 /* Build a GCC tree to call an allocation or deallocation function.
721 If GNU_OBJ is nonzero, it is an object to deallocate. Otherwise,
722 genrate an allocator.
723
724 GNU_SIZE is the size of the object and ALIGN is the alignment.
725 GNAT_PROC, if present is a procedure to call and GNAT_POOL is the
726 storage pool to use. If not preset, malloc and free will be used. */
727 extern tree build_call_alloc_dealloc PARAMS((tree, tree, int, Entity_Id,
728 Entity_Id));
729
730 /* Build a GCC tree to correspond to allocating an object of TYPE whose
731 initial value if INIT, if INIT is nonzero. Convert the expression to
732 RESULT_TYPE, which must be some type of pointer. Return the tree.
733 GNAT_PROC and GNAT_POOL optionally give the procedure to call and
734 the storage pool to use. */
735 extern tree build_allocator PARAMS((tree, tree, tree, Entity_Id,
736 Entity_Id));
737
738 /* Fill in a VMS descriptor for EXPR and return a constructor for it.
739 GNAT_FORMAL is how we find the descriptor record. */
740
741 extern tree fill_vms_descriptor PARAMS((tree, Entity_Id));
742
743 /* Indicate that we need to make the address of EXPR_NODE and it therefore
744 should not be allocated in a register. Return 1 if successful. */
745 extern int mark_addressable PARAMS((tree));
746
747 /* These functions return the basic data type sizes and related parameters
748 about the target machine. */
749
750 extern Pos get_target_bits_per_unit PARAMS ((void));
751 extern Pos get_target_bits_per_word PARAMS ((void));
752 extern Pos get_target_char_size PARAMS ((void));
753 extern Pos get_target_wchar_t_size PARAMS ((void));
754 extern Pos get_target_short_size PARAMS ((void));
755 extern Pos get_target_int_size PARAMS ((void));
756 extern Pos get_target_long_size PARAMS ((void));
757 extern Pos get_target_long_long_size PARAMS ((void));
758 extern Pos get_target_float_size PARAMS ((void));
759 extern Pos get_target_double_size PARAMS ((void));
760 extern Pos get_target_long_double_size PARAMS ((void));
761 extern Pos get_target_pointer_size PARAMS ((void));
762 extern Pos get_target_maximum_alignment PARAMS ((void));
763 extern Boolean get_target_no_dollar_in_label PARAMS ((void));
764 extern Nat get_float_words_be PARAMS ((void));
765 extern Nat get_words_be PARAMS ((void));
766 extern Nat get_bytes_be PARAMS ((void));
767 extern Nat get_bits_be PARAMS ((void));
768 extern Nat get_strict_alignment PARAMS ((void));