Branch data Line data Source code
1 : : /* General-purpose hooks.
2 : : Copyright (C) 2002-2025 Free Software Foundation, Inc.
3 : :
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.
8 : :
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.
13 : :
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/>.
17 : :
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! */
21 : :
22 : : /* This file contains generic hooks that can be used as defaults for
23 : : target or language-dependent hook initializers. */
24 : :
25 : : #include "config.h"
26 : : #include "system.h"
27 : : #include "coretypes.h"
28 : : #include "tm.h"
29 : : #include "hooks.h"
30 : :
31 : : /* Generic hook that does absolutely zappo. */
32 : : void
33 : 5268593 : hook_void_void (void)
34 : : {
35 : 5268593 : }
36 : :
37 : : /* Generic hook that takes no arguments and returns false. */
38 : : bool
39 : 565614541 : hook_bool_void_false (void)
40 : : {
41 : 565614541 : return false;
42 : : }
43 : :
44 : : /* Generic hook that takes no arguments and returns true. */
45 : : bool
46 : 135071290 : hook_bool_void_true (void)
47 : : {
48 : 135071290 : return true;
49 : : }
50 : :
51 : : /* Generic hook that takes (bool) and returns false. */
52 : : bool
53 : 0 : hook_bool_bool_false (bool)
54 : : {
55 : 0 : return false;
56 : : }
57 : :
58 : : /* Generic hook that takes (bool, struct gcc_options *) and returns false. */
59 : : bool
60 : 0 : hook_bool_bool_gcc_optionsp_false (bool, struct gcc_options *)
61 : : {
62 : 0 : return false;
63 : : }
64 : :
65 : : /* Generic hook that takes (dwarf_call_frame_info, dw_cfi_oprnd_type &) and
66 : : return false. */
67 : 0 : bool hook_bool_dwcfi_dwcfioprndtyperef_false (dwarf_call_frame_info,
68 : : dw_cfi_oprnd_type &)
69 : : {
70 : 0 : return false;
71 : : }
72 : :
73 : : /* Generic hook that takes (FILE *, dw_cfi_ref) and return false. */
74 : 0 : bool hook_bool_FILEptr_dwcfiptr_false (FILE *, dw_cfi_ref)
75 : : {
76 : 0 : return false;
77 : : }
78 : :
79 : : /* Generic hook that takes const int, const int) and returns true. */
80 : 0 : bool hook_bool_const_int_const_int_true (const int, const int)
81 : : {
82 : 0 : return true;
83 : : }
84 : :
85 : : /* Generic hook that takes (machine_mode) and returns false. */
86 : : bool
87 : 0 : hook_bool_mode_false (machine_mode)
88 : : {
89 : 0 : return false;
90 : : }
91 : :
92 : : /* Generic hook that takes (machine_mode) and returns true. */
93 : : bool
94 : 210868737 : hook_bool_mode_true (machine_mode)
95 : : {
96 : 210868737 : return true;
97 : : }
98 : :
99 : : /* Generic hook that takes (machine_mode, machine_mode) and returns true. */
100 : : bool
101 : 0 : hook_bool_mode_mode_true (machine_mode, machine_mode)
102 : : {
103 : 0 : return true;
104 : : }
105 : :
106 : : /* Generic hook that takes (machine_mode, const_rtx) and returns false. */
107 : : bool
108 : 0 : hook_bool_mode_const_rtx_false (machine_mode, const_rtx)
109 : : {
110 : 0 : return false;
111 : : }
112 : :
113 : : /* Generic hook that takes (machine_mode, const_rtx) and returns true. */
114 : : bool
115 : 4142105 : hook_bool_mode_const_rtx_true (machine_mode, const_rtx)
116 : : {
117 : 4142105 : return true;
118 : : }
119 : :
120 : : /* Generic hook that takes (machine_mode, int, unsigned) and returns false. */
121 : : bool
122 : 0 : hook_bool_mode_int_unsigned_false (machine_mode, int, unsigned)
123 : : {
124 : 0 : return false;
125 : : }
126 : :
127 : : /* Generic hook that takes (machine_mode, rtx) and returns false. */
128 : : bool
129 : 4330748 : hook_bool_mode_rtx_false (machine_mode, rtx)
130 : : {
131 : 4330748 : return false;
132 : : }
133 : :
134 : : /* Generic hook that takes (machine_mode, rtx) and returns true. */
135 : : bool
136 : 0 : hook_bool_mode_rtx_true (machine_mode, rtx)
137 : : {
138 : 0 : return true;
139 : : }
140 : :
141 : : /* Generic hook that takes (const rtx_insn *, const rtx_insn *) and returns true. */
142 : : bool
143 : 0 : hook_bool_const_rtx_insn_const_rtx_insn_true (const rtx_insn *,
144 : : const rtx_insn *)
145 : : {
146 : 0 : return true;
147 : : }
148 : :
149 : : /* Generic hook that takes (machine_mode, unsigned HOST_WIDE_INT)
150 : : and returns false. */
151 : : bool
152 : 58710182 : hook_bool_mode_uhwi_false (machine_mode, unsigned HOST_WIDE_INT)
153 : : {
154 : 58710182 : return false;
155 : : }
156 : :
157 : : /* Generic hook that takes (poly_uint64, poly_uint64) and returns true. */
158 : : bool
159 : 10070745 : hook_bool_puint64_puint64_true (poly_uint64, poly_uint64)
160 : : {
161 : 10070745 : return true;
162 : : }
163 : :
164 : : bool
165 : 0 : hook_bool_uint_uint_mode_false (unsigned int, unsigned int, machine_mode)
166 : : {
167 : 0 : return false;
168 : : }
169 : :
170 : : /* Generic hook that takes (unsigned int, machine_mode) and returns true. */
171 : : bool
172 : 0 : hook_bool_uint_mode_true (unsigned int, machine_mode)
173 : : {
174 : 0 : return true;
175 : : }
176 : :
177 : : /* Generic hook that takes (FILE *, const char *) and does nothing. */
178 : : void
179 : 0 : hook_void_FILEptr_constcharptr (FILE *, const char *)
180 : : {
181 : 0 : }
182 : :
183 : : /* Generic hook that takes (FILE *, const char *, constr_tree *) and does
184 : : nothing. */
185 : : void
186 : 295367 : hook_void_FILEptr_constcharptr_const_tree (FILE *, const char *, const_tree)
187 : : {
188 : 295367 : }
189 : :
190 : : /* Generic hook that takes (FILE *, rtx) and returns false. */
191 : : bool
192 : 0 : hook_bool_FILEptr_rtx_false (FILE *, rtx)
193 : : {
194 : 0 : return false;
195 : : }
196 : :
197 : : /* Generic hook that takes (gimple_stmt_iterator *) and returns
198 : : false. */
199 : : bool
200 : 0 : hook_bool_gsiptr_false (gimple_stmt_iterator *)
201 : : {
202 : 0 : return false;
203 : : }
204 : :
205 : : /* Used for the TARGET_ASM_CAN_OUTPUT_MI_THUNK hook. */
206 : : bool
207 : 0 : hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree, HOST_WIDE_INT,
208 : : HOST_WIDE_INT, const_tree)
209 : : {
210 : 0 : return false;
211 : : }
212 : :
213 : : bool
214 : 0 : hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree, HOST_WIDE_INT,
215 : : HOST_WIDE_INT, const_tree)
216 : : {
217 : 0 : return true;
218 : : }
219 : :
220 : : bool
221 : 0 : default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT,
222 : : HOST_WIDE_INT c, const_tree)
223 : : {
224 : 0 : return c == 0;
225 : : }
226 : :
227 : : int
228 : 0 : hook_int_uint_mode_1 (unsigned int, machine_mode)
229 : : {
230 : 0 : return 1;
231 : : }
232 : :
233 : : int
234 : 82712697 : hook_int_const_tree_0 (const_tree)
235 : : {
236 : 82712697 : return 0;
237 : : }
238 : :
239 : : /* ??? Used for comp_type_attributes, which ought to return bool. */
240 : : int
241 : 0 : hook_int_const_tree_const_tree_1 (const_tree, const_tree)
242 : : {
243 : 0 : return 1;
244 : : }
245 : :
246 : : int
247 : 0 : hook_int_rtx_0 (rtx)
248 : : {
249 : 0 : return 0;
250 : : }
251 : :
252 : : int
253 : 0 : hook_int_rtx_1 (rtx)
254 : : {
255 : 0 : return 1;
256 : : }
257 : :
258 : : int
259 : 2951280 : hook_int_rtx_insn_0 (rtx_insn *)
260 : : {
261 : 2951280 : return 0;
262 : : }
263 : :
264 : : int
265 : 0 : hook_int_rtx_insn_unreachable (rtx_insn *)
266 : : {
267 : 0 : gcc_unreachable ();
268 : : }
269 : :
270 : : int
271 : 0 : hook_int_rtx_bool_0 (rtx, bool)
272 : : {
273 : 0 : return 0;
274 : : }
275 : :
276 : : int
277 : 0 : hook_int_rtx_mode_as_bool_0 (rtx, machine_mode, addr_space_t, bool)
278 : : {
279 : 0 : return 0;
280 : : }
281 : :
282 : : unsigned int
283 : 11009 : hook_uint_void_0 (void)
284 : : {
285 : 11009 : return 0;
286 : : }
287 : :
288 : : HOST_WIDE_INT
289 : 13458789 : hook_hwi_void_0 (void)
290 : : {
291 : 13458789 : return 0;
292 : : }
293 : :
294 : : void
295 : 2531099126 : hook_void_tree (tree)
296 : : {
297 : 2531099126 : }
298 : :
299 : : void
300 : 1548959 : hook_void_FILEptr_tree (FILE *, tree)
301 : : {
302 : 1548959 : }
303 : :
304 : : void
305 : 5131 : hook_void_constcharptr (const char *)
306 : : {
307 : 5131 : }
308 : :
309 : : void
310 : 1788504595 : hook_void_tree_treeptr (tree, tree *)
311 : : {
312 : 1788504595 : }
313 : :
314 : : void
315 : 0 : hook_void_int_int (int, int)
316 : : {
317 : 0 : }
318 : :
319 : : bool
320 : 70771 : hook_bool_tree_false (tree)
321 : : {
322 : 70771 : return false;
323 : : }
324 : :
325 : : bool
326 : 37759437 : hook_bool_const_tree_false (const_tree)
327 : : {
328 : 37759437 : return false;
329 : : }
330 : :
331 : : bool
332 : 8799111 : hook_bool_const_tree_const_tree_true (const_tree, const_tree)
333 : : {
334 : 8799111 : return true;
335 : : }
336 : :
337 : : bool
338 : 9277 : hook_bool_tree_true (tree)
339 : : {
340 : 9277 : return true;
341 : : }
342 : :
343 : : bool
344 : 5954011 : hook_bool_const_tree_true (const_tree)
345 : : {
346 : 5954011 : return true;
347 : : }
348 : :
349 : : bool
350 : 240165860 : hook_bool_tree_tree_false (tree, tree)
351 : : {
352 : 240165860 : return false;
353 : : }
354 : :
355 : : bool
356 : 0 : hook_bool_tree_tree_true (tree, tree)
357 : : {
358 : 0 : return true;
359 : : }
360 : :
361 : : bool
362 : 536982 : hook_bool_tree_bool_false (tree, bool)
363 : : {
364 : 536982 : return false;
365 : : }
366 : :
367 : : bool
368 : 0 : hook_bool_rtx_insn_true (rtx_insn *)
369 : : {
370 : 0 : return true;
371 : : }
372 : :
373 : : bool
374 : 2320736 : hook_bool_rtx_false (rtx)
375 : : {
376 : 2320736 : return false;
377 : : }
378 : :
379 : : bool
380 : 0 : hook_bool_uintp_uintp_false (unsigned int *, unsigned int *)
381 : : {
382 : 0 : return false;
383 : : }
384 : :
385 : : bool
386 : 0 : hook_bool_rtx_mode_int_int_intp_bool_false (rtx, machine_mode, int, int,
387 : : int *, bool)
388 : : {
389 : 0 : return false;
390 : : }
391 : :
392 : : bool
393 : 0 : hook_bool_wint_wint_uint_bool_true (const widest_int &, const widest_int &,
394 : : unsigned int, bool)
395 : : {
396 : 0 : return true;
397 : : }
398 : :
399 : : /* Generic hook that takes an rtx and returns it. */
400 : : rtx
401 : 0 : hook_rtx_rtx_identity (rtx x)
402 : : {
403 : 0 : return x;
404 : : }
405 : :
406 : : /* Generic hook that takes an rtx and returns NULL_RTX. */
407 : : rtx
408 : 25609496 : hook_rtx_rtx_null (rtx)
409 : : {
410 : 25609496 : return NULL;
411 : : }
412 : :
413 : : /* Generic hook that takes a tree and an int and returns NULL_RTX. */
414 : : rtx
415 : 22192147 : hook_rtx_tree_int_null (tree, int)
416 : : {
417 : 22192147 : return NULL;
418 : : }
419 : :
420 : : /* Generic hook that takes a machine mode and returns an unsigned int 0. */
421 : : unsigned int
422 : 1426955 : hook_uint_mode_0 (machine_mode)
423 : : {
424 : 1426955 : return 0;
425 : : }
426 : :
427 : : /* Generic hook that takes no arguments and returns a NULL const string. */
428 : : const char *
429 : 0 : hook_constcharptr_void_null (void)
430 : : {
431 : 0 : return NULL;
432 : : }
433 : :
434 : : /* Generic hook that takes no arguments and returns a NULL string. */
435 : : char *
436 : 0 : hook_charptr_void_null (void)
437 : : {
438 : 0 : return NULL;
439 : : }
440 : :
441 : : /* Generic hook that takes a tree and returns a NULL string. */
442 : : const char *
443 : 0 : hook_constcharptr_const_tree_null (const_tree)
444 : : {
445 : 0 : return NULL;
446 : : }
447 : :
448 : : tree
449 : 0 : hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool)
450 : : {
451 : 0 : return NULL;
452 : : }
453 : :
454 : : tree
455 : 34790 : hook_tree_tree_bool_null (tree, bool)
456 : : {
457 : 34790 : return NULL;
458 : : }
459 : :
460 : : tree
461 : 375020110 : hook_tree_tree_tree_null (tree, tree)
462 : : {
463 : 375020110 : return NULL;
464 : : }
465 : :
466 : : tree
467 : 33364 : hook_tree_tree_tree_tree_null (tree, tree, tree)
468 : : {
469 : 33364 : return NULL;
470 : : }
471 : :
472 : : tree
473 : 465 : hook_tree_treeptr_tree_tree_int_boolptr_null (tree *, tree, tree, int, bool *)
474 : : {
475 : 465 : return NULL;
476 : : }
477 : :
478 : : /* Generic hook that takes an rtx_insn *and returns a NULL string. */
479 : : const char *
480 : 0 : hook_constcharptr_const_rtx_insn_null (const rtx_insn *)
481 : : {
482 : 0 : return NULL;
483 : : }
484 : :
485 : : const char *
486 : 0 : hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree)
487 : : {
488 : 0 : return NULL;
489 : : }
490 : :
491 : : const char *
492 : 0 : hook_constcharptr_int_const_tree_null (int, const_tree)
493 : : {
494 : 0 : return NULL;
495 : : }
496 : :
497 : : const char *
498 : 0 : hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree)
499 : : {
500 : 0 : return NULL;
501 : : }
502 : :
503 : : /* Generic hook that takes a const_tree and returns NULL_TREE. */
504 : : tree
505 : 2492865359 : hook_tree_const_tree_null (const_tree)
506 : : {
507 : 2492865359 : return NULL;
508 : : }
509 : :
510 : : /* Generic hook that takes no arguments and returns a NULL_TREE. */
511 : : tree
512 : 0 : hook_tree_void_null (void)
513 : : {
514 : 0 : return NULL;
515 : : }
516 : :
517 : : /* Generic hook that takes a rtx_insn * and an int and returns a bool. */
518 : :
519 : : bool
520 : 0 : hook_bool_rtx_insn_int_false (rtx_insn *, int)
521 : : {
522 : 0 : return false;
523 : : }
524 : :
525 : : /* Generic hook that takes a rtx_insn * and an int and returns void. */
526 : :
527 : : void
528 : 0 : hook_void_rtx_insn_int (rtx_insn *, int)
529 : : {
530 : 0 : }
531 : :
532 : : /* Generic hook that takes a struct gcc_options * and returns void. */
533 : :
534 : : void
535 : 1264 : hook_void_gcc_optionsp (struct gcc_options *)
536 : : {
537 : 1264 : }
538 : :
539 : : /* Generic hook that takes an unsigned int and returns true. */
540 : :
541 : : bool
542 : 0 : hook_bool_uint_true (unsigned int)
543 : : {
544 : 0 : return true;
545 : : }
546 : :
547 : : /* Generic hook that takes an unsigned int, an unsigned int pointer and
548 : : returns false. */
549 : :
550 : : bool
551 : 3207659 : hook_bool_uint_uintp_false (unsigned int, unsigned int *)
552 : : {
553 : 3207659 : return false;
554 : : }
555 : :
556 : : /* Generic hook that takes a register class and returns false. */
557 : : bool
558 : 1719099 : hook_bool_reg_class_t_false (reg_class_t regclass ATTRIBUTE_UNUSED)
559 : : {
560 : 1719099 : return false;
561 : : }
562 : :
563 : : /* Generic hook that takes 2 machine_modes and a register class and
564 : : returns true. */
565 : : bool
566 : 0 : hook_bool_mode_mode_reg_class_t_true (machine_mode, machine_mode, reg_class_t)
567 : : {
568 : 0 : return true;
569 : : }
570 : :
571 : : /* Generic hook that takes a machine_mode and 2 register classes
572 : : and returns false. */
573 : : bool
574 : 0 : hook_bool_mode_reg_class_t_reg_class_t_false (machine_mode, reg_class_t,
575 : : reg_class_t)
576 : : {
577 : 0 : return false;
578 : : }
579 : :
580 : : /* Generic hook that takes a mode and an unsigned HOST_WIDE_INT and
581 : : returns no mode. */
582 : :
583 : : opt_machine_mode
584 : 58710182 : hook_optmode_mode_uhwi_none (machine_mode, unsigned HOST_WIDE_INT)
585 : : {
586 : 58710182 : return opt_machine_mode ();
587 : : }
|