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