]>
Commit | Line | Data |
---|---|---|
e4ec2cac | 1 | /* General-purpose hooks. |
cbe34bb5 | 2 | Copyright (C) 2002-2017 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. */ |
32 | void | |
1d088dee | 33 | hook_void_void (void) |
e5f3b786 NB |
34 | { |
35 | } | |
36 | ||
e4ec2cac AO |
37 | /* Generic hook that takes no arguments and returns false. */ |
38 | bool | |
1d088dee | 39 | hook_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. */ |
45 | bool | |
46 | hook_bool_void_true (void) | |
47 | { | |
48 | return true; | |
49 | } | |
50 | ||
fe3ad572 SC |
51 | /* Generic hook that takes (bool) and returns false. */ |
52 | bool | |
34a594e8 | 53 | hook_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. */ |
59 | bool | |
34a594e8 | 60 | hook_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 | 66 | bool 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 | 72 | bool |
34a594e8 | 73 | hook_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 | 79 | bool |
34a594e8 | 80 | hook_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. */ |
86 | bool | |
87 | hook_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 | 93 | bool |
34a594e8 | 94 | hook_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 | 100 | bool |
34a594e8 | 101 | hook_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 | 107 | bool |
34a594e8 | 108 | hook_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 | 114 | bool |
34a594e8 | 115 | hook_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 | 121 | bool |
34a594e8 JJ |
122 | hook_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. */ |
130 | bool | |
34a594e8 | 131 | hook_bool_mode_uhwi_false (machine_mode, unsigned HOST_WIDE_INT) |
0f6d54f7 RS |
132 | { |
133 | return false; | |
134 | } | |
135 | ||
bb149ca2 RS |
136 | /* Generic hook that takes (unsigned int, unsigned int) and returns true. */ |
137 | bool | |
138 | hook_bool_uint_uint_true (unsigned int, unsigned int) | |
139 | { | |
140 | return true; | |
141 | } | |
142 | ||
80ec73f4 RS |
143 | /* Generic hook that takes (unsigned int, machine_mode) and returns false. */ |
144 | bool | |
145 | hook_bool_uint_mode_false (unsigned int, machine_mode) | |
146 | { | |
147 | return false; | |
148 | } | |
149 | ||
f939c3e6 RS |
150 | /* Generic hook that takes (unsigned int, machine_mode) and returns true. */ |
151 | bool | |
152 | hook_bool_uint_mode_true (unsigned int, machine_mode) | |
153 | { | |
154 | return true; | |
155 | } | |
156 | ||
5eb99654 KG |
157 | /* Generic hook that takes (FILE *, const char *) and does nothing. */ |
158 | void | |
34a594e8 | 159 | hook_void_FILEptr_constcharptr (FILE *, const char *) |
5eb99654 KG |
160 | { |
161 | } | |
3961e8fe | 162 | |
0d4b5b86 BS |
163 | /* Generic hook that takes (FILE *, const char *, constr_tree *) and does |
164 | nothing. */ | |
165 | void | |
166 | hook_void_FILEptr_constcharptr_const_tree (FILE *, const char *, const_tree) | |
167 | { | |
168 | } | |
169 | ||
e1267133 AS |
170 | /* Generic hook that takes (FILE *, rtx) and returns false. */ |
171 | bool | |
34a594e8 | 172 | hook_bool_FILEptr_rtx_false (FILE *, rtx) |
e1267133 AS |
173 | { |
174 | return false; | |
175 | } | |
176 | ||
ea679d55 JG |
177 | /* Generic hook that takes (gimple_stmt_iterator *) and returns |
178 | false. */ | |
179 | bool | |
34a594e8 | 180 | hook_bool_gsiptr_false (gimple_stmt_iterator *) |
ea679d55 JG |
181 | { |
182 | return false; | |
183 | } | |
184 | ||
3961e8fe RH |
185 | /* Used for the TARGET_ASM_CAN_OUTPUT_MI_THUNK hook. */ |
186 | bool | |
34a594e8 JJ |
187 | hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree, HOST_WIDE_INT, |
188 | HOST_WIDE_INT, const_tree) | |
3961e8fe RH |
189 | { |
190 | return false; | |
191 | } | |
192 | ||
193 | bool | |
34a594e8 JJ |
194 | hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree, HOST_WIDE_INT, |
195 | HOST_WIDE_INT, const_tree) | |
3961e8fe RH |
196 | { |
197 | return true; | |
198 | } | |
199 | ||
200 | bool | |
34a594e8 JJ |
201 | default_can_output_mi_thunk_no_vcall (const_tree, HOST_WIDE_INT, |
202 | HOST_WIDE_INT c, const_tree) | |
3961e8fe RH |
203 | { |
204 | return c == 0; | |
205 | } | |
7b1bd3c5 | 206 | |
df7b0cc4 | 207 | int |
34a594e8 | 208 | hook_int_uint_mode_1 (unsigned int, machine_mode) |
df7b0cc4 EI |
209 | { |
210 | return 1; | |
211 | } | |
212 | ||
a1c496cb | 213 | int |
34a594e8 | 214 | hook_int_const_tree_0 (const_tree) |
a1c496cb EC |
215 | { |
216 | return 0; | |
217 | } | |
218 | ||
7b1bd3c5 RH |
219 | /* ??? Used for comp_type_attributes, which ought to return bool. */ |
220 | int | |
34a594e8 | 221 | hook_int_const_tree_const_tree_1 (const_tree, const_tree) |
7b1bd3c5 RH |
222 | { |
223 | return 1; | |
224 | } | |
225 | ||
dcefdf67 | 226 | int |
34a594e8 | 227 | hook_int_rtx_0 (rtx) |
dcefdf67 RH |
228 | { |
229 | return 0; | |
230 | } | |
231 | ||
d327457f JR |
232 | int |
233 | hook_int_rtx_1 (rtx) | |
234 | { | |
235 | return 1; | |
236 | } | |
237 | ||
238 | int | |
84034c69 | 239 | hook_int_rtx_insn_unreachable (rtx_insn *) |
d327457f JR |
240 | { |
241 | gcc_unreachable (); | |
242 | } | |
243 | ||
f40751dd | 244 | int |
34a594e8 | 245 | hook_int_rtx_bool_0 (rtx, bool) |
f40751dd JH |
246 | { |
247 | return 0; | |
248 | } | |
249 | ||
b413068c | 250 | int |
ef4bddc2 | 251 | hook_int_rtx_mode_as_bool_0 (rtx, machine_mode, addr_space_t, bool) |
b413068c OE |
252 | { |
253 | return 0; | |
254 | } | |
255 | ||
b86f6cd9 | 256 | unsigned int |
7a9bf9a4 | 257 | hook_uint_void_0 (void) |
b86f6cd9 NB |
258 | { |
259 | return 0; | |
260 | } | |
261 | ||
7b1bd3c5 | 262 | void |
34a594e8 | 263 | hook_void_tree (tree) |
7b1bd3c5 RH |
264 | { |
265 | } | |
266 | ||
2f21e1ba BS |
267 | void |
268 | hook_void_rtx_tree (rtx, tree) | |
269 | { | |
270 | } | |
271 | ||
94d1613b | 272 | void |
34a594e8 | 273 | hook_void_constcharptr (const char *) |
94d1613b MS |
274 | { |
275 | } | |
276 | ||
7b1bd3c5 | 277 | void |
34a594e8 | 278 | hook_void_tree_treeptr (tree, tree *) |
7b1bd3c5 RH |
279 | { |
280 | } | |
281 | ||
fac0f722 | 282 | void |
34a594e8 | 283 | hook_void_int_int (int, int) |
fac0f722 JM |
284 | { |
285 | } | |
286 | ||
7b1bd3c5 | 287 | bool |
34a594e8 | 288 | hook_bool_tree_false (tree) |
7b1bd3c5 RH |
289 | { |
290 | return false; | |
291 | } | |
3a04ff64 | 292 | |
ac7d7749 | 293 | bool |
34a594e8 | 294 | hook_bool_const_tree_false (const_tree) |
ac7d7749 KG |
295 | { |
296 | return false; | |
297 | } | |
298 | ||
c6e8c921 | 299 | bool |
34a594e8 | 300 | hook_bool_tree_true (tree) |
c6e8c921 GK |
301 | { |
302 | return true; | |
303 | } | |
304 | ||
586de218 | 305 | bool |
34a594e8 | 306 | hook_bool_const_tree_true (const_tree) |
586de218 KG |
307 | { |
308 | return true; | |
309 | } | |
310 | ||
4977bab6 | 311 | bool |
34a594e8 | 312 | hook_bool_tree_tree_false (tree, tree) |
4977bab6 ZW |
313 | { |
314 | return false; | |
315 | } | |
316 | ||
faf63e39 | 317 | bool |
34a594e8 | 318 | hook_bool_tree_tree_true (tree, tree) |
faf63e39 RH |
319 | { |
320 | return true; | |
321 | } | |
322 | ||
953ff289 | 323 | bool |
34a594e8 | 324 | hook_bool_tree_bool_false (tree, bool) |
953ff289 DN |
325 | { |
326 | return false; | |
327 | } | |
328 | ||
78e4f1ad | 329 | bool |
34a594e8 | 330 | hook_bool_rtx_insn_true (rtx_insn *) |
78e4f1ad UB |
331 | { |
332 | return true; | |
333 | } | |
334 | ||
3a04ff64 | 335 | bool |
34a594e8 | 336 | hook_bool_rtx_false (rtx) |
3a04ff64 RH |
337 | { |
338 | return false; | |
339 | } | |
3c50106f | 340 | |
e129d93a | 341 | bool |
34a594e8 | 342 | hook_bool_uintp_uintp_false (unsigned int *, unsigned int *) |
e129d93a ILT |
343 | { |
344 | return false; | |
345 | } | |
346 | ||
3c50106f | 347 | bool |
34a594e8 JJ |
348 | hook_bool_rtx_mode_int_int_intp_bool_false (rtx, machine_mode, int, int, |
349 | int *, bool) | |
3c50106f RH |
350 | { |
351 | return false; | |
352 | } | |
353 | ||
1d0216c8 | 354 | bool |
807e902e KZ |
355 | hook_bool_wint_wint_uint_bool_true (const widest_int &, const widest_int &, |
356 | unsigned int, bool) | |
1d0216c8 RS |
357 | { |
358 | return true; | |
359 | } | |
360 | ||
7daebb7a RS |
361 | /* Generic hook that takes an rtx and returns it. */ |
362 | rtx | |
1d088dee | 363 | hook_rtx_rtx_identity (rtx x) |
7daebb7a RS |
364 | { |
365 | return x; | |
366 | } | |
367 | ||
96714395 AH |
368 | /* Generic hook that takes an rtx and returns NULL_RTX. */ |
369 | rtx | |
34a594e8 | 370 | hook_rtx_rtx_null (rtx) |
96714395 | 371 | { |
c6e8c921 GK |
372 | return NULL; |
373 | } | |
374 | ||
375 | /* Generic hook that takes a tree and an int and returns NULL_RTX. */ | |
376 | rtx | |
34a594e8 | 377 | hook_rtx_tree_int_null (tree, int) |
c6e8c921 GK |
378 | { |
379 | return NULL; | |
96714395 | 380 | } |
18c81520 | 381 | |
fceec4d3 AM |
382 | /* Generic hook that takes a machine mode and returns an unsigned int 0. */ |
383 | unsigned int | |
34a594e8 | 384 | hook_uint_mode_0 (machine_mode) |
fceec4d3 AM |
385 | { |
386 | return 0; | |
387 | } | |
388 | ||
c713ddc0 | 389 | /* Generic hook that takes no arguments and returns a NULL const string. */ |
1efcb8c6 JM |
390 | const char * |
391 | hook_constcharptr_void_null (void) | |
392 | { | |
393 | return NULL; | |
394 | } | |
395 | ||
c713ddc0 BS |
396 | /* Generic hook that takes no arguments and returns a NULL string. */ |
397 | char * | |
398 | hook_charptr_void_null (void) | |
399 | { | |
400 | return NULL; | |
401 | } | |
402 | ||
f18eca82 ZL |
403 | /* Generic hook that takes a tree and returns a NULL string. */ |
404 | const char * | |
34a594e8 | 405 | hook_constcharptr_const_tree_null (const_tree) |
f18eca82 ZL |
406 | { |
407 | return NULL; | |
408 | } | |
55e74277 | 409 | |
6b889d89 | 410 | tree |
34a594e8 | 411 | hook_tree_tree_int_treep_bool_null (tree, int, tree *, bool) |
55e74277 PB |
412 | { |
413 | return NULL; | |
414 | } | |
e7e64a25 | 415 | |
953ff289 | 416 | tree |
34a594e8 | 417 | hook_tree_tree_tree_null (tree, tree) |
953ff289 DN |
418 | { |
419 | return NULL; | |
420 | } | |
421 | ||
a68ab351 | 422 | tree |
34a594e8 | 423 | hook_tree_tree_tree_tree_null (tree, tree, tree) |
a68ab351 JJ |
424 | { |
425 | return NULL; | |
426 | } | |
427 | ||
ac44248e | 428 | /* Generic hook that takes an rtx_insn *and returns a NULL string. */ |
e7e64a25 | 429 | const char * |
34a594e8 | 430 | hook_constcharptr_const_rtx_insn_null (const rtx_insn *) |
e7e64a25 AS |
431 | { |
432 | return NULL; | |
433 | } | |
4de67c26 JM |
434 | |
435 | const char * | |
34a594e8 | 436 | hook_constcharptr_const_tree_const_tree_null (const_tree, const_tree) |
4de67c26 JM |
437 | { |
438 | return NULL; | |
439 | } | |
440 | ||
441 | const char * | |
34a594e8 | 442 | hook_constcharptr_int_const_tree_null (int, const_tree) |
4de67c26 JM |
443 | { |
444 | return NULL; | |
445 | } | |
446 | ||
447 | const char * | |
34a594e8 | 448 | hook_constcharptr_int_const_tree_const_tree_null (int, const_tree, const_tree) |
4de67c26 JM |
449 | { |
450 | return NULL; | |
451 | } | |
40449a90 SL |
452 | |
453 | /* Generic hook that takes a const_tree and returns NULL_TREE. */ | |
454 | tree | |
34a594e8 | 455 | hook_tree_const_tree_null (const_tree) |
40449a90 SL |
456 | { |
457 | return NULL; | |
458 | } | |
7942e47e | 459 | |
1202f33e JJ |
460 | /* Generic hook that takes no arguments and returns a NULL_TREE. */ |
461 | tree | |
462 | hook_tree_void_null (void) | |
463 | { | |
464 | return NULL; | |
465 | } | |
466 | ||
ac44248e | 467 | /* Generic hook that takes a rtx_insn * and an int and returns a bool. */ |
7942e47e RY |
468 | |
469 | bool | |
34a594e8 | 470 | hook_bool_rtx_insn_int_false (rtx_insn *, int) |
7942e47e RY |
471 | { |
472 | return false; | |
473 | } | |
474 | ||
ac44248e | 475 | /* Generic hook that takes a rtx_insn * and an int and returns void. */ |
7942e47e RY |
476 | |
477 | void | |
34a594e8 | 478 | hook_void_rtx_insn_int (rtx_insn *, int) |
7942e47e RY |
479 | { |
480 | } | |
7e4aae92 JM |
481 | |
482 | /* Generic hook that takes a struct gcc_options * and returns void. */ | |
483 | ||
484 | void | |
34a594e8 | 485 | hook_void_gcc_optionsp (struct gcc_options *) |
7e4aae92 JM |
486 | { |
487 | } | |
0ee70cc0 AV |
488 | |
489 | /* Generic hook that takes an unsigned int, an unsigned int pointer and | |
490 | returns false. */ | |
491 | ||
492 | bool | |
bf072854 | 493 | hook_bool_uint_uintp_false (unsigned int, unsigned int *) |
0ee70cc0 AV |
494 | { |
495 | return false; | |
496 | } | |
e93f30a6 VM |
497 | |
498 | /* Generic hook that takes a register class and returns false. */ | |
499 | bool | |
500 | hook_bool_reg_class_t_false (reg_class_t regclass ATTRIBUTE_UNUSED) | |
501 | { | |
502 | return false; | |
503 | } | |
504 | ||
0d803030 RS |
505 | /* Generic hook that takes 2 machine_modes and a register class and |
506 | returns true. */ | |
507 | bool | |
508 | hook_bool_mode_mode_reg_class_t_true (machine_mode, machine_mode, reg_class_t) | |
509 | { | |
510 | return true; | |
511 | } | |
512 | ||
f15643d4 RS |
513 | /* Generic hook that takes a machine_mode and 2 register classes |
514 | and returns false. */ | |
515 | bool | |
516 | hook_bool_mode_reg_class_t_reg_class_t_false (machine_mode, reg_class_t, | |
517 | reg_class_t) | |
518 | { | |
519 | return false; | |
520 | } | |
521 |