]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/hooks.c
Update copyright years.
[thirdparty/gcc.git] / gcc / hooks.c
CommitLineData
e4ec2cac 1/* General-purpose hooks.
8d9254fc 2 Copyright (C) 2002-2020 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
2f21e1ba
BS
283void
284hook_void_rtx_tree (rtx, tree)
285{
286}
287
94d1613b 288void
34a594e8 289hook_void_constcharptr (const char *)
94d1613b
MS
290{
291}
292
7b1bd3c5 293void
34a594e8 294hook_void_tree_treeptr (tree, tree *)
7b1bd3c5
RH
295{
296}
297
fac0f722 298void
34a594e8 299hook_void_int_int (int, int)
fac0f722
JM
300{
301}
302
7b1bd3c5 303bool
34a594e8 304hook_bool_tree_false (tree)
7b1bd3c5
RH
305{
306 return false;
307}
3a04ff64 308
ac7d7749 309bool
34a594e8 310hook_bool_const_tree_false (const_tree)
ac7d7749
KG
311{
312 return false;
313}
314
c6e8c921 315bool
34a594e8 316hook_bool_tree_true (tree)
c6e8c921
GK
317{
318 return true;
319}
320
586de218 321bool
34a594e8 322hook_bool_const_tree_true (const_tree)
586de218
KG
323{
324 return true;
325}
326
4977bab6 327bool
34a594e8 328hook_bool_tree_tree_false (tree, tree)
4977bab6
ZW
329{
330 return false;
331}
332
faf63e39 333bool
34a594e8 334hook_bool_tree_tree_true (tree, tree)
faf63e39
RH
335{
336 return true;
337}
338
953ff289 339bool
34a594e8 340hook_bool_tree_bool_false (tree, bool)
953ff289
DN
341{
342 return false;
343}
344
78e4f1ad 345bool
34a594e8 346hook_bool_rtx_insn_true (rtx_insn *)
78e4f1ad
UB
347{
348 return true;
349}
350
3a04ff64 351bool
34a594e8 352hook_bool_rtx_false (rtx)
3a04ff64
RH
353{
354 return false;
355}
3c50106f 356
e129d93a 357bool
34a594e8 358hook_bool_uintp_uintp_false (unsigned int *, unsigned int *)
e129d93a
ILT
359{
360 return false;
361}
362
3c50106f 363bool
34a594e8
JJ
364hook_bool_rtx_mode_int_int_intp_bool_false (rtx, machine_mode, int, int,
365 int *, bool)
3c50106f
RH
366{
367 return false;
368}
369
1d0216c8 370bool
807e902e
KZ
371hook_bool_wint_wint_uint_bool_true (const widest_int &, const widest_int &,
372 unsigned int, bool)
1d0216c8
RS
373{
374 return true;
375}
376
7daebb7a
RS
377/* Generic hook that takes an rtx and returns it. */
378rtx
1d088dee 379hook_rtx_rtx_identity (rtx x)
7daebb7a
RS
380{
381 return x;
382}
383
96714395
AH
384/* Generic hook that takes an rtx and returns NULL_RTX. */
385rtx
34a594e8 386hook_rtx_rtx_null (rtx)
96714395 387{
c6e8c921
GK
388 return NULL;
389}
390
391/* Generic hook that takes a tree and an int and returns NULL_RTX. */
392rtx
34a594e8 393hook_rtx_tree_int_null (tree, int)
c6e8c921
GK
394{
395 return NULL;
96714395 396}
18c81520 397
fceec4d3
AM
398/* Generic hook that takes a machine mode and returns an unsigned int 0. */
399unsigned int
34a594e8 400hook_uint_mode_0 (machine_mode)
fceec4d3
AM
401{
402 return 0;
403}
404
c713ddc0 405/* Generic hook that takes no arguments and returns a NULL const string. */
1efcb8c6
JM
406const char *
407hook_constcharptr_void_null (void)
408{
409 return NULL;
410}
411
c713ddc0
BS
412/* Generic hook that takes no arguments and returns a NULL string. */
413char *
414hook_charptr_void_null (void)
415{
416 return NULL;
417}
418
f18eca82
ZL
419/* Generic hook that takes a tree and returns a NULL string. */
420const char *
34a594e8 421hook_constcharptr_const_tree_null (const_tree)
f18eca82
ZL
422{
423 return NULL;
424}
55e74277 425
6b889d89 426tree
34a594e8 427hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool)
55e74277
PB
428{
429 return NULL;
430}
e7e64a25 431
92e63bd2
TB
432tree
433hook_tree_tree_bool_null (tree, bool)
434{
435 return NULL;
436}
437
953ff289 438tree
34a594e8 439hook_tree_tree_tree_null (tree, tree)
953ff289
DN
440{
441 return NULL;
442}
443
a68ab351 444tree
34a594e8 445hook_tree_tree_tree_tree_null (tree, tree, tree)
a68ab351
JJ
446{
447 return NULL;
448}
449
7a4418a5
JL
450tree
451hook_tree_treeptr_tree_tree_int_boolptr_null (tree *, tree, tree, int, bool *)
452{
453 return NULL;
454}
455
ac44248e 456/* Generic hook that takes an rtx_insn *and returns a NULL string. */
e7e64a25 457const char *
34a594e8 458hook_constcharptr_const_rtx_insn_null (const rtx_insn *)
e7e64a25
AS
459{
460 return NULL;
461}
4de67c26
JM
462
463const char *
34a594e8 464hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree)
4de67c26
JM
465{
466 return NULL;
467}
468
469const char *
34a594e8 470hook_constcharptr_int_const_tree_null (int, const_tree)
4de67c26
JM
471{
472 return NULL;
473}
474
475const char *
34a594e8 476hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree)
4de67c26
JM
477{
478 return NULL;
479}
40449a90
SL
480
481/* Generic hook that takes a const_tree and returns NULL_TREE. */
482tree
34a594e8 483hook_tree_const_tree_null (const_tree)
40449a90
SL
484{
485 return NULL;
486}
7942e47e 487
1202f33e
JJ
488/* Generic hook that takes no arguments and returns a NULL_TREE. */
489tree
490hook_tree_void_null (void)
491{
492 return NULL;
493}
494
ac44248e 495/* Generic hook that takes a rtx_insn * and an int and returns a bool. */
7942e47e
RY
496
497bool
34a594e8 498hook_bool_rtx_insn_int_false (rtx_insn *, int)
7942e47e
RY
499{
500 return false;
501}
502
ac44248e 503/* Generic hook that takes a rtx_insn * and an int and returns void. */
7942e47e
RY
504
505void
34a594e8 506hook_void_rtx_insn_int (rtx_insn *, int)
7942e47e
RY
507{
508}
7e4aae92
JM
509
510/* Generic hook that takes a struct gcc_options * and returns void. */
511
512void
34a594e8 513hook_void_gcc_optionsp (struct gcc_options *)
7e4aae92
JM
514{
515}
0ee70cc0
AV
516
517/* Generic hook that takes an unsigned int, an unsigned int pointer and
518 returns false. */
519
520bool
bf072854 521hook_bool_uint_uintp_false (unsigned int, unsigned int *)
0ee70cc0
AV
522{
523 return false;
524}
e93f30a6
VM
525
526/* Generic hook that takes a register class and returns false. */
527bool
528hook_bool_reg_class_t_false (reg_class_t regclass ATTRIBUTE_UNUSED)
529{
530 return false;
531}
532
0d803030
RS
533/* Generic hook that takes 2 machine_modes and a register class and
534 returns true. */
535bool
536hook_bool_mode_mode_reg_class_t_true (machine_mode, machine_mode, reg_class_t)
537{
538 return true;
539}
540
f15643d4
RS
541/* Generic hook that takes a machine_mode and 2 register classes
542 and returns false. */
543bool
544hook_bool_mode_reg_class_t_reg_class_t_false (machine_mode, reg_class_t,
545 reg_class_t)
546{
547 return false;
548}
549
695da534
RS
550/* Generic hook that takes a mode and an unsigned HOST_WIDE_INT and
551 returns no mode. */
552
553opt_machine_mode
554hook_optmode_mode_uhwi_none (machine_mode, unsigned HOST_WIDE_INT)
555{
556 return opt_machine_mode ();
557}