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