Use hard_regno_nregs instead of HARD_REGNO_NREGS
[official-gcc.git] / gcc / hooks.c
blob65b9fe5ce50a91f86da2f9f0bd933b1a7008cb08
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, 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 (unsigned int, machine_mode) and returns false. */
137 bool
138 hook_bool_uint_mode_false (unsigned int, machine_mode)
140 return false;
143 /* Generic hook that takes (unsigned int, machine_mode) and returns true. */
144 bool
145 hook_bool_uint_mode_true (unsigned int, machine_mode)
147 return true;
150 /* Generic hook that takes (FILE *, const char *) and does nothing. */
151 void
152 hook_void_FILEptr_constcharptr (FILE *, const char *)
156 /* Generic hook that takes (FILE *, const char *, constr_tree *) and does
157 nothing. */
158 void
159 hook_void_FILEptr_constcharptr_const_tree (FILE *, const char *, const_tree)
163 /* Generic hook that takes (FILE *, rtx) and returns false. */
164 bool
165 hook_bool_FILEptr_rtx_false (FILE *, rtx)
167 return false;
170 /* Generic hook that takes (gimple_stmt_iterator *) and returns
171 false. */
172 bool
173 hook_bool_gsiptr_false (gimple_stmt_iterator *)
175 return false;
178 /* Used for the TARGET_ASM_CAN_OUTPUT_MI_THUNK hook. */
179 bool
180 hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree, HOST_WIDE_INT,
181 HOST_WIDE_INT, const_tree)
183 return false;
186 bool
187 hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree, HOST_WIDE_INT,
188 HOST_WIDE_INT, const_tree)
190 return true;
193 bool
194 default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT,
195 HOST_WIDE_INT c, const_tree)
197 return c == 0;
201 hook_int_uint_mode_1 (unsigned int, machine_mode)
203 return 1;
207 hook_int_const_tree_0 (const_tree)
209 return 0;
212 /* ??? Used for comp_type_attributes, which ought to return bool. */
214 hook_int_const_tree_const_tree_1 (const_tree, const_tree)
216 return 1;
220 hook_int_rtx_0 (rtx)
222 return 0;
226 hook_int_rtx_1 (rtx)
228 return 1;
232 hook_int_rtx_insn_unreachable (rtx_insn *)
234 gcc_unreachable ();
238 hook_int_rtx_bool_0 (rtx, bool)
240 return 0;
244 hook_int_rtx_mode_as_bool_0 (rtx, machine_mode, addr_space_t, bool)
246 return 0;
249 unsigned int
250 hook_uint_void_0 (void)
252 return 0;
255 void
256 hook_void_tree (tree)
260 void
261 hook_void_rtx_tree (rtx, tree)
265 void
266 hook_void_constcharptr (const char *)
270 void
271 hook_void_tree_treeptr (tree, tree *)
275 void
276 hook_void_int_int (int, int)
280 bool
281 hook_bool_tree_false (tree)
283 return false;
286 bool
287 hook_bool_const_tree_false (const_tree)
289 return false;
292 bool
293 hook_bool_tree_true (tree)
295 return true;
298 bool
299 hook_bool_const_tree_true (const_tree)
301 return true;
304 bool
305 hook_bool_tree_tree_false (tree, tree)
307 return false;
310 bool
311 hook_bool_tree_tree_true (tree, tree)
313 return true;
316 bool
317 hook_bool_tree_bool_false (tree, bool)
319 return false;
322 bool
323 hook_bool_rtx_insn_true (rtx_insn *)
325 return true;
328 bool
329 hook_bool_rtx_false (rtx)
331 return false;
334 bool
335 hook_bool_uintp_uintp_false (unsigned int *, unsigned int *)
337 return false;
340 bool
341 hook_bool_rtx_mode_int_int_intp_bool_false (rtx, machine_mode, int, int,
342 int *, bool)
344 return false;
347 bool
348 hook_bool_wint_wint_uint_bool_true (const widest_int &, const widest_int &,
349 unsigned int, bool)
351 return true;
354 /* Generic hook that takes an rtx and returns it. */
356 hook_rtx_rtx_identity (rtx x)
358 return x;
361 /* Generic hook that takes an rtx and returns NULL_RTX. */
363 hook_rtx_rtx_null (rtx)
365 return NULL;
368 /* Generic hook that takes a tree and an int and returns NULL_RTX. */
370 hook_rtx_tree_int_null (tree, int)
372 return NULL;
375 /* Generic hook that takes a machine mode and returns an unsigned int 0. */
376 unsigned int
377 hook_uint_mode_0 (machine_mode)
379 return 0;
382 /* Generic hook that takes no arguments and returns a NULL const string. */
383 const char *
384 hook_constcharptr_void_null (void)
386 return NULL;
389 /* Generic hook that takes no arguments and returns a NULL string. */
390 char *
391 hook_charptr_void_null (void)
393 return NULL;
396 /* Generic hook that takes a tree and returns a NULL string. */
397 const char *
398 hook_constcharptr_const_tree_null (const_tree)
400 return NULL;
403 tree
404 hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool)
406 return NULL;
409 tree
410 hook_tree_tree_tree_null (tree, tree)
412 return NULL;
415 tree
416 hook_tree_tree_tree_tree_null (tree, tree, tree)
418 return NULL;
421 /* Generic hook that takes an rtx_insn *and returns a NULL string. */
422 const char *
423 hook_constcharptr_const_rtx_insn_null (const rtx_insn *)
425 return NULL;
428 const char *
429 hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree)
431 return NULL;
434 const char *
435 hook_constcharptr_int_const_tree_null (int, const_tree)
437 return NULL;
440 const char *
441 hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree)
443 return NULL;
446 /* Generic hook that takes a const_tree and returns NULL_TREE. */
447 tree
448 hook_tree_const_tree_null (const_tree)
450 return NULL;
453 /* Generic hook that takes no arguments and returns a NULL_TREE. */
454 tree
455 hook_tree_void_null (void)
457 return NULL;
460 /* Generic hook that takes a rtx_insn * and an int and returns a bool. */
462 bool
463 hook_bool_rtx_insn_int_false (rtx_insn *, int)
465 return false;
468 /* Generic hook that takes a rtx_insn * and an int and returns void. */
470 void
471 hook_void_rtx_insn_int (rtx_insn *, int)
475 /* Generic hook that takes a struct gcc_options * and returns void. */
477 void
478 hook_void_gcc_optionsp (struct gcc_options *)
482 /* Generic hook that takes an unsigned int, an unsigned int pointer and
483 returns false. */
485 bool
486 hook_bool_uint_uintp_false (unsigned int, unsigned int *)
488 return false;
491 /* Generic hook that takes a register class and returns false. */
492 bool
493 hook_bool_reg_class_t_false (reg_class_t regclass ATTRIBUTE_UNUSED)
495 return false;