| 1 |
/**************************************************************************** |
| 2 |
* * |
| 3 |
* GNAT COMPILER COMPONENTS * |
| 4 |
* * |
| 5 |
* M I S C * |
| 6 |
* * |
| 7 |
* C Implementation File * |
| 8 |
* * |
| 9 |
* Copyright (C) 1992-2025, 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 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/>. * |
| 20 |
* * |
| 21 |
* GNAT was originally developed by the GNAT team at New York University. * |
| 22 |
* Extensive contributions were provided by Ada Core Technologies Inc. * |
| 23 |
* * |
| 24 |
****************************************************************************/ |
| 25 |
|
| 26 |
#include "config.h" |
| 27 |
#include "system.h" |
| 28 |
#include "coretypes.h" |
| 29 |
#include "target.h" |
| 30 |
#include "tree.h" |
| 31 |
#include "memmodel.h" |
| 32 |
#include "tm_p.h" |
| 33 |
#include "diagnostic.h" |
| 34 |
#include "opts.h" |
| 35 |
#include "alias.h" |
| 36 |
#include "fold-const.h" |
| 37 |
#include "stor-layout.h" |
| 38 |
#include "print-tree.h" |
| 39 |
#include "toplev.h" |
| 40 |
#include "tree-pass.h" |
| 41 |
#include "langhooks.h" |
| 42 |
#include "langhooks-def.h" |
| 43 |
#include "plugin.h" |
| 44 |
#include "calls.h" /* For pass_by_reference. */ |
| 45 |
#include "dwarf2out.h" |
| 46 |
|
| 47 |
#include "ada.h" |
| 48 |
#include "adadecode.h" |
| 49 |
#include "types.h" |
| 50 |
#include "atree.h" |
| 51 |
#include "namet.h" |
| 52 |
#include "nlists.h" |
| 53 |
#include "snames.h" |
| 54 |
#include "uintp.h" |
| 55 |
#include "fe.h" |
| 56 |
#include "sinfo.h" |
| 57 |
#include "einfo.h" |
| 58 |
#include "ada-tree.h" |
| 59 |
#include "gigi.h" |
| 60 |
|
| 61 |
/* Command-line argc and argv. These variables are global since they are |
| 62 |
imported in back_end.adb. */ |
| 63 |
unsigned int save_argc; |
| 64 |
const char **save_argv; |
| 65 |
|
| 66 |
/* GNAT argc and argv generated by the binder for all Ada programs. */ |
| 67 |
extern int gnat_argc; |
| 68 |
extern char **gnat_argv; |
| 69 |
|
| 70 |
/* Ada code requires variables for these settings rather than elements |
| 71 |
of the global_options structure because they are imported. */ |
| 72 |
#undef gnat_encodings |
| 73 |
enum dwarf_gnat_encodings gnat_encodings = DWARF_GNAT_ENCODINGS_DEFAULT; |
| 74 |
|
| 75 |
#undef optimize |
| 76 |
int optimize; |
| 77 |
|
| 78 |
#undef optimize_size |
| 79 |
int optimize_size; |
| 80 |
|
| 81 |
#undef flag_short_enums |
| 82 |
int flag_short_enums; |
| 83 |
|
| 84 |
#undef flag_stack_check |
| 85 |
enum stack_check_type flag_stack_check = NO_STACK_CHECK; |
| 86 |
|
| 87 |
#ifdef __cplusplus |
| 88 |
extern "C" { |
| 89 |
#endif |
| 90 |
|
| 91 |
/* Declare functions we use as part of startup. */ |
| 92 |
extern void __gnat_initialize (void *); |
| 93 |
extern void __gnat_install_SEH_handler (void *); |
| 94 |
extern void adainit (void); |
| 95 |
extern void _ada_gnat1drv (void); |
| 96 |
|
| 97 |
#ifdef __cplusplus |
| 98 |
} |
| 99 |
#endif |
| 100 |
|
| 101 |
/* The parser for the language. For us, we process the GNAT tree. */ |
| 102 |
|
| 103 |
static void |
| 104 |
gnat_parse_file (void) |
| 105 |
{ |
| 106 |
int seh[2]; |
| 107 |
|
| 108 |
/* Call the target specific initializations. */ |
| 109 |
__gnat_initialize (NULL); |
| 110 |
|
| 111 |
/* ??? Call the SEH initialization routine. This is to workaround |
| 112 |
a bootstrap path problem. The call below should be removed at some |
| 113 |
point and the SEH pointer passed to __gnat_initialize above. */ |
| 114 |
__gnat_install_SEH_handler ((void *)seh); |
| 115 |
|
| 116 |
/* Call the front-end elaboration procedures. */ |
| 117 |
adainit (); |
| 118 |
|
| 119 |
/* Call the front end. */ |
| 120 |
_ada_gnat1drv (); |
| 121 |
|
| 122 |
/* Write the global declarations. */ |
| 123 |
gnat_write_global_declarations (); |
| 124 |
} |
| 125 |
|
| 126 |
/* Return language mask for option processing. */ |
| 127 |
|
| 128 |
static unsigned int |
| 129 |
gnat_option_lang_mask (void) |
| 130 |
{ |
| 131 |
return CL_Ada; |
| 132 |
} |
| 133 |
|
| 134 |
/* Decode all the language specific options that cannot be decoded by GCC. |
| 135 |
The option decoding phase of GCC calls this routine on the flags that |
| 136 |
are marked as Ada-specific. Return true on success or false on failure. */ |
| 137 |
|
| 138 |
static bool |
| 139 |
gnat_handle_option (size_t scode, const char *arg, HOST_WIDE_INT value, |
| 140 |
int kind, location_t loc, |
| 141 |
const struct cl_option_handlers *handlers) |
| 142 |
{ |
| 143 |
enum opt_code code = (enum opt_code) scode; |
| 144 |
|
| 145 |
switch (code) |
| 146 |
{ |
| 147 |
case OPT_Wall: |
| 148 |
handle_generated_option (&global_options, &global_options_set, |
| 149 |
OPT_Wunused, NULL, value, |
| 150 |
gnat_option_lang_mask (), kind, loc, |
| 151 |
handlers, true, global_dc); |
| 152 |
warn_uninitialized = value; |
| 153 |
warn_maybe_uninitialized = value; |
| 154 |
break; |
| 155 |
|
| 156 |
case OPT_gant: |
| 157 |
warning (0, "%<-gnat%> misspelled as %<-gant%>"); |
| 158 |
|
| 159 |
/* ... fall through ... */ |
| 160 |
|
| 161 |
case OPT_gnat: |
| 162 |
case OPT_gnatO: |
| 163 |
case OPT_fRTS_: |
| 164 |
case OPT_I: |
| 165 |
case OPT_fdump_scos: |
| 166 |
case OPT_nostdinc: |
| 167 |
case OPT_nostdlib: |
| 168 |
/* These are handled by the front-end. */ |
| 169 |
break; |
| 170 |
|
| 171 |
case OPT_fshort_enums: |
| 172 |
case OPT_fsigned_char: |
| 173 |
case OPT_funsigned_char: |
| 174 |
/* These are handled by the middle-end. */ |
| 175 |
break; |
| 176 |
|
| 177 |
case OPT_fbuiltin_printf: |
| 178 |
/* This is ignored in Ada but needs to be accepted so it can be |
| 179 |
defaulted. */ |
| 180 |
break; |
| 181 |
|
| 182 |
default: |
| 183 |
gcc_unreachable (); |
| 184 |
} |
| 185 |
|
| 186 |
Ada_handle_option_auto (&global_options, &global_options_set, |
| 187 |
scode, arg, value, |
| 188 |
gnat_option_lang_mask (), kind, loc, |
| 189 |
handlers, global_dc); |
| 190 |
return true; |
| 191 |
} |
| 192 |
|
| 193 |
/* Initialize options structure OPTS. */ |
| 194 |
|
| 195 |
static void |
| 196 |
gnat_init_options_struct (struct gcc_options *opts) |
| 197 |
{ |
| 198 |
/* Uninitialized really means uninitialized in Ada. */ |
| 199 |
opts->x_flag_zero_initialized_in_bss = 0; |
| 200 |
|
| 201 |
/* We don't care about errno in Ada and it causes __builtin_sqrt to |
| 202 |
call the libm function rather than do it inline. */ |
| 203 |
opts->x_flag_errno_math = 0; |
| 204 |
opts->frontend_set_flag_errno_math = true; |
| 205 |
} |
| 206 |
|
| 207 |
/* Initialize for option processing. */ |
| 208 |
|
| 209 |
static void |
| 210 |
gnat_init_options (unsigned int decoded_options_count, |
| 211 |
struct cl_decoded_option *decoded_options) |
| 212 |
{ |
| 213 |
/* Reconstruct an argv array for use of back_end.adb. |
| 214 |
|
| 215 |
??? back_end.adb should not rely on this; instead, it should work with |
| 216 |
decoded options without such reparsing, to ensure consistency in how |
| 217 |
options are decoded. */ |
| 218 |
save_argv = XNEWVEC (const char *, 2 * decoded_options_count + 1); |
| 219 |
save_argc = 0; |
| 220 |
for (unsigned int i = 0; i < decoded_options_count; i++) |
| 221 |
{ |
| 222 |
size_t num_elements = decoded_options[i].canonical_option_num_elements; |
| 223 |
|
| 224 |
if (decoded_options[i].errors |
| 225 |
|| decoded_options[i].opt_index == OPT_SPECIAL_unknown |
| 226 |
|| num_elements == 0) |
| 227 |
continue; |
| 228 |
|
| 229 |
/* Deal with -I- specially since it must be a single switch. */ |
| 230 |
if (decoded_options[i].opt_index == OPT_I |
| 231 |
&& num_elements == 2 |
| 232 |
&& decoded_options[i].canonical_option[1][0] == '-' |
| 233 |
&& decoded_options[i].canonical_option[1][1] == '\0') |
| 234 |
save_argv[save_argc++] = "-I-"; |
| 235 |
else |
| 236 |
{ |
| 237 |
gcc_assert (num_elements >= 1 && num_elements <= 2); |
| 238 |
save_argv[save_argc++] = decoded_options[i].canonical_option[0]; |
| 239 |
if (num_elements >= 2) |
| 240 |
save_argv[save_argc++] = decoded_options[i].canonical_option[1]; |
| 241 |
} |
| 242 |
} |
| 243 |
save_argv[save_argc] = NULL; |
| 244 |
|
| 245 |
/* Pass just the name of the command through the regular channel. */ |
| 246 |
gnat_argv = (char **) xmalloc (sizeof (char *)); |
| 247 |
gnat_argv[0] = xstrdup (save_argv[0]); |
| 248 |
gnat_argc = 1; |
| 249 |
} |
| 250 |
|
| 251 |
/* Settings adjustments after switches processing by the back-end. |
| 252 |
Note that the front-end switches processing (Scan_Compiler_Arguments) |
| 253 |
has not been done yet at this point! */ |
| 254 |
|
| 255 |
static bool |
| 256 |
gnat_post_options (const char **pfilename ATTRIBUTE_UNUSED) |
| 257 |
{ |
| 258 |
/* Excess precision other than "fast" requires front-end support. */ |
| 259 |
if (flag_excess_precision == EXCESS_PRECISION_STANDARD) |
| 260 |
sorry ("%<-fexcess-precision=standard%> for Ada"); |
| 261 |
else if (flag_excess_precision == EXCESS_PRECISION_FLOAT16) |
| 262 |
sorry ("%<-fexcess-precision=16%> for Ada"); |
| 263 |
|
| 264 |
flag_excess_precision = EXCESS_PRECISION_FAST; |
| 265 |
|
| 266 |
/* No psABI change warnings for Ada. */ |
| 267 |
warn_psabi = 0; |
| 268 |
|
| 269 |
/* No return type warnings for Ada. */ |
| 270 |
warn_return_type = 0; |
| 271 |
|
| 272 |
/* No caret by default for Ada. */ |
| 273 |
if (!OPTION_SET_P (flag_diagnostics_show_caret)) |
| 274 |
global_dc->m_source_printing.enabled = false; |
| 275 |
|
| 276 |
/* Copy global settings to local versions. */ |
| 277 |
gnat_encodings = global_options.x_gnat_encodings; |
| 278 |
optimize = global_options.x_optimize; |
| 279 |
optimize_size = global_options.x_optimize_size; |
| 280 |
flag_stack_check = global_options.x_flag_stack_check; |
| 281 |
flag_short_enums = global_options.x_flag_short_enums; |
| 282 |
|
| 283 |
/* Unfortunately the post_options hook is called before the value of |
| 284 |
flag_short_enums is autodetected, if need be. Mimic the process |
| 285 |
for our private flag_short_enums. */ |
| 286 |
if (!OPTION_SET_P (flag_short_enums)) |
| 287 |
flag_short_enums = targetm.default_short_enums (); |
| 288 |
|
| 289 |
return false; |
| 290 |
} |
| 291 |
|
| 292 |
/* Here is the function to handle the compiler error processing in GCC. */ |
| 293 |
|
| 294 |
static void |
| 295 |
internal_error_function (diagnostic_context *context, const char *msgid, |
| 296 |
va_list *ap) |
| 297 |
{ |
| 298 |
char *buffer, *p, *loc; |
| 299 |
String_Template temp, temp_loc; |
| 300 |
String_Pointer sp, sp_loc; |
| 301 |
expanded_location xloc; |
| 302 |
|
| 303 |
/* Warn if plugins present. */ |
| 304 |
warn_if_plugins (); |
| 305 |
|
| 306 |
/* Dump the representation of the function. */ |
| 307 |
emergency_dump_function (); |
| 308 |
|
| 309 |
/* Reset the pretty-printer. */ |
| 310 |
pp_clear_output_area (context->get_reference_printer ()); |
| 311 |
|
| 312 |
/* Format the message into the pretty-printer. */ |
| 313 |
text_info tinfo (msgid, ap, errno); |
| 314 |
pp_format_verbatim (context->get_reference_printer (), &tinfo); |
| 315 |
|
| 316 |
/* Extract a (writable) pointer to the formatted text. */ |
| 317 |
buffer = xstrdup (pp_formatted_text (context->get_reference_printer ())); |
| 318 |
|
| 319 |
/* Go up to the first newline. */ |
| 320 |
for (p = buffer; *p; p++) |
| 321 |
if (*p == '\n') |
| 322 |
{ |
| 323 |
*p = '\0'; |
| 324 |
break; |
| 325 |
} |
| 326 |
|
| 327 |
temp.Low_Bound = 1; |
| 328 |
temp.High_Bound = p - buffer; |
| 329 |
sp.Bounds = &temp; |
| 330 |
sp.Array = buffer; |
| 331 |
|
| 332 |
if (input_location == UNKNOWN_LOCATION) |
| 333 |
{ |
| 334 |
loc = NULL; |
| 335 |
temp_loc.Low_Bound = 1; |
| 336 |
temp_loc.High_Bound = 0; |
| 337 |
} |
| 338 |
else |
| 339 |
{ |
| 340 |
xloc = expand_location (input_location); |
| 341 |
if (context->m_show_column && xloc.column != 0) |
| 342 |
loc = xasprintf ("%s:%d:%d", xloc.file, xloc.line, xloc.column); |
| 343 |
else |
| 344 |
loc = xasprintf ("%s:%d", xloc.file, xloc.line); |
| 345 |
temp_loc.Low_Bound = 1; |
| 346 |
temp_loc.High_Bound = strlen (loc); |
| 347 |
} |
| 348 |
|
| 349 |
sp_loc.Bounds = &temp_loc; |
| 350 |
sp_loc.Array = loc; |
| 351 |
|
| 352 |
Compiler_Abort (sp, sp_loc, true); |
| 353 |
} |
| 354 |
|
| 355 |
/* Perform all the initialization steps that are language-specific. */ |
| 356 |
|
| 357 |
static bool |
| 358 |
gnat_init (void) |
| 359 |
{ |
| 360 |
/* Do little here, most of the standard declarations are set up after the |
| 361 |
front-end has been run. Use the same `char' as C for Interfaces.C. */ |
| 362 |
build_common_tree_nodes (flag_signed_char); |
| 363 |
|
| 364 |
/* In Ada, we use an unsigned 8-bit type for the default boolean type. */ |
| 365 |
boolean_type_node = make_unsigned_type (8); |
| 366 |
TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE); |
| 367 |
SET_TYPE_RM_MAX_VALUE (boolean_type_node, |
| 368 |
build_int_cst (boolean_type_node, 1)); |
| 369 |
SET_TYPE_RM_SIZE (boolean_type_node, bitsize_int (1)); |
| 370 |
boolean_true_node = TYPE_MAX_VALUE (boolean_type_node); |
| 371 |
boolean_false_node = TYPE_MIN_VALUE (boolean_type_node); |
| 372 |
|
| 373 |
sbitsize_one_node = sbitsize_int (1); |
| 374 |
sbitsize_unit_node = sbitsize_int (BITS_PER_UNIT); |
| 375 |
|
| 376 |
/* In Ada, we do not use location ranges. */ |
| 377 |
line_table->default_range_bits = 0; |
| 378 |
|
| 379 |
/* Register our internal error function. */ |
| 380 |
global_dc->m_internal_error = &internal_error_function; |
| 381 |
|
| 382 |
return true; |
| 383 |
} |
| 384 |
|
| 385 |
/* Initialize the GCC support for exception handling. */ |
| 386 |
|
| 387 |
void |
| 388 |
gnat_init_gcc_eh (void) |
| 389 |
{ |
| 390 |
/* We shouldn't do anything if the No_Exceptions_Handler pragma is set, |
| 391 |
though. This could for instance lead to the emission of tables with |
| 392 |
references to symbols (such as the Ada eh personality routine) within |
| 393 |
libraries we won't link against. */ |
| 394 |
if (No_Exception_Handlers_Set ()) |
| 395 |
return; |
| 396 |
|
| 397 |
/* Tell GCC we are handling cleanup actions through exception propagation. |
| 398 |
This opens possibilities that we don't take advantage of yet, but is |
| 399 |
nonetheless necessary to ensure that fixup code gets assigned to the |
| 400 |
right exception regions. */ |
| 401 |
using_eh_for_cleanups (); |
| 402 |
|
| 403 |
/* Turn on -fexceptions, -fnon-call-exceptions and -fdelete-dead-exceptions. |
| 404 |
The first one activates the support for exceptions in the compiler. |
| 405 |
The second one is useful for two reasons: 1/ we map some asynchronous |
| 406 |
signals like SEGV to exceptions, so we need to ensure that the insns |
| 407 |
which can lead to such signals are correctly attached to the exception |
| 408 |
region they pertain to, 2/ some calls to pure subprograms are handled as |
| 409 |
libcall blocks and then marked as "cannot trap" if the flag is not set |
| 410 |
(see emit_libcall_block). We should not let this be since it is possible |
| 411 |
for such calls to actually raise in Ada. |
| 412 |
The third one is an optimization that makes it possible to delete dead |
| 413 |
instructions that may throw exceptions, most notably loads and stores, |
| 414 |
as permitted in Ada. |
| 415 |
Turn off -faggressive-loop-optimizations because it may optimize away |
| 416 |
out-of-bound array accesses that we want to be able to catch. |
| 417 |
If checks are disabled, we use the same settings as the C++ compiler, |
| 418 |
except for the runtime on platforms where S'Machine_Overflow is true |
| 419 |
because the runtime depends on FP (hardware) checks being properly |
| 420 |
handled despite being compiled in -gnatp mode. */ |
| 421 |
flag_exceptions = 1; |
| 422 |
flag_delete_dead_exceptions = 1; |
| 423 |
if (Suppress_Checks) |
| 424 |
{ |
| 425 |
if (!OPTION_SET_P (flag_non_call_exceptions)) |
| 426 |
flag_non_call_exceptions = Machine_Overflows_On_Target && GNAT_Mode; |
| 427 |
} |
| 428 |
else |
| 429 |
{ |
| 430 |
if (!OPTION_SET_P (flag_non_call_exceptions)) |
| 431 |
flag_non_call_exceptions = 1; |
| 432 |
flag_aggressive_loop_optimizations = 0; |
| 433 |
warn_aggressive_loop_optimizations = 0; |
| 434 |
} |
| 435 |
|
| 436 |
init_eh (); |
| 437 |
} |
| 438 |
|
| 439 |
/* Initialize the GCC support for floating-point operations. */ |
| 440 |
|
| 441 |
void |
| 442 |
gnat_init_gcc_fp (void) |
| 443 |
{ |
| 444 |
/* Disable FP optimizations that ignore the signedness of zero if |
| 445 |
S'Signed_Zeros is true, but don't override the user if not. */ |
| 446 |
if (Signed_Zeros_On_Target) |
| 447 |
flag_signed_zeros = 1; |
| 448 |
else if (!OPTION_SET_P (flag_signed_zeros)) |
| 449 |
flag_signed_zeros = 0; |
| 450 |
|
| 451 |
/* Assume that FP operations can trap if S'Machine_Overflow is true, |
| 452 |
but don't override the user if not. */ |
| 453 |
if (Machine_Overflows_On_Target) |
| 454 |
flag_trapping_math = 1; |
| 455 |
else if (!OPTION_SET_P (flag_trapping_math)) |
| 456 |
flag_trapping_math = 0; |
| 457 |
} |
| 458 |
|
| 459 |
/* Print language-specific items in declaration NODE. */ |
| 460 |
|
| 461 |
static void |
| 462 |
gnat_print_decl (FILE *file, tree node, int indent) |
| 463 |
{ |
| 464 |
switch (TREE_CODE (node)) |
| 465 |
{ |
| 466 |
case CONST_DECL: |
| 467 |
print_node (file, "corresponding var", |
| 468 |
DECL_CONST_CORRESPONDING_VAR (node), indent + 4); |
| 469 |
break; |
| 470 |
|
| 471 |
case FIELD_DECL: |
| 472 |
print_node (file, "original field", DECL_ORIGINAL_FIELD (node), |
| 473 |
indent + 4); |
| 474 |
break; |
| 475 |
|
| 476 |
case VAR_DECL: |
| 477 |
if (DECL_LOOP_PARM_P (node)) |
| 478 |
print_node (file, "induction var", DECL_INDUCTION_VAR (node), |
| 479 |
indent + 4); |
| 480 |
break; |
| 481 |
|
| 482 |
default: |
| 483 |
break; |
| 484 |
} |
| 485 |
} |
| 486 |
|
| 487 |
/* Print language-specific items in type NODE. */ |
| 488 |
|
| 489 |
static void |
| 490 |
gnat_print_type (FILE *file, tree node, int indent) |
| 491 |
{ |
| 492 |
switch (TREE_CODE (node)) |
| 493 |
{ |
| 494 |
case FUNCTION_TYPE: |
| 495 |
case METHOD_TYPE: |
| 496 |
print_node (file, "ci/co list", TYPE_CI_CO_LIST (node), indent + 4); |
| 497 |
break; |
| 498 |
|
| 499 |
case INTEGER_TYPE: |
| 500 |
if (TYPE_MODULAR_P (node)) |
| 501 |
print_node_brief (file, "modulus", TYPE_MODULUS (node), indent + 4); |
| 502 |
else if (TYPE_FIXED_POINT_P (node)) |
| 503 |
print_node (file, "scale factor", TYPE_SCALE_FACTOR (node), |
| 504 |
indent + 4); |
| 505 |
else if (TYPE_HAS_ACTUAL_BOUNDS_P (node)) |
| 506 |
print_node (file, "actual bounds", TYPE_ACTUAL_BOUNDS (node), |
| 507 |
indent + 4); |
| 508 |
else |
| 509 |
print_node (file, "index type", TYPE_INDEX_TYPE (node), indent + 4); |
| 510 |
|
| 511 |
/* ... fall through ... */ |
| 512 |
|
| 513 |
case ENUMERAL_TYPE: |
| 514 |
case BOOLEAN_TYPE: |
| 515 |
print_node_brief (file, "RM size", TYPE_RM_SIZE (node), indent + 4); |
| 516 |
|
| 517 |
/* ... fall through ... */ |
| 518 |
|
| 519 |
case REAL_TYPE: |
| 520 |
print_node_brief (file, "RM min", TYPE_RM_MIN_VALUE (node), indent + 4); |
| 521 |
print_node_brief (file, "RM max", TYPE_RM_MAX_VALUE (node), indent + 4); |
| 522 |
break; |
| 523 |
|
| 524 |
case ARRAY_TYPE: |
| 525 |
print_node (file,"actual bounds", TYPE_ACTUAL_BOUNDS (node), indent + 4); |
| 526 |
break; |
| 527 |
|
| 528 |
case VECTOR_TYPE: |
| 529 |
print_node (file,"representative array", |
| 530 |
TYPE_REPRESENTATIVE_ARRAY (node), indent + 4); |
| 531 |
break; |
| 532 |
|
| 533 |
case RECORD_TYPE: |
| 534 |
if (TYPE_FAT_POINTER_P (node) || TYPE_CONTAINS_TEMPLATE_P (node)) |
| 535 |
print_node (file, "unconstrained array", |
| 536 |
TYPE_UNCONSTRAINED_ARRAY (node), indent + 4); |
| 537 |
else |
| 538 |
print_node (file, "Ada size", TYPE_ADA_SIZE (node), indent + 4); |
| 539 |
break; |
| 540 |
|
| 541 |
case UNION_TYPE: |
| 542 |
case QUAL_UNION_TYPE: |
| 543 |
print_node (file, "Ada size", TYPE_ADA_SIZE (node), indent + 4); |
| 544 |
break; |
| 545 |
|
| 546 |
default: |
| 547 |
break; |
| 548 |
} |
| 549 |
|
| 550 |
if (TYPE_CAN_HAVE_DEBUG_TYPE_P (node) && TYPE_DEBUG_TYPE (node)) |
| 551 |
print_node_brief (file, "debug type", TYPE_DEBUG_TYPE (node), indent + 4); |
| 552 |
|
| 553 |
if (TYPE_IMPL_PACKED_ARRAY_P (node) && TYPE_ORIGINAL_PACKED_ARRAY (node)) |
| 554 |
print_node_brief (file, "original packed array", |
| 555 |
TYPE_ORIGINAL_PACKED_ARRAY (node), indent + 4); |
| 556 |
} |
| 557 |
|
| 558 |
/* Return the name to be printed for DECL. */ |
| 559 |
|
| 560 |
static const char * |
| 561 |
gnat_printable_name (tree decl, int verbosity) |
| 562 |
{ |
| 563 |
const char *coded_name = IDENTIFIER_POINTER (DECL_NAME (decl)); |
| 564 |
char *ada_name = (char *) ggc_alloc_atomic (strlen (coded_name) * 2 + 60); |
| 565 |
|
| 566 |
__gnat_decode (coded_name, ada_name, 0); |
| 567 |
|
| 568 |
if (verbosity == 2 && !DECL_IS_UNDECLARED_BUILTIN (decl)) |
| 569 |
{ |
| 570 |
Set_Identifier_Casing (ada_name, DECL_SOURCE_FILE (decl)); |
| 571 |
return ggc_strdup (Name_Buffer); |
| 572 |
} |
| 573 |
|
| 574 |
return ada_name; |
| 575 |
} |
| 576 |
|
| 577 |
/* Return the name to be used in DWARF debug info for DECL. */ |
| 578 |
|
| 579 |
static const char * |
| 580 |
gnat_dwarf_name (tree decl, int verbosity ATTRIBUTE_UNUSED) |
| 581 |
{ |
| 582 |
gcc_assert (DECL_P (decl)); |
| 583 |
return (const char *) IDENTIFIER_POINTER (DECL_NAME (decl)); |
| 584 |
} |
| 585 |
|
| 586 |
/* Return the descriptive type associated with TYPE, if any. */ |
| 587 |
|
| 588 |
static tree |
| 589 |
gnat_descriptive_type (const_tree type) |
| 590 |
{ |
| 591 |
if (TYPE_STUB_DECL (type)) |
| 592 |
return DECL_PARALLEL_TYPE (TYPE_STUB_DECL (type)); |
| 593 |
else |
| 594 |
return NULL_TREE; |
| 595 |
} |
| 596 |
|
| 597 |
/* Return the underlying base type of an enumeration type. */ |
| 598 |
|
| 599 |
static tree |
| 600 |
gnat_enum_underlying_base_type (const_tree) |
| 601 |
{ |
| 602 |
/* Enumeration types are base types in Ada. */ |
| 603 |
return void_type_node; |
| 604 |
} |
| 605 |
|
| 606 |
/* Return the type to be used for debugging information instead of TYPE or |
| 607 |
NULL_TREE if TYPE is fine. */ |
| 608 |
|
| 609 |
static tree |
| 610 |
gnat_get_debug_type (const_tree type) |
| 611 |
{ |
| 612 |
if (TYPE_CAN_HAVE_DEBUG_TYPE_P (type)) |
| 613 |
return TYPE_DEBUG_TYPE (type); |
| 614 |
else |
| 615 |
return NULL_TREE; |
| 616 |
} |
| 617 |
|
| 618 |
/* Provide information in INFO for debugging output about the TYPE fixed-point |
| 619 |
type. Return whether TYPE is handled. */ |
| 620 |
|
| 621 |
static bool |
| 622 |
gnat_get_fixed_point_type_info (const_tree type, |
| 623 |
struct fixed_point_type_info *info) |
| 624 |
{ |
| 625 |
tree scale_factor; |
| 626 |
|
| 627 |
/* Do nothing if the GNAT encodings are used. */ |
| 628 |
if (!TYPE_IS_FIXED_POINT_P (type) |
| 629 |
|| gnat_encodings == DWARF_GNAT_ENCODINGS_ALL) |
| 630 |
return false; |
| 631 |
|
| 632 |
scale_factor = TYPE_SCALE_FACTOR (type); |
| 633 |
|
| 634 |
/* We expect here only a finite set of pattern. See fixed-point types |
| 635 |
handling in gnat_to_gnu_entity. */ |
| 636 |
|
| 637 |
if (TREE_CODE (scale_factor) == RDIV_EXPR) |
| 638 |
{ |
| 639 |
tree num = TREE_OPERAND (scale_factor, 0); |
| 640 |
tree den = TREE_OPERAND (scale_factor, 1); |
| 641 |
|
| 642 |
/* See if we have a binary or decimal scale. */ |
| 643 |
if (TREE_CODE (den) == POWER_EXPR) |
| 644 |
{ |
| 645 |
tree base = TREE_OPERAND (den, 0); |
| 646 |
tree exponent = TREE_OPERAND (den, 1); |
| 647 |
|
| 648 |
/* We expect the scale factor to be 1 / 2 ** N or 1 / 10 ** N. */ |
| 649 |
gcc_assert (num == integer_one_node |
| 650 |
&& TREE_CODE (base) == INTEGER_CST |
| 651 |
&& TREE_CODE (exponent) == INTEGER_CST); |
| 652 |
|
| 653 |
switch (tree_to_shwi (base)) |
| 654 |
{ |
| 655 |
case 2: |
| 656 |
info->scale_factor_kind = fixed_point_scale_factor_binary; |
| 657 |
info->scale_factor.binary = -tree_to_shwi (exponent); |
| 658 |
return true; |
| 659 |
|
| 660 |
case 10: |
| 661 |
info->scale_factor_kind = fixed_point_scale_factor_decimal; |
| 662 |
info->scale_factor.decimal = -tree_to_shwi (exponent); |
| 663 |
return true; |
| 664 |
|
| 665 |
default: |
| 666 |
gcc_unreachable (); |
| 667 |
} |
| 668 |
} |
| 669 |
|
| 670 |
/* If we reach this point, we are handling an arbitrary scale factor. We |
| 671 |
expect N / D with constant operands. */ |
| 672 |
gcc_assert (TREE_CODE (num) == INTEGER_CST |
| 673 |
&& TREE_CODE (den) == INTEGER_CST); |
| 674 |
|
| 675 |
info->scale_factor_kind = fixed_point_scale_factor_arbitrary; |
| 676 |
info->scale_factor.arbitrary.numerator = num; |
| 677 |
info->scale_factor.arbitrary.denominator = den; |
| 678 |
return true; |
| 679 |
} |
| 680 |
|
| 681 |
gcc_unreachable (); |
| 682 |
} |
| 683 |
|
| 684 |
/* Return true if types T1 and T2 are identical for type hashing purposes. |
| 685 |
Called only after doing all language independent checks. At present, |
| 686 |
this is only called when both types are FUNCTION_TYPE or METHOD_TYPE. */ |
| 687 |
|
| 688 |
static bool |
| 689 |
gnat_type_hash_eq (const_tree t1, const_tree t2) |
| 690 |
{ |
| 691 |
gcc_assert (FUNC_OR_METHOD_TYPE_P (t1) && TREE_CODE (t1) == TREE_CODE (t2)); |
| 692 |
return fntype_same_flags_p (t1, TYPE_CI_CO_LIST (t2), |
| 693 |
TYPE_RETURN_BY_DIRECT_REF_P (t2), |
| 694 |
TREE_ADDRESSABLE (t2)); |
| 695 |
} |
| 696 |
|
| 697 |
/* Do nothing (return the tree node passed). */ |
| 698 |
|
| 699 |
static tree |
| 700 |
gnat_return_tree (tree t) |
| 701 |
{ |
| 702 |
return t; |
| 703 |
} |
| 704 |
|
| 705 |
/* Get the alias set corresponding to a type or expression. */ |
| 706 |
|
| 707 |
static alias_set_type |
| 708 |
gnat_get_alias_set (tree type) |
| 709 |
{ |
| 710 |
/* If this is a padding type, use the type of the first field. */ |
| 711 |
if (TYPE_IS_PADDING_P (type)) |
| 712 |
return get_alias_set (TREE_TYPE (TYPE_FIELDS (type))); |
| 713 |
|
| 714 |
/* If this is an extra subtype, use the base type. */ |
| 715 |
else if (TYPE_IS_EXTRA_SUBTYPE_P (type)) |
| 716 |
return get_alias_set (get_base_type (type)); |
| 717 |
|
| 718 |
/* If the type is an unconstrained array, use the type of the |
| 719 |
self-referential array we make. */ |
| 720 |
else if (TREE_CODE (type) == UNCONSTRAINED_ARRAY_TYPE) |
| 721 |
return |
| 722 |
get_alias_set (TREE_TYPE (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (type))))); |
| 723 |
|
| 724 |
/* If the type can alias any other types, return the alias set 0. */ |
| 725 |
else if (TYPE_P (type) |
| 726 |
&& !TYPE_IS_DUMMY_P (type) |
| 727 |
&& TYPE_UNIVERSAL_ALIASING_P (type)) |
| 728 |
return 0; |
| 729 |
|
| 730 |
return -1; |
| 731 |
} |
| 732 |
|
| 733 |
/* GNU_TYPE is a type. Return its maximum size in bytes, if known, |
| 734 |
as a constant when possible. */ |
| 735 |
|
| 736 |
static tree |
| 737 |
gnat_type_max_size (const_tree gnu_type) |
| 738 |
{ |
| 739 |
/* First see what we can get from TYPE_SIZE_UNIT, which might not |
| 740 |
be constant even for simple expressions if it has already been |
| 741 |
elaborated and possibly replaced by a VAR_DECL. */ |
| 742 |
tree max_size_unit = max_size (TYPE_SIZE_UNIT (gnu_type), true); |
| 743 |
|
| 744 |
/* If we don't have a constant, see what we can get from TYPE_ADA_SIZE, |
| 745 |
which should stay untouched. */ |
| 746 |
if (!tree_fits_uhwi_p (max_size_unit) |
| 747 |
&& RECORD_OR_UNION_TYPE_P (gnu_type) |
| 748 |
&& !TYPE_FAT_POINTER_P (gnu_type) |
| 749 |
&& TYPE_ADA_SIZE (gnu_type)) |
| 750 |
{ |
| 751 |
tree max_ada_size = max_size (TYPE_ADA_SIZE (gnu_type), true); |
| 752 |
|
| 753 |
/* If we have succeeded in finding a constant, round it up to the |
| 754 |
type's alignment and return the result in units. */ |
| 755 |
if (tree_fits_uhwi_p (max_ada_size)) |
| 756 |
max_size_unit |
| 757 |
= size_binop (EXACT_DIV_EXPR, |
| 758 |
round_up (max_ada_size, TYPE_ALIGN (gnu_type)), |
| 759 |
bitsize_unit_node); |
| 760 |
} |
| 761 |
|
| 762 |
return max_size_unit; |
| 763 |
} |
| 764 |
|
| 765 |
/* Return the unit size of TYPE without reusable tail padding. */ |
| 766 |
|
| 767 |
static tree |
| 768 |
gnat_unit_size_without_reusable_padding (tree type) |
| 769 |
{ |
| 770 |
/* The padding of justified modular types can always be reused. */ |
| 771 |
if (TYPE_JUSTIFIED_MODULAR_P (type)) |
| 772 |
return fold_convert (sizetype, |
| 773 |
size_binop (CEIL_DIV_EXPR, |
| 774 |
TYPE_ADA_SIZE (type), bitsize_unit_node)); |
| 775 |
return TYPE_SIZE_UNIT (type); |
| 776 |
} |
| 777 |
|
| 778 |
static tree get_array_bit_stride (tree); |
| 779 |
|
| 780 |
/* Provide information in INFO for debug output about the TYPE array type. |
| 781 |
Return whether TYPE is handled. */ |
| 782 |
|
| 783 |
static bool |
| 784 |
gnat_get_array_descr_info (const_tree const_type, |
| 785 |
struct array_descr_info *info) |
| 786 |
{ |
| 787 |
tree type = const_cast<tree> (const_type); |
| 788 |
tree first_dimen, dimen; |
| 789 |
bool is_array; |
| 790 |
int i; |
| 791 |
|
| 792 |
/* Temporaries created in the first pass and used in the second one for thin |
| 793 |
pointers. The first one is an expression that yields the template record |
| 794 |
from the base address (i.e. the PLACEHOLDER_EXPR). The second one is just |
| 795 |
a cursor through this record's fields. */ |
| 796 |
tree thinptr_template_expr = NULL_TREE; |
| 797 |
tree thinptr_bound_field = NULL_TREE; |
| 798 |
|
| 799 |
/* If we have an implementation type for a packed array, get the original |
| 800 |
array type. */ |
| 801 |
if (TYPE_IMPL_PACKED_ARRAY_P (type) && TYPE_ORIGINAL_PACKED_ARRAY (type)) |
| 802 |
type = TYPE_ORIGINAL_PACKED_ARRAY (type); |
| 803 |
|
| 804 |
/* First pass: gather all information about this array except everything |
| 805 |
related to dimensions. */ |
| 806 |
|
| 807 |
/* Only handle ARRAY_TYPE nodes that come from GNAT. */ |
| 808 |
if (TREE_CODE (type) == ARRAY_TYPE |
| 809 |
&& TYPE_DOMAIN (type) |
| 810 |
&& TYPE_INDEX_TYPE (TYPE_DOMAIN (type))) |
| 811 |
{ |
| 812 |
is_array = true; |
| 813 |
first_dimen = type; |
| 814 |
} |
| 815 |
|
| 816 |
/* As well as array types embedded in a record type with their bounds. */ |
| 817 |
else if (TREE_CODE (type) == RECORD_TYPE |
| 818 |
&& TYPE_CONTAINS_TEMPLATE_P (type) |
| 819 |
&& gnat_encodings != DWARF_GNAT_ENCODINGS_ALL) |
| 820 |
{ |
| 821 |
/* This will be our base object address. Note that we assume that |
| 822 |
pointers to this will actually point to the array field (thin |
| 823 |
pointers are shifted). */ |
| 824 |
tree placeholder_expr = build0 (PLACEHOLDER_EXPR, type); |
| 825 |
tree placeholder_addr |
| 826 |
= build_unary_op (ADDR_EXPR, NULL_TREE, placeholder_expr); |
| 827 |
|
| 828 |
tree bounds_field = TYPE_FIELDS (type); |
| 829 |
tree bounds_type = TREE_TYPE (bounds_field); |
| 830 |
tree array_field = DECL_CHAIN (bounds_field); |
| 831 |
tree array_type = TREE_TYPE (array_field); |
| 832 |
|
| 833 |
/* Replay the entire processing for array types. */ |
| 834 |
if (TYPE_CAN_HAVE_DEBUG_TYPE_P (array_type) |
| 835 |
&& TYPE_DEBUG_TYPE (array_type)) |
| 836 |
array_type = TYPE_DEBUG_TYPE (array_type); |
| 837 |
if (TYPE_IMPL_PACKED_ARRAY_P (array_type) |
| 838 |
&& TYPE_ORIGINAL_PACKED_ARRAY (array_type)) |
| 839 |
array_type = TYPE_ORIGINAL_PACKED_ARRAY (array_type); |
| 840 |
|
| 841 |
/* Shift back the address to get the address of the template. */ |
| 842 |
tree shift_amount |
| 843 |
= fold_build1 (NEGATE_EXPR, sizetype, byte_position (array_field)); |
| 844 |
tree template_addr |
| 845 |
= build_binary_op (POINTER_PLUS_EXPR, TREE_TYPE (placeholder_addr), |
| 846 |
placeholder_addr, shift_amount); |
| 847 |
template_addr |
| 848 |
= fold_convert (TYPE_POINTER_TO (bounds_type), template_addr); |
| 849 |
|
| 850 |
thinptr_template_expr |
| 851 |
= build_unary_op (INDIRECT_REF, NULL_TREE, template_addr); |
| 852 |
thinptr_bound_field = TYPE_FIELDS (bounds_type); |
| 853 |
|
| 854 |
is_array = false; |
| 855 |
first_dimen = array_type; |
| 856 |
} |
| 857 |
|
| 858 |
else |
| 859 |
return false; |
| 860 |
|
| 861 |
/* Second pass: compute the remaining information: dimensions and |
| 862 |
corresponding bounds. */ |
| 863 |
|
| 864 |
/* If this array has fortran convention, it's arranged in column-major |
| 865 |
order, so our view here has reversed dimensions. */ |
| 866 |
const bool convention_fortran_p = TYPE_CONVENTION_FORTRAN_P (first_dimen); |
| 867 |
const bool is_bit_packed_array = BIT_PACKED_ARRAY_TYPE_P (first_dimen); |
| 868 |
|
| 869 |
/* ??? For row major ordering, we probably want to emit nothing and |
| 870 |
instead specify it as the default in Dw_TAG_compile_unit. */ |
| 871 |
info->ordering = (convention_fortran_p |
| 872 |
? array_descr_ordering_column_major |
| 873 |
: array_descr_ordering_row_major); |
| 874 |
info->rank = NULL_TREE; |
| 875 |
|
| 876 |
/* Count the number of dimensions and determine the element type. */ |
| 877 |
i = 1; |
| 878 |
dimen = TREE_TYPE (first_dimen); |
| 879 |
while (TREE_CODE (dimen) == ARRAY_TYPE && TYPE_MULTI_ARRAY_P (dimen)) |
| 880 |
{ |
| 881 |
i++; |
| 882 |
dimen = TREE_TYPE (dimen); |
| 883 |
} |
| 884 |
info->ndimensions = i; |
| 885 |
info->element_type = dimen; |
| 886 |
|
| 887 |
/* Too many dimensions? Give up generating proper description: yield instead |
| 888 |
nested arrays. Note that in this case, this hook is invoked once on each |
| 889 |
intermediate array type: be consistent and output nested arrays for all |
| 890 |
dimensions. */ |
| 891 |
if (info->ndimensions > DWARF2OUT_ARRAY_DESCR_INFO_MAX_DIMEN |
| 892 |
|| TYPE_MULTI_ARRAY_P (first_dimen)) |
| 893 |
{ |
| 894 |
info->ndimensions = 1; |
| 895 |
info->element_type = TREE_TYPE (first_dimen); |
| 896 |
} |
| 897 |
|
| 898 |
/* Now iterate over all dimensions in source order and fill the info |
| 899 |
structure. */ |
| 900 |
for (i = (convention_fortran_p ? info->ndimensions - 1 : 0), |
| 901 |
dimen = first_dimen; |
| 902 |
IN_RANGE (i, 0, info->ndimensions - 1); |
| 903 |
i += (convention_fortran_p ? -1 : 1), |
| 904 |
dimen = TREE_TYPE (dimen)) |
| 905 |
{ |
| 906 |
/* We are interested in the stored bounds for the debug info. */ |
| 907 |
tree index_type = TYPE_INDEX_TYPE (TYPE_DOMAIN (dimen)); |
| 908 |
|
| 909 |
if (is_array) |
| 910 |
{ |
| 911 |
/* GDB does not handle very well the self-referencial bound |
| 912 |
expressions we are able to generate here for XUA types (they are |
| 913 |
used only by XUP encodings) so avoid them in this case. Note that |
| 914 |
there are two cases where we generate self-referencial bound |
| 915 |
expressions: arrays that are constrained by record discriminants |
| 916 |
and XUA types. */ |
| 917 |
if (TYPE_CONTEXT (first_dimen) |
| 918 |
&& TREE_CODE (TYPE_CONTEXT (first_dimen)) != RECORD_TYPE |
| 919 |
&& CONTAINS_PLACEHOLDER_P (TYPE_MIN_VALUE (index_type)) |
| 920 |
&& gnat_encodings == DWARF_GNAT_ENCODINGS_ALL) |
| 921 |
{ |
| 922 |
info->dimen[i].lower_bound = NULL_TREE; |
| 923 |
info->dimen[i].upper_bound = NULL_TREE; |
| 924 |
} |
| 925 |
else |
| 926 |
{ |
| 927 |
info->dimen[i].lower_bound |
| 928 |
= maybe_character_value (TYPE_MIN_VALUE (index_type)); |
| 929 |
info->dimen[i].upper_bound |
| 930 |
= maybe_character_value (TYPE_MAX_VALUE (index_type)); |
| 931 |
} |
| 932 |
} |
| 933 |
|
| 934 |
/* This is a thin pointer. */ |
| 935 |
else |
| 936 |
{ |
| 937 |
info->dimen[i].lower_bound |
| 938 |
= build_component_ref (thinptr_template_expr, thinptr_bound_field, |
| 939 |
false); |
| 940 |
thinptr_bound_field = DECL_CHAIN (thinptr_bound_field); |
| 941 |
|
| 942 |
info->dimen[i].upper_bound |
| 943 |
= build_component_ref (thinptr_template_expr, thinptr_bound_field, |
| 944 |
false); |
| 945 |
thinptr_bound_field = DECL_CHAIN (thinptr_bound_field); |
| 946 |
} |
| 947 |
|
| 948 |
/* The DWARF back-end will output BOUNDS_TYPE as the base type of |
| 949 |
the array index, so get to the base type of INDEX_TYPE. */ |
| 950 |
while (TREE_TYPE (index_type)) |
| 951 |
index_type = TREE_TYPE (index_type); |
| 952 |
|
| 953 |
info->dimen[i].bounds_type = maybe_debug_type (index_type); |
| 954 |
info->dimen[i].stride = NULL_TREE; |
| 955 |
} |
| 956 |
|
| 957 |
/* These are Fortran-specific fields. They make no sense here. */ |
| 958 |
info->allocated = NULL_TREE; |
| 959 |
info->associated = NULL_TREE; |
| 960 |
info->data_location = NULL_TREE; |
| 961 |
|
| 962 |
if (gnat_encodings != DWARF_GNAT_ENCODINGS_ALL) |
| 963 |
{ |
| 964 |
/* When arrays contain dynamically-sized elements, we usually wrap them |
| 965 |
in padding types, or we create constrained types for them. Then, if |
| 966 |
such types are stripped in the debugging information output, the |
| 967 |
debugger needs a way to know the size that is reserved for each |
| 968 |
element. This is why we emit a stride in such situations. */ |
| 969 |
tree source_element_type = info->element_type; |
| 970 |
|
| 971 |
while (true) |
| 972 |
{ |
| 973 |
if (TYPE_CAN_HAVE_DEBUG_TYPE_P (source_element_type) |
| 974 |
&& TYPE_DEBUG_TYPE (source_element_type)) |
| 975 |
source_element_type = TYPE_DEBUG_TYPE (source_element_type); |
| 976 |
else if (TYPE_IS_PADDING_P (source_element_type)) |
| 977 |
source_element_type |
| 978 |
= TREE_TYPE (TYPE_FIELDS (source_element_type)); |
| 979 |
else |
| 980 |
break; |
| 981 |
} |
| 982 |
|
| 983 |
if (TREE_CODE (TYPE_SIZE_UNIT (source_element_type)) != INTEGER_CST) |
| 984 |
{ |
| 985 |
info->stride = TYPE_SIZE_UNIT (info->element_type); |
| 986 |
info->stride_in_bits = false; |
| 987 |
} |
| 988 |
|
| 989 |
/* We need to specify a bit stride when it does not correspond to the |
| 990 |
natural size of the contained elements. ??? Note that we do not |
| 991 |
support packed records and nested packed arrays. */ |
| 992 |
else if (is_bit_packed_array) |
| 993 |
{ |
| 994 |
info->stride = get_array_bit_stride (info->element_type); |
| 995 |
info->stride_in_bits = true; |
| 996 |
} |
| 997 |
} |
| 998 |
|
| 999 |
return true; |
| 1000 |
} |
| 1001 |
|
| 1002 |
/* Given the component type COMP_TYPE of a packed array, return an expression |
| 1003 |
that computes the bit stride of this packed array. Return NULL_TREE when |
| 1004 |
unsuccessful. */ |
| 1005 |
|
| 1006 |
static tree |
| 1007 |
get_array_bit_stride (tree comp_type) |
| 1008 |
{ |
| 1009 |
struct array_descr_info info; |
| 1010 |
tree stride; |
| 1011 |
|
| 1012 |
/* Simple case: the array contains an integral type: return its RM size. */ |
| 1013 |
if (INTEGRAL_TYPE_P (comp_type)) |
| 1014 |
return TYPE_RM_SIZE (comp_type); |
| 1015 |
|
| 1016 |
/* Likewise for record or union types. */ |
| 1017 |
if (RECORD_OR_UNION_TYPE_P (comp_type) && !TYPE_FAT_POINTER_P (comp_type)) |
| 1018 |
return TYPE_ADA_SIZE (comp_type); |
| 1019 |
|
| 1020 |
/* The gnat_get_array_descr_info debug hook expects a debug tyoe. */ |
| 1021 |
comp_type = maybe_debug_type (comp_type); |
| 1022 |
|
| 1023 |
/* Otherwise, see if this is an array we can analyze; if it's not, punt. */ |
| 1024 |
memset (&info, 0, sizeof (info)); |
| 1025 |
if (!gnat_get_array_descr_info (comp_type, &info) || !info.stride) |
| 1026 |
return NULL_TREE; |
| 1027 |
|
| 1028 |
/* Otherwise, the array stride is the inner array's stride multiplied by the |
| 1029 |
number of elements it contains. Note that if the inner array is not |
| 1030 |
packed, then the stride is "natural" and thus does not deserve an |
| 1031 |
attribute. */ |
| 1032 |
stride = info.stride; |
| 1033 |
if (!info.stride_in_bits) |
| 1034 |
{ |
| 1035 |
stride = fold_convert (bitsizetype, stride); |
| 1036 |
stride = build_binary_op (MULT_EXPR, bitsizetype, |
| 1037 |
stride, build_int_cst (bitsizetype, 8)); |
| 1038 |
} |
| 1039 |
|
| 1040 |
for (int i = 0; i < info.ndimensions; ++i) |
| 1041 |
{ |
| 1042 |
tree count; |
| 1043 |
|
| 1044 |
if (!info.dimen[i].lower_bound || !info.dimen[i].upper_bound) |
| 1045 |
return NULL_TREE; |
| 1046 |
|
| 1047 |
/* Put in count an expression that computes the length of this |
| 1048 |
dimension. */ |
| 1049 |
count = build_binary_op (MINUS_EXPR, sbitsizetype, |
| 1050 |
fold_convert (sbitsizetype, |
| 1051 |
info.dimen[i].upper_bound), |
| 1052 |
fold_convert (sbitsizetype, |
| 1053 |
info.dimen[i].lower_bound)), |
| 1054 |
count = build_binary_op (PLUS_EXPR, sbitsizetype, |
| 1055 |
count, build_int_cst (sbitsizetype, 1)); |
| 1056 |
count = build_binary_op (MAX_EXPR, sbitsizetype, |
| 1057 |
count, |
| 1058 |
build_int_cst (sbitsizetype, 0)); |
| 1059 |
count = fold_convert (bitsizetype, count); |
| 1060 |
stride = build_binary_op (MULT_EXPR, bitsizetype, stride, count); |
| 1061 |
} |
| 1062 |
|
| 1063 |
return stride; |
| 1064 |
} |
| 1065 |
|
| 1066 |
/* GNU_TYPE is a subtype of an integral type. Set LOWVAL to the low bound |
| 1067 |
and HIGHVAL to the high bound, respectively. */ |
| 1068 |
|
| 1069 |
static void |
| 1070 |
gnat_get_subrange_bounds (const_tree gnu_type, tree *lowval, tree *highval) |
| 1071 |
{ |
| 1072 |
*lowval = TYPE_MIN_VALUE (gnu_type); |
| 1073 |
*highval = TYPE_MAX_VALUE (gnu_type); |
| 1074 |
} |
| 1075 |
|
| 1076 |
/* Return the bias of GNU_TYPE, if any. */ |
| 1077 |
|
| 1078 |
static tree |
| 1079 |
gnat_get_type_bias (const_tree gnu_type) |
| 1080 |
{ |
| 1081 |
if (TREE_CODE (gnu_type) == INTEGER_TYPE |
| 1082 |
&& TYPE_BIASED_REPRESENTATION_P (gnu_type) |
| 1083 |
&& gnat_encodings != DWARF_GNAT_ENCODINGS_ALL) |
| 1084 |
return TYPE_RM_MIN_VALUE (gnu_type); |
| 1085 |
|
| 1086 |
return NULL_TREE; |
| 1087 |
} |
| 1088 |
|
| 1089 |
/* GNU_TYPE is the type of a subprogram parameter. Determine if it should be |
| 1090 |
passed by reference by default. */ |
| 1091 |
|
| 1092 |
bool |
| 1093 |
default_pass_by_ref (tree gnu_type) |
| 1094 |
{ |
| 1095 |
/* We pass aggregates by reference if they are sufficiently large for |
| 1096 |
their alignment. The ratio is somewhat arbitrary. We also pass by |
| 1097 |
reference if the target machine would either pass or return by |
| 1098 |
reference. Strictly speaking, we need only check the return if this |
| 1099 |
is an In Out parameter, but it's probably best to err on the side of |
| 1100 |
passing more things by reference. */ |
| 1101 |
|
| 1102 |
if (AGGREGATE_TYPE_P (gnu_type) |
| 1103 |
&& (!valid_constant_size_p (TYPE_SIZE_UNIT (gnu_type)) |
| 1104 |
|| compare_tree_int (TYPE_SIZE_UNIT (gnu_type), |
| 1105 |
TYPE_ALIGN (gnu_type)) > 0)) |
| 1106 |
return true; |
| 1107 |
|
| 1108 |
if (pass_by_reference (NULL, function_arg_info (gnu_type, /*named=*/true))) |
| 1109 |
return true; |
| 1110 |
|
| 1111 |
if (targetm.calls.return_in_memory (gnu_type, NULL_TREE)) |
| 1112 |
return true; |
| 1113 |
|
| 1114 |
return false; |
| 1115 |
} |
| 1116 |
|
| 1117 |
/* GNU_TYPE is the type of a subprogram parameter. Determine if it must be |
| 1118 |
passed by reference. */ |
| 1119 |
|
| 1120 |
bool |
| 1121 |
must_pass_by_ref (tree gnu_type) |
| 1122 |
{ |
| 1123 |
/* We pass only unconstrained objects, those required by the language |
| 1124 |
to be passed by reference, and objects of variable size. The latter |
| 1125 |
is more efficient, avoids problems with variable size temporaries, |
| 1126 |
and does not produce compatibility problems with C, since C does |
| 1127 |
not have such objects. */ |
| 1128 |
return (TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE |
| 1129 |
|| TYPE_IS_BY_REFERENCE_P (gnu_type) |
| 1130 |
|| (TYPE_SIZE_UNIT (gnu_type) |
| 1131 |
&& TREE_CODE (TYPE_SIZE_UNIT (gnu_type)) != INTEGER_CST)); |
| 1132 |
} |
| 1133 |
|
| 1134 |
/* Return the default alignment of a FIELD of TYPE declared in a record or |
| 1135 |
union type as specified by the ABI of the target architecture. */ |
| 1136 |
|
| 1137 |
unsigned int |
| 1138 |
default_field_alignment (tree ARG_UNUSED (field), tree type) |
| 1139 |
{ |
| 1140 |
/* This is modeled on layout_decl. */ |
| 1141 |
unsigned int align = TYPE_ALIGN (type); |
| 1142 |
|
| 1143 |
#ifdef BIGGEST_FIELD_ALIGNMENT |
| 1144 |
align = MIN (align, (unsigned int) BIGGEST_FIELD_ALIGNMENT); |
| 1145 |
#endif |
| 1146 |
|
| 1147 |
#ifdef ADJUST_FIELD_ALIGN |
| 1148 |
align = ADJUST_FIELD_ALIGN (field, type, align); |
| 1149 |
#endif |
| 1150 |
|
| 1151 |
return align; |
| 1152 |
} |
| 1153 |
|
| 1154 |
/* This function is called by the front-end to enumerate all the supported |
| 1155 |
modes for the machine, as well as some predefined C types. F is a function |
| 1156 |
which is called back with the parameters as listed below, first a string, |
| 1157 |
then seven ints. The name is any arbitrary null-terminated string and has |
| 1158 |
no particular significance, except for the case of predefined C types, where |
| 1159 |
it should be the name of the C type. For integer types, only signed types |
| 1160 |
should be listed, unsigned versions are assumed. The order of types should |
| 1161 |
be in order of preference, with the smallest/cheapest types first. |
| 1162 |
|
| 1163 |
In particular, C predefined types should be listed before other types, |
| 1164 |
binary floating point types before decimal ones, and narrower/cheaper |
| 1165 |
type versions before more expensive ones. In type selection the first |
| 1166 |
matching variant will be used. |
| 1167 |
|
| 1168 |
NAME pointer to first char of type name |
| 1169 |
DIGS number of decimal digits for floating-point modes, else 0 |
| 1170 |
COMPLEX_P nonzero is this represents a complex mode |
| 1171 |
COUNT count of number of items, nonzero for vector mode |
| 1172 |
FLOAT_REP Float_Rep_Kind for FP, otherwise undefined |
| 1173 |
PRECISION number of bits used to store data |
| 1174 |
SIZE number of bits occupied by the mode |
| 1175 |
ALIGN number of bits to which mode is aligned. */ |
| 1176 |
|
| 1177 |
void |
| 1178 |
enumerate_modes (void (*f) (const char *, int, int, int, int, int, int, int)) |
| 1179 |
{ |
| 1180 |
tree const c_types[] |
| 1181 |
= { float_type_node, double_type_node, long_double_type_node }; |
| 1182 |
const char *const c_names[] |
| 1183 |
= { "float", "double", "long double" }; |
| 1184 |
int iloop; |
| 1185 |
|
| 1186 |
/* We are going to compute it below. */ |
| 1187 |
fp_arith_may_widen = false; |
| 1188 |
|
| 1189 |
for (iloop = 0; iloop < NUM_MACHINE_MODES; iloop++) |
| 1190 |
{ |
| 1191 |
machine_mode i = (machine_mode) iloop; |
| 1192 |
machine_mode inner_mode = i; |
| 1193 |
bool float_p = false; |
| 1194 |
bool complex_p = false; |
| 1195 |
bool vector_p = false; |
| 1196 |
bool skip_p = false; |
| 1197 |
int digs = 0; |
| 1198 |
unsigned int nameloop; |
| 1199 |
Float_Rep_Kind float_rep = IEEE_Binary; /* Until proven otherwise */ |
| 1200 |
|
| 1201 |
switch (GET_MODE_CLASS (i)) |
| 1202 |
{ |
| 1203 |
case MODE_INT: |
| 1204 |
break; |
| 1205 |
case MODE_FLOAT: |
| 1206 |
float_p = true; |
| 1207 |
break; |
| 1208 |
case MODE_COMPLEX_INT: |
| 1209 |
complex_p = true; |
| 1210 |
inner_mode = GET_MODE_INNER (i); |
| 1211 |
break; |
| 1212 |
case MODE_COMPLEX_FLOAT: |
| 1213 |
float_p = true; |
| 1214 |
complex_p = true; |
| 1215 |
inner_mode = GET_MODE_INNER (i); |
| 1216 |
break; |
| 1217 |
case MODE_VECTOR_INT: |
| 1218 |
vector_p = true; |
| 1219 |
inner_mode = GET_MODE_INNER (i); |
| 1220 |
break; |
| 1221 |
case MODE_VECTOR_FLOAT: |
| 1222 |
float_p = true; |
| 1223 |
vector_p = true; |
| 1224 |
inner_mode = GET_MODE_INNER (i); |
| 1225 |
break; |
| 1226 |
default: |
| 1227 |
skip_p = true; |
| 1228 |
} |
| 1229 |
|
| 1230 |
if (float_p) |
| 1231 |
{ |
| 1232 |
const struct real_format *fmt = REAL_MODE_FORMAT (inner_mode); |
| 1233 |
|
| 1234 |
/* ??? Cope with the ghost XFmode of the ARM port. */ |
| 1235 |
if (!fmt) |
| 1236 |
continue; |
| 1237 |
|
| 1238 |
/* Be conservative and consider that floating-point arithmetics may |
| 1239 |
use wider intermediate results as soon as there is an extended |
| 1240 |
Motorola or Intel mode supported by the machine. */ |
| 1241 |
if (fmt == &ieee_extended_motorola_format |
| 1242 |
|| fmt == &ieee_extended_intel_96_format |
| 1243 |
|| fmt == &ieee_extended_intel_96_round_53_format |
| 1244 |
|| fmt == &ieee_extended_intel_128_format) |
| 1245 |
{ |
| 1246 |
#ifdef TARGET_FPMATH_DEFAULT |
| 1247 |
if (TARGET_FPMATH_DEFAULT == FPMATH_387) |
| 1248 |
#endif |
| 1249 |
fp_arith_may_widen = true; |
| 1250 |
} |
| 1251 |
|
| 1252 |
if (fmt->b == 2) |
| 1253 |
digs = (fmt->p - 1) * 1233 / 4096; /* scale by log (2) */ |
| 1254 |
|
| 1255 |
else if (fmt->b == 10) |
| 1256 |
digs = fmt->p; |
| 1257 |
|
| 1258 |
else |
| 1259 |
gcc_unreachable (); |
| 1260 |
} |
| 1261 |
|
| 1262 |
/* First register any C types for this mode that the front end |
| 1263 |
may need to know about, unless the mode should be skipped. */ |
| 1264 |
if (!skip_p && !vector_p) |
| 1265 |
for (nameloop = 0; nameloop < ARRAY_SIZE (c_types); nameloop++) |
| 1266 |
{ |
| 1267 |
tree type = c_types[nameloop]; |
| 1268 |
const char *name = c_names[nameloop]; |
| 1269 |
|
| 1270 |
if (TYPE_MODE (type) == i) |
| 1271 |
{ |
| 1272 |
f (name, digs, complex_p, 0, float_rep, TYPE_PRECISION (type), |
| 1273 |
TREE_INT_CST_LOW (TYPE_SIZE (type)), TYPE_ALIGN (type)); |
| 1274 |
skip_p = true; |
| 1275 |
} |
| 1276 |
} |
| 1277 |
|
| 1278 |
/* If no predefined C types were found, register the mode itself. */ |
| 1279 |
int nunits, precision, bitsize; |
| 1280 |
if (!skip_p |
| 1281 |
&& GET_MODE_NUNITS (i).is_constant (&nunits) |
| 1282 |
&& GET_MODE_PRECISION (i).is_constant (&precision) |
| 1283 |
&& GET_MODE_BITSIZE (i).is_constant (&bitsize)) |
| 1284 |
f (GET_MODE_NAME (i), digs, complex_p, |
| 1285 |
vector_p ? nunits : 0, float_rep, |
| 1286 |
precision, bitsize, GET_MODE_ALIGNMENT (i)); |
| 1287 |
} |
| 1288 |
} |
| 1289 |
|
| 1290 |
/* Return the size of the FP mode with precision PREC. */ |
| 1291 |
|
| 1292 |
int |
| 1293 |
fp_prec_to_size (int prec) |
| 1294 |
{ |
| 1295 |
opt_scalar_float_mode opt_mode; |
| 1296 |
|
| 1297 |
FOR_EACH_MODE_IN_CLASS (opt_mode, MODE_FLOAT) |
| 1298 |
{ |
| 1299 |
scalar_float_mode mode = opt_mode.require (); |
| 1300 |
if (GET_MODE_PRECISION (mode) == prec) |
| 1301 |
return GET_MODE_BITSIZE (mode); |
| 1302 |
} |
| 1303 |
|
| 1304 |
gcc_unreachable (); |
| 1305 |
} |
| 1306 |
|
| 1307 |
/* Return the precision of the FP mode with size SIZE. */ |
| 1308 |
|
| 1309 |
int |
| 1310 |
fp_size_to_prec (int size) |
| 1311 |
{ |
| 1312 |
opt_scalar_float_mode opt_mode; |
| 1313 |
|
| 1314 |
FOR_EACH_MODE_IN_CLASS (opt_mode, MODE_FLOAT) |
| 1315 |
{ |
| 1316 |
scalar_mode mode = opt_mode.require (); |
| 1317 |
if (GET_MODE_BITSIZE (mode) == size) |
| 1318 |
return GET_MODE_PRECISION (mode); |
| 1319 |
} |
| 1320 |
|
| 1321 |
gcc_unreachable (); |
| 1322 |
} |
| 1323 |
|
| 1324 |
static GTY(()) tree gnat_eh_personality_decl; |
| 1325 |
|
| 1326 |
/* Return the GNAT personality function decl. */ |
| 1327 |
|
| 1328 |
static tree |
| 1329 |
gnat_eh_personality (void) |
| 1330 |
{ |
| 1331 |
if (!gnat_eh_personality_decl) |
| 1332 |
gnat_eh_personality_decl = build_personality_function ("gnat"); |
| 1333 |
return gnat_eh_personality_decl; |
| 1334 |
} |
| 1335 |
|
| 1336 |
/* Get a value for the SARIF v2.1.0 "artifact.sourceLanguage" property, |
| 1337 |
based on the list in SARIF v2.1.0 Appendix J. */ |
| 1338 |
|
| 1339 |
static const char * |
| 1340 |
gnat_get_sarif_source_language (const char *) |
| 1341 |
{ |
| 1342 |
return "ada"; |
| 1343 |
} |
| 1344 |
|
| 1345 |
/* Initialize language-specific bits of tree_contains_struct. */ |
| 1346 |
|
| 1347 |
static void |
| 1348 |
gnat_init_ts (void) |
| 1349 |
{ |
| 1350 |
MARK_TS_COMMON (UNCONSTRAINED_ARRAY_TYPE); |
| 1351 |
|
| 1352 |
MARK_TS_TYPED (UNCONSTRAINED_ARRAY_REF); |
| 1353 |
MARK_TS_TYPED (LOAD_EXPR); |
| 1354 |
MARK_TS_TYPED (NULL_EXPR); |
| 1355 |
MARK_TS_TYPED (PLUS_NOMOD_EXPR); |
| 1356 |
MARK_TS_TYPED (MINUS_NOMOD_EXPR); |
| 1357 |
MARK_TS_TYPED (POWER_EXPR); |
| 1358 |
MARK_TS_TYPED (ATTR_ADDR_EXPR); |
| 1359 |
MARK_TS_TYPED (STMT_STMT); |
| 1360 |
MARK_TS_TYPED (LOOP_STMT); |
| 1361 |
MARK_TS_TYPED (EXIT_STMT); |
| 1362 |
} |
| 1363 |
|
| 1364 |
/* Return the size of a tree with CODE, which is a language-specific tree code |
| 1365 |
in category tcc_constant, tcc_exceptional or tcc_type. The default expects |
| 1366 |
never to be called. */ |
| 1367 |
|
| 1368 |
static size_t |
| 1369 |
gnat_tree_size (enum tree_code code) |
| 1370 |
{ |
| 1371 |
gcc_checking_assert (code >= NUM_TREE_CODES); |
| 1372 |
switch (code) |
| 1373 |
{ |
| 1374 |
case UNCONSTRAINED_ARRAY_TYPE: |
| 1375 |
return sizeof (tree_type_non_common); |
| 1376 |
default: |
| 1377 |
gcc_unreachable (); |
| 1378 |
} |
| 1379 |
} |
| 1380 |
|
| 1381 |
/* Return the lang specific structure attached to NODE. Allocate it (cleared) |
| 1382 |
if needed. */ |
| 1383 |
|
| 1384 |
struct lang_type * |
| 1385 |
get_lang_specific (tree node) |
| 1386 |
{ |
| 1387 |
if (!TYPE_LANG_SPECIFIC (node)) |
| 1388 |
TYPE_LANG_SPECIFIC (node) = ggc_cleared_alloc<struct lang_type> (); |
| 1389 |
return TYPE_LANG_SPECIFIC (node); |
| 1390 |
} |
| 1391 |
|
| 1392 |
const struct scoped_attribute_specs *const gnat_attribute_table[] = |
| 1393 |
{ |
| 1394 |
&gnat_internal_attribute_table |
| 1395 |
}; |
| 1396 |
|
| 1397 |
/* Definitions for our language-specific hooks. */ |
| 1398 |
|
| 1399 |
#undef LANG_HOOKS_NAME |
| 1400 |
#define LANG_HOOKS_NAME "GNU Ada" |
| 1401 |
#undef LANG_HOOKS_IDENTIFIER_SIZE |
| 1402 |
#define LANG_HOOKS_IDENTIFIER_SIZE sizeof (struct tree_identifier) |
| 1403 |
#undef LANG_HOOKS_TREE_SIZE |
| 1404 |
#define LANG_HOOKS_TREE_SIZE gnat_tree_size |
| 1405 |
#undef LANG_HOOKS_INIT |
| 1406 |
#define LANG_HOOKS_INIT gnat_init |
| 1407 |
#undef LANG_HOOKS_OPTION_LANG_MASK |
| 1408 |
#define LANG_HOOKS_OPTION_LANG_MASK gnat_option_lang_mask |
| 1409 |
#undef LANG_HOOKS_INIT_OPTIONS_STRUCT |
| 1410 |
#define LANG_HOOKS_INIT_OPTIONS_STRUCT gnat_init_options_struct |
| 1411 |
#undef LANG_HOOKS_INIT_OPTIONS |
| 1412 |
#define LANG_HOOKS_INIT_OPTIONS gnat_init_options |
| 1413 |
#undef LANG_HOOKS_HANDLE_OPTION |
| 1414 |
#define LANG_HOOKS_HANDLE_OPTION gnat_handle_option |
| 1415 |
#undef LANG_HOOKS_POST_OPTIONS |
| 1416 |
#define LANG_HOOKS_POST_OPTIONS gnat_post_options |
| 1417 |
#undef LANG_HOOKS_PARSE_FILE |
| 1418 |
#define LANG_HOOKS_PARSE_FILE gnat_parse_file |
| 1419 |
#undef LANG_HOOKS_TYPE_HASH_EQ |
| 1420 |
#define LANG_HOOKS_TYPE_HASH_EQ gnat_type_hash_eq |
| 1421 |
#undef LANG_HOOKS_GETDECLS |
| 1422 |
#define LANG_HOOKS_GETDECLS hook_tree_void_null |
| 1423 |
#undef LANG_HOOKS_PUSHDECL |
| 1424 |
#define LANG_HOOKS_PUSHDECL gnat_return_tree |
| 1425 |
#undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL |
| 1426 |
#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL hook_bool_const_tree_false |
| 1427 |
#undef LANG_HOOKS_GET_ALIAS_SET |
| 1428 |
#define LANG_HOOKS_GET_ALIAS_SET gnat_get_alias_set |
| 1429 |
#undef LANG_HOOKS_PRINT_DECL |
| 1430 |
#define LANG_HOOKS_PRINT_DECL gnat_print_decl |
| 1431 |
#undef LANG_HOOKS_PRINT_TYPE |
| 1432 |
#define LANG_HOOKS_PRINT_TYPE gnat_print_type |
| 1433 |
#undef LANG_HOOKS_TYPE_MAX_SIZE |
| 1434 |
#define LANG_HOOKS_TYPE_MAX_SIZE gnat_type_max_size |
| 1435 |
#undef LANG_HOOKS_DECL_PRINTABLE_NAME |
| 1436 |
#define LANG_HOOKS_DECL_PRINTABLE_NAME gnat_printable_name |
| 1437 |
#undef LANG_HOOKS_DWARF_NAME |
| 1438 |
#define LANG_HOOKS_DWARF_NAME gnat_dwarf_name |
| 1439 |
#undef LANG_HOOKS_GIMPLIFY_EXPR |
| 1440 |
#define LANG_HOOKS_GIMPLIFY_EXPR gnat_gimplify_expr |
| 1441 |
#undef LANG_HOOKS_TYPE_FOR_MODE |
| 1442 |
#define LANG_HOOKS_TYPE_FOR_MODE gnat_type_for_mode |
| 1443 |
#undef LANG_HOOKS_TYPE_FOR_SIZE |
| 1444 |
#define LANG_HOOKS_TYPE_FOR_SIZE gnat_type_for_size |
| 1445 |
#undef LANG_HOOKS_TYPES_COMPATIBLE_P |
| 1446 |
#define LANG_HOOKS_TYPES_COMPATIBLE_P gnat_types_compatible_p |
| 1447 |
#undef LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING |
| 1448 |
#define LANG_HOOKS_UNIT_SIZE_WITHOUT_REUSABLE_PADDING gnat_unit_size_without_reusable_padding |
| 1449 |
#undef LANG_HOOKS_GET_ARRAY_DESCR_INFO |
| 1450 |
#define LANG_HOOKS_GET_ARRAY_DESCR_INFO gnat_get_array_descr_info |
| 1451 |
#undef LANG_HOOKS_GET_SUBRANGE_BOUNDS |
| 1452 |
#define LANG_HOOKS_GET_SUBRANGE_BOUNDS gnat_get_subrange_bounds |
| 1453 |
#undef LANG_HOOKS_GET_TYPE_BIAS |
| 1454 |
#define LANG_HOOKS_GET_TYPE_BIAS gnat_get_type_bias |
| 1455 |
#undef LANG_HOOKS_DESCRIPTIVE_TYPE |
| 1456 |
#define LANG_HOOKS_DESCRIPTIVE_TYPE gnat_descriptive_type |
| 1457 |
#undef LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE |
| 1458 |
#define LANG_HOOKS_ENUM_UNDERLYING_BASE_TYPE gnat_enum_underlying_base_type |
| 1459 |
#undef LANG_HOOKS_GET_DEBUG_TYPE |
| 1460 |
#define LANG_HOOKS_GET_DEBUG_TYPE gnat_get_debug_type |
| 1461 |
#undef LANG_HOOKS_GET_FIXED_POINT_TYPE_INFO |
| 1462 |
#define LANG_HOOKS_GET_FIXED_POINT_TYPE_INFO gnat_get_fixed_point_type_info |
| 1463 |
#undef LANG_HOOKS_ATTRIBUTE_TABLE |
| 1464 |
#define LANG_HOOKS_ATTRIBUTE_TABLE gnat_attribute_table |
| 1465 |
#undef LANG_HOOKS_BUILTIN_FUNCTION |
| 1466 |
#define LANG_HOOKS_BUILTIN_FUNCTION gnat_builtin_function |
| 1467 |
#undef LANG_HOOKS_INIT_TS |
| 1468 |
#define LANG_HOOKS_INIT_TS gnat_init_ts |
| 1469 |
#undef LANG_HOOKS_EH_PERSONALITY |
| 1470 |
#define LANG_HOOKS_EH_PERSONALITY gnat_eh_personality |
| 1471 |
#undef LANG_HOOKS_DEEP_UNSHARING |
| 1472 |
#define LANG_HOOKS_DEEP_UNSHARING true |
| 1473 |
#undef LANG_HOOKS_CUSTOM_FUNCTION_DESCRIPTORS |
| 1474 |
#define LANG_HOOKS_CUSTOM_FUNCTION_DESCRIPTORS true |
| 1475 |
#undef LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE |
| 1476 |
#define LANG_HOOKS_GET_SARIF_SOURCE_LANGUAGE gnat_get_sarif_source_language |
| 1477 |
|
| 1478 |
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; |
| 1479 |
|
| 1480 |
#include "gt-ada-misc.h" |