1 /* Language-dependent hooks for LTO.
2 Copyright (C) 2009-2014 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"
27 #include "stringpool.h"
28 #include "stor-layout.h"
30 #include "langhooks.h"
31 #include "langhooks-def.h"
35 #include "tree-inline.h"
41 #include "hard-reg-set.h"
44 #include "basic-block.h"
45 #include "tree-ssa-alias.h"
46 #include "internal-fn.h"
47 #include "gimple-expr.h"
50 #include "diagnostic-core.h"
53 #include "plugin-api.h"
56 #include "lto-streamer.h"
59 static tree
lto_type_for_size (unsigned, int);
61 static tree
handle_noreturn_attribute (tree
*, tree
, tree
, int, bool *);
62 static tree
handle_leaf_attribute (tree
*, tree
, tree
, int, bool *);
63 static tree
handle_const_attribute (tree
*, tree
, tree
, int, bool *);
64 static tree
handle_malloc_attribute (tree
*, tree
, tree
, int, bool *);
65 static tree
handle_pure_attribute (tree
*, tree
, tree
, int, bool *);
66 static tree
handle_novops_attribute (tree
*, tree
, tree
, int, bool *);
67 static tree
handle_nonnull_attribute (tree
*, tree
, tree
, int, bool *);
68 static tree
handle_nothrow_attribute (tree
*, tree
, tree
, int, bool *);
69 static tree
handle_sentinel_attribute (tree
*, tree
, tree
, int, bool *);
70 static tree
handle_type_generic_attribute (tree
*, tree
, tree
, int, bool *);
71 static tree
handle_transaction_pure_attribute (tree
*, tree
, tree
, int, bool *);
72 static tree
handle_returns_twice_attribute (tree
*, tree
, tree
, int, bool *);
73 static tree
ignore_attribute (tree
*, tree
, tree
, int, bool *);
75 static tree
handle_format_attribute (tree
*, tree
, tree
, int, bool *);
76 static tree
handle_fnspec_attribute (tree
*, tree
, tree
, int, bool *);
77 static tree
handle_format_arg_attribute (tree
*, tree
, tree
, int, bool *);
79 /* Table of machine-independent attributes supported in GIMPLE. */
80 const struct attribute_spec lto_attribute_table
[] =
82 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
84 { "noreturn", 0, 0, true, false, false,
85 handle_noreturn_attribute
, NULL
, false },
86 { "leaf", 0, 0, true, false, false,
87 handle_leaf_attribute
, NULL
, false },
88 /* The same comments as for noreturn attributes apply to const ones. */
89 { "const", 0, 0, true, false, false,
90 handle_const_attribute
, NULL
, false },
91 { "malloc", 0, 0, true, false, false,
92 handle_malloc_attribute
, NULL
, false },
93 { "pure", 0, 0, true, false, false,
94 handle_pure_attribute
, NULL
, false },
95 { "no vops", 0, 0, true, false, false,
96 handle_novops_attribute
, NULL
, false },
97 { "nonnull", 0, -1, false, true, true,
98 NULL
, handle_nonnull_attribute
, false },
99 { "nothrow", 0, 0, true, false, false,
100 handle_nothrow_attribute
, NULL
, false },
101 { "returns_twice", 0, 0, true, false, false,
102 handle_returns_twice_attribute
, NULL
, false },
103 { "sentinel", 0, 1, false, true, true,
104 NULL
, handle_sentinel_attribute
, false },
105 { "type generic", 0, 0, false, true, true,
106 NULL
, handle_type_generic_attribute
, false },
107 { "fn spec", 1, 1, false, true, true,
108 NULL
, handle_fnspec_attribute
, false },
109 { "transaction_pure", 0, 0, false, true, true,
110 NULL
, handle_transaction_pure_attribute
, false },
111 /* For internal use only. The leading '*' both prevents its usage in
112 source code and signals that it may be overridden by machine tables. */
113 { "*tm regparm", 0, 0, false, true, true,
114 NULL
, ignore_attribute
,
116 { NULL
, 0, 0, false, false, false, NULL
, NULL
, false }
119 /* Give the specifications for the format attributes, used by C and all
122 const struct attribute_spec lto_format_attribute_table
[] =
124 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
125 affects_type_identity } */
126 { "format", 3, 3, false, true, true,
128 handle_format_attribute
, false },
129 { "format_arg", 1, 1, false, true, true,
131 handle_format_arg_attribute
, false },
132 { NULL
, 0, 0, false, false, false, NULL
, 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_POINTER_TYPE(NAME, TYPE) NAME,
178 #include "builtin-types.def"
179 #undef DEF_PRIMITIVE_TYPE
180 #undef DEF_FUNCTION_TYPE_0
181 #undef DEF_FUNCTION_TYPE_1
182 #undef DEF_FUNCTION_TYPE_2
183 #undef DEF_FUNCTION_TYPE_3
184 #undef DEF_FUNCTION_TYPE_4
185 #undef DEF_FUNCTION_TYPE_5
186 #undef DEF_FUNCTION_TYPE_6
187 #undef DEF_FUNCTION_TYPE_7
188 #undef DEF_FUNCTION_TYPE_8
189 #undef DEF_FUNCTION_TYPE_VAR_0
190 #undef DEF_FUNCTION_TYPE_VAR_1
191 #undef DEF_FUNCTION_TYPE_VAR_2
192 #undef DEF_FUNCTION_TYPE_VAR_3
193 #undef DEF_FUNCTION_TYPE_VAR_4
194 #undef DEF_FUNCTION_TYPE_VAR_5
195 #undef DEF_POINTER_TYPE
199 typedef enum lto_builtin_type builtin_type
;
201 static GTY(()) tree builtin_types
[(int) BT_LAST
+ 1];
203 static GTY(()) tree string_type_node
;
204 static GTY(()) tree const_string_type_node
;
205 static GTY(()) tree wint_type_node
;
206 static GTY(()) tree intmax_type_node
;
207 static GTY(()) tree uintmax_type_node
;
208 static GTY(()) tree signed_size_type_node
;
210 /* Flags needed to process builtins.def. */
215 /* Attribute handlers. */
217 /* Handle a "noreturn" attribute; arguments as in
218 struct attribute_spec.handler. */
221 handle_noreturn_attribute (tree
*node
, tree
ARG_UNUSED (name
),
222 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
223 bool * ARG_UNUSED (no_add_attrs
))
225 tree type
= TREE_TYPE (*node
);
227 if (TREE_CODE (*node
) == FUNCTION_DECL
)
228 TREE_THIS_VOLATILE (*node
) = 1;
229 else if (TREE_CODE (type
) == POINTER_TYPE
230 && TREE_CODE (TREE_TYPE (type
)) == FUNCTION_TYPE
)
233 (build_type_variant (TREE_TYPE (type
),
234 TYPE_READONLY (TREE_TYPE (type
)), 1));
241 /* Handle a "leaf" attribute; arguments as in
242 struct attribute_spec.handler. */
245 handle_leaf_attribute (tree
*node
, tree name
,
246 tree
ARG_UNUSED (args
),
247 int ARG_UNUSED (flags
), bool *no_add_attrs
)
249 if (TREE_CODE (*node
) != FUNCTION_DECL
)
251 warning (OPT_Wattributes
, "%qE attribute ignored", name
);
252 *no_add_attrs
= true;
254 if (!TREE_PUBLIC (*node
))
256 warning (OPT_Wattributes
, "%qE attribute has no effect on unit local functions", name
);
257 *no_add_attrs
= true;
263 /* Handle a "const" attribute; arguments as in
264 struct attribute_spec.handler. */
267 handle_const_attribute (tree
*node
, tree
ARG_UNUSED (name
),
268 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
269 bool * ARG_UNUSED (no_add_attrs
))
271 tree type
= TREE_TYPE (*node
);
273 /* See FIXME comment on noreturn in c_common_attribute_table. */
274 if (TREE_CODE (*node
) == FUNCTION_DECL
)
275 TREE_READONLY (*node
) = 1;
276 else if (TREE_CODE (type
) == POINTER_TYPE
277 && TREE_CODE (TREE_TYPE (type
)) == FUNCTION_TYPE
)
280 (build_type_variant (TREE_TYPE (type
), 1,
281 TREE_THIS_VOLATILE (TREE_TYPE (type
))));
289 /* Handle a "malloc" attribute; arguments as in
290 struct attribute_spec.handler. */
293 handle_malloc_attribute (tree
*node
, tree
ARG_UNUSED (name
),
294 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
295 bool * ARG_UNUSED (no_add_attrs
))
297 if (TREE_CODE (*node
) == FUNCTION_DECL
298 && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (*node
))))
299 DECL_IS_MALLOC (*node
) = 1;
307 /* Handle a "pure" attribute; arguments as in
308 struct attribute_spec.handler. */
311 handle_pure_attribute (tree
*node
, tree
ARG_UNUSED (name
),
312 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
313 bool * ARG_UNUSED (no_add_attrs
))
315 if (TREE_CODE (*node
) == FUNCTION_DECL
)
316 DECL_PURE_P (*node
) = 1;
324 /* Handle a "no vops" attribute; arguments as in
325 struct attribute_spec.handler. */
328 handle_novops_attribute (tree
*node
, tree
ARG_UNUSED (name
),
329 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
330 bool *ARG_UNUSED (no_add_attrs
))
332 gcc_assert (TREE_CODE (*node
) == FUNCTION_DECL
);
333 DECL_IS_NOVOPS (*node
) = 1;
338 /* Helper for nonnull attribute handling; fetch the operand number
339 from the attribute argument list. */
342 get_nonnull_operand (tree arg_num_expr
, unsigned HOST_WIDE_INT
*valp
)
344 /* Verify the arg number is a constant. */
345 if (!tree_fits_uhwi_p (arg_num_expr
))
348 *valp
= TREE_INT_CST_LOW (arg_num_expr
);
352 /* Handle the "nonnull" attribute. */
355 handle_nonnull_attribute (tree
*node
, tree
ARG_UNUSED (name
),
356 tree args
, int ARG_UNUSED (flags
),
357 bool * ARG_UNUSED (no_add_attrs
))
361 /* If no arguments are specified, all pointer arguments should be
362 non-null. Verify a full prototype is given so that the arguments
363 will have the correct types when we actually check them later. */
366 gcc_assert (prototype_p (type
));
370 /* Argument list specified. Verify that each argument number references
371 a pointer argument. */
372 for (; args
; args
= TREE_CHAIN (args
))
375 unsigned HOST_WIDE_INT arg_num
= 0, ck_num
;
377 if (!get_nonnull_operand (TREE_VALUE (args
), &arg_num
))
380 argument
= TYPE_ARG_TYPES (type
);
383 for (ck_num
= 1; ; ck_num
++)
385 if (!argument
|| ck_num
== arg_num
)
387 argument
= TREE_CHAIN (argument
);
391 && TREE_CODE (TREE_VALUE (argument
)) == POINTER_TYPE
);
399 /* Handle a "nothrow" attribute; arguments as in
400 struct attribute_spec.handler. */
403 handle_nothrow_attribute (tree
*node
, tree
ARG_UNUSED (name
),
404 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
405 bool * ARG_UNUSED (no_add_attrs
))
407 if (TREE_CODE (*node
) == FUNCTION_DECL
)
408 TREE_NOTHROW (*node
) = 1;
416 /* Handle a "sentinel" attribute. */
419 handle_sentinel_attribute (tree
*node
, tree
ARG_UNUSED (name
), tree args
,
420 int ARG_UNUSED (flags
),
421 bool * ARG_UNUSED (no_add_attrs
))
423 gcc_assert (stdarg_p (*node
));
427 tree position
= TREE_VALUE (args
);
428 gcc_assert (TREE_CODE (position
) == INTEGER_CST
);
429 if (tree_int_cst_lt (position
, integer_zero_node
))
436 /* Handle a "type_generic" attribute. */
439 handle_type_generic_attribute (tree
*node
, tree
ARG_UNUSED (name
),
440 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
441 bool * ARG_UNUSED (no_add_attrs
))
443 /* Ensure we have a function type. */
444 gcc_assert (TREE_CODE (*node
) == FUNCTION_TYPE
);
446 /* Ensure we have a variadic function. */
447 gcc_assert (!prototype_p (*node
) || stdarg_p (*node
));
452 /* Handle a "transaction_pure" attribute. */
455 handle_transaction_pure_attribute (tree
*node
, tree
ARG_UNUSED (name
),
456 tree
ARG_UNUSED (args
),
457 int ARG_UNUSED (flags
),
458 bool * ARG_UNUSED (no_add_attrs
))
460 /* Ensure we have a function type. */
461 gcc_assert (TREE_CODE (*node
) == FUNCTION_TYPE
);
466 /* Handle a "returns_twice" attribute. */
469 handle_returns_twice_attribute (tree
*node
, tree
ARG_UNUSED (name
),
470 tree
ARG_UNUSED (args
),
471 int ARG_UNUSED (flags
),
472 bool * ARG_UNUSED (no_add_attrs
))
474 gcc_assert (TREE_CODE (*node
) == FUNCTION_DECL
);
476 DECL_IS_RETURNS_TWICE (*node
) = 1;
481 /* Ignore the given attribute. Used when this attribute may be usefully
482 overridden by the target, but is not used generically. */
485 ignore_attribute (tree
* ARG_UNUSED (node
), tree
ARG_UNUSED (name
),
486 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
489 *no_add_attrs
= true;
493 /* Handle a "format" attribute; arguments as in
494 struct attribute_spec.handler. */
497 handle_format_attribute (tree
* ARG_UNUSED (node
), tree
ARG_UNUSED (name
),
498 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
501 *no_add_attrs
= true;
506 /* Handle a "format_arg" attribute; arguments as in
507 struct attribute_spec.handler. */
510 handle_format_arg_attribute (tree
* ARG_UNUSED (node
), tree
ARG_UNUSED (name
),
511 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
514 *no_add_attrs
= true;
519 /* Handle a "fn spec" attribute; arguments as in
520 struct attribute_spec.handler. */
523 handle_fnspec_attribute (tree
*node ATTRIBUTE_UNUSED
, tree
ARG_UNUSED (name
),
524 tree args
, int ARG_UNUSED (flags
),
525 bool *no_add_attrs ATTRIBUTE_UNUSED
)
528 && TREE_CODE (TREE_VALUE (args
)) == STRING_CST
529 && !TREE_CHAIN (args
));
533 /* Cribbed from c-common.c. */
536 def_fn_type (builtin_type def
, builtin_type ret
, bool var
, int n
, ...)
539 tree
*args
= XALLOCAVEC (tree
, n
);
545 for (i
= 0; i
< n
; ++i
)
547 builtin_type a
= (builtin_type
) va_arg (list
, int);
548 t
= builtin_types
[a
];
549 if (t
== error_mark_node
)
555 t
= builtin_types
[ret
];
558 if (t
== error_mark_node
)
561 t
= build_varargs_function_type_array (t
, n
, args
);
563 t
= build_function_type_array (t
, n
, args
);
565 builtin_types
[def
] = t
;
568 /* Used to help initialize the builtin-types.def table. When a type of
569 the correct size doesn't exist, use error_mark_node instead of NULL.
570 The later results in segfaults even when a decl using the type doesn't
574 builtin_type_for_size (int size
, bool unsignedp
)
576 tree type
= lto_type_for_size (size
, unsignedp
);
577 return type
? type
: error_mark_node
;
580 /* Support for DEF_BUILTIN. */
583 def_builtin_1 (enum built_in_function fncode
, const char *name
,
584 enum built_in_class fnclass
, tree fntype
, tree libtype
,
585 bool both_p
, bool fallback_p
, bool nonansi_p
,
586 tree fnattrs
, bool implicit_p
)
591 if (fntype
== error_mark_node
)
594 libname
= name
+ strlen ("__builtin_");
595 decl
= add_builtin_function (name
, fntype
, fncode
, fnclass
,
596 (fallback_p
? libname
: NULL
),
601 && !(nonansi_p
&& flag_no_nonansi_builtin
))
602 add_builtin_function (libname
, libtype
, fncode
, fnclass
,
605 set_builtin_decl (fncode
, decl
, implicit_p
);
609 /* Initialize the attribute table for all the supported builtins. */
612 lto_init_attributes (void)
614 /* Fill in the built_in_attributes array. */
615 #define DEF_ATTR_NULL_TREE(ENUM) \
616 built_in_attributes[(int) ENUM] = NULL_TREE;
617 #define DEF_ATTR_INT(ENUM, VALUE) \
618 built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE);
619 #define DEF_ATTR_STRING(ENUM, VALUE) \
620 built_in_attributes[(int) ENUM] = build_string (strlen (VALUE), VALUE);
621 #define DEF_ATTR_IDENT(ENUM, STRING) \
622 built_in_attributes[(int) ENUM] = get_identifier (STRING);
623 #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) \
624 built_in_attributes[(int) ENUM] \
625 = tree_cons (built_in_attributes[(int) PURPOSE], \
626 built_in_attributes[(int) VALUE], \
627 built_in_attributes[(int) CHAIN]);
628 #include "builtin-attrs.def"
629 #undef DEF_ATTR_NULL_TREE
631 #undef DEF_ATTR_STRING
632 #undef DEF_ATTR_IDENT
633 #undef DEF_ATTR_TREE_LIST
636 /* Create builtin types and functions. VA_LIST_REF_TYPE_NODE and
637 VA_LIST_ARG_TYPE_NODE are used in builtin-types.def. */
640 lto_define_builtins (tree va_list_ref_type_node ATTRIBUTE_UNUSED
,
641 tree va_list_arg_type_node ATTRIBUTE_UNUSED
)
643 #define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
644 builtin_types[ENUM] = VALUE;
645 #define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \
646 def_fn_type (ENUM, RETURN, 0, 0);
647 #define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1) \
648 def_fn_type (ENUM, RETURN, 0, 1, ARG1);
649 #define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \
650 def_fn_type (ENUM, RETURN, 0, 2, ARG1, ARG2);
651 #define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
652 def_fn_type (ENUM, RETURN, 0, 3, ARG1, ARG2, ARG3);
653 #define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
654 def_fn_type (ENUM, RETURN, 0, 4, ARG1, ARG2, ARG3, ARG4);
655 #define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
656 def_fn_type (ENUM, RETURN, 0, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
657 #define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
659 def_fn_type (ENUM, RETURN, 0, 6, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
660 #define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
662 def_fn_type (ENUM, RETURN, 0, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7);
663 #define DEF_FUNCTION_TYPE_8(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
665 def_fn_type (ENUM, RETURN, 0, 8, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, \
667 #define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \
668 def_fn_type (ENUM, RETURN, 1, 0);
669 #define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \
670 def_fn_type (ENUM, RETURN, 1, 1, ARG1);
671 #define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2) \
672 def_fn_type (ENUM, RETURN, 1, 2, ARG1, ARG2);
673 #define DEF_FUNCTION_TYPE_VAR_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
674 def_fn_type (ENUM, RETURN, 1, 3, ARG1, ARG2, ARG3);
675 #define DEF_FUNCTION_TYPE_VAR_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
676 def_fn_type (ENUM, RETURN, 1, 4, ARG1, ARG2, ARG3, ARG4);
677 #define DEF_FUNCTION_TYPE_VAR_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
678 def_fn_type (ENUM, RETURN, 1, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
679 #define DEF_POINTER_TYPE(ENUM, TYPE) \
680 builtin_types[(int) ENUM] = build_pointer_type (builtin_types[(int) TYPE]);
682 #include "builtin-types.def"
684 #undef DEF_PRIMITIVE_TYPE
685 #undef DEF_FUNCTION_TYPE_0
686 #undef DEF_FUNCTION_TYPE_1
687 #undef DEF_FUNCTION_TYPE_2
688 #undef DEF_FUNCTION_TYPE_3
689 #undef DEF_FUNCTION_TYPE_4
690 #undef DEF_FUNCTION_TYPE_5
691 #undef DEF_FUNCTION_TYPE_6
692 #undef DEF_FUNCTION_TYPE_7
693 #undef DEF_FUNCTION_TYPE_8
694 #undef DEF_FUNCTION_TYPE_VAR_0
695 #undef DEF_FUNCTION_TYPE_VAR_1
696 #undef DEF_FUNCTION_TYPE_VAR_2
697 #undef DEF_FUNCTION_TYPE_VAR_3
698 #undef DEF_FUNCTION_TYPE_VAR_4
699 #undef DEF_FUNCTION_TYPE_VAR_5
700 #undef DEF_POINTER_TYPE
701 builtin_types
[(int) BT_LAST
] = NULL_TREE
;
703 lto_init_attributes ();
705 #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, FALLBACK_P,\
706 NONANSI_P, ATTRS, IMPLICIT, COND) \
708 def_builtin_1 (ENUM, NAME, CLASS, builtin_types[(int) TYPE], \
709 builtin_types[(int) LIBTYPE], BOTH_P, FALLBACK_P, \
710 NONANSI_P, built_in_attributes[(int) ATTRS], IMPLICIT);
711 #include "builtins.def"
715 static GTY(()) tree registered_builtin_types
;
717 /* Language hooks. */
720 lto_option_lang_mask (void)
726 lto_complain_wrong_lang_p (const struct cl_option
*option ATTRIBUTE_UNUSED
)
728 /* The LTO front end inherits all the options from the first front
729 end that was used. However, not all the original front end
730 options make sense in LTO.
732 A real solution would be to filter this in collect2, but collect2
733 does not have access to all the option attributes to know what to
734 filter. So, in lto1 we silently accept inherited flags and do
740 lto_init_options_struct (struct gcc_options
*opts
)
742 /* By default, C99-like requirements for complex multiply and divide.
743 ??? Until the complex method is encoded in the IL this is the only
744 safe choice. This will pessimize Fortran code with LTO unless
745 people specify a complex method manually or use -ffast-math. */
746 opts
->x_flag_complex_method
= 2;
749 /* Handle command-line option SCODE. If the option takes an argument, it is
750 stored in ARG, which is otherwise NULL. VALUE holds either a numerical
751 argument or a binary value indicating whether the positive or negative form
752 of the option was supplied. */
754 const char *resolution_file_name
;
756 lto_handle_option (size_t scode
, const char *arg
,
757 int value ATTRIBUTE_UNUSED
, int kind ATTRIBUTE_UNUSED
,
758 location_t loc ATTRIBUTE_UNUSED
,
759 const struct cl_option_handlers
*handlers ATTRIBUTE_UNUSED
)
761 enum opt_code code
= (enum opt_code
) scode
;
766 case OPT_fresolution_
:
767 resolution_file_name
= arg
;
775 flag_wpa
= value
? "" : NULL
;
785 /* Perform post-option processing. Does additional initialization based on
786 command-line options. PFILENAME is the main input filename. Returns false
787 to enable subsequent back-end initialization. */
790 lto_post_options (const char **pfilename ATTRIBUTE_UNUSED
)
792 /* -fltrans and -fwpa are mutually exclusive. Check for that here. */
793 if (flag_wpa
&& flag_ltrans
)
794 error ("-fwpa and -fltrans are mutually exclusive");
798 flag_generate_lto
= 0;
800 /* During LTRANS, we are not looking at the whole program, only
801 a subset of the whole callgraph. */
802 flag_whole_program
= 0;
806 flag_generate_lto
= 1;
808 /* Excess precision other than "fast" requires front-end
810 flag_excess_precision_cmdline
= EXCESS_PRECISION_FAST
;
812 /* Initialize the compiler back end. */
816 /* Return an integer type with PRECISION bits of precision,
817 that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */
820 lto_type_for_size (unsigned precision
, int unsignedp
)
822 if (precision
== TYPE_PRECISION (integer_type_node
))
823 return unsignedp
? unsigned_type_node
: integer_type_node
;
825 if (precision
== TYPE_PRECISION (signed_char_type_node
))
826 return unsignedp
? unsigned_char_type_node
: signed_char_type_node
;
828 if (precision
== TYPE_PRECISION (short_integer_type_node
))
829 return unsignedp
? short_unsigned_type_node
: short_integer_type_node
;
831 if (precision
== TYPE_PRECISION (long_integer_type_node
))
832 return unsignedp
? long_unsigned_type_node
: long_integer_type_node
;
834 if (precision
== TYPE_PRECISION (long_long_integer_type_node
))
836 ? long_long_unsigned_type_node
837 : long_long_integer_type_node
;
839 if (precision
<= TYPE_PRECISION (intQI_type_node
))
840 return unsignedp
? unsigned_intQI_type_node
: intQI_type_node
;
842 if (precision
<= TYPE_PRECISION (intHI_type_node
))
843 return unsignedp
? unsigned_intHI_type_node
: intHI_type_node
;
845 if (precision
<= TYPE_PRECISION (intSI_type_node
))
846 return unsignedp
? unsigned_intSI_type_node
: intSI_type_node
;
848 if (precision
<= TYPE_PRECISION (intDI_type_node
))
849 return unsignedp
? unsigned_intDI_type_node
: intDI_type_node
;
851 if (precision
<= TYPE_PRECISION (intTI_type_node
))
852 return unsignedp
? unsigned_intTI_type_node
: intTI_type_node
;
858 /* Return a data type that has machine mode MODE.
859 If the mode is an integer,
860 then UNSIGNEDP selects between signed and unsigned types.
861 If the mode is a fixed-point mode,
862 then UNSIGNEDP selects between saturating and nonsaturating types. */
865 lto_type_for_mode (machine_mode mode
, int unsigned_p
)
869 if (mode
== TYPE_MODE (integer_type_node
))
870 return unsigned_p
? unsigned_type_node
: integer_type_node
;
872 if (mode
== TYPE_MODE (signed_char_type_node
))
873 return unsigned_p
? unsigned_char_type_node
: signed_char_type_node
;
875 if (mode
== TYPE_MODE (short_integer_type_node
))
876 return unsigned_p
? short_unsigned_type_node
: short_integer_type_node
;
878 if (mode
== TYPE_MODE (long_integer_type_node
))
879 return unsigned_p
? long_unsigned_type_node
: long_integer_type_node
;
881 if (mode
== TYPE_MODE (long_long_integer_type_node
))
882 return unsigned_p
? long_long_unsigned_type_node
: long_long_integer_type_node
;
885 return unsigned_p
? unsigned_intQI_type_node
: intQI_type_node
;
888 return unsigned_p
? unsigned_intHI_type_node
: intHI_type_node
;
891 return unsigned_p
? unsigned_intSI_type_node
: intSI_type_node
;
894 return unsigned_p
? unsigned_intDI_type_node
: intDI_type_node
;
896 #if HOST_BITS_PER_WIDE_INT >= 64
897 if (mode
== TYPE_MODE (intTI_type_node
))
898 return unsigned_p
? unsigned_intTI_type_node
: intTI_type_node
;
901 if (mode
== TYPE_MODE (float_type_node
))
902 return float_type_node
;
904 if (mode
== TYPE_MODE (double_type_node
))
905 return double_type_node
;
907 if (mode
== TYPE_MODE (long_double_type_node
))
908 return long_double_type_node
;
910 if (mode
== TYPE_MODE (void_type_node
))
911 return void_type_node
;
913 if (mode
== TYPE_MODE (build_pointer_type (char_type_node
)))
915 ? make_unsigned_type (GET_MODE_PRECISION (mode
))
916 : make_signed_type (GET_MODE_PRECISION (mode
)));
918 if (mode
== TYPE_MODE (build_pointer_type (integer_type_node
)))
920 ? make_unsigned_type (GET_MODE_PRECISION (mode
))
921 : make_signed_type (GET_MODE_PRECISION (mode
)));
923 if (COMPLEX_MODE_P (mode
))
925 machine_mode inner_mode
;
928 if (mode
== TYPE_MODE (complex_float_type_node
))
929 return complex_float_type_node
;
930 if (mode
== TYPE_MODE (complex_double_type_node
))
931 return complex_double_type_node
;
932 if (mode
== TYPE_MODE (complex_long_double_type_node
))
933 return complex_long_double_type_node
;
935 if (mode
== TYPE_MODE (complex_integer_type_node
) && !unsigned_p
)
936 return complex_integer_type_node
;
938 inner_mode
= GET_MODE_INNER (mode
);
939 inner_type
= lto_type_for_mode (inner_mode
, unsigned_p
);
940 if (inner_type
!= NULL_TREE
)
941 return build_complex_type (inner_type
);
943 else if (VECTOR_MODE_P (mode
))
945 machine_mode inner_mode
= GET_MODE_INNER (mode
);
946 tree inner_type
= lto_type_for_mode (inner_mode
, unsigned_p
);
947 if (inner_type
!= NULL_TREE
)
948 return build_vector_type_for_mode (inner_type
, mode
);
951 if (mode
== TYPE_MODE (dfloat32_type_node
))
952 return dfloat32_type_node
;
953 if (mode
== TYPE_MODE (dfloat64_type_node
))
954 return dfloat64_type_node
;
955 if (mode
== TYPE_MODE (dfloat128_type_node
))
956 return dfloat128_type_node
;
958 if (ALL_SCALAR_FIXED_POINT_MODE_P (mode
))
960 if (mode
== TYPE_MODE (short_fract_type_node
))
961 return unsigned_p
? sat_short_fract_type_node
: short_fract_type_node
;
962 if (mode
== TYPE_MODE (fract_type_node
))
963 return unsigned_p
? sat_fract_type_node
: fract_type_node
;
964 if (mode
== TYPE_MODE (long_fract_type_node
))
965 return unsigned_p
? sat_long_fract_type_node
: long_fract_type_node
;
966 if (mode
== TYPE_MODE (long_long_fract_type_node
))
967 return unsigned_p
? sat_long_long_fract_type_node
968 : long_long_fract_type_node
;
970 if (mode
== TYPE_MODE (unsigned_short_fract_type_node
))
971 return unsigned_p
? sat_unsigned_short_fract_type_node
972 : unsigned_short_fract_type_node
;
973 if (mode
== TYPE_MODE (unsigned_fract_type_node
))
974 return unsigned_p
? sat_unsigned_fract_type_node
975 : unsigned_fract_type_node
;
976 if (mode
== TYPE_MODE (unsigned_long_fract_type_node
))
977 return unsigned_p
? sat_unsigned_long_fract_type_node
978 : unsigned_long_fract_type_node
;
979 if (mode
== TYPE_MODE (unsigned_long_long_fract_type_node
))
980 return unsigned_p
? sat_unsigned_long_long_fract_type_node
981 : unsigned_long_long_fract_type_node
;
983 if (mode
== TYPE_MODE (short_accum_type_node
))
984 return unsigned_p
? sat_short_accum_type_node
: short_accum_type_node
;
985 if (mode
== TYPE_MODE (accum_type_node
))
986 return unsigned_p
? sat_accum_type_node
: accum_type_node
;
987 if (mode
== TYPE_MODE (long_accum_type_node
))
988 return unsigned_p
? sat_long_accum_type_node
: long_accum_type_node
;
989 if (mode
== TYPE_MODE (long_long_accum_type_node
))
990 return unsigned_p
? sat_long_long_accum_type_node
991 : long_long_accum_type_node
;
993 if (mode
== TYPE_MODE (unsigned_short_accum_type_node
))
994 return unsigned_p
? sat_unsigned_short_accum_type_node
995 : unsigned_short_accum_type_node
;
996 if (mode
== TYPE_MODE (unsigned_accum_type_node
))
997 return unsigned_p
? sat_unsigned_accum_type_node
998 : unsigned_accum_type_node
;
999 if (mode
== TYPE_MODE (unsigned_long_accum_type_node
))
1000 return unsigned_p
? sat_unsigned_long_accum_type_node
1001 : unsigned_long_accum_type_node
;
1002 if (mode
== TYPE_MODE (unsigned_long_long_accum_type_node
))
1003 return unsigned_p
? sat_unsigned_long_long_accum_type_node
1004 : unsigned_long_long_accum_type_node
;
1007 return unsigned_p
? sat_qq_type_node
: qq_type_node
;
1009 return unsigned_p
? sat_hq_type_node
: hq_type_node
;
1011 return unsigned_p
? sat_sq_type_node
: sq_type_node
;
1013 return unsigned_p
? sat_dq_type_node
: dq_type_node
;
1015 return unsigned_p
? sat_tq_type_node
: tq_type_node
;
1017 if (mode
== UQQmode
)
1018 return unsigned_p
? sat_uqq_type_node
: uqq_type_node
;
1019 if (mode
== UHQmode
)
1020 return unsigned_p
? sat_uhq_type_node
: uhq_type_node
;
1021 if (mode
== USQmode
)
1022 return unsigned_p
? sat_usq_type_node
: usq_type_node
;
1023 if (mode
== UDQmode
)
1024 return unsigned_p
? sat_udq_type_node
: udq_type_node
;
1025 if (mode
== UTQmode
)
1026 return unsigned_p
? sat_utq_type_node
: utq_type_node
;
1029 return unsigned_p
? sat_ha_type_node
: ha_type_node
;
1031 return unsigned_p
? sat_sa_type_node
: sa_type_node
;
1033 return unsigned_p
? sat_da_type_node
: da_type_node
;
1035 return unsigned_p
? sat_ta_type_node
: ta_type_node
;
1037 if (mode
== UHAmode
)
1038 return unsigned_p
? sat_uha_type_node
: uha_type_node
;
1039 if (mode
== USAmode
)
1040 return unsigned_p
? sat_usa_type_node
: usa_type_node
;
1041 if (mode
== UDAmode
)
1042 return unsigned_p
? sat_uda_type_node
: uda_type_node
;
1043 if (mode
== UTAmode
)
1044 return unsigned_p
? sat_uta_type_node
: uta_type_node
;
1047 for (t
= registered_builtin_types
; t
; t
= TREE_CHAIN (t
))
1048 if (TYPE_MODE (TREE_VALUE (t
)) == mode
)
1049 return TREE_VALUE (t
);
1054 /* Return true if we are in the global binding level. */
1057 lto_global_bindings_p (void)
1059 return cfun
== NULL
;
1063 lto_set_decl_assembler_name (tree decl
)
1065 /* This is almost the same as lhd_set_decl_assembler_name, except that
1066 we need to uniquify file-scope names, even if they are not
1067 TREE_PUBLIC, to avoid conflicts between individual files. */
1070 if (TREE_PUBLIC (decl
))
1071 id
= targetm
.mangle_decl_assembler_name (decl
, DECL_NAME (decl
));
1074 const char *name
= IDENTIFIER_POINTER (DECL_NAME (decl
));
1077 ASM_FORMAT_PRIVATE_NAME (label
, name
, DECL_UID (decl
));
1078 id
= get_identifier (label
);
1081 SET_DECL_ASSEMBLER_NAME (decl
, id
);
1085 lto_pushdecl (tree t ATTRIBUTE_UNUSED
)
1087 /* Do nothing, since we get all information from DWARF and LTO
1095 /* We have our own write_globals langhook, hence the getdecls
1096 langhook shouldn't be used, except by dbxout.c, so we can't
1102 lto_write_globals (void)
1107 /* Output debug info for global variables. */
1108 varpool_node
*vnode
;
1109 FOR_EACH_DEFINED_VARIABLE (vnode
)
1110 if (!decl_function_context (vnode
->decl
))
1111 debug_hooks
->global_decl (vnode
->decl
);
1115 lto_builtin_function (tree decl
)
1121 lto_register_builtin_type (tree type
, const char *name
)
1125 if (!TYPE_NAME (type
))
1127 decl
= build_decl (UNKNOWN_LOCATION
, TYPE_DECL
,
1128 get_identifier (name
), type
);
1129 DECL_ARTIFICIAL (decl
) = 1;
1130 TYPE_NAME (type
) = decl
;
1133 registered_builtin_types
= tree_cons (0, type
, registered_builtin_types
);
1136 /* Build nodes that would have be created by the C front-end; necessary
1137 for including builtin-types.def and ultimately builtins.def. */
1140 lto_build_c_type_nodes (void)
1142 gcc_assert (void_type_node
);
1144 void_list_node
= build_tree_list (NULL_TREE
, void_type_node
);
1145 string_type_node
= build_pointer_type (char_type_node
);
1146 const_string_type_node
1147 = build_pointer_type (build_qualified_type (char_type_node
, TYPE_QUAL_CONST
));
1149 if (strcmp (SIZE_TYPE
, "unsigned int") == 0)
1151 intmax_type_node
= integer_type_node
;
1152 uintmax_type_node
= unsigned_type_node
;
1153 signed_size_type_node
= integer_type_node
;
1155 else if (strcmp (SIZE_TYPE
, "long unsigned int") == 0)
1157 intmax_type_node
= long_integer_type_node
;
1158 uintmax_type_node
= long_unsigned_type_node
;
1159 signed_size_type_node
= long_integer_type_node
;
1161 else if (strcmp (SIZE_TYPE
, "long long unsigned int") == 0)
1163 intmax_type_node
= long_long_integer_type_node
;
1164 uintmax_type_node
= long_long_unsigned_type_node
;
1165 signed_size_type_node
= long_long_integer_type_node
;
1171 signed_size_type_node
= NULL_TREE
;
1172 for (i
= 0; i
< NUM_INT_N_ENTS
; i
++)
1173 if (int_n_enabled_p
[i
])
1176 sprintf (name
, "__int%d unsigned", int_n_data
[i
].bitsize
);
1178 if (strcmp (name
, SIZE_TYPE
) == 0)
1180 intmax_type_node
= int_n_trees
[i
].signed_type
;
1181 uintmax_type_node
= int_n_trees
[i
].unsigned_type
;
1182 signed_size_type_node
= int_n_trees
[i
].signed_type
;
1185 if (signed_size_type_node
== NULL_TREE
)
1189 wint_type_node
= unsigned_type_node
;
1190 pid_type_node
= integer_type_node
;
1193 /* Perform LTO-specific initialization. */
1200 /* We need to generate LTO if running in WPA mode. */
1201 flag_generate_lto
= (flag_wpa
!= NULL
);
1203 /* Create the basic integer types. */
1204 build_common_tree_nodes (flag_signed_char
, flag_short_double
);
1206 /* The global tree for the main identifier is filled in by
1207 language-specific front-end initialization that is not run in the
1208 LTO back-end. It appears that all languages that perform such
1209 initialization currently do so in the same way, so we do it here. */
1210 if (main_identifier_node
== NULL_TREE
)
1211 main_identifier_node
= get_identifier ("main");
1213 /* In the C++ front-end, fileptr_type_node is defined as a variant
1214 copy of of ptr_type_node, rather than ptr_node itself. The
1215 distinction should only be relevant to the front-end, so we
1216 always use the C definition here in lto1. */
1217 gcc_assert (fileptr_type_node
== ptr_type_node
);
1218 gcc_assert (TYPE_MAIN_VARIANT (fileptr_type_node
) == ptr_type_node
);
1220 ptrdiff_type_node
= integer_type_node
;
1222 lto_build_c_type_nodes ();
1223 gcc_assert (va_list_type_node
);
1225 if (TREE_CODE (va_list_type_node
) == ARRAY_TYPE
)
1227 tree x
= build_pointer_type (TREE_TYPE (va_list_type_node
));
1228 lto_define_builtins (x
, x
);
1232 lto_define_builtins (build_reference_type (va_list_type_node
),
1237 cilk_init_builtins ();
1239 targetm
.init_builtins ();
1240 build_common_builtin_nodes ();
1242 /* Assign names to the builtin types, otherwise they'll end up
1243 as __unknown__ in debug info.
1244 ??? We simply need to stop pre-seeding the streamer cache.
1245 Below is modeled after from c-common.c:c_common_nodes_and_builtins */
1246 #define NAME_TYPE(t,n) \
1248 TYPE_NAME (t) = build_decl (UNKNOWN_LOCATION, TYPE_DECL, \
1249 get_identifier (n), t)
1250 NAME_TYPE (integer_type_node
, "int");
1251 NAME_TYPE (char_type_node
, "char");
1252 NAME_TYPE (long_integer_type_node
, "long int");
1253 NAME_TYPE (unsigned_type_node
, "unsigned int");
1254 NAME_TYPE (long_unsigned_type_node
, "long unsigned int");
1255 NAME_TYPE (long_long_integer_type_node
, "long long int");
1256 NAME_TYPE (long_long_unsigned_type_node
, "long long unsigned int");
1257 NAME_TYPE (short_integer_type_node
, "short int");
1258 NAME_TYPE (short_unsigned_type_node
, "short unsigned int");
1259 if (signed_char_type_node
!= char_type_node
)
1260 NAME_TYPE (signed_char_type_node
, "signed char");
1261 if (unsigned_char_type_node
!= char_type_node
)
1262 NAME_TYPE (unsigned_char_type_node
, "unsigned char");
1263 NAME_TYPE (float_type_node
, "float");
1264 NAME_TYPE (double_type_node
, "double");
1265 NAME_TYPE (long_double_type_node
, "long double");
1266 NAME_TYPE (void_type_node
, "void");
1267 NAME_TYPE (boolean_type_node
, "bool");
1268 NAME_TYPE (complex_float_type_node
, "complex float");
1269 NAME_TYPE (complex_double_type_node
, "complex double");
1270 NAME_TYPE (complex_long_double_type_node
, "complex long double");
1271 for (i
= 0; i
< NUM_INT_N_ENTS
; i
++)
1272 if (int_n_enabled_p
[i
])
1275 sprintf (name
, "__int%d", int_n_data
[i
].bitsize
);
1276 NAME_TYPE (int_n_trees
[i
].signed_type
, name
);
1280 /* Initialize LTO-specific data structures. */
1286 /* Initialize tree structures required by the LTO front end. */
1288 static void lto_init_ts (void)
1290 tree_contains_struct
[NAMESPACE_DECL
][TS_DECL_MINIMAL
] = 1;
1293 #undef LANG_HOOKS_NAME
1294 #define LANG_HOOKS_NAME "GNU GIMPLE"
1295 #undef LANG_HOOKS_OPTION_LANG_MASK
1296 #define LANG_HOOKS_OPTION_LANG_MASK lto_option_lang_mask
1297 #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
1298 #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lto_complain_wrong_lang_p
1299 #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
1300 #define LANG_HOOKS_INIT_OPTIONS_STRUCT lto_init_options_struct
1301 #undef LANG_HOOKS_HANDLE_OPTION
1302 #define LANG_HOOKS_HANDLE_OPTION lto_handle_option
1303 #undef LANG_HOOKS_POST_OPTIONS
1304 #define LANG_HOOKS_POST_OPTIONS lto_post_options
1305 #undef LANG_HOOKS_GET_ALIAS_SET
1306 #define LANG_HOOKS_GET_ALIAS_SET gimple_get_alias_set
1307 #undef LANG_HOOKS_TYPE_FOR_MODE
1308 #define LANG_HOOKS_TYPE_FOR_MODE lto_type_for_mode
1309 #undef LANG_HOOKS_TYPE_FOR_SIZE
1310 #define LANG_HOOKS_TYPE_FOR_SIZE lto_type_for_size
1311 #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
1312 #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lto_set_decl_assembler_name
1313 #undef LANG_HOOKS_GLOBAL_BINDINGS_P
1314 #define LANG_HOOKS_GLOBAL_BINDINGS_P lto_global_bindings_p
1315 #undef LANG_HOOKS_PUSHDECL
1316 #define LANG_HOOKS_PUSHDECL lto_pushdecl
1317 #undef LANG_HOOKS_GETDECLS
1318 #define LANG_HOOKS_GETDECLS lto_getdecls
1319 #undef LANG_HOOKS_WRITE_GLOBALS
1320 #define LANG_HOOKS_WRITE_GLOBALS lto_write_globals
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"