1 /****************************************************************************
3 * GNAT COMPILER COMPONENTS *
9 * Copyright (C) 1992-2003 Free Software Foundation, Inc. *
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- *
13 * ware Foundation; either version 2, or (at your option) any later ver- *
14 * sion. GNAT is distributed in the hope that it will be useful, but WITH- *
15 * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
17 * for more details. You should have received a copy of the GNU General *
18 * Public License distributed with GNAT; see file COPYING. If not, write *
19 * to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, *
20 * MA 02111-1307, USA. *
22 * As a special exception, if you link this file with other files to *
23 * produce an executable, this file does not by itself cause the resulting *
24 * executable to be covered by the GNU General Public License. This except- *
25 * ion does not however invalidate any other reasons why the executable *
26 * file might be covered by the GNU Public License. *
28 * GNAT was originally developed by the GNAT team at New York University. *
29 * Extensive contributions were provided by Ada Core Technologies Inc. *
31 ****************************************************************************/
33 /* The largest alignment, in bits, that is needed for using the widest
35 extern unsigned int largest_move_alignment
;
37 /* Declare all functions and types used by gigi. */
39 /* See if DECL has an RTL that is indirect via a pseudo-register or a
40 memory location and replace it with an indirect reference if so.
41 This improves the debugger's ability to display the value. */
42 extern void adjust_decl_rtl
PARAMS ((tree
));
44 /* Record the current code position in GNAT_NODE. */
45 extern void record_code_position
PARAMS ((Node_Id
));
47 /* Insert the code for GNAT_NODE at the position saved for that node. */
48 extern void insert_code_for
PARAMS ((Node_Id
));
50 /* Compute the alignment of the largest mode that can be used for copying
52 extern void gnat_compute_largest_alignment
PARAMS ((void));
54 /* Routine called by gcc for emitting a stack check. GNU_EXPR is the
55 expression that contains the last address on the stack to check. */
56 extern tree emit_stack_check
PARAMS ((tree
));
58 /* Make a TRANSFORM_EXPR to later expand GNAT_NODE into code. */
59 extern tree make_transform_expr
PARAMS ((Node_Id
));
61 /* Update the setjmp buffer BUF with the current stack pointer. We assume
62 here that a __builtin_setjmp was done to BUF. */
63 extern void update_setjmp_buf
PARAMS ((tree
));
65 /* GNU_TYPE is a type. Determine if it should be passed by reference by
67 extern int default_pass_by_ref
PARAMS ((tree
));
69 /* GNU_TYPE is the type of a subprogram parameter. Determine from the type
70 if it should be passed by reference. */
71 extern int must_pass_by_ref
PARAMS ((tree
));
73 /* Elaboration routines for the front end. */
74 extern void elab_all_gnat
PARAMS ((void));
76 /* Initialize DUMMY_NODE_TABLE. */
77 extern void init_dummy_type
PARAMS ((void));
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
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.
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
94 extern tree gnat_to_gnu_entity
PARAMS ((Entity_Id
, tree
, int));
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
));
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
));
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
));
109 /* Make a dummy type corresponding to GNAT_TYPE. */
110 extern tree make_dummy_type
PARAMS ((Entity_Id
));
112 /* Get the unpadded version of a GNAT type. */
113 extern tree get_unpadded_type
PARAMS ((Entity_Id
));
115 /* Called when we need to protect a variable object using a save_expr. */
116 extern tree maybe_variable
PARAMS ((tree
, Node_Id
));
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
));
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
));
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
));
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
));
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 *));
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
));
148 /* Return a name for GNAT_ENTITY concatenated with two underscores and
150 extern tree create_concat_name
PARAMS ((Entity_Id
, const char *));
152 /* Flag indicating whether file names are discarded in exception messages */
153 extern int discard_file_names
;
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
;
160 /* Current file name without path */
161 extern const char *ref_filename
;
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
166 extern GTY(()) tree gnu_block_stack
;
168 /* This is the main program of the back-end. It sets up all the table
169 structures and then generates code. */
171 extern void gigi
PARAMS ((Node_Id
, int, int, struct Node
*,
172 Node_Id
*, Node_Id
*,
173 struct Elist_Header
*,
175 struct String_Entry
*,
177 struct List_Header
*,
179 Entity_Id
, Entity_Id
, Entity_Id
,
182 /* This function is the driver of the GNAT to GCC tree transformation process.
183 GNAT_NODE is the root of some gnat tree. It generates code for that
185 extern void gnat_to_code
PARAMS ((Node_Id
));
187 /* GNAT_NODE is the root of some GNAT tree. Return the root of the
188 GCC tree corresponding to that GNAT tree. Normally, no code is generated;
189 we just return an equivalent tree which is used elsewhere to generate
191 extern tree gnat_to_gnu
PARAMS ((Node_Id
));
193 /* GNU_STMT is a statement. We generate code for that statement. */
194 extern void gnat_expand_stmt
PARAMS ((tree
));
196 /* Do the processing for the declaration of a GNAT_ENTITY, a type. If
197 a separate Freeze node exists, delay the bulk of the processing. Otherwise
198 make a GCC type for GNAT_ENTITY and set up the correspondance. */
200 extern void process_type
PARAMS ((Entity_Id
));
202 /* Determine the input_filename and the input_line from the source location
203 (Sloc) of GNAT_NODE node. Set the global variable input_filename and
204 input_line. If WRITE_NOTE_P is true, emit a line number note. */
205 extern void set_lineno
PARAMS ((Node_Id
, int));
207 /* Likewise, but passed a Sloc. */
208 extern void set_lineno_from_sloc
PARAMS ((Source_Ptr
, int));
210 /* Post an error message. MSG is the error message, properly annotated.
211 NODE is the node at which to post the error and the node to use for the
213 extern void post_error
PARAMS ((const char *, Node_Id
));
215 /* Similar, but NODE is the node at which to post the error and ENT
216 is the node to use for the "&" substitution. */
217 extern void post_error_ne
PARAMS ((const char *, Node_Id
, Entity_Id
));
219 /* Similar, but NODE is the node at which to post the error, ENT is the node
220 to use for the "&" substitution, and N is the number to use for the ^. */
221 extern void post_error_ne_num
PARAMS ((const char *, Node_Id
, Entity_Id
,
224 /* Similar to post_error_ne_num, but T is a GCC tree representing the number
225 to write. If the tree represents a constant that fits within a
226 host integer, the text inside curly brackets in MSG will be output
227 (presumably including a '^'). Otherwise that text will not be output
228 and the text inside square brackets will be output instead. */
229 extern void post_error_ne_tree
PARAMS ((const char *, Node_Id
, Entity_Id
,
232 /* Similar to post_error_ne_tree, except that NUM is a second
233 integer to write in the message. */
234 extern void post_error_ne_tree_2
PARAMS ((const char *, Node_Id
, Entity_Id
,
237 /* Set the node for a second '&' in the error message. */
238 extern void set_second_error_entity
PARAMS ((Entity_Id
));
240 /* Protect EXP from multiple evaluation. This may make a SAVE_EXPR. */
241 extern tree protect_multiple_eval
PARAMS ((tree
));
243 /* Signal abort, with "Gigi abort" as the error label, and error_gnat_node
244 as the relevant node that provides the location info for the error.
245 The single parameter CODE is an integer code that is included in the
246 additional error message generated. */
247 extern void gigi_abort
PARAMS ((int)) ATTRIBUTE_NORETURN
;
249 /* Initialize the table that maps GNAT codes to GCC codes for simple
250 binary and unary operations. */
251 extern void init_code_table
PARAMS ((void));
253 /* Current node being treated, in case gigi_abort or Check_Elaboration_Code
255 extern Node_Id error_gnat_node
;
257 /* This is equivalent to stabilize_reference in GCC's tree.c, but we know
258 how to handle our new nodes and we take an extra argument that says
259 whether to force evaluation of everything. */
261 extern tree gnat_stabilize_reference
PARAMS ((tree
, int));
263 /* Highest number in the front-end node table. */
264 extern int max_gnat_nodes
;
266 /* If nonzero, pretend we are allocating at global level. */
267 extern int force_global
;
269 /* Standard data type sizes. Most of these are not used. */
271 #ifndef CHAR_TYPE_SIZE
272 #define CHAR_TYPE_SIZE BITS_PER_UNIT
275 #ifndef SHORT_TYPE_SIZE
276 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
279 #ifndef INT_TYPE_SIZE
280 #define INT_TYPE_SIZE BITS_PER_WORD
283 #ifndef LONG_TYPE_SIZE
284 #define LONG_TYPE_SIZE BITS_PER_WORD
287 #ifndef LONG_LONG_TYPE_SIZE
288 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
291 #ifndef FLOAT_TYPE_SIZE
292 #define FLOAT_TYPE_SIZE BITS_PER_WORD
295 #ifndef DOUBLE_TYPE_SIZE
296 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
299 #ifndef LONG_DOUBLE_TYPE_SIZE
300 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
303 /* The choice of SIZE_TYPE here is very problematic. We need a signed
304 type whose bit width is Pmode. Assume "long" is such a type here. */
306 #define SIZE_TYPE "long int"
309 /* Data structures used to represent attributes. */
311 enum attr_type
{ATTR_MACHINE_ATTRIBUTE
, ATTR_LINK_ALIAS
,
312 ATTR_LINK_SECTION
, ATTR_WEAK_EXTERNAL
};
323 /* Define the entries in the standard data array. */
324 enum standard_datatypes
326 /* Various standard data types and nodes. */
327 ADT_longest_float_type
,
330 /* The type of an exception. */
333 /* Type declaration node <==> typedef void *T */
336 /* Function type declaration -- void T() */
339 /* Type declaration node <==> typedef void *T() */
342 /* A function declaration node for a run-time function for allocating memory.
343 Ada allocators cause calls to this function to be generated. */
346 /* Likewise for freeing memory. */
349 /* Types and decls used by our temporary exception mechanism. See
350 init_gigi_decls for details. */
358 ADT_raise_nodefer_decl
,
359 ADT_begin_handler_decl
,
360 ADT_end_handler_decl
,
363 extern GTY(()) tree gnat_std_decls
[(int) ADT_LAST
];
364 extern GTY(()) tree gnat_raise_decls
[(int) LAST_REASON_CODE
+ 1];
366 #define longest_float_type_node gnat_std_decls[(int) ADT_longest_float_type]
367 #define void_type_decl_node gnat_std_decls[(int) ADT_void_type_decl]
368 #define except_type_node gnat_std_decls[(int) ADT_except_type]
369 #define ptr_void_type_node gnat_std_decls[(int) ADT_ptr_void_type]
370 #define void_ftype gnat_std_decls[(int) ADT_void_ftype]
371 #define ptr_void_ftype gnat_std_decls[(int) ADT_ptr_void_ftype]
372 #define malloc_decl gnat_std_decls[(int) ADT_malloc_decl]
373 #define free_decl gnat_std_decls[(int) ADT_free_decl]
374 #define jmpbuf_type gnat_std_decls[(int) ADT_jmpbuf_type]
375 #define jmpbuf_ptr_type gnat_std_decls[(int) ADT_jmpbuf_ptr_type]
376 #define get_jmpbuf_decl gnat_std_decls[(int) ADT_get_jmpbuf_decl]
377 #define set_jmpbuf_decl gnat_std_decls[(int) ADT_set_jmpbuf_decl]
378 #define get_excptr_decl gnat_std_decls[(int) ADT_get_excptr_decl]
379 #define setjmp_decl gnat_std_decls[(int) ADT_setjmp_decl]
380 #define longjmp_decl gnat_std_decls[(int) ADT_longjmp_decl]
381 #define raise_nodefer_decl gnat_std_decls[(int) ADT_raise_nodefer_decl]
382 #define begin_handler_decl gnat_std_decls[(int) ADT_begin_handler_decl]
383 #define end_handler_decl gnat_std_decls[(int) ADT_end_handler_decl]
385 /* Routines expected by the gcc back-end. They must have exactly the same
386 prototype and names as below. */
388 /* Returns non-zero if we are currently in the global binding level */
389 extern int global_bindings_p
PARAMS ((void));
391 /* Returns the list of declarations in the current level. Note that this list
392 is in reverse order (it has to be so for back-end compatibility). */
393 extern tree getdecls
PARAMS ((void));
395 /* Nonzero if the current level needs to have a BLOCK made. */
396 extern int kept_level_p
PARAMS ((void));
398 /* Enter a new binding level. The input parameter is ignored, but has to be
399 specified for back-end compatibility. */
400 extern void pushlevel
PARAMS ((int));
402 /* Exit a binding level.
403 Pop the level off, and restore the state of the identifier-decl mappings
404 that were in effect when this level was entered.
406 If KEEP is nonzero, this level had explicit declarations, so
407 and create a "block" (a BLOCK node) for the level
408 to record its declarations and subblocks for symbol table output.
410 If FUNCTIONBODY is nonzero, this level is the body of a function,
411 so create a block as if KEEP were set and also clear out all
414 If REVERSE is nonzero, reverse the order of decls before putting
415 them into the BLOCK. */
416 extern tree poplevel
PARAMS ((int,int, int));
418 /* Insert BLOCK at the end of the list of subblocks of the
419 current binding level. This is used when a BIND_EXPR is expanded,
420 to handle the BLOCK node inside the BIND_EXPR. */
421 extern void insert_block
PARAMS ((tree
));
423 /* Set the BLOCK node for the innermost scope
424 (the one we are currently in). */
425 extern void set_block
PARAMS ((tree
));
427 /* Records a ..._DECL node DECL as belonging to the current lexical scope.
428 Returns the ..._DECL node. */
429 extern tree pushdecl
PARAMS ((tree
));
431 /* Create the predefined scalar types such as `integer_type_node' needed
432 in the gcc back-end and initialize the global binding level. */
433 extern void gnat_init_decl_processing
PARAMS ((void));
434 extern void init_gigi_decls
PARAMS ((tree
, tree
));
435 extern void gnat_init_gcc_eh
PARAMS ((void));
437 /* Return an integer type with the number of bits of precision given by
438 PRECISION. UNSIGNEDP is nonzero if the type is unsigned; otherwise
439 it is a signed type. */
440 extern tree gnat_type_for_size
PARAMS ((unsigned, int));
442 /* Return a data type that has machine mode MODE. UNSIGNEDP selects
443 an unsigned type; otherwise a signed type is returned. */
444 extern tree gnat_type_for_mode
PARAMS ((enum machine_mode
, int));
446 /* Return the unsigned version of a TYPE_NODE, a scalar type. */
447 extern tree gnat_unsigned_type
PARAMS ((tree
));
449 /* Return the signed version of a TYPE_NODE, a scalar type. */
450 extern tree gnat_signed_type
PARAMS ((tree
));
452 /* Return a type the same as TYPE except unsigned or signed according to
454 extern tree gnat_signed_or_unsigned_type
PARAMS ((int, tree
));
456 /* Create an expression whose value is that of EXPR,
457 converted to type TYPE. The TREE_TYPE of the value
458 is always TYPE. This function implements all reasonable
459 conversions; callers should filter out those that are
460 not permitted by the language being compiled. */
461 extern tree convert
PARAMS ((tree
, tree
));
463 /* Routines created solely for the tree translator's sake. Their prototypes
464 can be changed as desired. */
466 /* GNAT_ENTITY is a GNAT tree node for a defining identifier.
467 GNU_DECL is the GCC tree which is to be associated with
468 GNAT_ENTITY. Such gnu tree node is always an ..._DECL node.
469 If NO_CHECK is nonzero, the latter check is suppressed.
470 If GNU_DECL is zero, a previous association is to be reset. */
471 extern void save_gnu_tree
PARAMS ((Entity_Id
, tree
, int));
473 /* GNAT_ENTITY is a GNAT tree node for a defining identifier.
474 Return the ..._DECL node that was associated with it. If there is no tree
475 node associated with GNAT_ENTITY, abort. */
476 extern tree get_gnu_tree
PARAMS ((Entity_Id
));
478 /* Return nonzero if a GCC tree has been associated with GNAT_ENTITY. */
479 extern int present_gnu_tree
PARAMS ((Entity_Id
));
481 /* Initialize tables for above routines. */
482 extern void init_gnat_to_gnu
PARAMS ((void));
484 /* Given a record type (RECORD_TYPE) and a chain of FIELD_DECL
485 nodes (FIELDLIST), finish constructing the record or union type.
486 If HAS_REP is nonzero, this record has a rep clause; don't call
487 layout_type but merely set the size and alignment ourselves.
488 If DEFER_DEBUG is nonzero, do not call the debugging routines
489 on this type; it will be done later. */
490 extern void finish_record_type
PARAMS ((tree
, tree
, int, int));
492 /* Returns a FUNCTION_TYPE node. RETURN_TYPE is the type returned by the
493 subprogram. If it is void_type_node, then we are dealing with a procedure,
494 otherwise we are dealing with a function. PARAM_DECL_LIST is a list of
495 PARM_DECL nodes that are the subprogram arguments. CICO_LIST is the
496 copy-in/copy-out list to be stored into TYPE_CI_CO_LIST.
497 RETURNS_UNCONSTRAINED is nonzero if the function returns an unconstrained
498 object. RETURNS_BY_REF is nonzero if the function returns by reference.
499 RETURNS_WITH_DSP is nonzero if the function is to return with a
500 depressed stack pointer. */
501 extern tree create_subprog_type
PARAMS ((tree
, tree
, tree
, int, int,
504 /* Return a copy of TYPE, but safe to modify in any way. */
505 extern tree copy_type
PARAMS ((tree
));
507 /* Return an INTEGER_TYPE of SIZETYPE with range MIN to MAX and whose
508 TYPE_INDEX_TYPE is INDEX. */
509 extern tree create_index_type
PARAMS ((tree
, tree
, tree
));
511 /* Return a TYPE_DECL node. TYPE_NAME gives the name of the type (a character
512 string) and TYPE is a ..._TYPE node giving its data type.
513 ARTIFICIAL_P is nonzero if this is a declaration that was generated
514 by the compiler. DEBUG_INFO_P is nonzero if we need to write debugging
515 information about this type. */
516 extern tree create_type_decl
PARAMS ((tree
, tree
, struct attrib
*,
519 /* Returns a GCC VAR_DECL node. VAR_NAME gives the name of the variable.
520 ASM_NAME is its assembler name (if provided). TYPE is
521 its data type (a GCC ..._TYPE node). VAR_INIT is the GCC tree for an
522 optional initial expression; NULL_TREE if none.
524 CONST_FLAG is nonzero if this variable is constant.
526 PUBLIC_FLAG is nonzero if this definition is to be made visible outside of
527 the current compilation unit. This flag should be set when processing the
528 variable definitions in a package specification. EXTERN_FLAG is nonzero
529 when processing an external variable declaration (as opposed to a
530 definition: no storage is to be allocated for the variable here).
531 STATIC_FLAG is only relevant when not at top level. In that case
532 it indicates whether to always allocate storage to the variable. */
533 extern tree create_var_decl
PARAMS ((tree
, tree
, tree
, tree
, int,
537 /* Given a DECL and ATTR_LIST, apply the listed attributes. */
538 extern void process_attributes
PARAMS ((tree
, struct attrib
*));
540 /* Obtain any pending elaborations and clear the old list. */
541 extern tree get_pending_elaborations
PARAMS ((void));
543 /* Return nonzero if there are pending elaborations. */
544 extern int pending_elaborations_p
PARAMS ((void));
546 /* Save a copy of the current pending elaboration list and make a new
548 extern void push_pending_elaborations
PARAMS ((void));
550 /* Pop the stack of pending elaborations. */
551 extern void pop_pending_elaborations
PARAMS ((void));
553 /* Return the current position in pending_elaborations so we can insert
554 elaborations after that point. */
555 extern tree get_elaboration_location
PARAMS ((void));
557 /* Insert the current elaborations after ELAB, which is in some elaboration
559 extern void insert_elaboration_list
PARAMS ((tree
));
561 /* Add some pending elaborations to the current list. */
562 extern void add_pending_elaborations
PARAMS ((tree
, tree
));
564 /* Returns a FIELD_DECL node. FIELD_NAME the field name, FIELD_TYPE is its
565 type, and RECORD_TYPE is the type of the parent. PACKED is nonzero if
566 this field is in a record type with a "pragma pack". If SIZE is nonzero
567 it is the specified size for this field. If POS is nonzero, it is the bit
568 position. If ADDRESSABLE is nonzero, it means we are allowed to take
569 the address of this field for aliasing purposes. */
570 extern tree create_field_decl
PARAMS ((tree
, tree
, tree
, int,
573 /* Returns a PARM_DECL node. PARAM_NAME is the name of the parameter,
574 PARAM_TYPE is its type. READONLY is nonzero if the parameter is
575 readonly (either an IN parameter or an address of a pass-by-ref
577 extern tree create_param_decl
PARAMS ((tree
, tree
, int));
579 /* Returns a FUNCTION_DECL node. SUBPROG_NAME is the name of the subprogram,
580 ASM_NAME is its assembler name, SUBPROG_TYPE is its type (a FUNCTION_TYPE
581 node), PARAM_DECL_LIST is the list of the subprogram arguments (a list of
582 PARM_DECL nodes chained through the TREE_CHAIN field).
584 INLINE_FLAG, PUBLIC_FLAG, and EXTERN_FLAG are used to set the appropriate
585 fields in the FUNCTION_DECL. */
586 extern tree create_subprog_decl
PARAMS ((tree
, tree
, tree
, tree
, int,
587 int, int, struct attrib
*));
589 /* Returns a LABEL_DECL node for LABEL_NAME. */
590 extern tree create_label_decl
PARAMS ((tree
));
592 /* Set up the framework for generating code for SUBPROG_DECL, a subprogram
593 body. This routine needs to be invoked before processing the declarations
594 appearing in the subprogram. */
595 extern void begin_subprog_body
PARAMS ((tree
));
597 /* Finish the definition of the current subprogram and compile it all the way
598 to assembler language output. */
599 extern void end_subprog_body
PARAMS ((void));
601 /* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE.
602 EXPR is an expression that we can use to locate any PLACEHOLDER_EXPRs.
603 Return a constructor for the template. */
604 extern tree build_template
PARAMS ((tree
, tree
, tree
));
606 /* Build a VMS descriptor from a Mechanism_Type, which must specify
607 a descriptor type, and the GCC type of an object. Each FIELD_DECL
608 in the type contains in its DECL_INITIAL the expression to use when
609 a constructor is made for the type. GNAT_ENTITY is a gnat node used
610 to print out an error message if the mechanism cannot be applied to
611 an object of that type and also for the name. */
613 extern tree build_vms_descriptor
PARAMS ((tree
, Mechanism_Type
,
616 /* Build a type to be used to represent an aliased object whose nominal
617 type is an unconstrained array. This consists of a RECORD_TYPE containing
618 a field of TEMPLATE_TYPE and a field of OBJECT_TYPE, which is an
619 ARRAY_TYPE. If ARRAY_TYPE is that of the unconstrained array, this
620 is used to represent an arbitrary unconstrained object. Use NAME
621 as the name of the record. */
622 extern tree build_unc_object_type
PARAMS ((tree
, tree
, tree
));
624 /* Update anything previously pointing to OLD_TYPE to point to NEW_TYPE. In
625 the normal case this is just two adjustments, but we have more to do
626 if NEW is an UNCONSTRAINED_ARRAY_TYPE. */
627 extern void update_pointer_to
PARAMS ((tree
, tree
));
629 /* EXP is an expression for the size of an object. If this size contains
630 discriminant references, replace them with the maximum (if MAX_P) or
631 minimum (if ! MAX_P) possible value of the discriminant. */
632 extern tree max_size
PARAMS ((tree
, int));
634 /* Remove all conversions that are done in EXP. This includes converting
635 from a padded type or to a left-justified modular type. If TRUE_ADDRESS
636 is nonzero, always return the address of the containing object even if
637 the address is not bit-aligned. */
638 extern tree remove_conversions
PARAMS ((tree
, int));
640 /* If EXP's type is an UNCONSTRAINED_ARRAY_TYPE, return an expression that
641 refers to the underlying array. If its type has TYPE_CONTAINS_TEMPLATE_P,
642 likewise return an expression pointing to the underlying array. */
643 extern tree maybe_unconstrained_array
PARAMS ((tree
));
645 /* Return an expression that does an unchecked converstion of EXPR to TYPE.
646 If NOTRUNC_P is set, truncation operations should be suppressed. */
647 extern tree unchecked_convert
PARAMS ((tree
, tree
, int));
649 /* Prepare expr to be an argument of a TRUTH_NOT_EXPR or other logical
652 This preparation consists of taking the ordinary
653 representation of an expression expr and producing a valid tree
654 boolean expression describing whether expr is nonzero. We could
655 simply always do build_binary_op (NE_EXPR, expr, integer_zero_node, 1),
656 but we optimize comparisons, &&, ||, and !.
658 The resulting type should always be the same as the input type.
659 This function is simpler than the corresponding C version since
660 the only possible operands will be things of Boolean type. */
661 extern tree gnat_truthvalue_conversion
PARAMS((tree
));
663 /* Return the base type of TYPE. */
664 extern tree get_base_type
PARAMS((tree
));
666 /* Likewise, but only return types known at Ada source. */
667 extern tree get_ada_base_type
PARAMS((tree
));
669 /* EXP is a GCC tree representing an address. See if we can find how
670 strictly the object at that address is aligned. Return that alignment
671 strictly the object at that address is aligned. Return that alignment
672 in bits. If we don't know anything about the alignment, return 0. */
673 extern unsigned int known_alignment
PARAMS((tree
));
675 /* Make a binary operation of kind OP_CODE. RESULT_TYPE is the type
676 desired for the result. Usually the operation is to be performed
677 in that type. For MODIFY_EXPR and ARRAY_REF, RESULT_TYPE may be 0
678 in which case the type to be used will be derived from the operands. */
679 extern tree build_binary_op
PARAMS((enum tree_code
, tree
, tree
, tree
));
681 /* Similar, but make unary operation. */
682 extern tree build_unary_op
PARAMS((enum tree_code
, tree
, tree
));
684 /* Similar, but for COND_EXPR. */
685 extern tree build_cond_expr
PARAMS((tree
, tree
, tree
, tree
));
687 /* Build a CALL_EXPR to call FUNDECL with one argument, ARG. Return
689 extern tree build_call_1_expr
PARAMS((tree
, tree
));
691 /* Build a CALL_EXPR to call FUNDECL with two argument, ARG1 & ARG2. Return
693 extern tree build_call_2_expr
PARAMS((tree
, tree
, tree
));
695 /* Likewise to call FUNDECL with no arguments. */
696 extern tree build_call_0_expr
PARAMS((tree
));
698 /* Call a function that raises an exception and pass the line number and file
699 name, if requested. MSG says which exception function to call. */
700 extern tree build_call_raise
PARAMS((int));
702 /* Return a CONSTRUCTOR of TYPE whose list is LIST. This is not the
703 same as build_constructor in the language-independent tree.c. */
704 extern tree gnat_build_constructor
PARAMS((tree
, tree
));
706 /* Return a COMPONENT_REF to access a field that is given by COMPONENT,
707 an IDENTIFIER_NODE giving the name of the field, FIELD, a FIELD_DECL,
708 for the field, or both. Don't fold the result if NO_FOLD_P. */
709 extern tree build_component_ref
PARAMS((tree
, tree
, tree
, int));
711 /* Build a GCC tree to call an allocation or deallocation function.
712 If GNU_OBJ is nonzero, it is an object to deallocate. Otherwise,
713 genrate an allocator.
715 GNU_SIZE is the size of the object and ALIGN is the alignment.
716 GNAT_PROC, if present is a procedure to call and GNAT_POOL is the
717 storage pool to use. If not preset, malloc and free will be used. */
718 extern tree build_call_alloc_dealloc
PARAMS((tree
, tree
, int, Entity_Id
,
719 Entity_Id
, Node_Id
));
721 /* Build a GCC tree to correspond to allocating an object of TYPE whose
722 initial value if INIT, if INIT is nonzero. Convert the expression to
723 RESULT_TYPE, which must be some type of pointer. Return the tree.
724 GNAT_PROC and GNAT_POOL optionally give the procedure to call and
725 the storage pool to use. GNAT_NODE is used to provide an error
726 location for restriction violations messages. */
727 extern tree build_allocator
PARAMS((tree
, tree
, tree
, Entity_Id
,
728 Entity_Id
, Node_Id
));
730 /* Fill in a VMS descriptor for EXPR and return a constructor for it.
731 GNAT_FORMAL is how we find the descriptor record. */
733 extern tree fill_vms_descriptor
PARAMS((tree
, Entity_Id
));
735 /* Indicate that we need to make the address of EXPR_NODE and it therefore
736 should not be allocated in a register. Return true if successful. */
737 extern bool gnat_mark_addressable
PARAMS((tree
));
739 /* These functions return the basic data type sizes and related parameters
740 about the target machine. */
742 extern Pos get_target_bits_per_unit
PARAMS ((void));
743 extern Pos get_target_bits_per_word
PARAMS ((void));
744 extern Pos get_target_char_size
PARAMS ((void));
745 extern Pos get_target_wchar_t_size
PARAMS ((void));
746 extern Pos get_target_short_size
PARAMS ((void));
747 extern Pos get_target_int_size
PARAMS ((void));
748 extern Pos get_target_long_size
PARAMS ((void));
749 extern Pos get_target_long_long_size
PARAMS ((void));
750 extern Pos get_target_float_size
PARAMS ((void));
751 extern Pos get_target_double_size
PARAMS ((void));
752 extern Pos get_target_long_double_size
PARAMS ((void));
753 extern Pos get_target_pointer_size
PARAMS ((void));
754 extern Pos get_target_maximum_alignment
PARAMS ((void));
755 extern Boolean get_target_no_dollar_in_label
PARAMS ((void));
756 extern Nat get_float_words_be
PARAMS ((void));
757 extern Nat get_words_be
PARAMS ((void));
758 extern Nat get_bytes_be
PARAMS ((void));
759 extern Nat get_bits_be
PARAMS ((void));
760 extern Nat get_strict_alignment
PARAMS ((void));