Pass name cleanups
[official-gcc.git] / gcc / lto / lto-lang.c
blob296a71976d1bbd4ac1c9ab2ac8eec45c4095cfb4
1 /* Language-dependent hooks for LTO.
2 Copyright 2009, 2010 Free Software Foundation, Inc.
3 Contributed by CodeSourcery, Inc.
5 This file is part of GCC.
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.
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.
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/>. */
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "flags.h"
25 #include "tm.h"
26 #include "tree.h"
27 #include "target.h"
28 #include "langhooks.h"
29 #include "langhooks-def.h"
30 #include "debug.h"
31 #include "lto-tree.h"
32 #include "lto.h"
33 #include "tree-inline.h"
34 #include "gimple.h"
35 #include "diagnostic-core.h"
36 #include "toplev.h"
37 #include "lto-streamer.h"
39 static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
40 static tree handle_leaf_attribute (tree *, tree, tree, int, bool *);
41 static tree handle_const_attribute (tree *, tree, tree, int, bool *);
42 static tree handle_malloc_attribute (tree *, tree, tree, int, bool *);
43 static tree handle_pure_attribute (tree *, tree, tree, int, bool *);
44 static tree handle_novops_attribute (tree *, tree, tree, int, bool *);
45 static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
46 static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
47 static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
48 static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
49 static tree handle_format_attribute (tree *, tree, tree, int, bool *);
50 static tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
52 /* Table of machine-independent attributes supported in GIMPLE. */
53 const struct attribute_spec lto_attribute_table[] =
55 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
56 do_diagnostic } */
57 { "noreturn", 0, 0, true, false, false,
58 handle_noreturn_attribute, false },
59 { "leaf", 0, 0, true, false, false,
60 handle_leaf_attribute, false },
61 /* The same comments as for noreturn attributes apply to const ones. */
62 { "const", 0, 0, true, false, false,
63 handle_const_attribute, false },
64 { "malloc", 0, 0, true, false, false,
65 handle_malloc_attribute, false },
66 { "pure", 0, 0, true, false, false,
67 handle_pure_attribute, false },
68 { "no vops", 0, 0, true, false, false,
69 handle_novops_attribute, false },
70 { "nonnull", 0, -1, false, true, true,
71 handle_nonnull_attribute, false },
72 { "nothrow", 0, 0, true, false, false,
73 handle_nothrow_attribute, false },
74 { "sentinel", 0, 1, false, true, true,
75 handle_sentinel_attribute, false },
76 { "type generic", 0, 0, false, true, true,
77 handle_type_generic_attribute, false },
78 { NULL, 0, 0, false, false, false, NULL, false }
81 /* Give the specifications for the format attributes, used by C and all
82 descendants. */
84 const struct attribute_spec lto_format_attribute_table[] =
86 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
87 affects_type_identity } */
88 { "format", 3, 3, false, true, true,
89 handle_format_attribute, false },
90 { "format_arg", 1, 1, false, true, true,
91 handle_format_arg_attribute, false },
92 { NULL, 0, 0, false, false, false, NULL, false }
95 enum built_in_attribute
97 #define DEF_ATTR_NULL_TREE(ENUM) ENUM,
98 #define DEF_ATTR_INT(ENUM, VALUE) ENUM,
99 #define DEF_ATTR_IDENT(ENUM, STRING) ENUM,
100 #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) ENUM,
101 #include "builtin-attrs.def"
102 #undef DEF_ATTR_NULL_TREE
103 #undef DEF_ATTR_INT
104 #undef DEF_ATTR_IDENT
105 #undef DEF_ATTR_TREE_LIST
106 ATTR_LAST
109 static GTY(()) tree built_in_attributes[(int) ATTR_LAST];
111 /* Builtin types. */
113 enum lto_builtin_type
115 #define DEF_PRIMITIVE_TYPE(NAME, VALUE) NAME,
116 #define DEF_FUNCTION_TYPE_0(NAME, RETURN) NAME,
117 #define DEF_FUNCTION_TYPE_1(NAME, RETURN, ARG1) NAME,
118 #define DEF_FUNCTION_TYPE_2(NAME, RETURN, ARG1, ARG2) NAME,
119 #define DEF_FUNCTION_TYPE_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
120 #define DEF_FUNCTION_TYPE_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
121 #define DEF_FUNCTION_TYPE_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) NAME,
122 #define DEF_FUNCTION_TYPE_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) NAME,
123 #define DEF_FUNCTION_TYPE_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) NAME,
124 #define DEF_FUNCTION_TYPE_VAR_0(NAME, RETURN) NAME,
125 #define DEF_FUNCTION_TYPE_VAR_1(NAME, RETURN, ARG1) NAME,
126 #define DEF_FUNCTION_TYPE_VAR_2(NAME, RETURN, ARG1, ARG2) NAME,
127 #define DEF_FUNCTION_TYPE_VAR_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
128 #define DEF_FUNCTION_TYPE_VAR_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
129 #define DEF_FUNCTION_TYPE_VAR_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG6) \
130 NAME,
131 #define DEF_POINTER_TYPE(NAME, TYPE) NAME,
132 #include "builtin-types.def"
133 #undef DEF_PRIMITIVE_TYPE
134 #undef DEF_FUNCTION_TYPE_0
135 #undef DEF_FUNCTION_TYPE_1
136 #undef DEF_FUNCTION_TYPE_2
137 #undef DEF_FUNCTION_TYPE_3
138 #undef DEF_FUNCTION_TYPE_4
139 #undef DEF_FUNCTION_TYPE_5
140 #undef DEF_FUNCTION_TYPE_6
141 #undef DEF_FUNCTION_TYPE_7
142 #undef DEF_FUNCTION_TYPE_VAR_0
143 #undef DEF_FUNCTION_TYPE_VAR_1
144 #undef DEF_FUNCTION_TYPE_VAR_2
145 #undef DEF_FUNCTION_TYPE_VAR_3
146 #undef DEF_FUNCTION_TYPE_VAR_4
147 #undef DEF_FUNCTION_TYPE_VAR_5
148 #undef DEF_POINTER_TYPE
149 BT_LAST
152 typedef enum lto_builtin_type builtin_type;
154 static GTY(()) tree builtin_types[(int) BT_LAST + 1];
156 static GTY(()) tree string_type_node;
157 static GTY(()) tree const_string_type_node;
158 static GTY(()) tree wint_type_node;
159 static GTY(()) tree intmax_type_node;
160 static GTY(()) tree uintmax_type_node;
161 static GTY(()) tree signed_size_type_node;
163 /* Flags needed to process builtins.def. */
164 int flag_isoc94;
165 int flag_isoc99;
167 /* Attribute handlers. */
169 /* Handle a "noreturn" attribute; arguments as in
170 struct attribute_spec.handler. */
172 static tree
173 handle_noreturn_attribute (tree *node, tree ARG_UNUSED (name),
174 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
175 bool * ARG_UNUSED (no_add_attrs))
177 tree type = TREE_TYPE (*node);
179 if (TREE_CODE (*node) == FUNCTION_DECL)
180 TREE_THIS_VOLATILE (*node) = 1;
181 else if (TREE_CODE (type) == POINTER_TYPE
182 && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
183 TREE_TYPE (*node)
184 = build_pointer_type
185 (build_type_variant (TREE_TYPE (type),
186 TYPE_READONLY (TREE_TYPE (type)), 1));
187 else
188 gcc_unreachable ();
190 return NULL_TREE;
193 /* Handle a "leaf" attribute; arguments as in
194 struct attribute_spec.handler. */
196 static tree
197 handle_leaf_attribute (tree *node, tree name,
198 tree ARG_UNUSED (args),
199 int ARG_UNUSED (flags), bool *no_add_attrs)
201 if (TREE_CODE (*node) != FUNCTION_DECL)
203 warning (OPT_Wattributes, "%qE attribute ignored", name);
204 *no_add_attrs = true;
206 if (!TREE_PUBLIC (*node))
208 warning (OPT_Wattributes, "%qE attribute has no effect on unit local functions", name);
209 *no_add_attrs = true;
212 return NULL_TREE;
215 /* Handle a "const" attribute; arguments as in
216 struct attribute_spec.handler. */
218 static tree
219 handle_const_attribute (tree *node, tree ARG_UNUSED (name),
220 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
221 bool * ARG_UNUSED (no_add_attrs))
223 tree type = TREE_TYPE (*node);
225 /* See FIXME comment on noreturn in c_common_attribute_table. */
226 if (TREE_CODE (*node) == FUNCTION_DECL)
227 TREE_READONLY (*node) = 1;
228 else if (TREE_CODE (type) == POINTER_TYPE
229 && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
230 TREE_TYPE (*node)
231 = build_pointer_type
232 (build_type_variant (TREE_TYPE (type), 1,
233 TREE_THIS_VOLATILE (TREE_TYPE (type))));
234 else
235 gcc_unreachable ();
237 return NULL_TREE;
241 /* Handle a "malloc" attribute; arguments as in
242 struct attribute_spec.handler. */
244 static tree
245 handle_malloc_attribute (tree *node, tree ARG_UNUSED (name),
246 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
247 bool * ARG_UNUSED (no_add_attrs))
249 if (TREE_CODE (*node) == FUNCTION_DECL
250 && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (*node))))
251 DECL_IS_MALLOC (*node) = 1;
252 else
253 gcc_unreachable ();
255 return NULL_TREE;
259 /* Handle a "pure" attribute; arguments as in
260 struct attribute_spec.handler. */
262 static tree
263 handle_pure_attribute (tree *node, tree ARG_UNUSED (name),
264 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
265 bool * ARG_UNUSED (no_add_attrs))
267 if (TREE_CODE (*node) == FUNCTION_DECL)
268 DECL_PURE_P (*node) = 1;
269 else
270 gcc_unreachable ();
272 return NULL_TREE;
276 /* Handle a "no vops" attribute; arguments as in
277 struct attribute_spec.handler. */
279 static tree
280 handle_novops_attribute (tree *node, tree ARG_UNUSED (name),
281 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
282 bool *ARG_UNUSED (no_add_attrs))
284 gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
285 DECL_IS_NOVOPS (*node) = 1;
286 return NULL_TREE;
290 /* Helper for nonnull attribute handling; fetch the operand number
291 from the attribute argument list. */
293 static bool
294 get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp)
296 /* Verify the arg number is a constant. */
297 if (TREE_CODE (arg_num_expr) != INTEGER_CST
298 || TREE_INT_CST_HIGH (arg_num_expr) != 0)
299 return false;
301 *valp = TREE_INT_CST_LOW (arg_num_expr);
302 return true;
305 /* Handle the "nonnull" attribute. */
307 static tree
308 handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
309 tree args, int ARG_UNUSED (flags),
310 bool * ARG_UNUSED (no_add_attrs))
312 tree type = *node;
314 /* If no arguments are specified, all pointer arguments should be
315 non-null. Verify a full prototype is given so that the arguments
316 will have the correct types when we actually check them later. */
317 if (!args)
319 gcc_assert (prototype_p (type));
320 return NULL_TREE;
323 /* Argument list specified. Verify that each argument number references
324 a pointer argument. */
325 for (; args; args = TREE_CHAIN (args))
327 tree argument;
328 unsigned HOST_WIDE_INT arg_num = 0, ck_num;
330 if (!get_nonnull_operand (TREE_VALUE (args), &arg_num))
331 gcc_unreachable ();
333 argument = TYPE_ARG_TYPES (type);
334 if (argument)
336 for (ck_num = 1; ; ck_num++)
338 if (!argument || ck_num == arg_num)
339 break;
340 argument = TREE_CHAIN (argument);
343 gcc_assert (argument
344 && TREE_CODE (TREE_VALUE (argument)) == POINTER_TYPE);
348 return NULL_TREE;
352 /* Handle a "nothrow" attribute; arguments as in
353 struct attribute_spec.handler. */
355 static tree
356 handle_nothrow_attribute (tree *node, tree ARG_UNUSED (name),
357 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
358 bool * ARG_UNUSED (no_add_attrs))
360 if (TREE_CODE (*node) == FUNCTION_DECL)
361 TREE_NOTHROW (*node) = 1;
362 else
363 gcc_unreachable ();
365 return NULL_TREE;
369 /* Handle a "sentinel" attribute. */
371 static tree
372 handle_sentinel_attribute (tree *node, tree ARG_UNUSED (name), tree args,
373 int ARG_UNUSED (flags),
374 bool * ARG_UNUSED (no_add_attrs))
376 gcc_assert (stdarg_p (*node));
378 if (args)
380 tree position = TREE_VALUE (args);
381 gcc_assert (TREE_CODE (position) == INTEGER_CST);
382 if (tree_int_cst_lt (position, integer_zero_node))
383 gcc_unreachable ();
386 return NULL_TREE;
389 /* Handle a "type_generic" attribute. */
391 static tree
392 handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
393 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
394 bool * ARG_UNUSED (no_add_attrs))
396 /* Ensure we have a function type. */
397 gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
399 /* Ensure we have a variadic function. */
400 gcc_assert (!prototype_p (*node) || stdarg_p (*node));
402 return NULL_TREE;
405 /* Handle a "format" attribute; arguments as in
406 struct attribute_spec.handler. */
408 static tree
409 handle_format_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
410 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
411 bool *no_add_attrs)
413 *no_add_attrs = true;
414 return NULL_TREE;
418 /* Handle a "format_arg" attribute; arguments as in
419 struct attribute_spec.handler. */
421 tree
422 handle_format_arg_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
423 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
424 bool *no_add_attrs)
426 *no_add_attrs = true;
427 return NULL_TREE;
431 /* Cribbed from c-common.c. */
433 static void
434 def_fn_type (builtin_type def, builtin_type ret, bool var, int n, ...)
436 tree t;
437 tree *args = XALLOCAVEC (tree, n);
438 va_list list;
439 int i;
441 va_start (list, n);
442 for (i = 0; i < n; ++i)
444 builtin_type a = (builtin_type) va_arg (list, int);
445 t = builtin_types[a];
446 if (t == error_mark_node)
447 goto egress;
448 args[i] = t;
450 va_end (list);
452 t = builtin_types[ret];
453 if (t == error_mark_node)
454 goto egress;
455 if (var)
456 t = build_varargs_function_type_array (t, n, args);
457 else
458 t = build_function_type_array (t, n, args);
460 egress:
461 builtin_types[def] = t;
462 va_end (list);
465 /* Used to help initialize the builtin-types.def table. When a type of
466 the correct size doesn't exist, use error_mark_node instead of NULL.
467 The later results in segfaults even when a decl using the type doesn't
468 get invoked. */
470 static tree
471 builtin_type_for_size (int size, bool unsignedp)
473 tree type = lang_hooks.types.type_for_size (size, unsignedp);
474 return type ? type : error_mark_node;
477 /* Support for DEF_BUILTIN. */
479 static void
480 def_builtin_1 (enum built_in_function fncode, const char *name,
481 enum built_in_class fnclass, tree fntype, tree libtype,
482 bool both_p, bool fallback_p, bool nonansi_p,
483 tree fnattrs, bool implicit_p)
485 tree decl;
486 const char *libname;
488 if (fntype == error_mark_node)
489 return;
491 libname = name + strlen ("__builtin_");
492 decl = add_builtin_function (name, fntype, fncode, fnclass,
493 (fallback_p ? libname : NULL),
494 fnattrs);
496 if (both_p
497 && !flag_no_builtin
498 && !(nonansi_p && flag_no_nonansi_builtin))
499 add_builtin_function (libname, libtype, fncode, fnclass,
500 NULL, fnattrs);
502 built_in_decls[(int) fncode] = decl;
503 if (implicit_p)
504 implicit_built_in_decls[(int) fncode] = decl;
508 /* Initialize the attribute table for all the supported builtins. */
510 static void
511 lto_init_attributes (void)
513 /* Fill in the built_in_attributes array. */
514 #define DEF_ATTR_NULL_TREE(ENUM) \
515 built_in_attributes[(int) ENUM] = NULL_TREE;
516 #define DEF_ATTR_INT(ENUM, VALUE) \
517 built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE);
518 #define DEF_ATTR_IDENT(ENUM, STRING) \
519 built_in_attributes[(int) ENUM] = get_identifier (STRING);
520 #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) \
521 built_in_attributes[(int) ENUM] \
522 = tree_cons (built_in_attributes[(int) PURPOSE], \
523 built_in_attributes[(int) VALUE], \
524 built_in_attributes[(int) CHAIN]);
525 #include "builtin-attrs.def"
526 #undef DEF_ATTR_NULL_TREE
527 #undef DEF_ATTR_INT
528 #undef DEF_ATTR_IDENT
529 #undef DEF_ATTR_TREE_LIST
532 /* Create builtin types and functions. VA_LIST_REF_TYPE_NODE and
533 VA_LIST_ARG_TYPE_NODE are used in builtin-types.def. */
535 static void
536 lto_define_builtins (tree va_list_ref_type_node ATTRIBUTE_UNUSED,
537 tree va_list_arg_type_node ATTRIBUTE_UNUSED)
539 #define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
540 builtin_types[ENUM] = VALUE;
541 #define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \
542 def_fn_type (ENUM, RETURN, 0, 0);
543 #define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1) \
544 def_fn_type (ENUM, RETURN, 0, 1, ARG1);
545 #define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \
546 def_fn_type (ENUM, RETURN, 0, 2, ARG1, ARG2);
547 #define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
548 def_fn_type (ENUM, RETURN, 0, 3, ARG1, ARG2, ARG3);
549 #define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
550 def_fn_type (ENUM, RETURN, 0, 4, ARG1, ARG2, ARG3, ARG4);
551 #define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
552 def_fn_type (ENUM, RETURN, 0, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
553 #define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
554 ARG6) \
555 def_fn_type (ENUM, RETURN, 0, 6, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
556 #define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
557 ARG6, ARG7) \
558 def_fn_type (ENUM, RETURN, 0, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7);
559 #define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \
560 def_fn_type (ENUM, RETURN, 1, 0);
561 #define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \
562 def_fn_type (ENUM, RETURN, 1, 1, ARG1);
563 #define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2) \
564 def_fn_type (ENUM, RETURN, 1, 2, ARG1, ARG2);
565 #define DEF_FUNCTION_TYPE_VAR_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
566 def_fn_type (ENUM, RETURN, 1, 3, ARG1, ARG2, ARG3);
567 #define DEF_FUNCTION_TYPE_VAR_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
568 def_fn_type (ENUM, RETURN, 1, 4, ARG1, ARG2, ARG3, ARG4);
569 #define DEF_FUNCTION_TYPE_VAR_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
570 def_fn_type (ENUM, RETURN, 1, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
571 #define DEF_POINTER_TYPE(ENUM, TYPE) \
572 builtin_types[(int) ENUM] = build_pointer_type (builtin_types[(int) TYPE]);
574 #include "builtin-types.def"
576 #undef DEF_PRIMITIVE_TYPE
577 #undef DEF_FUNCTION_TYPE_1
578 #undef DEF_FUNCTION_TYPE_2
579 #undef DEF_FUNCTION_TYPE_3
580 #undef DEF_FUNCTION_TYPE_4
581 #undef DEF_FUNCTION_TYPE_5
582 #undef DEF_FUNCTION_TYPE_6
583 #undef DEF_FUNCTION_TYPE_VAR_0
584 #undef DEF_FUNCTION_TYPE_VAR_1
585 #undef DEF_FUNCTION_TYPE_VAR_2
586 #undef DEF_FUNCTION_TYPE_VAR_3
587 #undef DEF_FUNCTION_TYPE_VAR_4
588 #undef DEF_FUNCTION_TYPE_VAR_5
589 #undef DEF_POINTER_TYPE
590 builtin_types[(int) BT_LAST] = NULL_TREE;
592 lto_init_attributes ();
594 #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, FALLBACK_P,\
595 NONANSI_P, ATTRS, IMPLICIT, COND) \
596 if (NAME && COND) \
597 def_builtin_1 (ENUM, NAME, CLASS, builtin_types[(int) TYPE], \
598 builtin_types[(int) LIBTYPE], BOTH_P, FALLBACK_P, \
599 NONANSI_P, built_in_attributes[(int) ATTRS], IMPLICIT);
600 #include "builtins.def"
601 #undef DEF_BUILTIN
604 static GTY(()) tree registered_builtin_types;
606 /* Language hooks. */
608 static unsigned int
609 lto_option_lang_mask (void)
611 return CL_LTO;
614 static bool
615 lto_complain_wrong_lang_p (const struct cl_option *option ATTRIBUTE_UNUSED)
617 /* The LTO front end inherits all the options from the first front
618 end that was used. However, not all the original front end
619 options make sense in LTO.
621 A real solution would be to filter this in collect2, but collect2
622 does not have access to all the option attributes to know what to
623 filter. So, in lto1 we silently accept inherited flags and do
624 nothing about it. */
625 return false;
628 static void
629 lto_init_options_struct (struct gcc_options *opts)
631 /* By default, C99-like requirements for complex multiply and divide.
632 ??? Until the complex method is encoded in the IL this is the only
633 safe choice. This will pessimize Fortran code with LTO unless
634 people specify a complex method manually or use -ffast-math. */
635 opts->x_flag_complex_method = 2;
638 /* Handle command-line option SCODE. If the option takes an argument, it is
639 stored in ARG, which is otherwise NULL. VALUE holds either a numerical
640 argument or a binary value indicating whether the positive or negative form
641 of the option was supplied. */
643 const char *resolution_file_name;
644 static bool
645 lto_handle_option (size_t scode, const char *arg,
646 int value ATTRIBUTE_UNUSED, int kind ATTRIBUTE_UNUSED,
647 location_t loc ATTRIBUTE_UNUSED,
648 const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
650 enum opt_code code = (enum opt_code) scode;
651 bool result = true;
653 switch (code)
655 case OPT_fresolution_:
656 resolution_file_name = arg;
657 break;
659 case OPT_Wabi:
660 warn_psabi = value;
661 break;
663 default:
664 break;
667 return result;
670 /* Perform post-option processing. Does additional initialization based on
671 command-line options. PFILENAME is the main input filename. Returns false
672 to enable subsequent back-end initialization. */
674 static bool
675 lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
677 /* -fltrans and -fwpa are mutually exclusive. Check for that here. */
678 if (flag_wpa && flag_ltrans)
679 error ("-fwpa and -fltrans are mutually exclusive");
681 if (flag_ltrans)
683 flag_generate_lto = 0;
685 /* During LTRANS, we are not looking at the whole program, only
686 a subset of the whole callgraph. */
687 flag_whole_program = 0;
690 if (flag_wpa)
691 flag_generate_lto = 1;
693 /* Excess precision other than "fast" requires front-end
694 support. */
695 flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
697 lto_read_all_file_options ();
699 /* Initialize the compiler back end. */
700 return false;
703 /* Return an integer type with PRECISION bits of precision,
704 that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */
706 static tree
707 lto_type_for_size (unsigned precision, int unsignedp)
709 if (precision == TYPE_PRECISION (integer_type_node))
710 return unsignedp ? unsigned_type_node : integer_type_node;
712 if (precision == TYPE_PRECISION (signed_char_type_node))
713 return unsignedp ? unsigned_char_type_node : signed_char_type_node;
715 if (precision == TYPE_PRECISION (short_integer_type_node))
716 return unsignedp ? short_unsigned_type_node : short_integer_type_node;
718 if (precision == TYPE_PRECISION (long_integer_type_node))
719 return unsignedp ? long_unsigned_type_node : long_integer_type_node;
721 if (precision == TYPE_PRECISION (long_long_integer_type_node))
722 return unsignedp
723 ? long_long_unsigned_type_node
724 : long_long_integer_type_node;
726 if (precision <= TYPE_PRECISION (intQI_type_node))
727 return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
729 if (precision <= TYPE_PRECISION (intHI_type_node))
730 return unsignedp ? unsigned_intHI_type_node : intHI_type_node;
732 if (precision <= TYPE_PRECISION (intSI_type_node))
733 return unsignedp ? unsigned_intSI_type_node : intSI_type_node;
735 if (precision <= TYPE_PRECISION (intDI_type_node))
736 return unsignedp ? unsigned_intDI_type_node : intDI_type_node;
738 if (precision <= TYPE_PRECISION (intTI_type_node))
739 return unsignedp ? unsigned_intTI_type_node : intTI_type_node;
741 return NULL_TREE;
745 /* Return a data type that has machine mode MODE.
746 If the mode is an integer,
747 then UNSIGNEDP selects between signed and unsigned types.
748 If the mode is a fixed-point mode,
749 then UNSIGNEDP selects between saturating and nonsaturating types. */
751 static tree
752 lto_type_for_mode (enum machine_mode mode, int unsigned_p)
754 tree t;
756 if (mode == TYPE_MODE (integer_type_node))
757 return unsigned_p ? unsigned_type_node : integer_type_node;
759 if (mode == TYPE_MODE (signed_char_type_node))
760 return unsigned_p ? unsigned_char_type_node : signed_char_type_node;
762 if (mode == TYPE_MODE (short_integer_type_node))
763 return unsigned_p ? short_unsigned_type_node : short_integer_type_node;
765 if (mode == TYPE_MODE (long_integer_type_node))
766 return unsigned_p ? long_unsigned_type_node : long_integer_type_node;
768 if (mode == TYPE_MODE (long_long_integer_type_node))
769 return unsigned_p ? long_long_unsigned_type_node : long_long_integer_type_node;
771 if (mode == QImode)
772 return unsigned_p ? unsigned_intQI_type_node : intQI_type_node;
774 if (mode == HImode)
775 return unsigned_p ? unsigned_intHI_type_node : intHI_type_node;
777 if (mode == SImode)
778 return unsigned_p ? unsigned_intSI_type_node : intSI_type_node;
780 if (mode == DImode)
781 return unsigned_p ? unsigned_intDI_type_node : intDI_type_node;
783 #if HOST_BITS_PER_WIDE_INT >= 64
784 if (mode == TYPE_MODE (intTI_type_node))
785 return unsigned_p ? unsigned_intTI_type_node : intTI_type_node;
786 #endif
788 if (mode == TYPE_MODE (float_type_node))
789 return float_type_node;
791 if (mode == TYPE_MODE (double_type_node))
792 return double_type_node;
794 if (mode == TYPE_MODE (long_double_type_node))
795 return long_double_type_node;
797 if (mode == TYPE_MODE (void_type_node))
798 return void_type_node;
800 if (mode == TYPE_MODE (build_pointer_type (char_type_node)))
801 return (unsigned_p
802 ? make_unsigned_type (GET_MODE_PRECISION (mode))
803 : make_signed_type (GET_MODE_PRECISION (mode)));
805 if (mode == TYPE_MODE (build_pointer_type (integer_type_node)))
806 return (unsigned_p
807 ? make_unsigned_type (GET_MODE_PRECISION (mode))
808 : make_signed_type (GET_MODE_PRECISION (mode)));
810 if (COMPLEX_MODE_P (mode))
812 enum machine_mode inner_mode;
813 tree inner_type;
815 if (mode == TYPE_MODE (complex_float_type_node))
816 return complex_float_type_node;
817 if (mode == TYPE_MODE (complex_double_type_node))
818 return complex_double_type_node;
819 if (mode == TYPE_MODE (complex_long_double_type_node))
820 return complex_long_double_type_node;
822 if (mode == TYPE_MODE (complex_integer_type_node) && !unsigned_p)
823 return complex_integer_type_node;
825 inner_mode = GET_MODE_INNER (mode);
826 inner_type = lto_type_for_mode (inner_mode, unsigned_p);
827 if (inner_type != NULL_TREE)
828 return build_complex_type (inner_type);
830 else if (VECTOR_MODE_P (mode))
832 enum machine_mode inner_mode = GET_MODE_INNER (mode);
833 tree inner_type = lto_type_for_mode (inner_mode, unsigned_p);
834 if (inner_type != NULL_TREE)
835 return build_vector_type_for_mode (inner_type, mode);
838 if (mode == TYPE_MODE (dfloat32_type_node))
839 return dfloat32_type_node;
840 if (mode == TYPE_MODE (dfloat64_type_node))
841 return dfloat64_type_node;
842 if (mode == TYPE_MODE (dfloat128_type_node))
843 return dfloat128_type_node;
845 if (ALL_SCALAR_FIXED_POINT_MODE_P (mode))
847 if (mode == TYPE_MODE (short_fract_type_node))
848 return unsigned_p ? sat_short_fract_type_node : short_fract_type_node;
849 if (mode == TYPE_MODE (fract_type_node))
850 return unsigned_p ? sat_fract_type_node : fract_type_node;
851 if (mode == TYPE_MODE (long_fract_type_node))
852 return unsigned_p ? sat_long_fract_type_node : long_fract_type_node;
853 if (mode == TYPE_MODE (long_long_fract_type_node))
854 return unsigned_p ? sat_long_long_fract_type_node
855 : long_long_fract_type_node;
857 if (mode == TYPE_MODE (unsigned_short_fract_type_node))
858 return unsigned_p ? sat_unsigned_short_fract_type_node
859 : unsigned_short_fract_type_node;
860 if (mode == TYPE_MODE (unsigned_fract_type_node))
861 return unsigned_p ? sat_unsigned_fract_type_node
862 : unsigned_fract_type_node;
863 if (mode == TYPE_MODE (unsigned_long_fract_type_node))
864 return unsigned_p ? sat_unsigned_long_fract_type_node
865 : unsigned_long_fract_type_node;
866 if (mode == TYPE_MODE (unsigned_long_long_fract_type_node))
867 return unsigned_p ? sat_unsigned_long_long_fract_type_node
868 : unsigned_long_long_fract_type_node;
870 if (mode == TYPE_MODE (short_accum_type_node))
871 return unsigned_p ? sat_short_accum_type_node : short_accum_type_node;
872 if (mode == TYPE_MODE (accum_type_node))
873 return unsigned_p ? sat_accum_type_node : accum_type_node;
874 if (mode == TYPE_MODE (long_accum_type_node))
875 return unsigned_p ? sat_long_accum_type_node : long_accum_type_node;
876 if (mode == TYPE_MODE (long_long_accum_type_node))
877 return unsigned_p ? sat_long_long_accum_type_node
878 : long_long_accum_type_node;
880 if (mode == TYPE_MODE (unsigned_short_accum_type_node))
881 return unsigned_p ? sat_unsigned_short_accum_type_node
882 : unsigned_short_accum_type_node;
883 if (mode == TYPE_MODE (unsigned_accum_type_node))
884 return unsigned_p ? sat_unsigned_accum_type_node
885 : unsigned_accum_type_node;
886 if (mode == TYPE_MODE (unsigned_long_accum_type_node))
887 return unsigned_p ? sat_unsigned_long_accum_type_node
888 : unsigned_long_accum_type_node;
889 if (mode == TYPE_MODE (unsigned_long_long_accum_type_node))
890 return unsigned_p ? sat_unsigned_long_long_accum_type_node
891 : unsigned_long_long_accum_type_node;
893 if (mode == QQmode)
894 return unsigned_p ? sat_qq_type_node : qq_type_node;
895 if (mode == HQmode)
896 return unsigned_p ? sat_hq_type_node : hq_type_node;
897 if (mode == SQmode)
898 return unsigned_p ? sat_sq_type_node : sq_type_node;
899 if (mode == DQmode)
900 return unsigned_p ? sat_dq_type_node : dq_type_node;
901 if (mode == TQmode)
902 return unsigned_p ? sat_tq_type_node : tq_type_node;
904 if (mode == UQQmode)
905 return unsigned_p ? sat_uqq_type_node : uqq_type_node;
906 if (mode == UHQmode)
907 return unsigned_p ? sat_uhq_type_node : uhq_type_node;
908 if (mode == USQmode)
909 return unsigned_p ? sat_usq_type_node : usq_type_node;
910 if (mode == UDQmode)
911 return unsigned_p ? sat_udq_type_node : udq_type_node;
912 if (mode == UTQmode)
913 return unsigned_p ? sat_utq_type_node : utq_type_node;
915 if (mode == HAmode)
916 return unsigned_p ? sat_ha_type_node : ha_type_node;
917 if (mode == SAmode)
918 return unsigned_p ? sat_sa_type_node : sa_type_node;
919 if (mode == DAmode)
920 return unsigned_p ? sat_da_type_node : da_type_node;
921 if (mode == TAmode)
922 return unsigned_p ? sat_ta_type_node : ta_type_node;
924 if (mode == UHAmode)
925 return unsigned_p ? sat_uha_type_node : uha_type_node;
926 if (mode == USAmode)
927 return unsigned_p ? sat_usa_type_node : usa_type_node;
928 if (mode == UDAmode)
929 return unsigned_p ? sat_uda_type_node : uda_type_node;
930 if (mode == UTAmode)
931 return unsigned_p ? sat_uta_type_node : uta_type_node;
934 for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
935 if (TYPE_MODE (TREE_VALUE (t)) == mode)
936 return TREE_VALUE (t);
938 return NULL_TREE;
941 /* Return true if we are in the global binding level. */
943 static bool
944 lto_global_bindings_p (void)
946 return cfun == NULL;
949 static void
950 lto_set_decl_assembler_name (tree decl)
952 /* This is almost the same as lhd_set_decl_assembler_name, except that
953 we need to uniquify file-scope names, even if they are not
954 TREE_PUBLIC, to avoid conflicts between individual files. */
955 tree id;
957 if (TREE_PUBLIC (decl))
958 id = targetm.mangle_decl_assembler_name (decl, DECL_NAME (decl));
959 else
961 const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
962 char *label;
964 ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl));
965 id = get_identifier (label);
968 SET_DECL_ASSEMBLER_NAME (decl, id);
971 static tree
972 lto_pushdecl (tree t ATTRIBUTE_UNUSED)
974 /* Do nothing, since we get all information from DWARF and LTO
975 sections. */
976 return NULL_TREE;
979 static tree
980 lto_getdecls (void)
982 /* We have our own write_globals langhook, hence the getdecls
983 langhook shouldn't be used, except by dbxout.c, so we can't
984 just abort here. */
985 return NULL_TREE;
988 static void
989 lto_write_globals (void)
991 tree *vec = VEC_address (tree, lto_global_var_decls);
992 int len = VEC_length (tree, lto_global_var_decls);
993 wrapup_global_declarations (vec, len);
994 emit_debug_global_declarations (vec, len);
995 VEC_free (tree, gc, lto_global_var_decls);
998 static tree
999 lto_builtin_function (tree decl)
1001 return decl;
1004 static void
1005 lto_register_builtin_type (tree type, const char *name)
1007 tree decl;
1009 decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL, get_identifier (name), type);
1010 DECL_ARTIFICIAL (decl) = 1;
1011 if (!TYPE_NAME (type))
1012 TYPE_NAME (type) = decl;
1014 registered_builtin_types = tree_cons (0, type, registered_builtin_types);
1017 /* Build nodes that would have be created by the C front-end; necessary
1018 for including builtin-types.def and ultimately builtins.def. */
1020 static void
1021 lto_build_c_type_nodes (void)
1023 gcc_assert (void_type_node);
1025 void_list_node = build_tree_list (NULL_TREE, void_type_node);
1026 string_type_node = build_pointer_type (char_type_node);
1027 const_string_type_node
1028 = build_pointer_type (build_qualified_type (char_type_node, TYPE_QUAL_CONST));
1030 if (strcmp (SIZE_TYPE, "unsigned int") == 0)
1032 intmax_type_node = integer_type_node;
1033 uintmax_type_node = unsigned_type_node;
1034 signed_size_type_node = integer_type_node;
1036 else if (strcmp (SIZE_TYPE, "long unsigned int") == 0)
1038 intmax_type_node = long_integer_type_node;
1039 uintmax_type_node = long_unsigned_type_node;
1040 signed_size_type_node = long_integer_type_node;
1042 else if (strcmp (SIZE_TYPE, "long long unsigned int") == 0)
1044 intmax_type_node = long_long_integer_type_node;
1045 uintmax_type_node = long_long_unsigned_type_node;
1046 signed_size_type_node = long_long_integer_type_node;
1048 else
1049 gcc_unreachable ();
1051 wint_type_node = unsigned_type_node;
1052 pid_type_node = integer_type_node;
1055 /* Re-compute TYPE_CANONICAL for NODE and related types. */
1057 static void
1058 lto_register_canonical_types (tree node)
1060 if (!node
1061 || !TYPE_P (node))
1062 return;
1064 TYPE_CANONICAL (node) = NULL_TREE;
1065 TYPE_CANONICAL (node) = gimple_register_canonical_type (node);
1067 if (POINTER_TYPE_P (node)
1068 || TREE_CODE (node) == COMPLEX_TYPE
1069 || TREE_CODE (node) == ARRAY_TYPE)
1070 lto_register_canonical_types (TREE_TYPE (node));
1073 /* Perform LTO-specific initialization. */
1075 static bool
1076 lto_init (void)
1078 unsigned i;
1080 /* We need to generate LTO if running in WPA mode. */
1081 flag_generate_lto = flag_wpa;
1083 /* Initialize libcpp line maps for gcc_assert to work. */
1084 linemap_add (line_table, LC_RENAME, 0, NULL, 0);
1085 linemap_add (line_table, LC_RENAME, 0, NULL, 0);
1087 /* Create the basic integer types. */
1088 build_common_tree_nodes (flag_signed_char);
1090 /* Tell the middle end what type to use for the size of objects. */
1091 if (strcmp (SIZE_TYPE, "unsigned int") == 0)
1092 size_type_node = unsigned_type_node;
1093 else if (strcmp (SIZE_TYPE, "long unsigned int") == 0)
1094 size_type_node = long_unsigned_type_node;
1095 else if (strcmp (SIZE_TYPE, "long long unsigned int") == 0)
1096 size_type_node = long_long_unsigned_type_node;
1097 else
1098 gcc_unreachable ();
1099 set_sizetype (size_type_node);
1101 /* The global tree for the main identifier is filled in by
1102 language-specific front-end initialization that is not run in the
1103 LTO back-end. It appears that all languages that perform such
1104 initialization currently do so in the same way, so we do it here. */
1105 if (main_identifier_node == NULL_TREE)
1106 main_identifier_node = get_identifier ("main");
1108 /* In the C++ front-end, fileptr_type_node is defined as a variant
1109 copy of of ptr_type_node, rather than ptr_node itself. The
1110 distinction should only be relevant to the front-end, so we
1111 always use the C definition here in lto1. */
1112 gcc_assert (fileptr_type_node == ptr_type_node);
1114 ptrdiff_type_node = integer_type_node;
1116 /* Create other basic types. */
1117 build_common_tree_nodes_2 (/*short_double=*/false);
1118 lto_build_c_type_nodes ();
1119 gcc_assert (va_list_type_node);
1121 if (TREE_CODE (va_list_type_node) == ARRAY_TYPE)
1123 tree x = build_pointer_type (TREE_TYPE (va_list_type_node));
1124 lto_define_builtins (x, x);
1126 else
1128 lto_define_builtins (va_list_type_node,
1129 build_reference_type (va_list_type_node));
1132 targetm.init_builtins ();
1133 build_common_builtin_nodes ();
1135 /* Assign names to the builtin types, otherwise they'll end up
1136 as __unknown__ in debug info.
1137 ??? We simply need to stop pre-seeding the streamer cache.
1138 Below is modeled after from c-common.c:c_common_nodes_and_builtins */
1139 #define NAME_TYPE(t,n) \
1140 if (t) \
1141 TYPE_NAME (t) = build_decl (UNKNOWN_LOCATION, TYPE_DECL, \
1142 get_identifier (n), t)
1143 NAME_TYPE (integer_type_node, "int");
1144 NAME_TYPE (char_type_node, "char");
1145 NAME_TYPE (long_integer_type_node, "long int");
1146 NAME_TYPE (unsigned_type_node, "unsigned int");
1147 NAME_TYPE (long_unsigned_type_node, "long unsigned int");
1148 NAME_TYPE (long_long_integer_type_node, "long long int");
1149 NAME_TYPE (long_long_unsigned_type_node, "long long unsigned int");
1150 NAME_TYPE (short_integer_type_node, "short int");
1151 NAME_TYPE (short_unsigned_type_node, "short unsigned int");
1152 if (signed_char_type_node != char_type_node)
1153 NAME_TYPE (signed_char_type_node, "signed char");
1154 if (unsigned_char_type_node != char_type_node)
1155 NAME_TYPE (unsigned_char_type_node, "unsigned char");
1156 NAME_TYPE (float_type_node, "float");
1157 NAME_TYPE (double_type_node, "double");
1158 NAME_TYPE (long_double_type_node, "long double");
1159 NAME_TYPE (void_type_node, "void");
1160 NAME_TYPE (boolean_type_node, "bool");
1161 #undef NAME_TYPE
1163 /* Register the common node types with the canonical type machinery so
1164 we properly share alias-sets across languages and TUs. Do not
1165 expose the common nodes as type merge target - those that should be
1166 are already exposed so by pre-loading the LTO streamer caches. */
1167 for (i = 0; i < itk_none; ++i)
1168 lto_register_canonical_types (integer_types[i]);
1169 /* The sizetypes are not used to access data so we do not need to
1170 do anything about them. */
1171 for (i = 0; i < TI_MAX; ++i)
1172 lto_register_canonical_types (global_trees[i]);
1174 /* Initialize LTO-specific data structures. */
1175 lto_global_var_decls = VEC_alloc (tree, gc, 256);
1176 in_lto_p = true;
1178 return true;
1181 /* Initialize tree structures required by the LTO front end. */
1183 static void lto_init_ts (void)
1185 tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
1188 #undef LANG_HOOKS_NAME
1189 #define LANG_HOOKS_NAME "GNU GIMPLE"
1190 #undef LANG_HOOKS_OPTION_LANG_MASK
1191 #define LANG_HOOKS_OPTION_LANG_MASK lto_option_lang_mask
1192 #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
1193 #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lto_complain_wrong_lang_p
1194 #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
1195 #define LANG_HOOKS_INIT_OPTIONS_STRUCT lto_init_options_struct
1196 #undef LANG_HOOKS_HANDLE_OPTION
1197 #define LANG_HOOKS_HANDLE_OPTION lto_handle_option
1198 #undef LANG_HOOKS_POST_OPTIONS
1199 #define LANG_HOOKS_POST_OPTIONS lto_post_options
1200 #undef LANG_HOOKS_GET_ALIAS_SET
1201 #define LANG_HOOKS_GET_ALIAS_SET gimple_get_alias_set
1202 #undef LANG_HOOKS_TYPE_FOR_MODE
1203 #define LANG_HOOKS_TYPE_FOR_MODE lto_type_for_mode
1204 #undef LANG_HOOKS_TYPE_FOR_SIZE
1205 #define LANG_HOOKS_TYPE_FOR_SIZE lto_type_for_size
1206 #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
1207 #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lto_set_decl_assembler_name
1208 #undef LANG_HOOKS_GLOBAL_BINDINGS_P
1209 #define LANG_HOOKS_GLOBAL_BINDINGS_P lto_global_bindings_p
1210 #undef LANG_HOOKS_PUSHDECL
1211 #define LANG_HOOKS_PUSHDECL lto_pushdecl
1212 #undef LANG_HOOKS_GETDECLS
1213 #define LANG_HOOKS_GETDECLS lto_getdecls
1214 #undef LANG_HOOKS_WRITE_GLOBALS
1215 #define LANG_HOOKS_WRITE_GLOBALS lto_write_globals
1216 #undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
1217 #define LANG_HOOKS_REGISTER_BUILTIN_TYPE lto_register_builtin_type
1218 #undef LANG_HOOKS_BUILTIN_FUNCTION
1219 #define LANG_HOOKS_BUILTIN_FUNCTION lto_builtin_function
1220 #undef LANG_HOOKS_INIT
1221 #define LANG_HOOKS_INIT lto_init
1222 #undef LANG_HOOKS_PARSE_FILE
1223 #define LANG_HOOKS_PARSE_FILE lto_main
1224 #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
1225 #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION tree_rest_of_compilation
1226 #undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
1227 #define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
1228 #undef LANG_HOOKS_TYPES_COMPATIBLE_P
1229 #define LANG_HOOKS_TYPES_COMPATIBLE_P NULL
1230 #undef LANG_HOOKS_EH_PERSONALITY
1231 #define LANG_HOOKS_EH_PERSONALITY lto_eh_personality
1233 /* Attribute hooks. */
1234 #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
1235 #define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE lto_attribute_table
1236 #undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
1237 #define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE lto_format_attribute_table
1239 #undef LANG_HOOKS_BEGIN_SECTION
1240 #define LANG_HOOKS_BEGIN_SECTION lto_obj_begin_section
1241 #undef LANG_HOOKS_APPEND_DATA
1242 #define LANG_HOOKS_APPEND_DATA lto_obj_append_data
1243 #undef LANG_HOOKS_END_SECTION
1244 #define LANG_HOOKS_END_SECTION lto_obj_end_section
1246 #undef LANG_HOOKS_INIT_TS
1247 #define LANG_HOOKS_INIT_TS lto_init_ts
1249 struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
1251 /* Language hooks that are not part of lang_hooks. */
1253 tree
1254 convert (tree type ATTRIBUTE_UNUSED, tree expr ATTRIBUTE_UNUSED)
1256 gcc_unreachable ();
1259 /* Tree walking support. */
1261 static enum lto_tree_node_structure_enum
1262 lto_tree_node_structure (union lang_tree_node *t ATTRIBUTE_UNUSED)
1264 return TS_LTO_GENERIC;
1267 #include "ggc.h"
1268 #include "gtype-lto.h"
1269 #include "gt-lto-lto-lang.h"