[Ada] Wrong accessibility level under -gnat12
[official-gcc.git] / gcc / hooks.c
blobf95659b3807949c615f15ba36b7a1d55e49daa5e
1 /* General-purpose hooks.
2 Copyright (C) 2002-2019 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 3, or (at your option) any
7 later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING3. If not see
16 <http://www.gnu.org/licenses/>.
18 In other words, you are welcome to use, share and improve this program.
19 You are forbidden to forbid anyone else to use, share and improve
20 what you give them. Help stamp out software-hoarding! */
22 /* This file contains generic hooks that can be used as defaults for
23 target or language-dependent hook initializers. */
25 #include "config.h"
26 #include "system.h"
27 #include "coretypes.h"
28 #include "tm.h"
29 #include "hooks.h"
31 /* Generic hook that does absolutely zappo. */
32 void
33 hook_void_void (void)
37 /* Generic hook that takes no arguments and returns false. */
38 bool
39 hook_bool_void_false (void)
41 return false;
44 /* Generic hook that takes no arguments and returns true. */
45 bool
46 hook_bool_void_true (void)
48 return true;
51 /* Generic hook that takes (bool) and returns false. */
52 bool
53 hook_bool_bool_false (bool)
55 return false;
58 /* Generic hook that takes (bool, struct gcc_options *) and returns false. */
59 bool
60 hook_bool_bool_gcc_optionsp_false (bool, struct gcc_options *)
62 return false;
65 /* Generic hook that takes const int, const int) and returns true. */
66 bool hook_bool_const_int_const_int_true (const int, const int)
68 return true;
71 /* Generic hook that takes (machine_mode) and returns false. */
72 bool
73 hook_bool_mode_false (machine_mode)
75 return false;
78 /* Generic hook that takes (machine_mode) and returns true. */
79 bool
80 hook_bool_mode_true (machine_mode)
82 return true;
85 /* Generic hook that takes (machine_mode, machine_mode) and returns true. */
86 bool
87 hook_bool_mode_mode_true (machine_mode, machine_mode)
89 return true;
92 /* Generic hook that takes (machine_mode, const_rtx) and returns false. */
93 bool
94 hook_bool_mode_const_rtx_false (machine_mode, const_rtx)
96 return false;
99 /* Generic hook that takes (machine_mode, const_rtx) and returns true. */
100 bool
101 hook_bool_mode_const_rtx_true (machine_mode, const_rtx)
103 return true;
106 /* Generic hook that takes (machine_mode, rtx) and returns false. */
107 bool
108 hook_bool_mode_rtx_false (machine_mode, rtx)
110 return false;
113 /* Generic hook that takes (machine_mode, rtx) and returns true. */
114 bool
115 hook_bool_mode_rtx_true (machine_mode, rtx)
117 return true;
120 /* Generic hook that takes (const rtx_insn *, const rtx_insn *) and returns true. */
121 bool
122 hook_bool_const_rtx_insn_const_rtx_insn_true (const rtx_insn *,
123 const rtx_insn *)
125 return true;
128 /* Generic hook that takes (machine_mode, unsigned HOST_WIDE_INT)
129 and returns false. */
130 bool
131 hook_bool_mode_uhwi_false (machine_mode, unsigned HOST_WIDE_INT)
133 return false;
136 /* Generic hook that takes (poly_uint64, poly_uint64) and returns true. */
137 bool
138 hook_bool_puint64_puint64_true (poly_uint64, poly_uint64)
140 return true;
143 /* Generic hook that takes (unsigned int, machine_mode) and returns false. */
144 bool
145 hook_bool_insn_uint_mode_false (rtx_insn *, unsigned int, machine_mode)
147 return false;
150 /* Generic hook that takes (unsigned int, machine_mode) and returns true. */
151 bool
152 hook_bool_uint_mode_true (unsigned int, machine_mode)
154 return true;
157 /* Generic hook that takes (FILE *, const char *) and does nothing. */
158 void
159 hook_void_FILEptr_constcharptr (FILE *, const char *)
163 /* Generic hook that takes (FILE *, const char *, constr_tree *) and does
164 nothing. */
165 void
166 hook_void_FILEptr_constcharptr_const_tree (FILE *, const char *, const_tree)
170 /* Generic hook that takes (FILE *, rtx) and returns false. */
171 bool
172 hook_bool_FILEptr_rtx_false (FILE *, rtx)
174 return false;
177 /* Generic hook that takes (gimple_stmt_iterator *) and returns
178 false. */
179 bool
180 hook_bool_gsiptr_false (gimple_stmt_iterator *)
182 return false;
185 /* Used for the TARGET_ASM_CAN_OUTPUT_MI_THUNK hook. */
186 bool
187 hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree, HOST_WIDE_INT,
188 HOST_WIDE_INT, const_tree)
190 return false;
193 bool
194 hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree, HOST_WIDE_INT,
195 HOST_WIDE_INT, const_tree)
197 return true;
200 bool
201 default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT,
202 HOST_WIDE_INT c, const_tree)
204 return c == 0;
208 hook_int_uint_mode_1 (unsigned int, machine_mode)
210 return 1;
214 hook_int_const_tree_0 (const_tree)
216 return 0;
219 /* ??? Used for comp_type_attributes, which ought to return bool. */
221 hook_int_const_tree_const_tree_1 (const_tree, const_tree)
223 return 1;
227 hook_int_rtx_0 (rtx)
229 return 0;
233 hook_int_rtx_1 (rtx)
235 return 1;
239 hook_int_rtx_insn_0 (rtx_insn *)
241 return 0;
245 hook_int_rtx_insn_unreachable (rtx_insn *)
247 gcc_unreachable ();
251 hook_int_rtx_bool_0 (rtx, bool)
253 return 0;
257 hook_int_rtx_mode_as_bool_0 (rtx, machine_mode, addr_space_t, bool)
259 return 0;
262 unsigned int
263 hook_uint_void_0 (void)
265 return 0;
268 HOST_WIDE_INT
269 hook_hwi_void_0 (void)
271 return 0;
274 void
275 hook_void_tree (tree)
279 void
280 hook_void_FILEptr_tree (FILE *, tree)
284 void
285 hook_void_rtx_tree (rtx, tree)
289 void
290 hook_void_constcharptr (const char *)
294 void
295 hook_void_tree_treeptr (tree, tree *)
299 void
300 hook_void_int_int (int, int)
304 bool
305 hook_bool_tree_false (tree)
307 return false;
310 bool
311 hook_bool_const_tree_false (const_tree)
313 return false;
316 bool
317 hook_bool_tree_true (tree)
319 return true;
322 bool
323 hook_bool_const_tree_true (const_tree)
325 return true;
328 bool
329 hook_bool_tree_tree_false (tree, tree)
331 return false;
334 bool
335 hook_bool_tree_tree_true (tree, tree)
337 return true;
340 bool
341 hook_bool_tree_bool_false (tree, bool)
343 return false;
346 bool
347 hook_bool_rtx_insn_true (rtx_insn *)
349 return true;
352 bool
353 hook_bool_rtx_false (rtx)
355 return false;
358 bool
359 hook_bool_uintp_uintp_false (unsigned int *, unsigned int *)
361 return false;
364 bool
365 hook_bool_rtx_mode_int_int_intp_bool_false (rtx, machine_mode, int, int,
366 int *, bool)
368 return false;
371 bool
372 hook_bool_wint_wint_uint_bool_true (const widest_int &, const widest_int &,
373 unsigned int, bool)
375 return true;
378 /* Generic hook that takes an rtx and returns it. */
380 hook_rtx_rtx_identity (rtx x)
382 return x;
385 /* Generic hook that takes an rtx and returns NULL_RTX. */
387 hook_rtx_rtx_null (rtx)
389 return NULL;
392 /* Generic hook that takes a tree and an int and returns NULL_RTX. */
394 hook_rtx_tree_int_null (tree, int)
396 return NULL;
399 /* Generic hook that takes a machine mode and returns an unsigned int 0. */
400 unsigned int
401 hook_uint_mode_0 (machine_mode)
403 return 0;
406 /* Generic hook that takes no arguments and returns a NULL const string. */
407 const char *
408 hook_constcharptr_void_null (void)
410 return NULL;
413 /* Generic hook that takes no arguments and returns a NULL string. */
414 char *
415 hook_charptr_void_null (void)
417 return NULL;
420 /* Generic hook that takes a tree and returns a NULL string. */
421 const char *
422 hook_constcharptr_const_tree_null (const_tree)
424 return NULL;
427 tree
428 hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool)
430 return NULL;
433 tree
434 hook_tree_tree_tree_null (tree, tree)
436 return NULL;
439 tree
440 hook_tree_tree_tree_tree_null (tree, tree, tree)
442 return NULL;
445 /* Generic hook that takes an rtx_insn *and returns a NULL string. */
446 const char *
447 hook_constcharptr_const_rtx_insn_null (const rtx_insn *)
449 return NULL;
452 const char *
453 hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree)
455 return NULL;
458 const char *
459 hook_constcharptr_int_const_tree_null (int, const_tree)
461 return NULL;
464 const char *
465 hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree)
467 return NULL;
470 /* Generic hook that takes a const_tree and returns NULL_TREE. */
471 tree
472 hook_tree_const_tree_null (const_tree)
474 return NULL;
477 /* Generic hook that takes no arguments and returns a NULL_TREE. */
478 tree
479 hook_tree_void_null (void)
481 return NULL;
484 /* Generic hook that takes a rtx_insn * and an int and returns a bool. */
486 bool
487 hook_bool_rtx_insn_int_false (rtx_insn *, int)
489 return false;
492 /* Generic hook that takes a rtx_insn * and an int and returns void. */
494 void
495 hook_void_rtx_insn_int (rtx_insn *, int)
499 /* Generic hook that takes a struct gcc_options * and returns void. */
501 void
502 hook_void_gcc_optionsp (struct gcc_options *)
506 /* Generic hook that takes an unsigned int, an unsigned int pointer and
507 returns false. */
509 bool
510 hook_bool_uint_uintp_false (unsigned int, unsigned int *)
512 return false;
515 /* Generic hook that takes a register class and returns false. */
516 bool
517 hook_bool_reg_class_t_false (reg_class_t regclass ATTRIBUTE_UNUSED)
519 return false;
522 /* Generic hook that takes 2 machine_modes and a register class and
523 returns true. */
524 bool
525 hook_bool_mode_mode_reg_class_t_true (machine_mode, machine_mode, reg_class_t)
527 return true;
530 /* Generic hook that takes a machine_mode and 2 register classes
531 and returns false. */
532 bool
533 hook_bool_mode_reg_class_t_reg_class_t_false (machine_mode, reg_class_t,
534 reg_class_t)
536 return false;
539 /* Generic hook that takes a mode and an unsigned HOST_WIDE_INT and
540 returns no mode. */
542 opt_machine_mode
543 hook_optmode_mode_uhwi_none (machine_mode, unsigned HOST_WIDE_INT)
545 return opt_machine_mode ();