]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/hooks.c
./:
[thirdparty/gcc.git] / gcc / hooks.c
CommitLineData
e27e52e0 1/* General-purpose hooks.
bc620c5c 2 Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009
cfaf579d 3 Free Software Foundation, Inc.
e27e52e0 4
8c4c00c1 5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 3, or (at your option) any
8 later version.
e27e52e0 9
8c4c00c1 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
e27e52e0 14
8c4c00c1 15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING3. If not see
17 <http://www.gnu.org/licenses/>.
e27e52e0 18
8c4c00c1 19 In other words, you are welcome to use, share and improve this program.
20 You are forbidden to forbid anyone else to use, share and improve
21 what you give them. Help stamp out software-hoarding! */
e27e52e0 22
23/* This file contains generic hooks that can be used as defaults for
24 target or language-dependent hook initializers. */
25
26#include "config.h"
27#include "system.h"
805e22b2 28#include "coretypes.h"
29#include "tm.h"
e27e52e0 30#include "hooks.h"
31
dd436eaf 32/* Generic hook that does absolutely zappo. */
33void
952f0048 34hook_void_void (void)
dd436eaf 35{
36}
37
e27e52e0 38/* Generic hook that takes no arguments and returns false. */
39bool
952f0048 40hook_bool_void_false (void)
52470889 41{
42 return false;
43}
7811991d 44
219626ad 45/* Generic hook that takes no arguments and returns true. */
46bool
47hook_bool_void_true (void)
48{
49 return true;
50}
51
8af3db02 52/* Generic hook that takes (bool) and returns false. */
53bool
54hook_bool_bool_false (bool a ATTRIBUTE_UNUSED)
55{
56 return false;
57}
58
9e7454d0 59/* Generic hook that takes (enum machine_mode) and returns false. */
60bool
61hook_bool_mode_false (enum machine_mode mode ATTRIBUTE_UNUSED)
62{
63 return false;
64}
65
f2d0e9f1 66/* Generic hook that takes (enum machine_mode, rtx) and returns false. */
67bool
a9f1838b 68hook_bool_mode_const_rtx_false (enum machine_mode mode ATTRIBUTE_UNUSED,
69 const_rtx value ATTRIBUTE_UNUSED)
f2d0e9f1 70{
71 return false;
72}
73
2dbdc48e 74/* Generic hook that takes (enum machine_mode, rtx) and returns true. */
75bool
a9f1838b 76hook_bool_mode_const_rtx_true (enum machine_mode mode ATTRIBUTE_UNUSED,
77 const_rtx value ATTRIBUTE_UNUSED)
2dbdc48e 78{
79 return true;
80}
81
67c1e638 82/* Generic hook that takes (FILE *, const char *) and does nothing. */
83void
952f0048 84hook_void_FILEptr_constcharptr (FILE *a ATTRIBUTE_UNUSED, const char *b ATTRIBUTE_UNUSED)
67c1e638 85{
86}
eb344f43 87
88/* Used for the TARGET_ASM_CAN_OUTPUT_MI_THUNK hook. */
89bool
a9f1838b 90hook_bool_const_tree_hwi_hwi_const_tree_false (const_tree a ATTRIBUTE_UNUSED,
91 HOST_WIDE_INT b ATTRIBUTE_UNUSED,
92 HOST_WIDE_INT c ATTRIBUTE_UNUSED,
93 const_tree d ATTRIBUTE_UNUSED)
eb344f43 94{
95 return false;
96}
97
98bool
a9f1838b 99hook_bool_const_tree_hwi_hwi_const_tree_true (const_tree a ATTRIBUTE_UNUSED,
100 HOST_WIDE_INT b ATTRIBUTE_UNUSED,
101 HOST_WIDE_INT c ATTRIBUTE_UNUSED,
102 const_tree d ATTRIBUTE_UNUSED)
eb344f43 103{
104 return true;
105}
106
76bf7746 107bool
108hook_bool_constcharptr_size_t_false (const char *a ATTRIBUTE_UNUSED,
109 size_t b ATTRIBUTE_UNUSED)
110{
111 return false;
112}
113
ff05e09e 114bool
115hook_bool_size_t_constcharptr_int_true (size_t a ATTRIBUTE_UNUSED,
116 const char *b ATTRIBUTE_UNUSED,
117 int c ATTRIBUTE_UNUSED)
118{
119 return true;
120}
121
eb344f43 122bool
a9f1838b 123default_can_output_mi_thunk_no_vcall (const_tree a ATTRIBUTE_UNUSED,
952f0048 124 HOST_WIDE_INT b ATTRIBUTE_UNUSED,
125 HOST_WIDE_INT c,
a9f1838b 126 const_tree d ATTRIBUTE_UNUSED)
eb344f43 127{
128 return c == 0;
129}
b2ec75b5 130
8ff30ff6 131int
a9f1838b 132hook_int_const_tree_0 (const_tree a ATTRIBUTE_UNUSED)
8ff30ff6 133{
134 return 0;
135}
136
b2ec75b5 137/* ??? Used for comp_type_attributes, which ought to return bool. */
138int
a9f1838b 139hook_int_const_tree_const_tree_1 (const_tree a ATTRIBUTE_UNUSED, const_tree b ATTRIBUTE_UNUSED)
b2ec75b5 140{
141 return 1;
142}
143
ec0457a8 144int
952f0048 145hook_int_rtx_0 (rtx a ATTRIBUTE_UNUSED)
ec0457a8 146{
147 return 0;
148}
149
f529eb25 150int
151hook_int_rtx_bool_0 (rtx a ATTRIBUTE_UNUSED, bool b ATTRIBUTE_UNUSED)
152{
153 return 0;
154}
155
e938cdf5 156int
157hook_int_size_t_constcharptr_int_0 (size_t a ATTRIBUTE_UNUSED,
158 const char *b ATTRIBUTE_UNUSED,
159 int c ATTRIBUTE_UNUSED)
160{
161 return 0;
162}
163
4838a8b6 164unsigned int
165hook_uint_uint_constcharptrptr_0 (unsigned int a ATTRIBUTE_UNUSED,
166 const char **b ATTRIBUTE_UNUSED)
167{
168 return 0;
169}
170
b2ec75b5 171void
952f0048 172hook_void_tree (tree a ATTRIBUTE_UNUSED)
b2ec75b5 173{
174}
175
065e625b 176void
9423c9b7 177hook_void_constcharptr (const char *a ATTRIBUTE_UNUSED)
065e625b 178{
179}
180
b2ec75b5 181void
952f0048 182hook_void_tree_treeptr (tree a ATTRIBUTE_UNUSED, tree *b ATTRIBUTE_UNUSED)
b2ec75b5 183{
184}
185
186bool
952f0048 187hook_bool_tree_false (tree a ATTRIBUTE_UNUSED)
b2ec75b5 188{
189 return false;
190}
a6bbccc1 191
f8fd23c0 192bool
193hook_bool_const_tree_false (const_tree a ATTRIBUTE_UNUSED)
194{
195 return false;
196}
197
4e00ee67 198bool
199hook_bool_tree_true (tree a ATTRIBUTE_UNUSED)
200{
201 return true;
202}
203
fb80456a 204bool
205hook_bool_const_tree_true (const_tree a ATTRIBUTE_UNUSED)
206{
207 return true;
208}
209
805e22b2 210bool
952f0048 211hook_bool_tree_tree_false (tree a ATTRIBUTE_UNUSED, tree b ATTRIBUTE_UNUSED)
805e22b2 212{
213 return false;
214}
215
1e8e9920 216bool
217hook_bool_tree_bool_false (tree a ATTRIBUTE_UNUSED, bool b ATTRIBUTE_UNUSED)
218{
219 return false;
220}
221
a6bbccc1 222bool
952f0048 223hook_bool_rtx_false (rtx a ATTRIBUTE_UNUSED)
a6bbccc1 224{
225 return false;
226}
fab7adbf 227
124ac4e4 228bool
229hook_bool_uintp_uintp_false (unsigned int *a ATTRIBUTE_UNUSED,
230 unsigned int *b ATTRIBUTE_UNUSED)
231{
232 return false;
233}
234
fab7adbf 235bool
f529eb25 236hook_bool_rtx_int_int_intp_bool_false (rtx a ATTRIBUTE_UNUSED,
237 int b ATTRIBUTE_UNUSED,
238 int c ATTRIBUTE_UNUSED,
239 int *d ATTRIBUTE_UNUSED,
240 bool speed_p ATTRIBUTE_UNUSED)
fab7adbf 241{
242 return false;
243}
244
bfe57ab7 245/* Generic hook that takes an rtx and returns it. */
246rtx
952f0048 247hook_rtx_rtx_identity (rtx x)
bfe57ab7 248{
249 return x;
250}
251
9754a2f0 252/* Generic hook that takes an rtx and returns NULL_RTX. */
253rtx
952f0048 254hook_rtx_rtx_null (rtx x ATTRIBUTE_UNUSED)
9754a2f0 255{
4e00ee67 256 return NULL;
257}
258
259/* Generic hook that takes a tree and an int and returns NULL_RTX. */
260rtx
261hook_rtx_tree_int_null (tree a ATTRIBUTE_UNUSED, int b ATTRIBUTE_UNUSED)
262{
263 return NULL;
9754a2f0 264}
ddf4604f 265
64d5fb6a 266/* Generic hook that takes three trees and returns the last one as is. */
0fb2666c 267tree
64d5fb6a 268hook_tree_tree_tree_tree_3rd_identity (tree a ATTRIBUTE_UNUSED,
269 tree b ATTRIBUTE_UNUSED, tree c)
0fb2666c 270{
64d5fb6a 271 return c;
0fb2666c 272}
333715c2 273
274/* Generic hook that takes a tree and returns a NULL string. */
275const char *
a9f1838b 276hook_constcharptr_const_tree_null (const_tree t ATTRIBUTE_UNUSED)
333715c2 277{
278 return NULL;
279}
60284f2b 280
e174638f 281tree
282hook_tree_tree_tree_bool_null (tree t0 ATTRIBUTE_UNUSED,
283 tree t1 ATTRIBUTE_UNUSED,
0ab8af67 284 bool ignore ATTRIBUTE_UNUSED)
60284f2b 285{
286 return NULL;
287}
1606e68a 288
1e8e9920 289tree
290hook_tree_tree_tree_null (tree t0 ATTRIBUTE_UNUSED, tree t1 ATTRIBUTE_UNUSED)
291{
292 return NULL;
293}
294
fd6481cf 295tree
296hook_tree_tree_tree_tree_null (tree t0 ATTRIBUTE_UNUSED,
297 tree t1 ATTRIBUTE_UNUSED,
298 tree t2 ATTRIBUTE_UNUSED)
299{
300 return NULL;
301}
302
1606e68a 303/* Generic hook that takes a rtx and returns a NULL string. */
304const char *
a9f1838b 305hook_constcharptr_const_rtx_null (const_rtx r ATTRIBUTE_UNUSED)
1606e68a 306{
307 return NULL;
308}
7a979707 309
310const char *
a9f1838b 311hook_constcharptr_const_tree_const_tree_null (const_tree t0 ATTRIBUTE_UNUSED,
312 const_tree t1 ATTRIBUTE_UNUSED)
7a979707 313{
314 return NULL;
315}
316
317const char *
a9f1838b 318hook_constcharptr_int_const_tree_null (int i ATTRIBUTE_UNUSED,
319 const_tree t0 ATTRIBUTE_UNUSED)
7a979707 320{
321 return NULL;
322}
323
324const char *
a9f1838b 325hook_constcharptr_int_const_tree_const_tree_null (int i ATTRIBUTE_UNUSED,
326 const_tree t0 ATTRIBUTE_UNUSED,
327 const_tree t1 ATTRIBUTE_UNUSED)
7a979707 328{
329 return NULL;
330}