]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/hooks.cc
[PATCH v1 1/1] RISC-V: Nan-box the result of movbf on soft-bf16
[thirdparty/gcc.git] / gcc / hooks.cc
CommitLineData
e4ec2cac 1/* General-purpose hooks.
a945c346 2 Copyright (C) 2002-2024 Free Software Foundation, Inc.
e4ec2cac 3
9dcd6f09
NC
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.
e4ec2cac 8
9dcd6f09
NC
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.
e4ec2cac 13
9dcd6f09
NC
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
b8698a0f 16 <http://www.gnu.org/licenses/>.
e4ec2cac 17
9dcd6f09
NC
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! */
e4ec2cac
AO
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"
4977bab6
ZW
27#include "coretypes.h"
28#include "tm.h"
e4ec2cac
AO
29#include "hooks.h"
30
e5f3b786
NB
31/* Generic hook that does absolutely zappo. */
32void
1d088dee 33hook_void_void (void)
e5f3b786
NB
34{
35}
36
e4ec2cac
AO
37/* Generic hook that takes no arguments and returns false. */
38bool
1d088dee 39hook_bool_void_false (void)
ae46c4e0
RH
40{
41 return false;
42}
fb49053f 43
af287697
MM
44/* Generic hook that takes no arguments and returns true. */
45bool
46hook_bool_void_true (void)
47{
48 return true;
49}
50
fe3ad572
SC
51/* Generic hook that takes (bool) and returns false. */
52bool
34a594e8 53hook_bool_bool_false (bool)
fe3ad572
SC
54{
55 return false;
56}
57
d5fabb58
JM
58/* Generic hook that takes (bool, struct gcc_options *) and returns false. */
59bool
34a594e8 60hook_bool_bool_gcc_optionsp_false (bool, struct gcc_options *)
d5fabb58
JM
61{
62 return false;
63}
64
7b5cbb57 65/* Generic hook that takes const int, const int) and returns true. */
34a594e8 66bool hook_bool_const_int_const_int_true (const int, const int)
7b5cbb57
AS
67{
68 return true;
69}
70
ef4bddc2 71/* Generic hook that takes (machine_mode) and returns false. */
f676971a 72bool
34a594e8 73hook_bool_mode_false (machine_mode)
f676971a
EC
74{
75 return false;
76}
77
ef4bddc2 78/* Generic hook that takes (machine_mode) and returns true. */
42db504c 79bool
34a594e8 80hook_bool_mode_true (machine_mode)
42db504c
SB
81{
82 return true;
83}
84
99e1629f
RS
85/* Generic hook that takes (machine_mode, machine_mode) and returns true. */
86bool
87hook_bool_mode_mode_true (machine_mode, machine_mode)
88{
89 return true;
90}
91
ef4bddc2 92/* Generic hook that takes (machine_mode, const_rtx) and returns false. */
aacd3885 93bool
34a594e8 94hook_bool_mode_const_rtx_false (machine_mode, const_rtx)
aacd3885
RS
95{
96 return false;
97}
98
ef4bddc2 99/* Generic hook that takes (machine_mode, const_rtx) and returns true. */
1d3dbd99 100bool
34a594e8 101hook_bool_mode_const_rtx_true (machine_mode, const_rtx)
1d3dbd99
RS
102{
103 return true;
104}
105
ef4bddc2 106/* Generic hook that takes (machine_mode, rtx) and returns false. */
fbbf66e7 107bool
34a594e8 108hook_bool_mode_rtx_false (machine_mode, rtx)
fbbf66e7
RS
109{
110 return false;
111}
112
ef4bddc2 113/* Generic hook that takes (machine_mode, rtx) and returns true. */
1a627b35 114bool
34a594e8 115hook_bool_mode_rtx_true (machine_mode, rtx)
1a627b35
RS
116{
117 return true;
118}
119
c1ce59ab 120/* Generic hook that takes (const rtx_insn *, const rtx_insn *) and returns true. */
4b4de898 121bool
34a594e8
JJ
122hook_bool_const_rtx_insn_const_rtx_insn_true (const rtx_insn *,
123 const rtx_insn *)
4b4de898
JR
124{
125 return true;
126}
127
ef4bddc2 128/* Generic hook that takes (machine_mode, unsigned HOST_WIDE_INT)
0f6d54f7
RS
129 and returns false. */
130bool
34a594e8 131hook_bool_mode_uhwi_false (machine_mode, unsigned HOST_WIDE_INT)
0f6d54f7
RS
132{
133 return false;
134}
135
37b2b8f9 136/* Generic hook that takes (poly_uint64, poly_uint64) and returns true. */
bb149ca2 137bool
37b2b8f9 138hook_bool_puint64_puint64_true (poly_uint64, poly_uint64)
bb149ca2
RS
139{
140 return true;
141}
142
80ec73f4 143bool
6ee2cc70 144hook_bool_uint_uint_mode_false (unsigned int, unsigned int, machine_mode)
80ec73f4
RS
145{
146 return false;
147}
148
f939c3e6
RS
149/* Generic hook that takes (unsigned int, machine_mode) and returns true. */
150bool
151hook_bool_uint_mode_true (unsigned int, machine_mode)
152{
153 return true;
154}
155
5eb99654
KG
156/* Generic hook that takes (FILE *, const char *) and does nothing. */
157void
34a594e8 158hook_void_FILEptr_constcharptr (FILE *, const char *)
5eb99654
KG
159{
160}
3961e8fe 161
0d4b5b86
BS
162/* Generic hook that takes (FILE *, const char *, constr_tree *) and does
163 nothing. */
164void
165hook_void_FILEptr_constcharptr_const_tree (FILE *, const char *, const_tree)
166{
167}
168
e1267133
AS
169/* Generic hook that takes (FILE *, rtx) and returns false. */
170bool
34a594e8 171hook_bool_FILEptr_rtx_false (FILE *, rtx)
e1267133
AS
172{
173 return false;
174}
175
ea679d55
JG
176/* Generic hook that takes (gimple_stmt_iterator *) and returns
177 false. */
178bool
34a594e8 179hook_bool_gsiptr_false (gimple_stmt_iterator *)
ea679d55
JG
180{
181 return false;
182}
183
3961e8fe
RH
184/* Used for the TARGET_ASM_CAN_OUTPUT_MI_THUNK hook. */
185bool
34a594e8
JJ
186hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree, HOST_WIDE_INT,
187 HOST_WIDE_INT, const_tree)
3961e8fe
RH
188{
189 return false;
190}
191
192bool
34a594e8
JJ
193hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree, HOST_WIDE_INT,
194 HOST_WIDE_INT, const_tree)
3961e8fe
RH
195{
196 return true;
197}
198
199bool
34a594e8
JJ
200default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT,
201 HOST_WIDE_INT c, const_tree)
3961e8fe
RH
202{
203 return c == 0;
204}
7b1bd3c5 205
df7b0cc4 206int
34a594e8 207hook_int_uint_mode_1 (unsigned int, machine_mode)
df7b0cc4
EI
208{
209 return 1;
210}
211
a1c496cb 212int
34a594e8 213hook_int_const_tree_0 (const_tree)
a1c496cb
EC
214{
215 return 0;
216}
217
7b1bd3c5
RH
218/* ??? Used for comp_type_attributes, which ought to return bool. */
219int
34a594e8 220hook_int_const_tree_const_tree_1 (const_tree, const_tree)
7b1bd3c5
RH
221{
222 return 1;
223}
224
dcefdf67 225int
34a594e8 226hook_int_rtx_0 (rtx)
dcefdf67
RH
227{
228 return 0;
229}
230
d327457f
JR
231int
232hook_int_rtx_1 (rtx)
233{
234 return 1;
235}
236
924c9e3e
AO
237int
238hook_int_rtx_insn_0 (rtx_insn *)
239{
240 return 0;
241}
242
d327457f 243int
84034c69 244hook_int_rtx_insn_unreachable (rtx_insn *)
d327457f
JR
245{
246 gcc_unreachable ();
247}
248
f40751dd 249int
34a594e8 250hook_int_rtx_bool_0 (rtx, bool)
f40751dd
JH
251{
252 return 0;
253}
254
b413068c 255int
ef4bddc2 256hook_int_rtx_mode_as_bool_0 (rtx, machine_mode, addr_space_t, bool)
b413068c
OE
257{
258 return 0;
259}
260
b86f6cd9 261unsigned int
7a9bf9a4 262hook_uint_void_0 (void)
2a31c321
RS
263{
264 return 0;
265}
266
267HOST_WIDE_INT
268hook_hwi_void_0 (void)
b86f6cd9
NB
269{
270 return 0;
271}
272
7b1bd3c5 273void
34a594e8 274hook_void_tree (tree)
7b1bd3c5
RH
275{
276}
277
dddb7af4
ST
278void
279hook_void_FILEptr_tree (FILE *, tree)
280{
281}
282
94d1613b 283void
34a594e8 284hook_void_constcharptr (const char *)
94d1613b
MS
285{
286}
287
7b1bd3c5 288void
34a594e8 289hook_void_tree_treeptr (tree, tree *)
7b1bd3c5
RH
290{
291}
292
fac0f722 293void
34a594e8 294hook_void_int_int (int, int)
fac0f722
JM
295{
296}
297
7b1bd3c5 298bool
34a594e8 299hook_bool_tree_false (tree)
7b1bd3c5
RH
300{
301 return false;
302}
3a04ff64 303
ac7d7749 304bool
34a594e8 305hook_bool_const_tree_false (const_tree)
ac7d7749
KG
306{
307 return false;
308}
309
482b2b43
RS
310bool
311hook_bool_const_tree_const_tree_true (const_tree, const_tree)
312{
313 return true;
314}
315
c6e8c921 316bool
34a594e8 317hook_bool_tree_true (tree)
c6e8c921
GK
318{
319 return true;
320}
321
586de218 322bool
34a594e8 323hook_bool_const_tree_true (const_tree)
586de218
KG
324{
325 return true;
326}
327
4977bab6 328bool
34a594e8 329hook_bool_tree_tree_false (tree, tree)
4977bab6
ZW
330{
331 return false;
332}
333
faf63e39 334bool
34a594e8 335hook_bool_tree_tree_true (tree, tree)
faf63e39
RH
336{
337 return true;
338}
339
953ff289 340bool
34a594e8 341hook_bool_tree_bool_false (tree, bool)
953ff289
DN
342{
343 return false;
344}
345
78e4f1ad 346bool
34a594e8 347hook_bool_rtx_insn_true (rtx_insn *)
78e4f1ad
UB
348{
349 return true;
350}
351
3a04ff64 352bool
34a594e8 353hook_bool_rtx_false (rtx)
3a04ff64
RH
354{
355 return false;
356}
3c50106f 357
e129d93a 358bool
34a594e8 359hook_bool_uintp_uintp_false (unsigned int *, unsigned int *)
e129d93a
ILT
360{
361 return false;
362}
363
3c50106f 364bool
34a594e8
JJ
365hook_bool_rtx_mode_int_int_intp_bool_false (rtx, machine_mode, int, int,
366 int *, bool)
3c50106f
RH
367{
368 return false;
369}
370
1d0216c8 371bool
807e902e
KZ
372hook_bool_wint_wint_uint_bool_true (const widest_int &, const widest_int &,
373 unsigned int, bool)
1d0216c8
RS
374{
375 return true;
376}
377
7daebb7a
RS
378/* Generic hook that takes an rtx and returns it. */
379rtx
1d088dee 380hook_rtx_rtx_identity (rtx x)
7daebb7a
RS
381{
382 return x;
383}
384
96714395
AH
385/* Generic hook that takes an rtx and returns NULL_RTX. */
386rtx
34a594e8 387hook_rtx_rtx_null (rtx)
96714395 388{
c6e8c921
GK
389 return NULL;
390}
391
392/* Generic hook that takes a tree and an int and returns NULL_RTX. */
393rtx
34a594e8 394hook_rtx_tree_int_null (tree, int)
c6e8c921
GK
395{
396 return NULL;
96714395 397}
18c81520 398
fceec4d3
AM
399/* Generic hook that takes a machine mode and returns an unsigned int 0. */
400unsigned int
34a594e8 401hook_uint_mode_0 (machine_mode)
fceec4d3
AM
402{
403 return 0;
404}
405
c713ddc0 406/* Generic hook that takes no arguments and returns a NULL const string. */
1efcb8c6
JM
407const char *
408hook_constcharptr_void_null (void)
409{
410 return NULL;
411}
412
c713ddc0
BS
413/* Generic hook that takes no arguments and returns a NULL string. */
414char *
415hook_charptr_void_null (void)
416{
417 return NULL;
418}
419
f18eca82
ZL
420/* Generic hook that takes a tree and returns a NULL string. */
421const char *
34a594e8 422hook_constcharptr_const_tree_null (const_tree)
f18eca82
ZL
423{
424 return NULL;
425}
55e74277 426
6b889d89 427tree
34a594e8 428hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool)
55e74277
PB
429{
430 return NULL;
431}
e7e64a25 432
92e63bd2
TB
433tree
434hook_tree_tree_bool_null (tree, bool)
435{
436 return NULL;
437}
438
953ff289 439tree
34a594e8 440hook_tree_tree_tree_null (tree, tree)
953ff289
DN
441{
442 return NULL;
443}
444
a68ab351 445tree
34a594e8 446hook_tree_tree_tree_tree_null (tree, tree, tree)
a68ab351
JJ
447{
448 return NULL;
449}
450
7a4418a5
JL
451tree
452hook_tree_treeptr_tree_tree_int_boolptr_null (tree *, tree, tree, int, bool *)
453{
454 return NULL;
455}
456
ac44248e 457/* Generic hook that takes an rtx_insn *and returns a NULL string. */
e7e64a25 458const char *
34a594e8 459hook_constcharptr_const_rtx_insn_null (const rtx_insn *)
e7e64a25
AS
460{
461 return NULL;
462}
4de67c26
JM
463
464const char *
34a594e8 465hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree)
4de67c26
JM
466{
467 return NULL;
468}
469
470const char *
34a594e8 471hook_constcharptr_int_const_tree_null (int, const_tree)
4de67c26
JM
472{
473 return NULL;
474}
475
476const char *
34a594e8 477hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree)
4de67c26
JM
478{
479 return NULL;
480}
40449a90
SL
481
482/* Generic hook that takes a const_tree and returns NULL_TREE. */
483tree
34a594e8 484hook_tree_const_tree_null (const_tree)
40449a90
SL
485{
486 return NULL;
487}
7942e47e 488
1202f33e
JJ
489/* Generic hook that takes no arguments and returns a NULL_TREE. */
490tree
491hook_tree_void_null (void)
492{
493 return NULL;
494}
495
ac44248e 496/* Generic hook that takes a rtx_insn * and an int and returns a bool. */
7942e47e
RY
497
498bool
34a594e8 499hook_bool_rtx_insn_int_false (rtx_insn *, int)
7942e47e
RY
500{
501 return false;
502}
503
ac44248e 504/* Generic hook that takes a rtx_insn * and an int and returns void. */
7942e47e
RY
505
506void
34a594e8 507hook_void_rtx_insn_int (rtx_insn *, int)
7942e47e
RY
508{
509}
7e4aae92
JM
510
511/* Generic hook that takes a struct gcc_options * and returns void. */
512
513void
34a594e8 514hook_void_gcc_optionsp (struct gcc_options *)
7e4aae92
JM
515{
516}
0ee70cc0 517
967b4653
L
518/* Generic hook that takes an unsigned int and returns true. */
519
520bool
521hook_bool_uint_true (unsigned int)
522{
523 return true;
524}
525
0ee70cc0
AV
526/* Generic hook that takes an unsigned int, an unsigned int pointer and
527 returns false. */
528
529bool
bf072854 530hook_bool_uint_uintp_false (unsigned int, unsigned int *)
0ee70cc0
AV
531{
532 return false;
533}
e93f30a6
VM
534
535/* Generic hook that takes a register class and returns false. */
536bool
537hook_bool_reg_class_t_false (reg_class_t regclass ATTRIBUTE_UNUSED)
538{
539 return false;
540}
541
0d803030
RS
542/* Generic hook that takes 2 machine_modes and a register class and
543 returns true. */
544bool
545hook_bool_mode_mode_reg_class_t_true (machine_mode, machine_mode, reg_class_t)
546{
547 return true;
548}
549
f15643d4
RS
550/* Generic hook that takes a machine_mode and 2 register classes
551 and returns false. */
552bool
553hook_bool_mode_reg_class_t_reg_class_t_false (machine_mode, reg_class_t,
554 reg_class_t)
555{
556 return false;
557}
558
695da534
RS
559/* Generic hook that takes a mode and an unsigned HOST_WIDE_INT and
560 returns no mode. */
561
562opt_machine_mode
563hook_optmode_mode_uhwi_none (machine_mode, unsigned HOST_WIDE_INT)
564{
565 return opt_machine_mode ();
566}