Line data Source code
1 : /* Language-dependent hooks for LTO.
2 : Copyright (C) 2009-2026 Free Software Foundation, Inc.
3 : Contributed by CodeSourcery, Inc.
4 :
5 : This file is part of GCC.
6 :
7 : GCC is free software; you can redistribute it and/or modify it under
8 : the terms of the GNU General Public License as published by the Free
9 : Software Foundation; either version 3, or (at your option) any later
10 : version.
11 :
12 : GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 : WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 : FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 : for more details.
16 :
17 : You should have received a copy of the GNU General Public License
18 : along with GCC; see the file COPYING3. If not see
19 : <http://www.gnu.org/licenses/>. */
20 :
21 : #include "config.h"
22 : #include "system.h"
23 : #include "coretypes.h"
24 : #include "target.h"
25 : #include "function.h"
26 : #include "basic-block.h"
27 : #include "tree.h"
28 : #include "gimple.h"
29 : #include "stringpool.h"
30 : #include "diagnostic-core.h"
31 : #include "stor-layout.h"
32 : #include "langhooks.h"
33 : #include "langhooks-def.h"
34 : #include "debug.h"
35 : #include "lto-tree.h"
36 : #include "lto.h"
37 : #include "lto-common.h"
38 : #include "stringpool.h"
39 : #include "attribs.h"
40 :
41 : /* LTO specific dumps. */
42 : int lto_link_dump_id, decl_merge_dump_id, partition_dump_id;
43 :
44 : static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
45 : static tree handle_leaf_attribute (tree *, tree, tree, int, bool *);
46 : static tree handle_const_attribute (tree *, tree, tree, int, bool *);
47 : static tree handle_malloc_attribute (tree *, tree, tree, int, bool *);
48 : static tree handle_pure_attribute (tree *, tree, tree, int, bool *);
49 : static tree handle_novops_attribute (tree *, tree, tree, int, bool *);
50 : static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
51 : static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
52 : static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
53 : static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
54 : static tree handle_transaction_pure_attribute (tree *, tree, tree, int, bool *);
55 : static tree handle_returns_twice_attribute (tree *, tree, tree, int, bool *);
56 : static tree handle_patchable_function_entry_attribute (tree *, tree, tree,
57 : int, bool *);
58 : static tree ignore_attribute (tree *, tree, tree, int, bool *);
59 :
60 : static tree handle_format_attribute (tree *, tree, tree, int, bool *);
61 : static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *);
62 : static tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
63 : static tree handle_cold_attribute (tree *, tree, tree, int, bool *);
64 :
65 : /* Helper to define attribute exclusions. */
66 : #define ATTR_EXCL(name, function, type, variable) \
67 : { name, function, type, variable }
68 :
69 : /* Define attributes that are mutually exclusive with one another. */
70 : static const struct attribute_spec::exclusions attr_noreturn_exclusions[] =
71 : {
72 : ATTR_EXCL ("noreturn", true, true, true),
73 : ATTR_EXCL ("alloc_align", true, true, true),
74 : ATTR_EXCL ("alloc_size", true, true, true),
75 : ATTR_EXCL ("const", true, true, true),
76 : ATTR_EXCL ("malloc", true, true, true),
77 : ATTR_EXCL ("pure", true, true, true),
78 : ATTR_EXCL ("returns_twice", true, true, true),
79 : ATTR_EXCL ("warn_unused_result", true, true, true),
80 : ATTR_EXCL (NULL, false, false, false),
81 : };
82 :
83 : static const struct attribute_spec::exclusions attr_returns_twice_exclusions[] =
84 : {
85 : ATTR_EXCL ("noreturn", true, true, true),
86 : ATTR_EXCL (NULL, false, false, false),
87 : };
88 :
89 : static const struct attribute_spec::exclusions attr_const_pure_exclusions[] =
90 : {
91 : ATTR_EXCL ("const", true, true, true),
92 : ATTR_EXCL ("noreturn", true, true, true),
93 : ATTR_EXCL ("pure", true, true, true),
94 : ATTR_EXCL (NULL, false, false, false)
95 : };
96 :
97 : /* Table of machine-independent attributes supported in GIMPLE. */
98 : static const attribute_spec lto_gnu_attributes[] =
99 : {
100 : /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
101 : affects_type_identity, handler, exclude } */
102 : { "noreturn", 0, 0, true, false, false, false,
103 : handle_noreturn_attribute,
104 : attr_noreturn_exclusions },
105 : { "leaf", 0, 0, true, false, false, false,
106 : handle_leaf_attribute, NULL },
107 : /* The same comments as for noreturn attributes apply to const ones. */
108 : { "const", 0, 0, true, false, false, false,
109 : handle_const_attribute,
110 : attr_const_pure_exclusions },
111 : { "malloc", 0, 0, true, false, false, false,
112 : handle_malloc_attribute, NULL },
113 : { "pure", 0, 0, true, false, false, false,
114 : handle_pure_attribute,
115 : attr_const_pure_exclusions },
116 : { "no vops", 0, 0, true, false, false, false,
117 : handle_novops_attribute, NULL },
118 : { "nonnull", 0, -1, false, true, true, false,
119 : handle_nonnull_attribute, NULL },
120 : { "nothrow", 0, 0, true, false, false, false,
121 : handle_nothrow_attribute, NULL },
122 : { "patchable_function_entry", 1, 2, true, false, false, false,
123 : handle_patchable_function_entry_attribute,
124 : NULL },
125 : { "returns_twice", 0, 0, true, false, false, false,
126 : handle_returns_twice_attribute,
127 : attr_returns_twice_exclusions },
128 : { "sentinel", 0, 1, false, true, true, false,
129 : handle_sentinel_attribute, NULL },
130 : { "type generic", 0, 0, false, true, true, false,
131 : handle_type_generic_attribute, NULL },
132 : { "cold", 0, 0, false, false, false, false,
133 : handle_cold_attribute, NULL },
134 : { "fn spec", 1, 1, false, true, true, false,
135 : handle_fnspec_attribute, NULL },
136 : { "transaction_pure", 0, 0, false, true, true, false,
137 : handle_transaction_pure_attribute, NULL },
138 : /* For internal use only. The leading '*' both prevents its usage in
139 : source code and signals that it may be overridden by machine tables. */
140 : { "*tm regparm", 0, 0, false, true, true, false,
141 : ignore_attribute, NULL }
142 : };
143 :
144 : static const scoped_attribute_specs lto_gnu_attribute_table =
145 : {
146 : "gnu", { lto_gnu_attributes }
147 : };
148 :
149 : /* Give the specifications for the format attributes, used by C and all
150 : descendants. */
151 :
152 : static const attribute_spec lto_format_attributes[] =
153 : {
154 : /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
155 : affects_type_identity, handler, exclude } */
156 : { "format", 3, 3, false, true, true, false,
157 : handle_format_attribute, NULL },
158 : { "format_arg", 1, 1, false, true, true, false,
159 : handle_format_arg_attribute, NULL },
160 : };
161 :
162 : static const scoped_attribute_specs lto_format_attribute_table =
163 : {
164 : "gnu", { lto_format_attributes }
165 : };
166 :
167 : static const scoped_attribute_specs *const lto_attribute_table[] =
168 : {
169 : <o_gnu_attribute_table,
170 : <o_format_attribute_table
171 : };
172 :
173 : enum built_in_attribute
174 : {
175 : #define DEF_ATTR_NULL_TREE(ENUM) ENUM,
176 : #define DEF_ATTR_INT(ENUM, VALUE) ENUM,
177 : #define DEF_ATTR_STRING(ENUM, VALUE) ENUM,
178 : #define DEF_ATTR_IDENT(ENUM, STRING) ENUM,
179 : #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) ENUM,
180 : #include "builtin-attrs.def"
181 : #undef DEF_ATTR_NULL_TREE
182 : #undef DEF_ATTR_INT
183 : #undef DEF_ATTR_STRING
184 : #undef DEF_ATTR_IDENT
185 : #undef DEF_ATTR_TREE_LIST
186 : ATTR_LAST
187 : };
188 :
189 : static GTY(()) tree built_in_attributes[(int) ATTR_LAST];
190 :
191 : /* Builtin types. */
192 :
193 : enum lto_builtin_type
194 : {
195 : #define DEF_PRIMITIVE_TYPE(NAME, VALUE) NAME,
196 : #define DEF_FUNCTION_TYPE_0(NAME, RETURN) NAME,
197 : #define DEF_FUNCTION_TYPE_1(NAME, RETURN, ARG1) NAME,
198 : #define DEF_FUNCTION_TYPE_2(NAME, RETURN, ARG1, ARG2) NAME,
199 : #define DEF_FUNCTION_TYPE_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
200 : #define DEF_FUNCTION_TYPE_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
201 : #define DEF_FUNCTION_TYPE_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) NAME,
202 : #define DEF_FUNCTION_TYPE_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
203 : ARG6) NAME,
204 : #define DEF_FUNCTION_TYPE_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
205 : ARG6, ARG7) NAME,
206 : #define DEF_FUNCTION_TYPE_8(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
207 : ARG6, ARG7, ARG8) NAME,
208 : #define DEF_FUNCTION_TYPE_9(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
209 : ARG6, ARG7, ARG8, ARG9) NAME,
210 : #define DEF_FUNCTION_TYPE_10(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
211 : ARG6, ARG7, ARG8, ARG9, ARG10) NAME,
212 : #define DEF_FUNCTION_TYPE_11(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
213 : ARG6, ARG7, ARG8, ARG9, ARG10, ARG11) NAME,
214 : #define DEF_FUNCTION_TYPE_VAR_0(NAME, RETURN) NAME,
215 : #define DEF_FUNCTION_TYPE_VAR_1(NAME, RETURN, ARG1) NAME,
216 : #define DEF_FUNCTION_TYPE_VAR_2(NAME, RETURN, ARG1, ARG2) NAME,
217 : #define DEF_FUNCTION_TYPE_VAR_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
218 : #define DEF_FUNCTION_TYPE_VAR_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
219 : #define DEF_FUNCTION_TYPE_VAR_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG6) \
220 : NAME,
221 : #define DEF_FUNCTION_TYPE_VAR_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
222 : ARG6) NAME,
223 : #define DEF_FUNCTION_TYPE_VAR_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
224 : ARG6, ARG7) NAME,
225 : #define DEF_POINTER_TYPE(NAME, TYPE) NAME,
226 : #include "builtin-types.def"
227 : #undef DEF_PRIMITIVE_TYPE
228 : #undef DEF_FUNCTION_TYPE_0
229 : #undef DEF_FUNCTION_TYPE_1
230 : #undef DEF_FUNCTION_TYPE_2
231 : #undef DEF_FUNCTION_TYPE_3
232 : #undef DEF_FUNCTION_TYPE_4
233 : #undef DEF_FUNCTION_TYPE_5
234 : #undef DEF_FUNCTION_TYPE_6
235 : #undef DEF_FUNCTION_TYPE_7
236 : #undef DEF_FUNCTION_TYPE_8
237 : #undef DEF_FUNCTION_TYPE_9
238 : #undef DEF_FUNCTION_TYPE_10
239 : #undef DEF_FUNCTION_TYPE_11
240 : #undef DEF_FUNCTION_TYPE_VAR_0
241 : #undef DEF_FUNCTION_TYPE_VAR_1
242 : #undef DEF_FUNCTION_TYPE_VAR_2
243 : #undef DEF_FUNCTION_TYPE_VAR_3
244 : #undef DEF_FUNCTION_TYPE_VAR_4
245 : #undef DEF_FUNCTION_TYPE_VAR_5
246 : #undef DEF_FUNCTION_TYPE_VAR_6
247 : #undef DEF_FUNCTION_TYPE_VAR_7
248 : #undef DEF_POINTER_TYPE
249 : BT_LAST
250 : };
251 :
252 : typedef enum lto_builtin_type builtin_type;
253 :
254 : static GTY(()) tree builtin_types[(int) BT_LAST + 1];
255 :
256 : static GTY(()) tree string_type_node;
257 : static GTY(()) tree const_string_type_node;
258 : static GTY(()) tree wint_type_node;
259 : static GTY(()) tree intmax_type_node;
260 : static GTY(()) tree uintmax_type_node;
261 : static GTY(()) tree signed_size_type_node;
262 :
263 : /* Flags needed to process builtins.def. */
264 : int flag_isoc94;
265 : int flag_isoc99;
266 : int flag_isoc11;
267 : int flag_isoc23;
268 : int flag_isoc2y;
269 :
270 : /* Attribute handlers. */
271 :
272 : /* Handle a "noreturn" attribute; arguments as in
273 : struct attribute_spec.handler. */
274 :
275 : static tree
276 360519 : handle_noreturn_attribute (tree *node, tree ARG_UNUSED (name),
277 : tree ARG_UNUSED (args), int ARG_UNUSED (flags),
278 : bool * ARG_UNUSED (no_add_attrs))
279 : {
280 360519 : tree type = TREE_TYPE (*node);
281 :
282 360519 : if (TREE_CODE (*node) == FUNCTION_DECL)
283 360519 : TREE_THIS_VOLATILE (*node) = 1;
284 0 : else if (TREE_CODE (type) == POINTER_TYPE
285 0 : && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
286 0 : TREE_TYPE (*node)
287 0 : = build_pointer_type
288 0 : (build_type_variant (TREE_TYPE (type),
289 : TYPE_READONLY (TREE_TYPE (type)), 1));
290 : else
291 0 : gcc_unreachable ();
292 :
293 360519 : return NULL_TREE;
294 : }
295 :
296 : /* Handle a "leaf" attribute; arguments as in
297 : struct attribute_spec.handler. */
298 :
299 : static tree
300 36724547 : handle_leaf_attribute (tree *node, tree name,
301 : tree ARG_UNUSED (args),
302 : int ARG_UNUSED (flags), bool *no_add_attrs)
303 : {
304 36724547 : if (TREE_CODE (*node) != FUNCTION_DECL)
305 : {
306 0 : warning (OPT_Wattributes, "%qE attribute ignored", name);
307 0 : *no_add_attrs = true;
308 : }
309 36724547 : if (!TREE_PUBLIC (*node))
310 : {
311 0 : warning (OPT_Wattributes, "%qE attribute has no effect on unit local functions", name);
312 0 : *no_add_attrs = true;
313 : }
314 :
315 36724547 : return NULL_TREE;
316 : }
317 :
318 : /* Handle a "const" attribute; arguments as in
319 : struct attribute_spec.handler. */
320 :
321 : static tree
322 15351500 : handle_const_attribute (tree *node, tree ARG_UNUSED (name),
323 : tree ARG_UNUSED (args), int ARG_UNUSED (flags),
324 : bool * ARG_UNUSED (no_add_attrs))
325 : {
326 15351500 : if (TREE_CODE (*node) != FUNCTION_DECL
327 15351500 : || !fndecl_built_in_p (*node))
328 0 : inform (UNKNOWN_LOCATION, "%s:%s: %E: %E", __FILE__, __func__, *node, name);
329 :
330 15351500 : tree type = TREE_TYPE (*node);
331 :
332 : /* See FIXME comment on noreturn in c_common_attribute_table. */
333 15351500 : if (TREE_CODE (*node) == FUNCTION_DECL)
334 15351500 : TREE_READONLY (*node) = 1;
335 0 : else if (TREE_CODE (type) == POINTER_TYPE
336 0 : && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
337 0 : TREE_TYPE (*node)
338 0 : = build_pointer_type
339 0 : (build_type_variant (TREE_TYPE (type), 1,
340 : TREE_THIS_VOLATILE (TREE_TYPE (type))));
341 : else
342 0 : gcc_unreachable ();
343 :
344 15351500 : return NULL_TREE;
345 : }
346 :
347 :
348 : /* Handle a "malloc" attribute; arguments as in
349 : struct attribute_spec.handler. */
350 :
351 : static tree
352 244975 : handle_malloc_attribute (tree *node, tree ARG_UNUSED (name),
353 : tree ARG_UNUSED (args), int ARG_UNUSED (flags),
354 : bool * ARG_UNUSED (no_add_attrs))
355 : {
356 244975 : if (TREE_CODE (*node) == FUNCTION_DECL
357 244975 : && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (*node))))
358 244975 : DECL_IS_MALLOC (*node) = 1;
359 : else
360 0 : gcc_unreachable ();
361 :
362 244975 : return NULL_TREE;
363 : }
364 :
365 :
366 : /* Handle a "pure" attribute; arguments as in
367 : struct attribute_spec.handler. */
368 :
369 : static tree
370 1864268 : handle_pure_attribute (tree *node, tree ARG_UNUSED (name),
371 : tree ARG_UNUSED (args), int ARG_UNUSED (flags),
372 : bool * ARG_UNUSED (no_add_attrs))
373 : {
374 1864268 : if (TREE_CODE (*node) == FUNCTION_DECL)
375 1864268 : DECL_PURE_P (*node) = 1;
376 : else
377 0 : gcc_unreachable ();
378 :
379 1864268 : return NULL_TREE;
380 : }
381 :
382 :
383 : /* Handle a "no vops" attribute; arguments as in
384 : struct attribute_spec.handler. */
385 :
386 : static tree
387 163136 : handle_novops_attribute (tree *node, tree ARG_UNUSED (name),
388 : tree ARG_UNUSED (args), int ARG_UNUSED (flags),
389 : bool *ARG_UNUSED (no_add_attrs))
390 : {
391 163136 : gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
392 163136 : DECL_IS_NOVOPS (*node) = 1;
393 163136 : return NULL_TREE;
394 : }
395 :
396 :
397 : /* Helper for nonnull attribute handling; fetch the operand number
398 : from the attribute argument list. */
399 :
400 : static bool
401 1712928 : get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp)
402 : {
403 : /* Verify the arg number is a constant. */
404 1712928 : if (!tree_fits_uhwi_p (arg_num_expr))
405 : return false;
406 :
407 1712928 : *valp = TREE_INT_CST_LOW (arg_num_expr);
408 1712928 : return true;
409 : }
410 :
411 : /* Handle the "nonnull" attribute. */
412 :
413 : static tree
414 3711344 : handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
415 : tree args, int ARG_UNUSED (flags),
416 : bool * ARG_UNUSED (no_add_attrs))
417 : {
418 3711344 : tree type = *node;
419 :
420 : /* If no arguments are specified, all pointer arguments should be
421 : non-null. Verify a full prototype is given so that the arguments
422 : will have the correct types when we actually check them later.
423 : Avoid diagnosing type-generic built-ins since those have no
424 : prototype. */
425 3711344 : if (!args)
426 : {
427 2365472 : gcc_assert (prototype_p (type)
428 : || !TYPE_ATTRIBUTES (type)
429 : || lookup_attribute ("type generic", TYPE_ATTRIBUTES (type)));
430 :
431 2365472 : return NULL_TREE;
432 : }
433 :
434 : /* Argument list specified. Verify that each argument number references
435 : a pointer argument. */
436 3058800 : for (; args; args = TREE_CHAIN (args))
437 : {
438 1712928 : tree argument;
439 1712928 : unsigned HOST_WIDE_INT arg_num = 0, ck_num;
440 :
441 1712928 : if (!get_nonnull_operand (TREE_VALUE (args), &arg_num))
442 0 : gcc_unreachable ();
443 :
444 1712928 : argument = TYPE_ARG_TYPES (type);
445 1712928 : if (argument)
446 : {
447 1835280 : for (ck_num = 1; ; ck_num++)
448 : {
449 3548208 : if (!argument || ck_num == arg_num)
450 : break;
451 1835280 : argument = TREE_CHAIN (argument);
452 : }
453 :
454 1712928 : gcc_assert (argument
455 : && TREE_CODE (TREE_VALUE (argument)) == POINTER_TYPE);
456 : }
457 : }
458 :
459 : return NULL_TREE;
460 : }
461 :
462 :
463 : /* Handle a "nothrow" attribute; arguments as in
464 : struct attribute_spec.handler. */
465 :
466 : static tree
467 37920748 : handle_nothrow_attribute (tree *node, tree ARG_UNUSED (name),
468 : tree ARG_UNUSED (args), int ARG_UNUSED (flags),
469 : bool * ARG_UNUSED (no_add_attrs))
470 : {
471 37920748 : if (TREE_CODE (*node) == FUNCTION_DECL)
472 37920748 : TREE_NOTHROW (*node) = 1;
473 : else
474 0 : gcc_unreachable ();
475 :
476 37920748 : return NULL_TREE;
477 : }
478 :
479 :
480 : /* Handle a "sentinel" attribute. */
481 :
482 : static tree
483 122352 : handle_sentinel_attribute (tree *node, tree ARG_UNUSED (name), tree args,
484 : int ARG_UNUSED (flags),
485 : bool * ARG_UNUSED (no_add_attrs))
486 : {
487 122352 : gcc_assert (stdarg_p (*node));
488 :
489 122352 : if (args)
490 : {
491 40784 : tree position = TREE_VALUE (args);
492 40784 : gcc_assert (TREE_CODE (position) == INTEGER_CST);
493 40784 : if (tree_int_cst_lt (position, integer_zero_node))
494 0 : gcc_unreachable ();
495 : }
496 :
497 122352 : return NULL_TREE;
498 : }
499 :
500 : /* Handle a "type_generic" attribute. */
501 :
502 : static tree
503 632152 : handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
504 : tree ARG_UNUSED (args), int ARG_UNUSED (flags),
505 : bool * ARG_UNUSED (no_add_attrs))
506 : {
507 : /* Ensure we have a function type. */
508 632152 : gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
509 :
510 : /* Ensure we have a variadic function. */
511 632152 : gcc_assert (!prototype_p (*node) || stdarg_p (*node));
512 :
513 632152 : return NULL_TREE;
514 : }
515 :
516 : /* Handle a "transaction_pure" attribute. */
517 :
518 : static tree
519 231676 : handle_transaction_pure_attribute (tree *node, tree ARG_UNUSED (name),
520 : tree ARG_UNUSED (args),
521 : int ARG_UNUSED (flags),
522 : bool * ARG_UNUSED (no_add_attrs))
523 : {
524 : /* Ensure we have a function type. */
525 231676 : gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
526 :
527 231676 : return NULL_TREE;
528 : }
529 :
530 : /* Handle a "returns_twice" attribute. */
531 :
532 : static tree
533 20394 : handle_returns_twice_attribute (tree *node, tree ARG_UNUSED (name),
534 : tree ARG_UNUSED (args),
535 : int ARG_UNUSED (flags),
536 : bool * ARG_UNUSED (no_add_attrs))
537 : {
538 20394 : gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
539 :
540 20394 : DECL_IS_RETURNS_TWICE (*node) = 1;
541 :
542 20394 : return NULL_TREE;
543 : }
544 :
545 : static tree
546 0 : handle_patchable_function_entry_attribute (tree *, tree, tree, int, bool *)
547 : {
548 : /* Nothing to be done here. */
549 0 : return NULL_TREE;
550 : }
551 :
552 : /* Ignore the given attribute. Used when this attribute may be usefully
553 : overridden by the target, but is not used generically. */
554 :
555 : static tree
556 0 : ignore_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
557 : tree ARG_UNUSED (args), int ARG_UNUSED (flags),
558 : bool *no_add_attrs)
559 : {
560 0 : *no_add_attrs = true;
561 0 : return NULL_TREE;
562 : }
563 :
564 : /* Handle a "format" attribute; arguments as in
565 : struct attribute_spec.handler. */
566 :
567 : static tree
568 1060384 : handle_format_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
569 : tree ARG_UNUSED (args), int ARG_UNUSED (flags),
570 : bool *no_add_attrs)
571 : {
572 1060384 : *no_add_attrs = true;
573 1060384 : return NULL_TREE;
574 : }
575 :
576 :
577 : /* Handle a "format_arg" attribute; arguments as in
578 : struct attribute_spec.handler. */
579 :
580 : tree
581 122352 : handle_format_arg_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
582 : tree ARG_UNUSED (args), int ARG_UNUSED (flags),
583 : bool *no_add_attrs)
584 : {
585 122352 : *no_add_attrs = true;
586 122352 : return NULL_TREE;
587 : }
588 :
589 :
590 : /* Handle a "fn spec" attribute; arguments as in
591 : struct attribute_spec.handler. */
592 :
593 : static tree
594 10828400 : handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name),
595 : tree args, int ARG_UNUSED (flags),
596 : bool *no_add_attrs ATTRIBUTE_UNUSED)
597 : {
598 21656800 : gcc_assert (args
599 : && TREE_CODE (TREE_VALUE (args)) == STRING_CST
600 : && !TREE_CHAIN (args));
601 10828400 : return NULL_TREE;
602 : }
603 :
604 : /* Handle a "cold" attribute; arguments as in
605 : struct attribute_spec.handler. */
606 :
607 : static tree
608 187301 : handle_cold_attribute (tree *, tree, tree, int, bool *)
609 : {
610 : /* Nothing to be done here. */
611 187301 : return NULL_TREE;
612 : }
613 :
614 : /* Cribbed from c-common.cc. */
615 :
616 : static void
617 10277568 : def_fn_type (builtin_type def, builtin_type ret, bool var, int n, ...)
618 : {
619 10277568 : tree t;
620 10277568 : tree *args = XALLOCAVEC (tree, n);
621 10277568 : va_list list;
622 10277568 : int i;
623 10277568 : bool err = false;
624 :
625 10277568 : va_start (list, n);
626 33055432 : for (i = 0; i < n; ++i)
627 : {
628 22777864 : builtin_type a = (builtin_type) va_arg (list, int);
629 22777864 : t = builtin_types[a];
630 22777864 : if (t == error_mark_node)
631 407840 : err = true;
632 22777864 : args[i] = t;
633 : }
634 10277568 : va_end (list);
635 :
636 10277568 : t = builtin_types[ret];
637 10277568 : if (err)
638 285488 : t = error_mark_node;
639 10277568 : if (t == error_mark_node)
640 : ;
641 9951296 : else if (var)
642 611760 : t = build_varargs_function_type_array (t, n, args);
643 : else
644 9339536 : t = build_function_type_array (t, n, args);
645 :
646 10277568 : builtin_types[def] = t;
647 10277568 : }
648 :
649 : /* Used to help initialize the builtin-types.def table. When a type of
650 : the correct size doesn't exist, use error_mark_node instead of NULL.
651 : The later results in segfaults even when a decl using the type doesn't
652 : get invoked. */
653 :
654 : static tree
655 101960 : builtin_type_for_size (int size, bool unsignedp)
656 : {
657 101960 : tree type = lang_hooks.types.type_for_size (size, unsignedp);
658 101960 : return type ? type : error_mark_node;
659 : }
660 :
661 : /* Support for DEF_BUILTIN. */
662 :
663 : static void
664 30871227 : def_builtin_1 (enum built_in_function fncode, const char *name,
665 : enum built_in_class fnclass, tree fntype, tree libtype,
666 : bool both_p, bool fallback_p, bool nonansi_p,
667 : tree fnattrs, bool implicit_p)
668 : {
669 30871227 : tree decl;
670 30871227 : const char *libname;
671 :
672 30871227 : if (fntype == error_mark_node)
673 : return;
674 :
675 29117515 : libname = name + strlen ("__builtin_");
676 37601727 : decl = add_builtin_function (name, fntype, fncode, fnclass,
677 : (fallback_p ? libname : NULL),
678 : fnattrs);
679 :
680 29117515 : if (both_p
681 10419108 : && !flag_no_builtin
682 10419108 : && !(nonansi_p && flag_no_nonansi_builtin))
683 10419108 : add_builtin_function (libname, libtype, fncode, fnclass,
684 : NULL, fnattrs);
685 :
686 29117515 : set_builtin_decl (fncode, decl, implicit_p);
687 : }
688 :
689 :
690 : /* Initialize the attribute table for all the supported builtins. */
691 :
692 : static void
693 20392 : lto_init_attributes (void)
694 : {
695 : /* Fill in the built_in_attributes array. */
696 : #define DEF_ATTR_NULL_TREE(ENUM) \
697 : built_in_attributes[(int) ENUM] = NULL_TREE;
698 : #define DEF_ATTR_INT(ENUM, VALUE) \
699 : built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE);
700 : #define DEF_ATTR_STRING(ENUM, VALUE) \
701 : built_in_attributes[(int) ENUM] = build_string (strlen (VALUE), VALUE);
702 : #define DEF_ATTR_IDENT(ENUM, STRING) \
703 : built_in_attributes[(int) ENUM] = get_identifier (STRING);
704 : #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) \
705 : built_in_attributes[(int) ENUM] \
706 : = tree_cons (built_in_attributes[(int) PURPOSE], \
707 : built_in_attributes[(int) VALUE], \
708 : built_in_attributes[(int) CHAIN]);
709 : #include "builtin-attrs.def"
710 : #undef DEF_ATTR_NULL_TREE
711 : #undef DEF_ATTR_INT
712 : #undef DEF_ATTR_STRING
713 : #undef DEF_ATTR_IDENT
714 : #undef DEF_ATTR_TREE_LIST
715 20392 : }
716 :
717 : /* Create builtin types and functions. VA_LIST_REF_TYPE_NODE and
718 : VA_LIST_ARG_TYPE_NODE are used in builtin-types.def. */
719 :
720 : static void
721 20392 : lto_define_builtins (tree va_list_ref_type_node ATTRIBUTE_UNUSED,
722 : tree va_list_arg_type_node ATTRIBUTE_UNUSED)
723 : {
724 : #define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
725 : builtin_types[ENUM] = VALUE;
726 : #define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \
727 : def_fn_type (ENUM, RETURN, 0, 0);
728 : #define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1) \
729 : def_fn_type (ENUM, RETURN, 0, 1, ARG1);
730 : #define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \
731 : def_fn_type (ENUM, RETURN, 0, 2, ARG1, ARG2);
732 : #define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
733 : def_fn_type (ENUM, RETURN, 0, 3, ARG1, ARG2, ARG3);
734 : #define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
735 : def_fn_type (ENUM, RETURN, 0, 4, ARG1, ARG2, ARG3, ARG4);
736 : #define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
737 : def_fn_type (ENUM, RETURN, 0, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
738 : #define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
739 : ARG6) \
740 : def_fn_type (ENUM, RETURN, 0, 6, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
741 : #define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
742 : ARG6, ARG7) \
743 : def_fn_type (ENUM, RETURN, 0, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7);
744 : #define DEF_FUNCTION_TYPE_8(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
745 : ARG6, ARG7, ARG8) \
746 : def_fn_type (ENUM, RETURN, 0, 8, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, \
747 : ARG7, ARG8);
748 : #define DEF_FUNCTION_TYPE_9(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
749 : ARG6, ARG7, ARG8, ARG9) \
750 : def_fn_type (ENUM, RETURN, 0, 9, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, \
751 : ARG7, ARG8, ARG9);
752 : #define DEF_FUNCTION_TYPE_10(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
753 : ARG6, ARG7, ARG8, ARG9, ARG10) \
754 : def_fn_type (ENUM, RETURN, 0, 10, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, \
755 : ARG7, ARG8, ARG9, ARG10);
756 : #define DEF_FUNCTION_TYPE_11(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
757 : ARG6, ARG7, ARG8, ARG9, ARG10, ARG11) \
758 : def_fn_type (ENUM, RETURN, 0, 11, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, \
759 : ARG7, ARG8, ARG9, ARG10, ARG11);
760 : #define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \
761 : def_fn_type (ENUM, RETURN, 1, 0);
762 : #define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \
763 : def_fn_type (ENUM, RETURN, 1, 1, ARG1);
764 : #define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2) \
765 : def_fn_type (ENUM, RETURN, 1, 2, ARG1, ARG2);
766 : #define DEF_FUNCTION_TYPE_VAR_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
767 : def_fn_type (ENUM, RETURN, 1, 3, ARG1, ARG2, ARG3);
768 : #define DEF_FUNCTION_TYPE_VAR_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
769 : def_fn_type (ENUM, RETURN, 1, 4, ARG1, ARG2, ARG3, ARG4);
770 : #define DEF_FUNCTION_TYPE_VAR_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
771 : def_fn_type (ENUM, RETURN, 1, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
772 : #define DEF_FUNCTION_TYPE_VAR_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
773 : ARG6) \
774 : def_fn_type (ENUM, RETURN, 1, 6, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
775 : #define DEF_FUNCTION_TYPE_VAR_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
776 : ARG6, ARG7) \
777 : def_fn_type (ENUM, RETURN, 1, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7);
778 : #define DEF_POINTER_TYPE(ENUM, TYPE) \
779 : builtin_types[(int) ENUM] = build_pointer_type (builtin_types[(int) TYPE]);
780 :
781 : #include "builtin-types.def"
782 :
783 : #undef DEF_PRIMITIVE_TYPE
784 : #undef DEF_FUNCTION_TYPE_0
785 : #undef DEF_FUNCTION_TYPE_1
786 : #undef DEF_FUNCTION_TYPE_2
787 : #undef DEF_FUNCTION_TYPE_3
788 : #undef DEF_FUNCTION_TYPE_4
789 : #undef DEF_FUNCTION_TYPE_5
790 : #undef DEF_FUNCTION_TYPE_6
791 : #undef DEF_FUNCTION_TYPE_7
792 : #undef DEF_FUNCTION_TYPE_8
793 : #undef DEF_FUNCTION_TYPE_9
794 : #undef DEF_FUNCTION_TYPE_10
795 : #undef DEF_FUNCTION_TYPE_11
796 : #undef DEF_FUNCTION_TYPE_VAR_0
797 : #undef DEF_FUNCTION_TYPE_VAR_1
798 : #undef DEF_FUNCTION_TYPE_VAR_2
799 : #undef DEF_FUNCTION_TYPE_VAR_3
800 : #undef DEF_FUNCTION_TYPE_VAR_4
801 : #undef DEF_FUNCTION_TYPE_VAR_5
802 : #undef DEF_FUNCTION_TYPE_VAR_6
803 : #undef DEF_FUNCTION_TYPE_VAR_7
804 : #undef DEF_POINTER_TYPE
805 20392 : builtin_types[(int) BT_LAST] = NULL_TREE;
806 :
807 20392 : lto_init_attributes ();
808 :
809 : #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, FALLBACK_P,\
810 : NONANSI_P, ATTRS, IMPLICIT, COND) \
811 : if (NAME && COND) \
812 : def_builtin_1 (ENUM, NAME, CLASS, builtin_types[(int) TYPE], \
813 : builtin_types[(int) LIBTYPE], BOTH_P, FALLBACK_P, \
814 : NONANSI_P, built_in_attributes[(int) ATTRS], IMPLICIT);
815 : #include "builtins.def"
816 20392 : }
817 :
818 : static GTY(()) tree registered_builtin_types;
819 :
820 : /* Language hooks. */
821 :
822 : static bool
823 0 : lto_complain_wrong_lang_p (const struct cl_option *option ATTRIBUTE_UNUSED)
824 : {
825 : /* The LTO front end inherits all the options from the first front
826 : end that was used. However, not all the original front end
827 : options make sense in LTO.
828 :
829 : A real solution would be to filter this in collect2, but collect2
830 : does not have access to all the option attributes to know what to
831 : filter. So, in lto1 we silently accept inherited flags and do
832 : nothing about it. */
833 0 : return false;
834 : }
835 :
836 : static void
837 20448 : lto_init_options_struct (struct gcc_options *opts)
838 : {
839 : /* By default, C99-like requirements for complex multiply and divide.
840 : ??? Until the complex method is encoded in the IL this is the only
841 : safe choice. This will pessimize Fortran code with LTO unless
842 : people specify a complex method manually or use -ffast-math. */
843 20448 : opts->x_flag_complex_method = 2;
844 20448 : }
845 :
846 : /* Handle command-line option SCODE. If the option takes an argument, it is
847 : stored in ARG, which is otherwise NULL. VALUE holds either a numerical
848 : argument or a binary value indicating whether the positive or negative form
849 : of the option was supplied. */
850 :
851 : const char *resolution_file_name;
852 : static bool
853 81085 : lto_handle_option (size_t scode, const char *arg,
854 : HOST_WIDE_INT value ATTRIBUTE_UNUSED,
855 : int kind ATTRIBUTE_UNUSED,
856 : location_t loc ATTRIBUTE_UNUSED,
857 : const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
858 : {
859 81085 : enum opt_code code = (enum opt_code) scode;
860 81085 : bool result = true;
861 :
862 81085 : switch (code)
863 : {
864 7846 : case OPT_fresolution_:
865 7846 : resolution_file_name = arg;
866 7846 : break;
867 :
868 0 : case OPT_Wabi:
869 0 : warn_psabi = value;
870 0 : break;
871 :
872 78 : case OPT_fwpa:
873 78 : flag_wpa = value ? "" : NULL;
874 78 : break;
875 :
876 : default:
877 : break;
878 : }
879 :
880 81085 : return result;
881 : }
882 :
883 : /* Perform post-option processing. Does additional initialization based on
884 : command-line options. PFILENAME is the main input filename. Returns false
885 : to enable subsequent back-end initialization. */
886 :
887 : static bool
888 20392 : lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
889 : {
890 : /* -fltrans and -fwpa are mutually exclusive. Check for that here. */
891 20392 : if (flag_wpa && flag_ltrans)
892 0 : error ("%<-fwpa%> and %<-fltrans%> are mutually exclusive");
893 :
894 20392 : if (flag_ltrans)
895 : {
896 8190 : flag_generate_lto = 0;
897 :
898 : /* During LTRANS, we are not looking at the whole program, only
899 : a subset of the whole callgraph. */
900 8190 : flag_whole_program = 0;
901 : }
902 :
903 20392 : if (flag_wpa)
904 7817 : flag_generate_lto = 1;
905 :
906 : /* Initialize the codegen flags according to the output type. */
907 20392 : switch (flag_lto_linker_output)
908 : {
909 33 : case LTO_LINKER_OUTPUT_REL: /* .o: incremental link producing LTO IL */
910 : /* Configure compiler same way as normal frontend would do with -flto:
911 : this way we read the trees (declarations & types), symbol table,
912 : optimization summaries and link them. Subsequently we output new LTO
913 : file. */
914 33 : flag_lto = "";
915 33 : flag_incremental_link = INCREMENTAL_LINK_LTO;
916 33 : flag_whole_program = 0;
917 33 : flag_wpa = 0;
918 33 : flag_generate_lto = 1;
919 : /* It would be cool to produce .o file directly, but our current
920 : simple objects does not contain the lto symbol markers. Go the slow
921 : way through the asm file. */
922 33 : lang_hooks.lto.begin_section = lhd_begin_section;
923 33 : lang_hooks.lto.append_data = lhd_append_data;
924 33 : lang_hooks.lto.end_section = lhd_end_section;
925 33 : if (flag_ltrans)
926 0 : error ("%<-flinker-output=rel%> and %<-fltrans%> are mutually "
927 : "exclusive");
928 : break;
929 :
930 256 : case LTO_LINKER_OUTPUT_NOLTOREL: /* .o: incremental link producing asm */
931 256 : flag_incremental_link = INCREMENTAL_LINK_NOLTO;
932 256 : break;
933 :
934 : case LTO_LINKER_OUTPUT_DYN: /* .so: PID library */
935 : /* On some targets, like i386 it makes sense to build PIC library wihout
936 : -fpic for performance reasons. So no need to adjust flags. */
937 : break;
938 :
939 0 : case LTO_LINKER_OUTPUT_PIE: /* PIE binary */
940 : /* If -fPIC or -fPIE was used at compile time, be sure that
941 : flag_pie is 2. */
942 0 : flag_pie = MAX (flag_pie, flag_pic);
943 0 : flag_pic = flag_pie;
944 0 : flag_shlib = 0;
945 0 : break;
946 :
947 7671 : case LTO_LINKER_OUTPUT_EXEC: /* Normal executable */
948 7671 : flag_pic = 0;
949 7671 : flag_pie = 0;
950 7671 : flag_shlib = 0;
951 7671 : break;
952 :
953 : case LTO_LINKER_OUTPUT_UNKNOWN:
954 : break;
955 : }
956 :
957 : /* Excess precision other than "fast" requires front-end
958 : support. */
959 20392 : if (flag_excess_precision == EXCESS_PRECISION_DEFAULT)
960 20250 : flag_excess_precision = EXCESS_PRECISION_FAST;
961 :
962 : /* When partitioning, we can tear appart STRING_CSTs uses from the same
963 : TU into multiple partitions. Without constant merging the constants
964 : might not be equal at runtime. See PR50199. */
965 20392 : if (!flag_merge_constants)
966 3929 : flag_merge_constants = 1;
967 :
968 : /* Initialize the compiler back end. */
969 20392 : return false;
970 : }
971 :
972 : /* Return a data type that has machine mode MODE.
973 : If the mode is an integer,
974 : then UNSIGNEDP selects between signed and unsigned types.
975 : If the mode is a fixed-point mode,
976 : then UNSIGNEDP selects between saturating and nonsaturating types. */
977 :
978 : static tree
979 278863 : lto_type_for_mode (machine_mode mode, int unsigned_p)
980 : {
981 278863 : tree t;
982 278863 : int i;
983 :
984 278863 : if (mode == TYPE_MODE (integer_type_node))
985 7837 : return unsigned_p ? unsigned_type_node : integer_type_node;
986 :
987 271026 : if (mode == TYPE_MODE (signed_char_type_node))
988 684 : return unsigned_p ? unsigned_char_type_node : signed_char_type_node;
989 :
990 270342 : if (mode == TYPE_MODE (short_integer_type_node))
991 3244 : return unsigned_p ? short_unsigned_type_node : short_integer_type_node;
992 :
993 267098 : if (mode == TYPE_MODE (long_integer_type_node))
994 116966 : return unsigned_p ? long_unsigned_type_node : long_integer_type_node;
995 :
996 150132 : if (mode == TYPE_MODE (long_long_integer_type_node))
997 0 : return unsigned_p ? long_long_unsigned_type_node : long_long_integer_type_node;
998 :
999 299423 : for (i = 0; i < NUM_INT_N_ENTS; i ++)
1000 150132 : if (int_n_enabled_p[i]
1001 150132 : && mode == int_n_data[i].m)
1002 841 : return (unsigned_p ? int_n_trees[i].unsigned_type
1003 841 : : int_n_trees[i].signed_type);
1004 :
1005 149291 : if (mode == QImode)
1006 0 : return unsigned_p ? unsigned_intQI_type_node : intQI_type_node;
1007 :
1008 149291 : if (mode == HImode)
1009 0 : return unsigned_p ? unsigned_intHI_type_node : intHI_type_node;
1010 :
1011 149291 : if (mode == SImode)
1012 0 : return unsigned_p ? unsigned_intSI_type_node : intSI_type_node;
1013 :
1014 149291 : if (mode == DImode)
1015 0 : return unsigned_p ? unsigned_intDI_type_node : intDI_type_node;
1016 :
1017 : #if HOST_BITS_PER_WIDE_INT >= 64
1018 149291 : if (mode == TYPE_MODE (intTI_type_node))
1019 0 : return unsigned_p ? unsigned_intTI_type_node : intTI_type_node;
1020 : #endif
1021 :
1022 149291 : if (float16_type_node && mode == TYPE_MODE (float16_type_node))
1023 453 : return float16_type_node;
1024 :
1025 148838 : if (mode == TYPE_MODE (float_type_node))
1026 2752 : return float_type_node;
1027 :
1028 146086 : if (mode == TYPE_MODE (double_type_node))
1029 789 : return double_type_node;
1030 :
1031 145297 : if (mode == TYPE_MODE (long_double_type_node))
1032 548 : return long_double_type_node;
1033 :
1034 1153652 : for (i = 0; i < NUM_FLOATN_NX_TYPES; i++)
1035 1009988 : if (FLOATN_NX_TYPE_NODE (i) != NULL_TREE
1036 1009988 : && mode == TYPE_MODE (FLOATN_NX_TYPE_NODE (i)))
1037 1085 : return FLOATN_NX_TYPE_NODE (i);
1038 :
1039 143664 : if (mode == TYPE_MODE (void_type_node))
1040 0 : return void_type_node;
1041 :
1042 143664 : if (mode == TYPE_MODE (build_pointer_type (char_type_node))
1043 143664 : || mode == TYPE_MODE (build_pointer_type (integer_type_node)))
1044 : {
1045 0 : unsigned int precision
1046 0 : = GET_MODE_PRECISION (as_a <scalar_int_mode> (mode));
1047 0 : return (unsigned_p
1048 0 : ? make_unsigned_type (precision)
1049 0 : : make_signed_type (precision));
1050 : }
1051 :
1052 143664 : if (COMPLEX_MODE_P (mode))
1053 : {
1054 122378 : machine_mode inner_mode;
1055 122378 : tree inner_type;
1056 :
1057 122378 : if (mode == TYPE_MODE (complex_float_type_node))
1058 20417 : return complex_float_type_node;
1059 101961 : if (mode == TYPE_MODE (complex_double_type_node))
1060 20392 : return complex_double_type_node;
1061 81569 : if (mode == TYPE_MODE (complex_long_double_type_node))
1062 20392 : return complex_long_double_type_node;
1063 :
1064 265097 : for (i = 0; i < NUM_FLOATN_NX_TYPES; i++)
1065 244705 : if (COMPLEX_FLOATN_NX_TYPE_NODE (i) != NULL_TREE
1066 244705 : && mode == TYPE_MODE (COMPLEX_FLOATN_NX_TYPE_NODE (i)))
1067 40785 : return COMPLEX_FLOATN_NX_TYPE_NODE (i);
1068 :
1069 20392 : if (mode == TYPE_MODE (complex_integer_type_node) && !unsigned_p)
1070 0 : return complex_integer_type_node;
1071 :
1072 20392 : inner_mode = GET_MODE_INNER (mode);
1073 20392 : inner_type = lto_type_for_mode (inner_mode, unsigned_p);
1074 20392 : if (inner_type != NULL_TREE)
1075 20392 : return build_complex_type (inner_type);
1076 : }
1077 21286 : else if (GET_MODE_CLASS (mode) == MODE_VECTOR_BOOL
1078 21286 : && valid_vector_subparts_p (GET_MODE_NUNITS (mode)))
1079 : {
1080 0 : unsigned int elem_bits = vector_element_size (GET_MODE_PRECISION (mode),
1081 : GET_MODE_NUNITS (mode));
1082 0 : tree bool_type = build_nonstandard_boolean_type (elem_bits);
1083 0 : return build_vector_type_for_mode (bool_type, mode);
1084 : }
1085 20787 : else if (VECTOR_MODE_P (mode)
1086 21785 : && valid_vector_subparts_p (GET_MODE_NUNITS (mode)))
1087 : {
1088 499 : machine_mode inner_mode = GET_MODE_INNER (mode);
1089 499 : tree inner_type = lto_type_for_mode (inner_mode, unsigned_p);
1090 499 : if (inner_type != NULL_TREE)
1091 499 : return build_vector_type_for_mode (inner_type, mode);
1092 : }
1093 :
1094 20787 : if (dfloat32_type_node != NULL_TREE
1095 20787 : && mode == TYPE_MODE (dfloat32_type_node))
1096 140 : return dfloat32_type_node;
1097 20647 : if (dfloat64_type_node != NULL_TREE
1098 20647 : && mode == TYPE_MODE (dfloat64_type_node))
1099 116 : return dfloat64_type_node;
1100 20531 : if (dfloat128_type_node != NULL_TREE
1101 20531 : && mode == TYPE_MODE (dfloat128_type_node))
1102 68 : return dfloat128_type_node;
1103 :
1104 20463 : if (ALL_SCALAR_FIXED_POINT_MODE_P (mode))
1105 : {
1106 0 : if (mode == TYPE_MODE (short_fract_type_node))
1107 0 : return unsigned_p ? sat_short_fract_type_node : short_fract_type_node;
1108 0 : if (mode == TYPE_MODE (fract_type_node))
1109 0 : return unsigned_p ? sat_fract_type_node : fract_type_node;
1110 0 : if (mode == TYPE_MODE (long_fract_type_node))
1111 0 : return unsigned_p ? sat_long_fract_type_node : long_fract_type_node;
1112 0 : if (mode == TYPE_MODE (long_long_fract_type_node))
1113 0 : return unsigned_p ? sat_long_long_fract_type_node
1114 0 : : long_long_fract_type_node;
1115 :
1116 0 : if (mode == TYPE_MODE (unsigned_short_fract_type_node))
1117 0 : return unsigned_p ? sat_unsigned_short_fract_type_node
1118 0 : : unsigned_short_fract_type_node;
1119 0 : if (mode == TYPE_MODE (unsigned_fract_type_node))
1120 0 : return unsigned_p ? sat_unsigned_fract_type_node
1121 0 : : unsigned_fract_type_node;
1122 0 : if (mode == TYPE_MODE (unsigned_long_fract_type_node))
1123 0 : return unsigned_p ? sat_unsigned_long_fract_type_node
1124 0 : : unsigned_long_fract_type_node;
1125 0 : if (mode == TYPE_MODE (unsigned_long_long_fract_type_node))
1126 0 : return unsigned_p ? sat_unsigned_long_long_fract_type_node
1127 0 : : unsigned_long_long_fract_type_node;
1128 :
1129 0 : if (mode == TYPE_MODE (short_accum_type_node))
1130 0 : return unsigned_p ? sat_short_accum_type_node : short_accum_type_node;
1131 0 : if (mode == TYPE_MODE (accum_type_node))
1132 0 : return unsigned_p ? sat_accum_type_node : accum_type_node;
1133 0 : if (mode == TYPE_MODE (long_accum_type_node))
1134 0 : return unsigned_p ? sat_long_accum_type_node : long_accum_type_node;
1135 0 : if (mode == TYPE_MODE (long_long_accum_type_node))
1136 0 : return unsigned_p ? sat_long_long_accum_type_node
1137 0 : : long_long_accum_type_node;
1138 :
1139 0 : if (mode == TYPE_MODE (unsigned_short_accum_type_node))
1140 0 : return unsigned_p ? sat_unsigned_short_accum_type_node
1141 0 : : unsigned_short_accum_type_node;
1142 0 : if (mode == TYPE_MODE (unsigned_accum_type_node))
1143 0 : return unsigned_p ? sat_unsigned_accum_type_node
1144 0 : : unsigned_accum_type_node;
1145 0 : if (mode == TYPE_MODE (unsigned_long_accum_type_node))
1146 0 : return unsigned_p ? sat_unsigned_long_accum_type_node
1147 0 : : unsigned_long_accum_type_node;
1148 0 : if (mode == TYPE_MODE (unsigned_long_long_accum_type_node))
1149 0 : return unsigned_p ? sat_unsigned_long_long_accum_type_node
1150 0 : : unsigned_long_long_accum_type_node;
1151 :
1152 0 : if (mode == QQmode)
1153 0 : return unsigned_p ? sat_qq_type_node : qq_type_node;
1154 : if (mode == HQmode)
1155 0 : return unsigned_p ? sat_hq_type_node : hq_type_node;
1156 : if (mode == SQmode)
1157 0 : return unsigned_p ? sat_sq_type_node : sq_type_node;
1158 : if (mode == DQmode)
1159 0 : return unsigned_p ? sat_dq_type_node : dq_type_node;
1160 : if (mode == TQmode)
1161 0 : return unsigned_p ? sat_tq_type_node : tq_type_node;
1162 :
1163 : if (mode == UQQmode)
1164 0 : return unsigned_p ? sat_uqq_type_node : uqq_type_node;
1165 : if (mode == UHQmode)
1166 0 : return unsigned_p ? sat_uhq_type_node : uhq_type_node;
1167 : if (mode == USQmode)
1168 0 : return unsigned_p ? sat_usq_type_node : usq_type_node;
1169 : if (mode == UDQmode)
1170 0 : return unsigned_p ? sat_udq_type_node : udq_type_node;
1171 : if (mode == UTQmode)
1172 0 : return unsigned_p ? sat_utq_type_node : utq_type_node;
1173 :
1174 : if (mode == HAmode)
1175 0 : return unsigned_p ? sat_ha_type_node : ha_type_node;
1176 : if (mode == SAmode)
1177 0 : return unsigned_p ? sat_sa_type_node : sa_type_node;
1178 : if (mode == DAmode)
1179 0 : return unsigned_p ? sat_da_type_node : da_type_node;
1180 : if (mode == TAmode)
1181 0 : return unsigned_p ? sat_ta_type_node : ta_type_node;
1182 :
1183 : if (mode == UHAmode)
1184 0 : return unsigned_p ? sat_uha_type_node : uha_type_node;
1185 : if (mode == USAmode)
1186 0 : return unsigned_p ? sat_usa_type_node : usa_type_node;
1187 : if (mode == UDAmode)
1188 0 : return unsigned_p ? sat_uda_type_node : uda_type_node;
1189 : if (mode == UTAmode)
1190 0 : return unsigned_p ? sat_uta_type_node : uta_type_node;
1191 : }
1192 :
1193 20463 : for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
1194 : {
1195 20463 : tree type = TREE_VALUE (t);
1196 20463 : if (TYPE_MODE (type) == mode
1197 20463 : && VECTOR_TYPE_P (type) == VECTOR_MODE_P (mode)
1198 40926 : && !!unsigned_p == !!TYPE_UNSIGNED (type))
1199 : return type;
1200 : }
1201 : return NULL_TREE;
1202 : }
1203 :
1204 : /* Return true if we are in the global binding level. */
1205 :
1206 : static bool
1207 3558 : lto_global_bindings_p (void)
1208 : {
1209 3558 : return cfun == NULL;
1210 : }
1211 :
1212 : static void
1213 170539 : lto_set_decl_assembler_name (tree decl)
1214 : {
1215 : /* This is almost the same as lhd_set_decl_assembler_name, except that
1216 : we need to uniquify file-scope names, even if they are not
1217 : TREE_PUBLIC, to avoid conflicts between individual files. */
1218 170539 : tree id;
1219 :
1220 170539 : if (TREE_PUBLIC (decl))
1221 165049 : id = targetm.mangle_decl_assembler_name (decl, DECL_NAME (decl));
1222 : else
1223 : {
1224 5490 : const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
1225 5490 : char *label;
1226 5490 : static unsigned long num;
1227 :
1228 5490 : ASM_FORMAT_PRIVATE_NAME (label, name, num++);
1229 5490 : id = get_identifier (label);
1230 : }
1231 :
1232 170539 : SET_DECL_ASSEMBLER_NAME (decl, id);
1233 170539 : }
1234 :
1235 : static tree
1236 0 : lto_pushdecl (tree t ATTRIBUTE_UNUSED)
1237 : {
1238 : /* Do nothing, since we get all information from DWARF and LTO
1239 : sections. */
1240 0 : return NULL_TREE;
1241 : }
1242 :
1243 : static tree
1244 0 : lto_getdecls (void)
1245 : {
1246 : /* We have our own write_globals langhook, hence the getdecls
1247 : langhook shouldn't be used, except by dbxout.cc, so we can't
1248 : just abort here. */
1249 0 : return NULL_TREE;
1250 : }
1251 :
1252 : static tree
1253 114885119 : lto_builtin_function (tree decl)
1254 : {
1255 114885119 : return decl;
1256 : }
1257 :
1258 : static void
1259 81568 : lto_register_builtin_type (tree type, const char *name)
1260 : {
1261 81568 : tree decl;
1262 :
1263 81568 : if (!TYPE_NAME (type))
1264 : {
1265 81568 : decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL,
1266 : get_identifier (name), type);
1267 81568 : DECL_ARTIFICIAL (decl) = 1;
1268 81568 : TYPE_NAME (type) = decl;
1269 : }
1270 :
1271 81568 : registered_builtin_types = tree_cons (0, type, registered_builtin_types);
1272 81568 : }
1273 :
1274 : /* Build nodes that would have be created by the C front-end; necessary
1275 : for including builtin-types.def and ultimately builtins.def. */
1276 :
1277 : static void
1278 20392 : lto_build_c_type_nodes (void)
1279 : {
1280 20392 : gcc_assert (void_type_node);
1281 :
1282 20392 : string_type_node = build_pointer_type (char_type_node);
1283 20392 : const_string_type_node
1284 20392 : = build_pointer_type (build_qualified_type (char_type_node, TYPE_QUAL_CONST));
1285 :
1286 20392 : if (strcmp (SIZE_TYPE, "unsigned int") == 0)
1287 : {
1288 0 : intmax_type_node = integer_type_node;
1289 0 : uintmax_type_node = unsigned_type_node;
1290 0 : signed_size_type_node = integer_type_node;
1291 : }
1292 20392 : else if (strcmp (SIZE_TYPE, "long unsigned int") == 0)
1293 : {
1294 20392 : intmax_type_node = long_integer_type_node;
1295 20392 : uintmax_type_node = long_unsigned_type_node;
1296 20392 : signed_size_type_node = long_integer_type_node;
1297 : }
1298 0 : else if (strcmp (SIZE_TYPE, "long long unsigned int") == 0)
1299 : {
1300 0 : intmax_type_node = long_long_integer_type_node;
1301 0 : uintmax_type_node = long_long_unsigned_type_node;
1302 0 : signed_size_type_node = long_long_integer_type_node;
1303 : }
1304 : else
1305 : {
1306 0 : int i;
1307 :
1308 0 : signed_size_type_node = NULL_TREE;
1309 0 : for (i = 0; i < NUM_INT_N_ENTS; i++)
1310 0 : if (int_n_enabled_p[i])
1311 : {
1312 0 : char name[50], altname[50];
1313 0 : sprintf (name, "__int%d unsigned", int_n_data[i].bitsize);
1314 0 : sprintf (altname, "__int%d__ unsigned", int_n_data[i].bitsize);
1315 :
1316 0 : if (strcmp (name, SIZE_TYPE) == 0
1317 0 : || strcmp (altname, SIZE_TYPE) == 0)
1318 : {
1319 0 : intmax_type_node = int_n_trees[i].signed_type;
1320 0 : uintmax_type_node = int_n_trees[i].unsigned_type;
1321 0 : signed_size_type_node = int_n_trees[i].signed_type;
1322 : }
1323 : }
1324 0 : if (signed_size_type_node == NULL_TREE)
1325 0 : gcc_unreachable ();
1326 : }
1327 :
1328 20392 : wint_type_node = unsigned_type_node;
1329 20392 : pid_type_node = integer_type_node;
1330 20392 : }
1331 :
1332 : /* Perform LTO-specific initialization. */
1333 :
1334 : static bool
1335 20392 : lto_init (void)
1336 : {
1337 20392 : int i;
1338 :
1339 : /* Initialize LTO-specific data structures. */
1340 20392 : in_lto_p = true;
1341 :
1342 : /* We need to generate LTO if running in WPA mode. */
1343 40784 : flag_generate_lto = (flag_incremental_link == INCREMENTAL_LINK_LTO
1344 20392 : || flag_wpa != NULL);
1345 :
1346 : /* Create the basic integer types. */
1347 20392 : build_common_tree_nodes (flag_signed_char);
1348 :
1349 : /* The global tree for the main identifier is filled in by
1350 : language-specific front-end initialization that is not run in the
1351 : LTO back-end. It appears that all languages that perform such
1352 : initialization currently do so in the same way, so we do it here. */
1353 20392 : if (main_identifier_node == NULL_TREE)
1354 20392 : main_identifier_node = get_identifier ("main");
1355 :
1356 : /* In the C++ front-end, fileptr_type_node is defined as a variant
1357 : copy of ptr_type_node, rather than ptr_node itself. The
1358 : distinction should only be relevant to the front-end, so we
1359 : always use the C definition here in lto1.
1360 : Likewise for const struct tm*. */
1361 142744 : for (unsigned i = 0; i < ARRAY_SIZE (builtin_structptr_types); ++i)
1362 : {
1363 122352 : gcc_assert (builtin_structptr_types[i].node
1364 : == builtin_structptr_types[i].base);
1365 122352 : gcc_assert (TYPE_MAIN_VARIANT (builtin_structptr_types[i].node)
1366 : == builtin_structptr_types[i].base);
1367 : }
1368 :
1369 20392 : lto_build_c_type_nodes ();
1370 20392 : gcc_assert (va_list_type_node);
1371 :
1372 20392 : if (TREE_CODE (va_list_type_node) == ARRAY_TYPE)
1373 : {
1374 20392 : tree x = build_pointer_type (TREE_TYPE (va_list_type_node));
1375 20392 : lto_define_builtins (x, x);
1376 : }
1377 : else
1378 : {
1379 0 : lto_define_builtins (build_reference_type (va_list_type_node),
1380 : va_list_type_node);
1381 : }
1382 :
1383 20392 : targetm.init_builtins ();
1384 20392 : build_common_builtin_nodes ();
1385 :
1386 : /* Assign names to the builtin types, otherwise they'll end up
1387 : as __unknown__ in debug info.
1388 : ??? We simply need to stop pre-seeding the streamer cache.
1389 : Below is modeled after from c-common.cc:c_common_nodes_and_builtins */
1390 : #define NAME_TYPE(t,n) \
1391 : if (t) \
1392 : TYPE_NAME (t) = build_decl (UNKNOWN_LOCATION, TYPE_DECL, \
1393 : get_identifier (n), t)
1394 20392 : NAME_TYPE (integer_type_node, "int");
1395 20392 : NAME_TYPE (char_type_node, "char");
1396 20392 : NAME_TYPE (long_integer_type_node, "long int");
1397 20392 : NAME_TYPE (unsigned_type_node, "unsigned int");
1398 20392 : NAME_TYPE (long_unsigned_type_node, "long unsigned int");
1399 20392 : NAME_TYPE (long_long_integer_type_node, "long long int");
1400 20392 : NAME_TYPE (long_long_unsigned_type_node, "long long unsigned int");
1401 20392 : NAME_TYPE (short_integer_type_node, "short int");
1402 20392 : NAME_TYPE (short_unsigned_type_node, "short unsigned int");
1403 20392 : if (signed_char_type_node != char_type_node)
1404 20392 : NAME_TYPE (signed_char_type_node, "signed char");
1405 20392 : if (unsigned_char_type_node != char_type_node)
1406 20392 : NAME_TYPE (unsigned_char_type_node, "unsigned char");
1407 20392 : NAME_TYPE (float_type_node, "float");
1408 20392 : NAME_TYPE (double_type_node, "double");
1409 20392 : NAME_TYPE (long_double_type_node, "long double");
1410 20392 : NAME_TYPE (void_type_node, "void");
1411 20392 : NAME_TYPE (boolean_type_node, "bool");
1412 20392 : NAME_TYPE (complex_float_type_node, "complex float");
1413 20392 : NAME_TYPE (complex_double_type_node, "complex double");
1414 20392 : NAME_TYPE (complex_long_double_type_node, "complex long double");
1415 40784 : for (i = 0; i < NUM_INT_N_ENTS; i++)
1416 20392 : if (int_n_enabled_p[i])
1417 : {
1418 20392 : char name[50];
1419 20392 : sprintf (name, "__int%d", int_n_data[i].bitsize);
1420 20392 : NAME_TYPE (int_n_trees[i].signed_type, name);
1421 : }
1422 : #undef NAME_TYPE
1423 :
1424 20392 : return true;
1425 : }
1426 :
1427 : /* Register c++-specific dumps. */
1428 :
1429 : void
1430 20392 : lto_register_dumps (gcc::dump_manager *dumps)
1431 : {
1432 40784 : lto_link_dump_id = dumps->dump_register
1433 20392 : (".lto-link", "ipa-lto-link", "ipa-lto-link",
1434 : DK_ipa, OPTGROUP_NONE, false);
1435 40784 : decl_merge_dump_id = dumps->dump_register
1436 20392 : (".lto-decl-merge", "ipa-lto-decl-merge", "ipa-lto-decl-merge",
1437 : DK_ipa, OPTGROUP_NONE, false);
1438 40784 : partition_dump_id = dumps->dump_register
1439 20392 : (".lto-partition", "ipa-lto-partition", "ipa-lto-partition",
1440 : DK_ipa, OPTGROUP_NONE, false);
1441 20392 : }
1442 :
1443 :
1444 : /* Initialize tree structures required by the LTO front end. */
1445 :
1446 20392 : static void lto_init_ts (void)
1447 : {
1448 20392 : tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
1449 20392 : }
1450 :
1451 : #undef LANG_HOOKS_NAME
1452 : #define LANG_HOOKS_NAME "GNU GIMPLE"
1453 : #undef LANG_HOOKS_OPTION_LANG_MASK
1454 : #define LANG_HOOKS_OPTION_LANG_MASK lto_option_lang_mask
1455 : #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
1456 : #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lto_complain_wrong_lang_p
1457 : #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
1458 : #define LANG_HOOKS_INIT_OPTIONS_STRUCT lto_init_options_struct
1459 : #undef LANG_HOOKS_REGISTER_DUMPS
1460 : #define LANG_HOOKS_REGISTER_DUMPS lto_register_dumps
1461 : #undef LANG_HOOKS_HANDLE_OPTION
1462 : #define LANG_HOOKS_HANDLE_OPTION lto_handle_option
1463 : #undef LANG_HOOKS_POST_OPTIONS
1464 : #define LANG_HOOKS_POST_OPTIONS lto_post_options
1465 : #undef LANG_HOOKS_GET_ALIAS_SET
1466 : #define LANG_HOOKS_GET_ALIAS_SET gimple_get_alias_set
1467 : #undef LANG_HOOKS_TYPE_FOR_MODE
1468 : #define LANG_HOOKS_TYPE_FOR_MODE lto_type_for_mode
1469 : #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
1470 : #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lto_set_decl_assembler_name
1471 : #undef LANG_HOOKS_GLOBAL_BINDINGS_P
1472 : #define LANG_HOOKS_GLOBAL_BINDINGS_P lto_global_bindings_p
1473 : #undef LANG_HOOKS_PUSHDECL
1474 : #define LANG_HOOKS_PUSHDECL lto_pushdecl
1475 : #undef LANG_HOOKS_GETDECLS
1476 : #define LANG_HOOKS_GETDECLS lto_getdecls
1477 : #undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
1478 : #define LANG_HOOKS_REGISTER_BUILTIN_TYPE lto_register_builtin_type
1479 : #undef LANG_HOOKS_BUILTIN_FUNCTION
1480 : #define LANG_HOOKS_BUILTIN_FUNCTION lto_builtin_function
1481 : #undef LANG_HOOKS_INIT
1482 : #define LANG_HOOKS_INIT lto_init
1483 : #undef LANG_HOOKS_PARSE_FILE
1484 : #define LANG_HOOKS_PARSE_FILE lto_main
1485 : #undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
1486 : #define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
1487 : #undef LANG_HOOKS_TYPES_COMPATIBLE_P
1488 : #define LANG_HOOKS_TYPES_COMPATIBLE_P NULL
1489 : #undef LANG_HOOKS_EH_PERSONALITY
1490 : #define LANG_HOOKS_EH_PERSONALITY lto_eh_personality
1491 :
1492 : /* Attribute hooks. */
1493 : #undef LANG_HOOKS_ATTRIBUTE_TABLE
1494 : #define LANG_HOOKS_ATTRIBUTE_TABLE lto_attribute_table
1495 :
1496 : #undef LANG_HOOKS_BEGIN_SECTION
1497 : #define LANG_HOOKS_BEGIN_SECTION lto_obj_begin_section
1498 : #undef LANG_HOOKS_APPEND_DATA
1499 : #define LANG_HOOKS_APPEND_DATA lto_obj_append_data
1500 : #undef LANG_HOOKS_END_SECTION
1501 : #define LANG_HOOKS_END_SECTION lto_obj_end_section
1502 :
1503 : #undef LANG_HOOKS_INIT_TS
1504 : #define LANG_HOOKS_INIT_TS lto_init_ts
1505 :
1506 : struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
1507 :
1508 : /* Language hooks that are not part of lang_hooks. */
1509 :
1510 : tree
1511 0 : convert (tree type ATTRIBUTE_UNUSED, tree expr ATTRIBUTE_UNUSED)
1512 : {
1513 0 : gcc_unreachable ();
1514 : }
1515 :
1516 : /* Tree walking support. */
1517 :
1518 : static enum lto_tree_node_structure_enum
1519 0 : lto_tree_node_structure (union lang_tree_node *t ATTRIBUTE_UNUSED)
1520 : {
1521 0 : return TS_LTO_GENERIC;
1522 : }
1523 :
1524 : #include "gtype-lto.h"
1525 : #include "gt-lto-lto-lang.h"
|