1 /****************************************************************************
3 * GNAT COMPILER COMPONENTS *
7 * C Implementation File *
9 * Copyright (C) 1992-2014, 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 3, 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 COPYING3. If not see *
19 * <http://www.gnu.org/licenses/>. *
21 * GNAT was originally developed by the GNAT team at New York University. *
22 * Extensive contributions were provided by Ada Core Technologies Inc. *
24 ****************************************************************************/
28 #include "coretypes.h"
33 #include "stor-layout.h"
34 #include "print-tree.h"
35 #include "diagnostic.h"
41 #include "langhooks.h"
42 #include "langhooks-def.h"
45 #include "function.h" /* For pass_by_reference. */
48 #include "adadecode.h"
62 /* This symbol needs to be defined for the front-end. */
63 void *callgraph_info_file
= NULL
;
65 /* Command-line argc and argv. These variables are global since they are
66 imported in back_end.adb. */
67 unsigned int save_argc
;
68 const char **save_argv
;
70 /* GNAT argc and argv. */
72 extern char **gnat_argv
;
78 /* Declare functions we use as part of startup. */
79 extern void __gnat_initialize (void *);
80 extern void __gnat_install_SEH_handler (void *);
81 extern void adainit (void);
82 extern void _ada_gnat1drv (void);
88 /* The parser for the language. For us, we process the GNAT tree. */
91 gnat_parse_file (void)
95 /* Call the target specific initializations. */
96 __gnat_initialize (NULL
);
98 /* ??? Call the SEH initialization routine. This is to workaround
99 a bootstrap path problem. The call below should be removed at some
100 point and the SEH pointer passed to __gnat_initialize() above. */
101 __gnat_install_SEH_handler((void *)seh
);
103 /* Call the front-end elaboration procedures. */
106 /* Call the front end. */
110 /* Return language mask for option processing. */
113 gnat_option_lang_mask (void)
118 /* Decode all the language specific options that cannot be decoded by GCC.
119 The option decoding phase of GCC calls this routine on the flags that
120 are marked as Ada-specific. Return true on success or false on failure. */
123 gnat_handle_option (size_t scode
, const char *arg ATTRIBUTE_UNUSED
, int value
,
124 int kind ATTRIBUTE_UNUSED
, location_t loc ATTRIBUTE_UNUSED
,
125 const struct cl_option_handlers
*handlers ATTRIBUTE_UNUSED
)
127 enum opt_code code
= (enum opt_code
) scode
;
132 handle_generated_option (&global_options
, &global_options_set
,
133 OPT_Wunused
, NULL
, value
,
134 gnat_option_lang_mask (), kind
, loc
,
135 handlers
, global_dc
);
136 warn_uninitialized
= value
;
137 warn_maybe_uninitialized
= value
;
141 warning (0, "%<-gnat%> misspelled as %<-gant%>");
143 /* ... fall through ... */
151 /* These are handled by the front-end. */
154 case OPT_fshort_enums
:
155 /* This is handled by the middle-end. */
162 Ada_handle_option_auto (&global_options
, &global_options_set
,
164 gnat_option_lang_mask (), kind
,
165 loc
, handlers
, global_dc
);
169 /* Initialize options structure OPTS. */
172 gnat_init_options_struct (struct gcc_options
*opts
)
174 /* Uninitialized really means uninitialized in Ada. */
175 opts
->x_flag_zero_initialized_in_bss
= 0;
177 /* We can delete dead instructions that may throw exceptions in Ada. */
178 opts
->x_flag_delete_dead_exceptions
= 1;
181 /* Initialize for option processing. */
184 gnat_init_options (unsigned int decoded_options_count
,
185 struct cl_decoded_option
*decoded_options
)
187 /* Reconstruct an argv array for use of back_end.adb.
189 ??? back_end.adb should not rely on this; instead, it should work with
190 decoded options without such reparsing, to ensure consistency in how
191 options are decoded. */
194 save_argv
= XNEWVEC (const char *, 2 * decoded_options_count
+ 1);
196 for (i
= 0; i
< decoded_options_count
; i
++)
198 size_t num_elements
= decoded_options
[i
].canonical_option_num_elements
;
200 if (decoded_options
[i
].errors
201 || decoded_options
[i
].opt_index
== OPT_SPECIAL_unknown
202 || num_elements
== 0)
205 /* Deal with -I- specially since it must be a single switch. */
206 if (decoded_options
[i
].opt_index
== OPT_I
208 && decoded_options
[i
].canonical_option
[1][0] == '-'
209 && decoded_options
[i
].canonical_option
[1][1] == '\0')
210 save_argv
[save_argc
++] = "-I-";
213 gcc_assert (num_elements
>= 1 && num_elements
<= 2);
214 save_argv
[save_argc
++] = decoded_options
[i
].canonical_option
[0];
215 if (num_elements
>= 2)
216 save_argv
[save_argc
++] = decoded_options
[i
].canonical_option
[1];
219 save_argv
[save_argc
] = NULL
;
221 gnat_argv
= (char **) xmalloc (sizeof (save_argv
[0]));
222 gnat_argv
[0] = xstrdup (save_argv
[0]); /* name of the command */
226 /* Ada code requires variables for these settings rather than elements
227 of the global_options structure. */
230 #undef flag_compare_debug
231 #undef flag_short_enums
232 #undef flag_stack_check
235 int flag_compare_debug
;
236 int flag_short_enums
;
237 enum stack_check_type flag_stack_check
= NO_STACK_CHECK
;
239 /* Settings adjustments after switches processing by the back-end.
240 Note that the front-end switches processing (Scan_Compiler_Arguments)
241 has not been done yet at this point! */
244 gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED
)
246 /* Excess precision other than "fast" requires front-end support. */
247 if (flag_excess_precision_cmdline
== EXCESS_PRECISION_STANDARD
248 && TARGET_FLT_EVAL_METHOD_NON_DEFAULT
)
249 sorry ("-fexcess-precision=standard for Ada");
250 flag_excess_precision_cmdline
= EXCESS_PRECISION_FAST
;
252 /* ??? The warning machinery is outsmarted by Ada. */
253 warn_unused_parameter
= 0;
255 /* No psABI change warnings for Ada. */
258 /* No caret by default for Ada. */
259 if (!global_options_set
.x_flag_diagnostics_show_caret
)
260 global_dc
->show_caret
= false;
262 optimize
= global_options
.x_optimize
;
263 optimize_size
= global_options
.x_optimize_size
;
264 flag_compare_debug
= global_options
.x_flag_compare_debug
;
265 flag_stack_check
= global_options
.x_flag_stack_check
;
266 flag_short_enums
= global_options
.x_flag_short_enums
;
268 /* Unfortunately the post_options hook is called before the value of
269 flag_short_enums is autodetected, if need be. Mimic the process
270 for our private flag_short_enums. */
271 if (flag_short_enums
== 2)
272 flag_short_enums
= targetm
.default_short_enums ();
277 /* Here is the function to handle the compiler error processing in GCC. */
280 internal_error_function (diagnostic_context
*context
,
281 const char *msgid
, va_list *ap
)
284 char *buffer
, *p
, *loc
;
285 String_Template temp
, temp_loc
;
286 Fat_Pointer fp
, fp_loc
;
289 /* Warn if plugins present. */
292 /* Reset the pretty-printer. */
293 pp_clear_output_area (context
->printer
);
295 /* Format the message into the pretty-printer. */
296 tinfo
.format_spec
= msgid
;
298 tinfo
.err_no
= errno
;
299 pp_format_verbatim (context
->printer
, &tinfo
);
301 /* Extract a (writable) pointer to the formatted text. */
302 buffer
= xstrdup (pp_formatted_text (context
->printer
));
304 /* Go up to the first newline. */
305 for (p
= buffer
; *p
; p
++)
313 temp
.High_Bound
= p
- buffer
;
317 s
= expand_location (input_location
);
318 if (context
->show_column
&& s
.column
!= 0)
319 asprintf (&loc
, "%s:%d:%d", s
.file
, s
.line
, s
.column
);
321 asprintf (&loc
, "%s:%d", s
.file
, s
.line
);
322 temp_loc
.Low_Bound
= 1;
323 temp_loc
.High_Bound
= strlen (loc
);
324 fp_loc
.Bounds
= &temp_loc
;
327 Current_Error_Node
= error_gnat_node
;
328 Compiler_Abort (fp
, -1, fp_loc
);
331 /* Perform all the initialization steps that are language-specific. */
336 /* Do little here, most of the standard declarations are set up after the
337 front-end has been run. Use the same `char' as C, this doesn't really
338 matter since we'll use the explicit `unsigned char' for Character. */
339 build_common_tree_nodes (flag_signed_char
, false);
341 /* In Ada, we use an unsigned 8-bit type for the default boolean type. */
342 boolean_type_node
= make_unsigned_type (8);
343 TREE_SET_CODE (boolean_type_node
, BOOLEAN_TYPE
);
344 SET_TYPE_RM_MAX_VALUE (boolean_type_node
,
345 build_int_cst (boolean_type_node
, 1));
346 SET_TYPE_RM_SIZE (boolean_type_node
, bitsize_int (1));
347 boolean_true_node
= TYPE_MAX_VALUE (boolean_type_node
);
348 boolean_false_node
= TYPE_MIN_VALUE (boolean_type_node
);
350 sbitsize_one_node
= sbitsize_int (1);
351 sbitsize_unit_node
= sbitsize_int (BITS_PER_UNIT
);
353 ptr_void_type_node
= build_pointer_type (void_type_node
);
355 /* Show that REFERENCE_TYPEs are internal and should be Pmode. */
356 internal_reference_types ();
358 /* Register our internal error function. */
359 global_dc
->internal_error
= &internal_error_function
;
364 /* Initialize the GCC support for exception handling. */
367 gnat_init_gcc_eh (void)
369 /* We shouldn't do anything if the No_Exceptions_Handler pragma is set,
370 though. This could for instance lead to the emission of tables with
371 references to symbols (such as the Ada eh personality routine) within
372 libraries we won't link against. */
373 if (No_Exception_Handlers_Set ())
376 /* Tell GCC we are handling cleanup actions through exception propagation.
377 This opens possibilities that we don't take advantage of yet, but is
378 nonetheless necessary to ensure that fixup code gets assigned to the
379 right exception regions. */
380 using_eh_for_cleanups ();
382 /* Turn on -fexceptions and -fnon-call-exceptions. The first one triggers
383 the generation of the necessary exception tables. The second one is
384 useful for two reasons: 1/ we map some asynchronous signals like SEGV to
385 exceptions, so we need to ensure that the insns which can lead to such
386 signals are correctly attached to the exception region they pertain to,
387 2/ Some calls to pure subprograms are handled as libcall blocks and then
388 marked as "cannot trap" if the flag is not set (see emit_libcall_block).
389 We should not let this be since it is possible for such calls to actually
392 flag_non_call_exceptions
= 1;
397 /* Initialize the GCC support for floating-point operations. */
400 gnat_init_gcc_fp (void)
402 /* Disable FP optimizations that ignore the signedness of zero if
403 S'Signed_Zeros is true, but don't override the user if not. */
404 if (Signed_Zeros_On_Target
)
405 flag_signed_zeros
= 1;
406 else if (!global_options_set
.x_flag_signed_zeros
)
407 flag_signed_zeros
= 0;
409 /* Assume that FP operations can trap if S'Machine_Overflow is true,
410 but don't override the user if not.
412 ??? Alpha/VMS enables FP traps without declaring it. */
413 if (Machine_Overflows_On_Target
|| TARGET_ABI_OPEN_VMS
)
414 flag_trapping_math
= 1;
415 else if (!global_options_set
.x_flag_trapping_math
)
416 flag_trapping_math
= 0;
419 /* Print language-specific items in declaration NODE. */
422 gnat_print_decl (FILE *file
, tree node
, int indent
)
424 switch (TREE_CODE (node
))
427 print_node (file
, "corresponding var",
428 DECL_CONST_CORRESPONDING_VAR (node
), indent
+ 4);
432 print_node (file
, "original field", DECL_ORIGINAL_FIELD (node
),
437 if (DECL_LOOP_PARM_P (node
))
438 print_node (file
, "induction var", DECL_INDUCTION_VAR (node
),
441 print_node (file
, "renamed object", DECL_RENAMED_OBJECT (node
),
450 /* Print language-specific items in type NODE. */
453 gnat_print_type (FILE *file
, tree node
, int indent
)
455 switch (TREE_CODE (node
))
458 print_node (file
, "ci/co list", TYPE_CI_CO_LIST (node
), indent
+ 4);
462 if (TYPE_MODULAR_P (node
))
463 print_node_brief (file
, "modulus", TYPE_MODULUS (node
), indent
+ 4);
464 else if (TYPE_HAS_ACTUAL_BOUNDS_P (node
))
465 print_node (file
, "actual bounds", TYPE_ACTUAL_BOUNDS (node
),
467 else if (TYPE_VAX_FLOATING_POINT_P (node
))
470 print_node (file
, "index type", TYPE_INDEX_TYPE (node
), indent
+ 4);
472 /* ... fall through ... */
476 print_node_brief (file
, "RM size", TYPE_RM_SIZE (node
), indent
+ 4);
478 /* ... fall through ... */
481 print_node_brief (file
, "RM min", TYPE_RM_MIN_VALUE (node
), indent
+ 4);
482 print_node_brief (file
, "RM max", TYPE_RM_MAX_VALUE (node
), indent
+ 4);
486 print_node (file
,"actual bounds", TYPE_ACTUAL_BOUNDS (node
), indent
+ 4);
490 print_node (file
,"representative array",
491 TYPE_REPRESENTATIVE_ARRAY (node
), indent
+ 4);
495 if (TYPE_FAT_POINTER_P (node
) || TYPE_CONTAINS_TEMPLATE_P (node
))
496 print_node (file
, "unconstrained array",
497 TYPE_UNCONSTRAINED_ARRAY (node
), indent
+ 4);
499 print_node (file
, "Ada size", TYPE_ADA_SIZE (node
), indent
+ 4);
503 case QUAL_UNION_TYPE
:
504 print_node (file
, "Ada size", TYPE_ADA_SIZE (node
), indent
+ 4);
512 /* Return the name to be printed for DECL. */
515 gnat_printable_name (tree decl
, int verbosity
)
517 const char *coded_name
= IDENTIFIER_POINTER (DECL_NAME (decl
));
518 char *ada_name
= (char *) ggc_alloc_atomic (strlen (coded_name
) * 2 + 60);
520 __gnat_decode (coded_name
, ada_name
, 0);
522 if (verbosity
== 2 && !DECL_IS_BUILTIN (decl
))
524 Set_Identifier_Casing (ada_name
, DECL_SOURCE_FILE (decl
));
525 return ggc_strdup (Name_Buffer
);
531 /* Return the name to be used in DWARF debug info for DECL. */
534 gnat_dwarf_name (tree decl
, int verbosity ATTRIBUTE_UNUSED
)
536 gcc_assert (DECL_P (decl
));
537 return (const char *) IDENTIFIER_POINTER (DECL_NAME (decl
));
540 /* Return the descriptive type associated with TYPE, if any. */
543 gnat_descriptive_type (const_tree type
)
545 if (TYPE_STUB_DECL (type
))
546 return DECL_PARALLEL_TYPE (TYPE_STUB_DECL (type
));
551 /* Return true if types T1 and T2 are identical for type hashing purposes.
552 Called only after doing all language independent checks. At present,
553 this function is only called when both types are FUNCTION_TYPE. */
556 gnat_type_hash_eq (const_tree t1
, const_tree t2
)
558 gcc_assert (TREE_CODE (t1
) == FUNCTION_TYPE
);
559 return fntype_same_flags_p (t1
, TYPE_CI_CO_LIST (t2
),
560 TYPE_RETURN_UNCONSTRAINED_P (t2
),
561 TYPE_RETURN_BY_DIRECT_REF_P (t2
),
562 TREE_ADDRESSABLE (t2
));
565 /* Do nothing (return the tree node passed). */
568 gnat_return_tree (tree t
)
573 /* Get the alias set corresponding to a type or expression. */
575 static alias_set_type
576 gnat_get_alias_set (tree type
)
578 /* If this is a padding type, use the type of the first field. */
579 if (TYPE_IS_PADDING_P (type
))
580 return get_alias_set (TREE_TYPE (TYPE_FIELDS (type
)));
582 /* If the type is an unconstrained array, use the type of the
583 self-referential array we make. */
584 else if (TREE_CODE (type
) == UNCONSTRAINED_ARRAY_TYPE
)
586 get_alias_set (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (type
)))));
588 /* If the type can alias any other types, return the alias set 0. */
589 else if (TYPE_P (type
)
590 && TYPE_UNIVERSAL_ALIASING_P (TYPE_MAIN_VARIANT (type
)))
596 /* GNU_TYPE is a type. Return its maximum size in bytes, if known,
597 as a constant when possible. */
600 gnat_type_max_size (const_tree gnu_type
)
602 /* First see what we can get from TYPE_SIZE_UNIT, which might not
603 be constant even for simple expressions if it has already been
604 elaborated and possibly replaced by a VAR_DECL. */
605 tree max_unitsize
= max_size (TYPE_SIZE_UNIT (gnu_type
), true);
607 /* If we don't have a constant, see what we can get from TYPE_ADA_SIZE,
608 which should stay untouched. */
609 if (!tree_fits_uhwi_p (max_unitsize
)
610 && RECORD_OR_UNION_TYPE_P (gnu_type
)
611 && !TYPE_FAT_POINTER_P (gnu_type
)
612 && TYPE_ADA_SIZE (gnu_type
))
614 tree max_adasize
= max_size (TYPE_ADA_SIZE (gnu_type
), true);
616 /* If we have succeeded in finding a constant, round it up to the
617 type's alignment and return the result in units. */
618 if (tree_fits_uhwi_p (max_adasize
))
620 = size_binop (CEIL_DIV_EXPR
,
621 round_up (max_adasize
, TYPE_ALIGN (gnu_type
)),
628 /* GNU_TYPE is a subtype of an integral type. Set LOWVAL to the low bound
629 and HIGHVAL to the high bound, respectively. */
632 gnat_get_subrange_bounds (const_tree gnu_type
, tree
*lowval
, tree
*highval
)
634 *lowval
= TYPE_MIN_VALUE (gnu_type
);
635 *highval
= TYPE_MAX_VALUE (gnu_type
);
638 /* GNU_TYPE is the type of a subprogram parameter. Determine if it should be
639 passed by reference by default. */
642 default_pass_by_ref (tree gnu_type
)
644 /* We pass aggregates by reference if they are sufficiently large for
645 their alignment. The ratio is somewhat arbitrary. We also pass by
646 reference if the target machine would either pass or return by
647 reference. Strictly speaking, we need only check the return if this
648 is an In Out parameter, but it's probably best to err on the side of
649 passing more things by reference. */
651 if (pass_by_reference (NULL
, TYPE_MODE (gnu_type
), gnu_type
, true))
654 if (targetm
.calls
.return_in_memory (gnu_type
, NULL_TREE
))
657 if (AGGREGATE_TYPE_P (gnu_type
)
658 && (!valid_constant_size_p (TYPE_SIZE_UNIT (gnu_type
))
659 || 0 < compare_tree_int (TYPE_SIZE_UNIT (gnu_type
),
660 TYPE_ALIGN (gnu_type
))))
666 /* GNU_TYPE is the type of a subprogram parameter. Determine if it must be
667 passed by reference. */
670 must_pass_by_ref (tree gnu_type
)
672 /* We pass only unconstrained objects, those required by the language
673 to be passed by reference, and objects of variable size. The latter
674 is more efficient, avoids problems with variable size temporaries,
675 and does not produce compatibility problems with C, since C does
676 not have such objects. */
677 return (TREE_CODE (gnu_type
) == UNCONSTRAINED_ARRAY_TYPE
678 || TYPE_IS_BY_REFERENCE_P (gnu_type
)
679 || (TYPE_SIZE_UNIT (gnu_type
)
680 && TREE_CODE (TYPE_SIZE_UNIT (gnu_type
)) != INTEGER_CST
));
683 /* This function is called by the front-end to enumerate all the supported
684 modes for the machine, as well as some predefined C types. F is a function
685 which is called back with the parameters as listed below, first a string,
686 then seven ints. The name is any arbitrary null-terminated string and has
687 no particular significance, except for the case of predefined C types, where
688 it should be the name of the C type. For integer types, only signed types
689 should be listed, unsigned versions are assumed. The order of types should
690 be in order of preference, with the smallest/cheapest types first.
692 In particular, C predefined types should be listed before other types,
693 binary floating point types before decimal ones, and narrower/cheaper
694 type versions before more expensive ones. In type selection the first
695 matching variant will be used.
697 NAME pointer to first char of type name
698 DIGS number of decimal digits for floating-point modes, else 0
699 COMPLEX_P nonzero is this represents a complex mode
700 COUNT count of number of items, nonzero for vector mode
701 FLOAT_REP Float_Rep_Kind for FP, otherwise undefined
702 PRECISION number of bits used to store data
703 SIZE number of bits occupied by the mode
704 ALIGN number of bits to which mode is aligned. */
707 enumerate_modes (void (*f
) (const char *, int, int, int, int, int, int, int))
710 = { float_type_node
, double_type_node
, long_double_type_node
};
711 const char *const c_names
[]
712 = { "float", "double", "long double" };
715 for (iloop
= 0; iloop
< NUM_MACHINE_MODES
; iloop
++)
717 enum machine_mode i
= (enum machine_mode
) iloop
;
718 enum machine_mode inner_mode
= i
;
719 bool float_p
= false;
720 bool complex_p
= false;
721 bool vector_p
= false;
724 unsigned int nameloop
;
725 Float_Rep_Kind float_rep
= IEEE_Binary
; /* Until proven otherwise */
727 switch (GET_MODE_CLASS (i
))
734 case MODE_COMPLEX_INT
:
736 inner_mode
= GET_MODE_INNER (i
);
738 case MODE_COMPLEX_FLOAT
:
741 inner_mode
= GET_MODE_INNER (i
);
743 case MODE_VECTOR_INT
:
745 inner_mode
= GET_MODE_INNER (i
);
747 case MODE_VECTOR_FLOAT
:
750 inner_mode
= GET_MODE_INNER (i
);
758 const struct real_format
*fmt
= REAL_MODE_FORMAT (inner_mode
);
760 /* ??? Cope with the ghost XFmode of the ARM port. */
765 digs
= (fmt
->p
- 1) * 1233 / 4096; /* scale by log (2) */
767 else if (fmt
->b
== 10)
773 if (fmt
== &vax_f_format
774 || fmt
== &vax_d_format
775 || fmt
== &vax_g_format
)
776 float_rep
= VAX_Native
;
779 /* First register any C types for this mode that the front end
780 may need to know about, unless the mode should be skipped. */
781 if (!skip_p
&& !vector_p
)
782 for (nameloop
= 0; nameloop
< ARRAY_SIZE (c_types
); nameloop
++)
784 tree type
= c_types
[nameloop
];
785 const char *name
= c_names
[nameloop
];
787 if (TYPE_MODE (type
) == i
)
789 f (name
, digs
, complex_p
, 0, float_rep
, TYPE_PRECISION (type
),
790 TREE_INT_CST_LOW (TYPE_SIZE (type
)), TYPE_ALIGN (type
));
795 /* If no predefined C types were found, register the mode itself. */
797 f (GET_MODE_NAME (i
), digs
, complex_p
,
798 vector_p
? GET_MODE_NUNITS (i
) : 0, float_rep
,
799 GET_MODE_PRECISION (i
), GET_MODE_BITSIZE (i
),
800 GET_MODE_ALIGNMENT (i
));
804 /* Return the size of the FP mode with precision PREC. */
807 fp_prec_to_size (int prec
)
809 enum machine_mode mode
;
811 for (mode
= GET_CLASS_NARROWEST_MODE (MODE_FLOAT
); mode
!= VOIDmode
;
812 mode
= GET_MODE_WIDER_MODE (mode
))
813 if (GET_MODE_PRECISION (mode
) == prec
)
814 return GET_MODE_BITSIZE (mode
);
819 /* Return the precision of the FP mode with size SIZE. */
822 fp_size_to_prec (int size
)
824 enum machine_mode mode
;
826 for (mode
= GET_CLASS_NARROWEST_MODE (MODE_FLOAT
); mode
!= VOIDmode
;
827 mode
= GET_MODE_WIDER_MODE (mode
))
828 if (GET_MODE_BITSIZE (mode
) == size
)
829 return GET_MODE_PRECISION (mode
);
834 static GTY(()) tree gnat_eh_personality_decl
;
836 /* Return the GNAT personality function decl. */
839 gnat_eh_personality (void)
841 if (!gnat_eh_personality_decl
)
842 gnat_eh_personality_decl
= build_personality_function ("gnat");
843 return gnat_eh_personality_decl
;
846 /* Initialize language-specific bits of tree_contains_struct. */
851 MARK_TS_COMMON (UNCONSTRAINED_ARRAY_TYPE
);
853 MARK_TS_TYPED (UNCONSTRAINED_ARRAY_REF
);
854 MARK_TS_TYPED (NULL_EXPR
);
855 MARK_TS_TYPED (PLUS_NOMOD_EXPR
);
856 MARK_TS_TYPED (MINUS_NOMOD_EXPR
);
857 MARK_TS_TYPED (ATTR_ADDR_EXPR
);
858 MARK_TS_TYPED (STMT_STMT
);
859 MARK_TS_TYPED (LOOP_STMT
);
860 MARK_TS_TYPED (EXIT_STMT
);
863 /* Definitions for our language-specific hooks. */
865 #undef LANG_HOOKS_NAME
866 #define LANG_HOOKS_NAME "GNU Ada"
867 #undef LANG_HOOKS_IDENTIFIER_SIZE
868 #define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct tree_identifier)
869 #undef LANG_HOOKS_INIT
870 #define LANG_HOOKS_INIT gnat_init
871 #undef LANG_HOOKS_OPTION_LANG_MASK
872 #define LANG_HOOKS_OPTION_LANG_MASK gnat_option_lang_mask
873 #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
874 #define LANG_HOOKS_INIT_OPTIONS_STRUCT gnat_init_options_struct
875 #undef LANG_HOOKS_INIT_OPTIONS
876 #define LANG_HOOKS_INIT_OPTIONS gnat_init_options
877 #undef LANG_HOOKS_HANDLE_OPTION
878 #define LANG_HOOKS_HANDLE_OPTION gnat_handle_option
879 #undef LANG_HOOKS_POST_OPTIONS
880 #define LANG_HOOKS_POST_OPTIONS gnat_post_options
881 #undef LANG_HOOKS_PARSE_FILE
882 #define LANG_HOOKS_PARSE_FILE gnat_parse_file
883 #undef LANG_HOOKS_TYPE_HASH_EQ
884 #define LANG_HOOKS_TYPE_HASH_EQ gnat_type_hash_eq
885 #undef LANG_HOOKS_GETDECLS
886 #define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
887 #undef LANG_HOOKS_PUSHDECL
888 #define LANG_HOOKS_PUSHDECL gnat_return_tree
889 #undef LANG_HOOKS_WRITE_GLOBALS
890 #define LANG_HOOKS_WRITE_GLOBALS gnat_write_global_declarations
891 #undef LANG_HOOKS_GET_ALIAS_SET
892 #define LANG_HOOKS_GET_ALIAS_SET gnat_get_alias_set
893 #undef LANG_HOOKS_PRINT_DECL
894 #define LANG_HOOKS_PRINT_DECL gnat_print_decl
895 #undef LANG_HOOKS_PRINT_TYPE
896 #define LANG_HOOKS_PRINT_TYPE gnat_print_type
897 #undef LANG_HOOKS_TYPE_MAX_SIZE
898 #define LANG_HOOKS_TYPE_MAX_SIZE gnat_type_max_size
899 #undef LANG_HOOKS_DECL_PRINTABLE_NAME
900 #define LANG_HOOKS_DECL_PRINTABLE_NAME gnat_printable_name
901 #undef LANG_HOOKS_DWARF_NAME
902 #define LANG_HOOKS_DWARF_NAME gnat_dwarf_name
903 #undef LANG_HOOKS_GIMPLIFY_EXPR
904 #define LANG_HOOKS_GIMPLIFY_EXPR gnat_gimplify_expr
905 #undef LANG_HOOKS_TYPE_FOR_MODE
906 #define LANG_HOOKS_TYPE_FOR_MODE gnat_type_for_mode
907 #undef LANG_HOOKS_TYPE_FOR_SIZE
908 #define LANG_HOOKS_TYPE_FOR_SIZE gnat_type_for_size
909 #undef LANG_HOOKS_TYPES_COMPATIBLE_P
910 #define LANG_HOOKS_TYPES_COMPATIBLE_P gnat_types_compatible_p
911 #undef LANG_HOOKS_GET_SUBRANGE_BOUNDS
912 #define LANG_HOOKS_GET_SUBRANGE_BOUNDS gnat_get_subrange_bounds
913 #undef LANG_HOOKS_DESCRIPTIVE_TYPE
914 #define LANG_HOOKS_DESCRIPTIVE_TYPE gnat_descriptive_type
915 #undef LANG_HOOKS_ATTRIBUTE_TABLE
916 #define LANG_HOOKS_ATTRIBUTE_TABLE gnat_internal_attribute_table
917 #undef LANG_HOOKS_BUILTIN_FUNCTION
918 #define LANG_HOOKS_BUILTIN_FUNCTION gnat_builtin_function
919 #undef LANG_HOOKS_EH_PERSONALITY
920 #define LANG_HOOKS_EH_PERSONALITY gnat_eh_personality
921 #undef LANG_HOOKS_DEEP_UNSHARING
922 #define LANG_HOOKS_DEEP_UNSHARING true
923 #undef LANG_HOOKS_INIT_TS
924 #define LANG_HOOKS_INIT_TS gnat_init_ts
926 struct lang_hooks lang_hooks
= LANG_HOOKS_INITIALIZER
;
928 #include "gt-ada-misc.h"