1 /* Language-dependent hooks for LTO.
2 Copyright (C) 2009-2015 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
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
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/>. */
23 #include "coretypes.h"
33 #include "fold-const.h"
34 #include "stringpool.h"
35 #include "stor-layout.h"
37 #include "langhooks.h"
38 #include "langhooks-def.h"
42 #include "tree-inline.h"
44 #include "hard-reg-set.h"
47 #include "basic-block.h"
48 #include "tree-ssa-alias.h"
49 #include "internal-fn.h"
50 #include "gimple-expr.h"
53 #include "diagnostic-core.h"
56 #include "plugin-api.h"
59 #include "lto-streamer.h"
62 static tree lto_type_for_size (unsigned, int);
64 static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
65 static tree handle_leaf_attribute (tree *, tree, tree, int, bool *);
66 static tree handle_const_attribute (tree *, tree, tree, int, bool *);
67 static tree handle_malloc_attribute (tree *, tree, tree, int, bool *);
68 static tree handle_pure_attribute (tree *, tree, tree, int, bool *);
69 static tree handle_novops_attribute (tree *, tree, tree, int, bool *);
70 static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
71 static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
72 static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
73 static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
74 static tree handle_transaction_pure_attribute (tree *, tree, tree, int, bool *);
75 static tree handle_returns_twice_attribute (tree *, tree, tree, int, bool *);
76 static tree ignore_attribute (tree *, tree, tree, int, bool *);
78 static tree handle_format_attribute (tree *, tree, tree, int, bool *);
79 static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *);
80 static tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
82 /* Table of machine-independent attributes supported in GIMPLE. */
83 const struct attribute_spec lto_attribute_table[] =
85 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
87 { "noreturn", 0, 0, true, false, false,
88 handle_noreturn_attribute, false },
89 { "leaf", 0, 0, true, false, false,
90 handle_leaf_attribute, false },
91 /* The same comments as for noreturn attributes apply to const ones. */
92 { "const", 0, 0, true, false, false,
93 handle_const_attribute, false },
94 { "malloc", 0, 0, true, false, false,
95 handle_malloc_attribute, false },
96 { "pure", 0, 0, true, false, false,
97 handle_pure_attribute, false },
98 { "no vops", 0, 0, true, false, false,
99 handle_novops_attribute, false },
100 { "nonnull", 0, -1, false, true, true,
101 handle_nonnull_attribute, false },
102 { "nothrow", 0, 0, true, false, false,
103 handle_nothrow_attribute, false },
104 { "returns_twice", 0, 0, true, false, false,
105 handle_returns_twice_attribute, false },
106 { "sentinel", 0, 1, false, true, true,
107 handle_sentinel_attribute, false },
108 { "type generic", 0, 0, false, true, true,
109 handle_type_generic_attribute, false },
110 { "fn spec", 1, 1, false, true, true,
111 handle_fnspec_attribute, false },
112 { "transaction_pure", 0, 0, false, true, true,
113 handle_transaction_pure_attribute, false },
114 /* For internal use only. The leading '*' both prevents its usage in
115 source code and signals that it may be overridden by machine tables. */
116 { "*tm regparm", 0, 0, false, true, true,
117 ignore_attribute, false },
118 { NULL, 0, 0, false, false, false, NULL, false }
121 /* Give the specifications for the format attributes, used by C and all
124 const struct attribute_spec lto_format_attribute_table[] =
126 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
127 affects_type_identity } */
128 { "format", 3, 3, false, true, true,
129 handle_format_attribute, false },
130 { "format_arg", 1, 1, false, true, true,
131 handle_format_arg_attribute, false },
132 { NULL, 0, 0, false, false, false, NULL, false }
135 enum built_in_attribute
137 #define DEF_ATTR_NULL_TREE(ENUM) ENUM,
138 #define DEF_ATTR_INT(ENUM, VALUE) ENUM,
139 #define DEF_ATTR_STRING(ENUM, VALUE) ENUM,
140 #define DEF_ATTR_IDENT(ENUM, STRING) ENUM,
141 #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) ENUM,
142 #include "builtin-attrs.def"
143 #undef DEF_ATTR_NULL_TREE
145 #undef DEF_ATTR_STRING
146 #undef DEF_ATTR_IDENT
147 #undef DEF_ATTR_TREE_LIST
151 static GTY(()) tree built_in_attributes[(int) ATTR_LAST];
155 enum lto_builtin_type
157 #define DEF_PRIMITIVE_TYPE(NAME, VALUE) NAME,
158 #define DEF_FUNCTION_TYPE_0(NAME, RETURN) NAME,
159 #define DEF_FUNCTION_TYPE_1(NAME, RETURN, ARG1) NAME,
160 #define DEF_FUNCTION_TYPE_2(NAME, RETURN, ARG1, ARG2) NAME,
161 #define DEF_FUNCTION_TYPE_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
162 #define DEF_FUNCTION_TYPE_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
163 #define DEF_FUNCTION_TYPE_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) NAME,
164 #define DEF_FUNCTION_TYPE_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
166 #define DEF_FUNCTION_TYPE_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
168 #define DEF_FUNCTION_TYPE_8(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
169 ARG6, ARG7, ARG8) NAME,
170 #define DEF_FUNCTION_TYPE_VAR_0(NAME, RETURN) NAME,
171 #define DEF_FUNCTION_TYPE_VAR_1(NAME, RETURN, ARG1) NAME,
172 #define DEF_FUNCTION_TYPE_VAR_2(NAME, RETURN, ARG1, ARG2) NAME,
173 #define DEF_FUNCTION_TYPE_VAR_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
174 #define DEF_FUNCTION_TYPE_VAR_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
175 #define DEF_FUNCTION_TYPE_VAR_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG6) \
177 #define DEF_FUNCTION_TYPE_VAR_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
179 #define DEF_FUNCTION_TYPE_VAR_11(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
180 ARG6, ARG7, ARG8, ARG9, ARG10, ARG11) NAME,
181 #define DEF_POINTER_TYPE(NAME, TYPE) NAME,
182 #include "builtin-types.def"
183 #undef DEF_PRIMITIVE_TYPE
184 #undef DEF_FUNCTION_TYPE_0
185 #undef DEF_FUNCTION_TYPE_1
186 #undef DEF_FUNCTION_TYPE_2
187 #undef DEF_FUNCTION_TYPE_3
188 #undef DEF_FUNCTION_TYPE_4
189 #undef DEF_FUNCTION_TYPE_5
190 #undef DEF_FUNCTION_TYPE_6
191 #undef DEF_FUNCTION_TYPE_7
192 #undef DEF_FUNCTION_TYPE_8
193 #undef DEF_FUNCTION_TYPE_VAR_0
194 #undef DEF_FUNCTION_TYPE_VAR_1
195 #undef DEF_FUNCTION_TYPE_VAR_2
196 #undef DEF_FUNCTION_TYPE_VAR_3
197 #undef DEF_FUNCTION_TYPE_VAR_4
198 #undef DEF_FUNCTION_TYPE_VAR_5
199 #undef DEF_FUNCTION_TYPE_VAR_7
200 #undef DEF_FUNCTION_TYPE_VAR_11
201 #undef DEF_POINTER_TYPE
205 typedef enum lto_builtin_type builtin_type;
207 static GTY(()) tree builtin_types[(int) BT_LAST + 1];
209 static GTY(()) tree string_type_node;
210 static GTY(()) tree const_string_type_node;
211 static GTY(()) tree wint_type_node;
212 static GTY(()) tree intmax_type_node;
213 static GTY(()) tree uintmax_type_node;
214 static GTY(()) tree signed_size_type_node;
216 /* Flags needed to process builtins.def. */
221 /* Attribute handlers. */
223 /* Handle a "noreturn" attribute; arguments as in
224 struct attribute_spec.handler. */
227 handle_noreturn_attribute (tree *node, tree ARG_UNUSED (name),
228 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
229 bool * ARG_UNUSED (no_add_attrs))
231 tree type = TREE_TYPE (*node);
233 if (TREE_CODE (*node) == FUNCTION_DECL)
234 TREE_THIS_VOLATILE (*node) = 1;
235 else if (TREE_CODE (type) == POINTER_TYPE
236 && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
239 (build_type_variant (TREE_TYPE (type),
240 TYPE_READONLY (TREE_TYPE (type)), 1));
247 /* Handle a "leaf" attribute; arguments as in
248 struct attribute_spec.handler. */
251 handle_leaf_attribute (tree *node, tree name,
252 tree ARG_UNUSED (args),
253 int ARG_UNUSED (flags), bool *no_add_attrs)
255 if (TREE_CODE (*node) != FUNCTION_DECL)
257 warning (OPT_Wattributes, "%qE attribute ignored", name);
258 *no_add_attrs = true;
260 if (!TREE_PUBLIC (*node))
262 warning (OPT_Wattributes, "%qE attribute has no effect on unit local functions", name);
263 *no_add_attrs = true;
269 /* Handle a "const" attribute; arguments as in
270 struct attribute_spec.handler. */
273 handle_const_attribute (tree *node, tree ARG_UNUSED (name),
274 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
275 bool * ARG_UNUSED (no_add_attrs))
277 tree type = TREE_TYPE (*node);
279 /* See FIXME comment on noreturn in c_common_attribute_table. */
280 if (TREE_CODE (*node) == FUNCTION_DECL)
281 TREE_READONLY (*node) = 1;
282 else if (TREE_CODE (type) == POINTER_TYPE
283 && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
286 (build_type_variant (TREE_TYPE (type), 1,
287 TREE_THIS_VOLATILE (TREE_TYPE (type))));
295 /* Handle a "malloc" attribute; arguments as in
296 struct attribute_spec.handler. */
299 handle_malloc_attribute (tree *node, tree ARG_UNUSED (name),
300 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
301 bool * ARG_UNUSED (no_add_attrs))
303 if (TREE_CODE (*node) == FUNCTION_DECL
304 && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (*node))))
305 DECL_IS_MALLOC (*node) = 1;
313 /* Handle a "pure" attribute; arguments as in
314 struct attribute_spec.handler. */
317 handle_pure_attribute (tree *node, tree ARG_UNUSED (name),
318 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
319 bool * ARG_UNUSED (no_add_attrs))
321 if (TREE_CODE (*node) == FUNCTION_DECL)
322 DECL_PURE_P (*node) = 1;
330 /* Handle a "no vops" attribute; arguments as in
331 struct attribute_spec.handler. */
334 handle_novops_attribute (tree *node, tree ARG_UNUSED (name),
335 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
336 bool *ARG_UNUSED (no_add_attrs))
338 gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
339 DECL_IS_NOVOPS (*node) = 1;
344 /* Helper for nonnull attribute handling; fetch the operand number
345 from the attribute argument list. */
348 get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp)
350 /* Verify the arg number is a constant. */
351 if (!tree_fits_uhwi_p (arg_num_expr))
354 *valp = TREE_INT_CST_LOW (arg_num_expr);
358 /* Handle the "nonnull" attribute. */
361 handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
362 tree args, int ARG_UNUSED (flags),
363 bool * ARG_UNUSED (no_add_attrs))
367 /* If no arguments are specified, all pointer arguments should be
368 non-null. Verify a full prototype is given so that the arguments
369 will have the correct types when we actually check them later. */
372 gcc_assert (prototype_p (type));
376 /* Argument list specified. Verify that each argument number references
377 a pointer argument. */
378 for (; args; args = TREE_CHAIN (args))
381 unsigned HOST_WIDE_INT arg_num = 0, ck_num;
383 if (!get_nonnull_operand (TREE_VALUE (args), &arg_num))
386 argument = TYPE_ARG_TYPES (type);
389 for (ck_num = 1; ; ck_num++)
391 if (!argument || ck_num == arg_num)
393 argument = TREE_CHAIN (argument);
397 && TREE_CODE (TREE_VALUE (argument)) == POINTER_TYPE);
405 /* Handle a "nothrow" attribute; arguments as in
406 struct attribute_spec.handler. */
409 handle_nothrow_attribute (tree *node, tree ARG_UNUSED (name),
410 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
411 bool * ARG_UNUSED (no_add_attrs))
413 if (TREE_CODE (*node) == FUNCTION_DECL)
414 TREE_NOTHROW (*node) = 1;
422 /* Handle a "sentinel" attribute. */
425 handle_sentinel_attribute (tree *node, tree ARG_UNUSED (name), tree args,
426 int ARG_UNUSED (flags),
427 bool * ARG_UNUSED (no_add_attrs))
429 gcc_assert (stdarg_p (*node));
433 tree position = TREE_VALUE (args);
434 gcc_assert (TREE_CODE (position) == INTEGER_CST);
435 if (tree_int_cst_lt (position, integer_zero_node))
442 /* Handle a "type_generic" attribute. */
445 handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
446 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
447 bool * ARG_UNUSED (no_add_attrs))
449 /* Ensure we have a function type. */
450 gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
452 /* Ensure we have a variadic function. */
453 gcc_assert (!prototype_p (*node) || stdarg_p (*node));
458 /* Handle a "transaction_pure" attribute. */
461 handle_transaction_pure_attribute (tree *node, tree ARG_UNUSED (name),
462 tree ARG_UNUSED (args),
463 int ARG_UNUSED (flags),
464 bool * ARG_UNUSED (no_add_attrs))
466 /* Ensure we have a function type. */
467 gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
472 /* Handle a "returns_twice" attribute. */
475 handle_returns_twice_attribute (tree *node, tree ARG_UNUSED (name),
476 tree ARG_UNUSED (args),
477 int ARG_UNUSED (flags),
478 bool * ARG_UNUSED (no_add_attrs))
480 gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
482 DECL_IS_RETURNS_TWICE (*node) = 1;
487 /* Ignore the given attribute. Used when this attribute may be usefully
488 overridden by the target, but is not used generically. */
491 ignore_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
492 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
495 *no_add_attrs = true;
499 /* Handle a "format" attribute; arguments as in
500 struct attribute_spec.handler. */
503 handle_format_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
504 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
507 *no_add_attrs = true;
512 /* Handle a "format_arg" attribute; arguments as in
513 struct attribute_spec.handler. */
516 handle_format_arg_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
517 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
520 *no_add_attrs = true;
525 /* Handle a "fn spec" attribute; arguments as in
526 struct attribute_spec.handler. */
529 handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name),
530 tree args, int ARG_UNUSED (flags),
531 bool *no_add_attrs ATTRIBUTE_UNUSED)
534 && TREE_CODE (TREE_VALUE (args)) == STRING_CST
535 && !TREE_CHAIN (args));
539 /* Cribbed from c-common.c. */
542 def_fn_type (builtin_type def, builtin_type ret, bool var, int n, ...)
545 tree *args = XALLOCAVEC (tree, n);
551 for (i = 0; i < n; ++i)
553 builtin_type a = (builtin_type) va_arg (list, int);
554 t = builtin_types[a];
555 if (t == error_mark_node)
561 t = builtin_types[ret];
564 if (t == error_mark_node)
567 t = build_varargs_function_type_array (t, n, args);
569 t = build_function_type_array (t, n, args);
571 builtin_types[def] = t;
574 /* Used to help initialize the builtin-types.def table. When a type of
575 the correct size doesn't exist, use error_mark_node instead of NULL.
576 The later results in segfaults even when a decl using the type doesn't
580 builtin_type_for_size (int size, bool unsignedp)
582 tree type = lto_type_for_size (size, unsignedp);
583 return type ? type : error_mark_node;
586 /* Support for DEF_BUILTIN. */
589 def_builtin_1 (enum built_in_function fncode, const char *name,
590 enum built_in_class fnclass, tree fntype, tree libtype,
591 bool both_p, bool fallback_p, bool nonansi_p,
592 tree fnattrs, bool implicit_p)
597 if (fntype == error_mark_node)
600 libname = name + strlen ("__builtin_");
601 decl = add_builtin_function (name, fntype, fncode, fnclass,
602 (fallback_p ? libname : NULL),
607 && !(nonansi_p && flag_no_nonansi_builtin))
608 add_builtin_function (libname, libtype, fncode, fnclass,
611 set_builtin_decl (fncode, decl, implicit_p);
615 /* Initialize the attribute table for all the supported builtins. */
618 lto_init_attributes (void)
620 /* Fill in the built_in_attributes array. */
621 #define DEF_ATTR_NULL_TREE(ENUM) \
622 built_in_attributes[(int) ENUM] = NULL_TREE;
623 #define DEF_ATTR_INT(ENUM, VALUE) \
624 built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE);
625 #define DEF_ATTR_STRING(ENUM, VALUE) \
626 built_in_attributes[(int) ENUM] = build_string (strlen (VALUE), VALUE);
627 #define DEF_ATTR_IDENT(ENUM, STRING) \
628 built_in_attributes[(int) ENUM] = get_identifier (STRING);
629 #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) \
630 built_in_attributes[(int) ENUM] \
631 = tree_cons (built_in_attributes[(int) PURPOSE], \
632 built_in_attributes[(int) VALUE], \
633 built_in_attributes[(int) CHAIN]);
634 #include "builtin-attrs.def"
635 #undef DEF_ATTR_NULL_TREE
637 #undef DEF_ATTR_STRING
638 #undef DEF_ATTR_IDENT
639 #undef DEF_ATTR_TREE_LIST
642 /* Create builtin types and functions. VA_LIST_REF_TYPE_NODE and
643 VA_LIST_ARG_TYPE_NODE are used in builtin-types.def. */
646 lto_define_builtins (tree va_list_ref_type_node ATTRIBUTE_UNUSED,
647 tree va_list_arg_type_node ATTRIBUTE_UNUSED)
649 #define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
650 builtin_types[ENUM] = VALUE;
651 #define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \
652 def_fn_type (ENUM, RETURN, 0, 0);
653 #define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1) \
654 def_fn_type (ENUM, RETURN, 0, 1, ARG1);
655 #define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \
656 def_fn_type (ENUM, RETURN, 0, 2, ARG1, ARG2);
657 #define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
658 def_fn_type (ENUM, RETURN, 0, 3, ARG1, ARG2, ARG3);
659 #define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
660 def_fn_type (ENUM, RETURN, 0, 4, ARG1, ARG2, ARG3, ARG4);
661 #define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
662 def_fn_type (ENUM, RETURN, 0, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
663 #define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
665 def_fn_type (ENUM, RETURN, 0, 6, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
666 #define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
668 def_fn_type (ENUM, RETURN, 0, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7);
669 #define DEF_FUNCTION_TYPE_8(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
671 def_fn_type (ENUM, RETURN, 0, 8, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, \
673 #define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \
674 def_fn_type (ENUM, RETURN, 1, 0);
675 #define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \
676 def_fn_type (ENUM, RETURN, 1, 1, ARG1);
677 #define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2) \
678 def_fn_type (ENUM, RETURN, 1, 2, ARG1, ARG2);
679 #define DEF_FUNCTION_TYPE_VAR_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
680 def_fn_type (ENUM, RETURN, 1, 3, ARG1, ARG2, ARG3);
681 #define DEF_FUNCTION_TYPE_VAR_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
682 def_fn_type (ENUM, RETURN, 1, 4, ARG1, ARG2, ARG3, ARG4);
683 #define DEF_FUNCTION_TYPE_VAR_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
684 def_fn_type (ENUM, RETURN, 1, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
685 #define DEF_FUNCTION_TYPE_VAR_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
687 def_fn_type (ENUM, RETURN, 1, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7);
688 #define DEF_FUNCTION_TYPE_VAR_11(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
689 ARG6, ARG7, ARG8, ARG9, ARG10, ARG11) \
690 def_fn_type (ENUM, RETURN, 1, 11, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, \
691 ARG7, ARG8, ARG9, ARG10, ARG11);
692 #define DEF_POINTER_TYPE(ENUM, TYPE) \
693 builtin_types[(int) ENUM] = build_pointer_type (builtin_types[(int) TYPE]);
695 #include "builtin-types.def"
697 #undef DEF_PRIMITIVE_TYPE
698 #undef DEF_FUNCTION_TYPE_0
699 #undef DEF_FUNCTION_TYPE_1
700 #undef DEF_FUNCTION_TYPE_2
701 #undef DEF_FUNCTION_TYPE_3
702 #undef DEF_FUNCTION_TYPE_4
703 #undef DEF_FUNCTION_TYPE_5
704 #undef DEF_FUNCTION_TYPE_6
705 #undef DEF_FUNCTION_TYPE_7
706 #undef DEF_FUNCTION_TYPE_8
707 #undef DEF_FUNCTION_TYPE_VAR_0
708 #undef DEF_FUNCTION_TYPE_VAR_1
709 #undef DEF_FUNCTION_TYPE_VAR_2
710 #undef DEF_FUNCTION_TYPE_VAR_3
711 #undef DEF_FUNCTION_TYPE_VAR_4
712 #undef DEF_FUNCTION_TYPE_VAR_5
713 #undef DEF_FUNCTION_TYPE_VAR_7
714 #undef DEF_FUNCTION_TYPE_VAR_11
715 #undef DEF_POINTER_TYPE
716 builtin_types[(int) BT_LAST] = NULL_TREE;
718 lto_init_attributes ();
720 #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, FALLBACK_P,\
721 NONANSI_P, ATTRS, IMPLICIT, COND) \
723 def_builtin_1 (ENUM, NAME, CLASS, builtin_types[(int) TYPE], \
724 builtin_types[(int) LIBTYPE], BOTH_P, FALLBACK_P, \
725 NONANSI_P, built_in_attributes[(int) ATTRS], IMPLICIT);
726 #include "builtins.def"
730 static GTY(()) tree registered_builtin_types;
732 /* Language hooks. */
735 lto_option_lang_mask (void)
741 lto_complain_wrong_lang_p (const struct cl_option *option ATTRIBUTE_UNUSED)
743 /* The LTO front end inherits all the options from the first front
744 end that was used. However, not all the original front end
745 options make sense in LTO.
747 A real solution would be to filter this in collect2, but collect2
748 does not have access to all the option attributes to know what to
749 filter. So, in lto1 we silently accept inherited flags and do
755 lto_init_options_struct (struct gcc_options *opts)
757 /* By default, C99-like requirements for complex multiply and divide.
758 ??? Until the complex method is encoded in the IL this is the only
759 safe choice. This will pessimize Fortran code with LTO unless
760 people specify a complex method manually or use -ffast-math. */
761 opts->x_flag_complex_method = 2;
764 /* Handle command-line option SCODE. If the option takes an argument, it is
765 stored in ARG, which is otherwise NULL. VALUE holds either a numerical
766 argument or a binary value indicating whether the positive or negative form
767 of the option was supplied. */
769 const char *resolution_file_name;
771 lto_handle_option (size_t scode, const char *arg,
772 int value ATTRIBUTE_UNUSED, int kind ATTRIBUTE_UNUSED,
773 location_t loc ATTRIBUTE_UNUSED,
774 const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
776 enum opt_code code = (enum opt_code) scode;
781 case OPT_fresolution_:
782 resolution_file_name = arg;
790 flag_wpa = value ? "" : NULL;
800 /* Perform post-option processing. Does additional initialization based on
801 command-line options. PFILENAME is the main input filename. Returns false
802 to enable subsequent back-end initialization. */
805 lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
807 /* -fltrans and -fwpa are mutually exclusive. Check for that here. */
808 if (flag_wpa && flag_ltrans)
809 error ("-fwpa and -fltrans are mutually exclusive");
813 flag_generate_lto = 0;
815 /* During LTRANS, we are not looking at the whole program, only
816 a subset of the whole callgraph. */
817 flag_whole_program = 0;
821 flag_generate_lto = 1;
823 /* Excess precision other than "fast" requires front-end
825 flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
827 /* Initialize the compiler back end. */
831 /* Return an integer type with PRECISION bits of precision,
832 that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */
835 lto_type_for_size (unsigned precision, int unsignedp)
837 if (precision == TYPE_PRECISION (integer_type_node))
838 return unsignedp ? unsigned_type_node : integer_type_node;
840 if (precision == TYPE_PRECISION (signed_char_type_node))
841 return unsignedp ? unsigned_char_type_node : signed_char_type_node;
843 if (precision == TYPE_PRECISION (short_integer_type_node))
844 return unsignedp ? short_unsigned_type_node : short_integer_type_node;
846 if (precision == TYPE_PRECISION (long_integer_type_node))
847 return unsignedp ? long_unsigned_type_node : long_integer_type_node;
849 if (precision == TYPE_PRECISION (long_long_integer_type_node))
851 ? long_long_unsigned_type_node
852 : long_long_integer_type_node;
854 if (precision <= TYPE_PRECISION (intQI_type_node))
855 return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
857 if (precision <= TYPE_PRECISION (intHI_type_node))
858 return unsignedp ? unsigned_intHI_type_node : intHI_type_node;
860 if (precision <= TYPE_PRECISION (intSI_type_node))
861 return unsignedp ? unsigned_intSI_type_node : intSI_type_node;
863 if (precision <= TYPE_PRECISION (intDI_type_node))
864 return unsignedp ? unsigned_intDI_type_node : intDI_type_node;
866 if (precision <= TYPE_PRECISION (intTI_type_node))
867 return unsignedp ? unsigned_intTI_type_node : intTI_type_node;
873 /* Return a data type that has machine mode MODE.
874 If the mode is an integer,
875 then UNSIGNEDP selects between signed and unsigned types.
876 If the mode is a fixed-point mode,
877 then UNSIGNEDP selects between saturating and nonsaturating types. */
880 lto_type_for_mode (machine_mode mode, int unsigned_p)
884 if (mode == TYPE_MODE (integer_type_node))
885 return unsigned_p ? unsigned_type_node : integer_type_node;
887 if (mode == TYPE_MODE (signed_char_type_node))
888 return unsigned_p ? unsigned_char_type_node : signed_char_type_node;
890 if (mode == TYPE_MODE (short_integer_type_node))
891 return unsigned_p ? short_unsigned_type_node : short_integer_type_node;
893 if (mode == TYPE_MODE (long_integer_type_node))
894 return unsigned_p ? long_unsigned_type_node : long_integer_type_node;
896 if (mode == TYPE_MODE (long_long_integer_type_node))
897 return unsigned_p ? long_long_unsigned_type_node : long_long_integer_type_node;
900 return unsigned_p ? unsigned_intQI_type_node : intQI_type_node;
903 return unsigned_p ? unsigned_intHI_type_node : intHI_type_node;
906 return unsigned_p ? unsigned_intSI_type_node : intSI_type_node;
909 return unsigned_p ? unsigned_intDI_type_node : intDI_type_node;
911 #if HOST_BITS_PER_WIDE_INT >= 64
912 if (mode == TYPE_MODE (intTI_type_node))
913 return unsigned_p ? unsigned_intTI_type_node : intTI_type_node;
916 if (mode == TYPE_MODE (float_type_node))
917 return float_type_node;
919 if (mode == TYPE_MODE (double_type_node))
920 return double_type_node;
922 if (mode == TYPE_MODE (long_double_type_node))
923 return long_double_type_node;
925 if (mode == TYPE_MODE (void_type_node))
926 return void_type_node;
928 if (mode == TYPE_MODE (build_pointer_type (char_type_node)))
930 ? make_unsigned_type (GET_MODE_PRECISION (mode))
931 : make_signed_type (GET_MODE_PRECISION (mode)));
933 if (mode == TYPE_MODE (build_pointer_type (integer_type_node)))
935 ? make_unsigned_type (GET_MODE_PRECISION (mode))
936 : make_signed_type (GET_MODE_PRECISION (mode)));
938 if (COMPLEX_MODE_P (mode))
940 machine_mode inner_mode;
943 if (mode == TYPE_MODE (complex_float_type_node))
944 return complex_float_type_node;
945 if (mode == TYPE_MODE (complex_double_type_node))
946 return complex_double_type_node;
947 if (mode == TYPE_MODE (complex_long_double_type_node))
948 return complex_long_double_type_node;
950 if (mode == TYPE_MODE (complex_integer_type_node) && !unsigned_p)
951 return complex_integer_type_node;
953 inner_mode = GET_MODE_INNER (mode);
954 inner_type = lto_type_for_mode (inner_mode, unsigned_p);
955 if (inner_type != NULL_TREE)
956 return build_complex_type (inner_type);
958 else if (VECTOR_MODE_P (mode))
960 machine_mode inner_mode = GET_MODE_INNER (mode);
961 tree inner_type = lto_type_for_mode (inner_mode, unsigned_p);
962 if (inner_type != NULL_TREE)
963 return build_vector_type_for_mode (inner_type, mode);
966 if (mode == TYPE_MODE (dfloat32_type_node))
967 return dfloat32_type_node;
968 if (mode == TYPE_MODE (dfloat64_type_node))
969 return dfloat64_type_node;
970 if (mode == TYPE_MODE (dfloat128_type_node))
971 return dfloat128_type_node;
973 if (ALL_SCALAR_FIXED_POINT_MODE_P (mode))
975 if (mode == TYPE_MODE (short_fract_type_node))
976 return unsigned_p ? sat_short_fract_type_node : short_fract_type_node;
977 if (mode == TYPE_MODE (fract_type_node))
978 return unsigned_p ? sat_fract_type_node : fract_type_node;
979 if (mode == TYPE_MODE (long_fract_type_node))
980 return unsigned_p ? sat_long_fract_type_node : long_fract_type_node;
981 if (mode == TYPE_MODE (long_long_fract_type_node))
982 return unsigned_p ? sat_long_long_fract_type_node
983 : long_long_fract_type_node;
985 if (mode == TYPE_MODE (unsigned_short_fract_type_node))
986 return unsigned_p ? sat_unsigned_short_fract_type_node
987 : unsigned_short_fract_type_node;
988 if (mode == TYPE_MODE (unsigned_fract_type_node))
989 return unsigned_p ? sat_unsigned_fract_type_node
990 : unsigned_fract_type_node;
991 if (mode == TYPE_MODE (unsigned_long_fract_type_node))
992 return unsigned_p ? sat_unsigned_long_fract_type_node
993 : unsigned_long_fract_type_node;
994 if (mode == TYPE_MODE (unsigned_long_long_fract_type_node))
995 return unsigned_p ? sat_unsigned_long_long_fract_type_node
996 : unsigned_long_long_fract_type_node;
998 if (mode == TYPE_MODE (short_accum_type_node))
999 return unsigned_p ? sat_short_accum_type_node : short_accum_type_node;
1000 if (mode == TYPE_MODE (accum_type_node))
1001 return unsigned_p ? sat_accum_type_node : accum_type_node;
1002 if (mode == TYPE_MODE (long_accum_type_node))
1003 return unsigned_p ? sat_long_accum_type_node : long_accum_type_node;
1004 if (mode == TYPE_MODE (long_long_accum_type_node))
1005 return unsigned_p ? sat_long_long_accum_type_node
1006 : long_long_accum_type_node;
1008 if (mode == TYPE_MODE (unsigned_short_accum_type_node))
1009 return unsigned_p ? sat_unsigned_short_accum_type_node
1010 : unsigned_short_accum_type_node;
1011 if (mode == TYPE_MODE (unsigned_accum_type_node))
1012 return unsigned_p ? sat_unsigned_accum_type_node
1013 : unsigned_accum_type_node;
1014 if (mode == TYPE_MODE (unsigned_long_accum_type_node))
1015 return unsigned_p ? sat_unsigned_long_accum_type_node
1016 : unsigned_long_accum_type_node;
1017 if (mode == TYPE_MODE (unsigned_long_long_accum_type_node))
1018 return unsigned_p ? sat_unsigned_long_long_accum_type_node
1019 : unsigned_long_long_accum_type_node;
1022 return unsigned_p ? sat_qq_type_node : qq_type_node;
1024 return unsigned_p ? sat_hq_type_node : hq_type_node;
1026 return unsigned_p ? sat_sq_type_node : sq_type_node;
1028 return unsigned_p ? sat_dq_type_node : dq_type_node;
1030 return unsigned_p ? sat_tq_type_node : tq_type_node;
1032 if (mode == UQQmode)
1033 return unsigned_p ? sat_uqq_type_node : uqq_type_node;
1034 if (mode == UHQmode)
1035 return unsigned_p ? sat_uhq_type_node : uhq_type_node;
1036 if (mode == USQmode)
1037 return unsigned_p ? sat_usq_type_node : usq_type_node;
1038 if (mode == UDQmode)
1039 return unsigned_p ? sat_udq_type_node : udq_type_node;
1040 if (mode == UTQmode)
1041 return unsigned_p ? sat_utq_type_node : utq_type_node;
1044 return unsigned_p ? sat_ha_type_node : ha_type_node;
1046 return unsigned_p ? sat_sa_type_node : sa_type_node;
1048 return unsigned_p ? sat_da_type_node : da_type_node;
1050 return unsigned_p ? sat_ta_type_node : ta_type_node;
1052 if (mode == UHAmode)
1053 return unsigned_p ? sat_uha_type_node : uha_type_node;
1054 if (mode == USAmode)
1055 return unsigned_p ? sat_usa_type_node : usa_type_node;
1056 if (mode == UDAmode)
1057 return unsigned_p ? sat_uda_type_node : uda_type_node;
1058 if (mode == UTAmode)
1059 return unsigned_p ? sat_uta_type_node : uta_type_node;
1062 for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
1063 if (TYPE_MODE (TREE_VALUE (t)) == mode)
1064 return TREE_VALUE (t);
1069 /* Return true if we are in the global binding level. */
1072 lto_global_bindings_p (void)
1074 return cfun == NULL;
1078 lto_set_decl_assembler_name (tree decl)
1080 /* This is almost the same as lhd_set_decl_assembler_name, except that
1081 we need to uniquify file-scope names, even if they are not
1082 TREE_PUBLIC, to avoid conflicts between individual files. */
1085 if (TREE_PUBLIC (decl))
1086 id = targetm.mangle_decl_assembler_name (decl, DECL_NAME (decl));
1089 const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
1092 ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl));
1093 id = get_identifier (label);
1096 SET_DECL_ASSEMBLER_NAME (decl, id);
1100 lto_pushdecl (tree t ATTRIBUTE_UNUSED)
1102 /* Do nothing, since we get all information from DWARF and LTO
1110 /* We have our own write_globals langhook, hence the getdecls
1111 langhook shouldn't be used, except by dbxout.c, so we can't
1117 lto_builtin_function (tree decl)
1123 lto_register_builtin_type (tree type, const char *name)
1127 if (!TYPE_NAME (type))
1129 decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL,
1130 get_identifier (name), type);
1131 DECL_ARTIFICIAL (decl) = 1;
1132 TYPE_NAME (type) = decl;
1135 registered_builtin_types = tree_cons (0, type, registered_builtin_types);
1138 /* Build nodes that would have be created by the C front-end; necessary
1139 for including builtin-types.def and ultimately builtins.def. */
1142 lto_build_c_type_nodes (void)
1144 gcc_assert (void_type_node);
1146 void_list_node = build_tree_list (NULL_TREE, void_type_node);
1147 string_type_node = build_pointer_type (char_type_node);
1148 const_string_type_node
1149 = build_pointer_type (build_qualified_type (char_type_node, TYPE_QUAL_CONST));
1151 if (strcmp (SIZE_TYPE, "unsigned int") == 0)
1153 intmax_type_node = integer_type_node;
1154 uintmax_type_node = unsigned_type_node;
1155 signed_size_type_node = integer_type_node;
1157 else if (strcmp (SIZE_TYPE, "long unsigned int") == 0)
1159 intmax_type_node = long_integer_type_node;
1160 uintmax_type_node = long_unsigned_type_node;
1161 signed_size_type_node = long_integer_type_node;
1163 else if (strcmp (SIZE_TYPE, "long long unsigned int") == 0)
1165 intmax_type_node = long_long_integer_type_node;
1166 uintmax_type_node = long_long_unsigned_type_node;
1167 signed_size_type_node = long_long_integer_type_node;
1173 signed_size_type_node = NULL_TREE;
1174 for (i = 0; i < NUM_INT_N_ENTS; i++)
1175 if (int_n_enabled_p[i])
1178 sprintf (name, "__int%d unsigned", int_n_data[i].bitsize);
1180 if (strcmp (name, SIZE_TYPE) == 0)
1182 intmax_type_node = int_n_trees[i].signed_type;
1183 uintmax_type_node = int_n_trees[i].unsigned_type;
1184 signed_size_type_node = int_n_trees[i].signed_type;
1187 if (signed_size_type_node == NULL_TREE)
1191 wint_type_node = unsigned_type_node;
1192 pid_type_node = integer_type_node;
1195 /* Perform LTO-specific initialization. */
1202 /* We need to generate LTO if running in WPA mode. */
1203 flag_generate_lto = (flag_wpa != NULL);
1205 /* Create the basic integer types. */
1206 build_common_tree_nodes (flag_signed_char, flag_short_double);
1208 /* The global tree for the main identifier is filled in by
1209 language-specific front-end initialization that is not run in the
1210 LTO back-end. It appears that all languages that perform such
1211 initialization currently do so in the same way, so we do it here. */
1212 if (main_identifier_node == NULL_TREE)
1213 main_identifier_node = get_identifier ("main");
1215 /* In the C++ front-end, fileptr_type_node is defined as a variant
1216 copy of of ptr_type_node, rather than ptr_node itself. The
1217 distinction should only be relevant to the front-end, so we
1218 always use the C definition here in lto1. */
1219 gcc_assert (fileptr_type_node == ptr_type_node);
1220 gcc_assert (TYPE_MAIN_VARIANT (fileptr_type_node) == ptr_type_node);
1222 ptrdiff_type_node = integer_type_node;
1224 lto_build_c_type_nodes ();
1225 gcc_assert (va_list_type_node);
1227 if (TREE_CODE (va_list_type_node) == ARRAY_TYPE)
1229 tree x = build_pointer_type (TREE_TYPE (va_list_type_node));
1230 lto_define_builtins (x, x);
1234 lto_define_builtins (build_reference_type (va_list_type_node),
1239 cilk_init_builtins ();
1241 targetm.init_builtins ();
1242 build_common_builtin_nodes ();
1244 /* Assign names to the builtin types, otherwise they'll end up
1245 as __unknown__ in debug info.
1246 ??? We simply need to stop pre-seeding the streamer cache.
1247 Below is modeled after from c-common.c:c_common_nodes_and_builtins */
1248 #define NAME_TYPE(t,n) \
1250 TYPE_NAME (t) = build_decl (UNKNOWN_LOCATION, TYPE_DECL, \
1251 get_identifier (n), t)
1252 NAME_TYPE (integer_type_node, "int");
1253 NAME_TYPE (char_type_node, "char");
1254 NAME_TYPE (long_integer_type_node, "long int");
1255 NAME_TYPE (unsigned_type_node, "unsigned int");
1256 NAME_TYPE (long_unsigned_type_node, "long unsigned int");
1257 NAME_TYPE (long_long_integer_type_node, "long long int");
1258 NAME_TYPE (long_long_unsigned_type_node, "long long unsigned int");
1259 NAME_TYPE (short_integer_type_node, "short int");
1260 NAME_TYPE (short_unsigned_type_node, "short unsigned int");
1261 if (signed_char_type_node != char_type_node)
1262 NAME_TYPE (signed_char_type_node, "signed char");
1263 if (unsigned_char_type_node != char_type_node)
1264 NAME_TYPE (unsigned_char_type_node, "unsigned char");
1265 NAME_TYPE (float_type_node, "float");
1266 NAME_TYPE (double_type_node, "double");
1267 NAME_TYPE (long_double_type_node, "long double");
1268 NAME_TYPE (void_type_node, "void");
1269 NAME_TYPE (boolean_type_node, "bool");
1270 NAME_TYPE (complex_float_type_node, "complex float");
1271 NAME_TYPE (complex_double_type_node, "complex double");
1272 NAME_TYPE (complex_long_double_type_node, "complex long double");
1273 for (i = 0; i < NUM_INT_N_ENTS; i++)
1274 if (int_n_enabled_p[i])
1277 sprintf (name, "__int%d", int_n_data[i].bitsize);
1278 NAME_TYPE (int_n_trees[i].signed_type, name);
1282 /* Initialize LTO-specific data structures. */
1288 /* Initialize tree structures required by the LTO front end. */
1290 static void lto_init_ts (void)
1292 tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
1295 #undef LANG_HOOKS_NAME
1296 #define LANG_HOOKS_NAME "GNU GIMPLE"
1297 #undef LANG_HOOKS_OPTION_LANG_MASK
1298 #define LANG_HOOKS_OPTION_LANG_MASK lto_option_lang_mask
1299 #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
1300 #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lto_complain_wrong_lang_p
1301 #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
1302 #define LANG_HOOKS_INIT_OPTIONS_STRUCT lto_init_options_struct
1303 #undef LANG_HOOKS_HANDLE_OPTION
1304 #define LANG_HOOKS_HANDLE_OPTION lto_handle_option
1305 #undef LANG_HOOKS_POST_OPTIONS
1306 #define LANG_HOOKS_POST_OPTIONS lto_post_options
1307 #undef LANG_HOOKS_GET_ALIAS_SET
1308 #define LANG_HOOKS_GET_ALIAS_SET gimple_get_alias_set
1309 #undef LANG_HOOKS_TYPE_FOR_MODE
1310 #define LANG_HOOKS_TYPE_FOR_MODE lto_type_for_mode
1311 #undef LANG_HOOKS_TYPE_FOR_SIZE
1312 #define LANG_HOOKS_TYPE_FOR_SIZE lto_type_for_size
1313 #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
1314 #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lto_set_decl_assembler_name
1315 #undef LANG_HOOKS_GLOBAL_BINDINGS_P
1316 #define LANG_HOOKS_GLOBAL_BINDINGS_P lto_global_bindings_p
1317 #undef LANG_HOOKS_PUSHDECL
1318 #define LANG_HOOKS_PUSHDECL lto_pushdecl
1319 #undef LANG_HOOKS_GETDECLS
1320 #define LANG_HOOKS_GETDECLS lto_getdecls
1321 #undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
1322 #define LANG_HOOKS_REGISTER_BUILTIN_TYPE lto_register_builtin_type
1323 #undef LANG_HOOKS_BUILTIN_FUNCTION
1324 #define LANG_HOOKS_BUILTIN_FUNCTION lto_builtin_function
1325 #undef LANG_HOOKS_INIT
1326 #define LANG_HOOKS_INIT lto_init
1327 #undef LANG_HOOKS_PARSE_FILE
1328 #define LANG_HOOKS_PARSE_FILE lto_main
1329 #undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
1330 #define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
1331 #undef LANG_HOOKS_TYPES_COMPATIBLE_P
1332 #define LANG_HOOKS_TYPES_COMPATIBLE_P NULL
1333 #undef LANG_HOOKS_EH_PERSONALITY
1334 #define LANG_HOOKS_EH_PERSONALITY lto_eh_personality
1336 /* Attribute hooks. */
1337 #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
1338 #define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE lto_attribute_table
1339 #undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
1340 #define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE lto_format_attribute_table
1342 #undef LANG_HOOKS_BEGIN_SECTION
1343 #define LANG_HOOKS_BEGIN_SECTION lto_obj_begin_section
1344 #undef LANG_HOOKS_APPEND_DATA
1345 #define LANG_HOOKS_APPEND_DATA lto_obj_append_data
1346 #undef LANG_HOOKS_END_SECTION
1347 #define LANG_HOOKS_END_SECTION lto_obj_end_section
1349 #undef LANG_HOOKS_INIT_TS
1350 #define LANG_HOOKS_INIT_TS lto_init_ts
1352 struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
1354 /* Language hooks that are not part of lang_hooks. */
1357 convert (tree type ATTRIBUTE_UNUSED, tree expr ATTRIBUTE_UNUSED)
1362 /* Tree walking support. */
1364 static enum lto_tree_node_structure_enum
1365 lto_tree_node_structure (union lang_tree_node *t ATTRIBUTE_UNUSED)
1367 return TS_LTO_GENERIC;
1370 #include "gtype-lto.h"
1371 #include "gt-lto-lto-lang.h"