* parser.c (cp_parser_direct_declarator): Reorder if to avoid
[official-gcc.git] / gcc / hooks.c
blobf4591dc585c978a08b70bae080d85b909108fa95
1 /* General-purpose hooks.
2 Copyright (C) 2002-2017 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, const_rtx) and returns false. */
86 bool
87 hook_bool_mode_const_rtx_false (machine_mode, const_rtx)
89 return false;
92 /* Generic hook that takes (machine_mode, const_rtx) and returns true. */
93 bool
94 hook_bool_mode_const_rtx_true (machine_mode, const_rtx)
96 return true;
99 /* Generic hook that takes (machine_mode, rtx) and returns false. */
100 bool
101 hook_bool_mode_rtx_false (machine_mode, rtx)
103 return false;
106 /* Generic hook that takes (machine_mode, rtx) and returns true. */
107 bool
108 hook_bool_mode_rtx_true (machine_mode, rtx)
110 return true;
113 /* Generic hook that takes (const rtx_insn *, const rtx_insn *) and returns true. */
114 bool
115 hook_bool_const_rtx_insn_const_rtx_insn_true (const rtx_insn *,
116 const rtx_insn *)
118 return true;
121 /* Generic hook that takes (machine_mode, unsigned HOST_WIDE_INT)
122 and returns false. */
123 bool
124 hook_bool_mode_uhwi_false (machine_mode, unsigned HOST_WIDE_INT)
126 return false;
129 /* Generic hook that takes (FILE *, const char *) and does nothing. */
130 void
131 hook_void_FILEptr_constcharptr (FILE *, const char *)
135 /* Generic hook that takes (FILE *, const char *, constr_tree *) and does
136 nothing. */
137 void
138 hook_void_FILEptr_constcharptr_const_tree (FILE *, const char *, const_tree)
142 /* Generic hook that takes (FILE *, rtx) and returns false. */
143 bool
144 hook_bool_FILEptr_rtx_false (FILE *, rtx)
146 return false;
149 /* Generic hook that takes (gimple_stmt_iterator *) and returns
150 false. */
151 bool
152 hook_bool_gsiptr_false (gimple_stmt_iterator *)
154 return false;
157 /* Used for the TARGET_ASM_CAN_OUTPUT_MI_THUNK hook. */
158 bool
159 hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree, HOST_WIDE_INT,
160 HOST_WIDE_INT, const_tree)
162 return false;
165 bool
166 hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree, HOST_WIDE_INT,
167 HOST_WIDE_INT, const_tree)
169 return true;
172 bool
173 default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT,
174 HOST_WIDE_INT c, const_tree)
176 return c == 0;
180 hook_int_uint_mode_1 (unsigned int, machine_mode)
182 return 1;
186 hook_int_const_tree_0 (const_tree)
188 return 0;
191 /* ??? Used for comp_type_attributes, which ought to return bool. */
193 hook_int_const_tree_const_tree_1 (const_tree, const_tree)
195 return 1;
199 hook_int_rtx_0 (rtx)
201 return 0;
205 hook_int_rtx_1 (rtx)
207 return 1;
211 hook_int_rtx_insn_unreachable (rtx_insn *)
213 gcc_unreachable ();
217 hook_int_rtx_bool_0 (rtx, bool)
219 return 0;
223 hook_int_rtx_mode_as_bool_0 (rtx, machine_mode, addr_space_t, bool)
225 return 0;
228 unsigned int
229 hook_uint_void_0 (void)
231 return 0;
234 void
235 hook_void_tree (tree)
239 void
240 hook_void_rtx_tree (rtx, tree)
244 void
245 hook_void_constcharptr (const char *)
249 void
250 hook_void_tree_treeptr (tree, tree *)
254 void
255 hook_void_int_int (int, int)
259 bool
260 hook_bool_tree_false (tree)
262 return false;
265 bool
266 hook_bool_const_tree_false (const_tree)
268 return false;
271 bool
272 hook_bool_tree_true (tree)
274 return true;
277 bool
278 hook_bool_const_tree_true (const_tree)
280 return true;
283 bool
284 hook_bool_tree_tree_false (tree, tree)
286 return false;
289 bool
290 hook_bool_tree_tree_true (tree, tree)
292 return true;
295 bool
296 hook_bool_tree_bool_false (tree, bool)
298 return false;
301 bool
302 hook_bool_rtx_insn_true (rtx_insn *)
304 return true;
307 bool
308 hook_bool_rtx_false (rtx)
310 return false;
313 bool
314 hook_bool_uintp_uintp_false (unsigned int *, unsigned int *)
316 return false;
319 bool
320 hook_bool_rtx_mode_int_int_intp_bool_false (rtx, machine_mode, int, int,
321 int *, bool)
323 return false;
326 bool
327 hook_bool_wint_wint_uint_bool_true (const widest_int &, const widest_int &,
328 unsigned int, bool)
330 return true;
333 /* Generic hook that takes an rtx and returns it. */
335 hook_rtx_rtx_identity (rtx x)
337 return x;
340 /* Generic hook that takes an rtx and returns NULL_RTX. */
342 hook_rtx_rtx_null (rtx)
344 return NULL;
347 /* Generic hook that takes a tree and an int and returns NULL_RTX. */
349 hook_rtx_tree_int_null (tree, int)
351 return NULL;
354 /* Generic hook that takes a machine mode and returns an unsigned int 0. */
355 unsigned int
356 hook_uint_mode_0 (machine_mode)
358 return 0;
361 /* Generic hook that takes no arguments and returns a NULL const string. */
362 const char *
363 hook_constcharptr_void_null (void)
365 return NULL;
368 /* Generic hook that takes no arguments and returns a NULL string. */
369 char *
370 hook_charptr_void_null (void)
372 return NULL;
375 /* Generic hook that takes a tree and returns a NULL string. */
376 const char *
377 hook_constcharptr_const_tree_null (const_tree)
379 return NULL;
382 tree
383 hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool)
385 return NULL;
388 tree
389 hook_tree_tree_tree_null (tree, tree)
391 return NULL;
394 tree
395 hook_tree_tree_tree_tree_null (tree, tree, tree)
397 return NULL;
400 /* Generic hook that takes an rtx_insn *and returns a NULL string. */
401 const char *
402 hook_constcharptr_const_rtx_insn_null (const rtx_insn *)
404 return NULL;
407 const char *
408 hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree)
410 return NULL;
413 const char *
414 hook_constcharptr_int_const_tree_null (int, const_tree)
416 return NULL;
419 const char *
420 hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree)
422 return NULL;
425 /* Generic hook that takes a const_tree and returns NULL_TREE. */
426 tree
427 hook_tree_const_tree_null (const_tree)
429 return NULL;
432 /* Generic hook that takes no arguments and returns a NULL_TREE. */
433 tree
434 hook_tree_void_null (void)
436 return NULL;
439 /* Generic hook that takes a rtx_insn * and an int and returns a bool. */
441 bool
442 hook_bool_rtx_insn_int_false (rtx_insn *, int)
444 return false;
447 /* Generic hook that takes a rtx_insn * and an int and returns void. */
449 void
450 hook_void_rtx_insn_int (rtx_insn *, int)
454 /* Generic hook that takes a struct gcc_options * and returns void. */
456 void
457 hook_void_gcc_optionsp (struct gcc_options *)
461 /* Generic hook that takes an unsigned int, an unsigned int pointer and
462 returns false. */
464 bool
465 hook_bool_uint_uintp_false (unsigned int, unsigned int *)
467 return false;
470 /* Generic hook that takes a register class and returns false. */
471 bool
472 hook_bool_reg_class_t_false (reg_class_t regclass ATTRIBUTE_UNUSED)
474 return false;