OSDN Git Service

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