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