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