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"
29 #include "fold-const.h"
30 #include "stringpool.h"
31 #include "stor-layout.h"
33 #include "langhooks.h"
34 #include "langhooks-def.h"
38 #include "tree-inline.h"
40 #include "hard-reg-set.h"
42 #include "basic-block.h"
43 #include "tree-ssa-alias.h"
44 #include "internal-fn.h"
45 #include "gimple-expr.h"
47 #include "diagnostic-core.h"
50 #include "lto-streamer.h"
53 static tree
lto_type_for_size (unsigned, int);
55 static tree
handle_noreturn_attribute (tree
*, tree
, tree
, int, bool *);
56 static tree
handle_leaf_attribute (tree
*, tree
, tree
, int, bool *);
57 static tree
handle_const_attribute (tree
*, tree
, tree
, int, bool *);
58 static tree
handle_malloc_attribute (tree
*, tree
, tree
, int, bool *);
59 static tree
handle_pure_attribute (tree
*, tree
, tree
, int, bool *);
60 static tree
handle_novops_attribute (tree
*, tree
, tree
, int, bool *);
61 static tree
handle_nonnull_attribute (tree
*, tree
, tree
, int, bool *);
62 static tree
handle_nothrow_attribute (tree
*, tree
, tree
, int, bool *);
63 static tree
handle_sentinel_attribute (tree
*, tree
, tree
, int, bool *);
64 static tree
handle_type_generic_attribute (tree
*, tree
, tree
, int, bool *);
65 static tree
handle_transaction_pure_attribute (tree
*, tree
, tree
, int, bool *);
66 static tree
handle_returns_twice_attribute (tree
*, tree
, tree
, int, bool *);
67 static tree
ignore_attribute (tree
*, tree
, tree
, int, bool *);
69 static tree
handle_format_attribute (tree
*, tree
, tree
, int, bool *);
70 static tree
handle_fnspec_attribute (tree
*, tree
, tree
, int, bool *);
71 static tree
handle_format_arg_attribute (tree
*, tree
, tree
, int, bool *);
73 /* Table of machine-independent attributes supported in GIMPLE. */
74 const struct attribute_spec lto_attribute_table
[] =
76 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
78 { "noreturn", 0, 0, true, false, false,
79 handle_noreturn_attribute
, false },
80 { "leaf", 0, 0, true, false, false,
81 handle_leaf_attribute
, false },
82 /* The same comments as for noreturn attributes apply to const ones. */
83 { "const", 0, 0, true, false, false,
84 handle_const_attribute
, false },
85 { "malloc", 0, 0, true, false, false,
86 handle_malloc_attribute
, false },
87 { "pure", 0, 0, true, false, false,
88 handle_pure_attribute
, false },
89 { "no vops", 0, 0, true, false, false,
90 handle_novops_attribute
, false },
91 { "nonnull", 0, -1, false, true, true,
92 handle_nonnull_attribute
, false },
93 { "nothrow", 0, 0, true, false, false,
94 handle_nothrow_attribute
, false },
95 { "returns_twice", 0, 0, true, false, false,
96 handle_returns_twice_attribute
, false },
97 { "sentinel", 0, 1, false, true, true,
98 handle_sentinel_attribute
, false },
99 { "type generic", 0, 0, false, true, true,
100 handle_type_generic_attribute
, false },
101 { "fn spec", 1, 1, false, true, true,
102 handle_fnspec_attribute
, false },
103 { "transaction_pure", 0, 0, false, true, true,
104 handle_transaction_pure_attribute
, false },
105 /* For internal use only. The leading '*' both prevents its usage in
106 source code and signals that it may be overridden by machine tables. */
107 { "*tm regparm", 0, 0, false, true, true,
108 ignore_attribute
, false },
109 { NULL
, 0, 0, false, false, false, NULL
, false }
112 /* Give the specifications for the format attributes, used by C and all
115 const struct attribute_spec lto_format_attribute_table
[] =
117 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
118 affects_type_identity } */
119 { "format", 3, 3, false, true, true,
120 handle_format_attribute
, false },
121 { "format_arg", 1, 1, false, true, true,
122 handle_format_arg_attribute
, false },
123 { NULL
, 0, 0, false, false, false, NULL
, false }
126 enum built_in_attribute
128 #define DEF_ATTR_NULL_TREE(ENUM) ENUM,
129 #define DEF_ATTR_INT(ENUM, VALUE) ENUM,
130 #define DEF_ATTR_STRING(ENUM, VALUE) ENUM,
131 #define DEF_ATTR_IDENT(ENUM, STRING) ENUM,
132 #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) ENUM,
133 #include "builtin-attrs.def"
134 #undef DEF_ATTR_NULL_TREE
136 #undef DEF_ATTR_STRING
137 #undef DEF_ATTR_IDENT
138 #undef DEF_ATTR_TREE_LIST
142 static GTY(()) tree built_in_attributes
[(int) ATTR_LAST
];
146 enum lto_builtin_type
148 #define DEF_PRIMITIVE_TYPE(NAME, VALUE) NAME,
149 #define DEF_FUNCTION_TYPE_0(NAME, RETURN) NAME,
150 #define DEF_FUNCTION_TYPE_1(NAME, RETURN, ARG1) NAME,
151 #define DEF_FUNCTION_TYPE_2(NAME, RETURN, ARG1, ARG2) NAME,
152 #define DEF_FUNCTION_TYPE_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
153 #define DEF_FUNCTION_TYPE_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
154 #define DEF_FUNCTION_TYPE_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) NAME,
155 #define DEF_FUNCTION_TYPE_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
157 #define DEF_FUNCTION_TYPE_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
159 #define DEF_FUNCTION_TYPE_8(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
160 ARG6, ARG7, ARG8) NAME,
161 #define DEF_FUNCTION_TYPE_VAR_0(NAME, RETURN) NAME,
162 #define DEF_FUNCTION_TYPE_VAR_1(NAME, RETURN, ARG1) NAME,
163 #define DEF_FUNCTION_TYPE_VAR_2(NAME, RETURN, ARG1, ARG2) NAME,
164 #define DEF_FUNCTION_TYPE_VAR_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
165 #define DEF_FUNCTION_TYPE_VAR_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
166 #define DEF_FUNCTION_TYPE_VAR_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG6) \
168 #define DEF_FUNCTION_TYPE_VAR_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
170 #define DEF_FUNCTION_TYPE_VAR_11(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
171 ARG6, ARG7, ARG8, ARG9, ARG10, ARG11) NAME,
172 #define DEF_POINTER_TYPE(NAME, TYPE) NAME,
173 #include "builtin-types.def"
174 #undef DEF_PRIMITIVE_TYPE
175 #undef DEF_FUNCTION_TYPE_0
176 #undef DEF_FUNCTION_TYPE_1
177 #undef DEF_FUNCTION_TYPE_2
178 #undef DEF_FUNCTION_TYPE_3
179 #undef DEF_FUNCTION_TYPE_4
180 #undef DEF_FUNCTION_TYPE_5
181 #undef DEF_FUNCTION_TYPE_6
182 #undef DEF_FUNCTION_TYPE_7
183 #undef DEF_FUNCTION_TYPE_8
184 #undef DEF_FUNCTION_TYPE_VAR_0
185 #undef DEF_FUNCTION_TYPE_VAR_1
186 #undef DEF_FUNCTION_TYPE_VAR_2
187 #undef DEF_FUNCTION_TYPE_VAR_3
188 #undef DEF_FUNCTION_TYPE_VAR_4
189 #undef DEF_FUNCTION_TYPE_VAR_5
190 #undef DEF_FUNCTION_TYPE_VAR_7
191 #undef DEF_FUNCTION_TYPE_VAR_11
192 #undef DEF_POINTER_TYPE
196 typedef enum lto_builtin_type builtin_type
;
198 static GTY(()) tree builtin_types
[(int) BT_LAST
+ 1];
200 static GTY(()) tree string_type_node
;
201 static GTY(()) tree const_string_type_node
;
202 static GTY(()) tree wint_type_node
;
203 static GTY(()) tree intmax_type_node
;
204 static GTY(()) tree uintmax_type_node
;
205 static GTY(()) tree signed_size_type_node
;
207 /* Flags needed to process builtins.def. */
212 /* Attribute handlers. */
214 /* Handle a "noreturn" attribute; arguments as in
215 struct attribute_spec.handler. */
218 handle_noreturn_attribute (tree
*node
, tree
ARG_UNUSED (name
),
219 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
220 bool * ARG_UNUSED (no_add_attrs
))
222 tree type
= TREE_TYPE (*node
);
224 if (TREE_CODE (*node
) == FUNCTION_DECL
)
225 TREE_THIS_VOLATILE (*node
) = 1;
226 else if (TREE_CODE (type
) == POINTER_TYPE
227 && TREE_CODE (TREE_TYPE (type
)) == FUNCTION_TYPE
)
230 (build_type_variant (TREE_TYPE (type
),
231 TYPE_READONLY (TREE_TYPE (type
)), 1));
238 /* Handle a "leaf" attribute; arguments as in
239 struct attribute_spec.handler. */
242 handle_leaf_attribute (tree
*node
, tree name
,
243 tree
ARG_UNUSED (args
),
244 int ARG_UNUSED (flags
), bool *no_add_attrs
)
246 if (TREE_CODE (*node
) != FUNCTION_DECL
)
248 warning (OPT_Wattributes
, "%qE attribute ignored", name
);
249 *no_add_attrs
= true;
251 if (!TREE_PUBLIC (*node
))
253 warning (OPT_Wattributes
, "%qE attribute has no effect on unit local functions", name
);
254 *no_add_attrs
= true;
260 /* Handle a "const" attribute; arguments as in
261 struct attribute_spec.handler. */
264 handle_const_attribute (tree
*node
, tree
ARG_UNUSED (name
),
265 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
266 bool * ARG_UNUSED (no_add_attrs
))
268 tree type
= TREE_TYPE (*node
);
270 /* See FIXME comment on noreturn in c_common_attribute_table. */
271 if (TREE_CODE (*node
) == FUNCTION_DECL
)
272 TREE_READONLY (*node
) = 1;
273 else if (TREE_CODE (type
) == POINTER_TYPE
274 && TREE_CODE (TREE_TYPE (type
)) == FUNCTION_TYPE
)
277 (build_type_variant (TREE_TYPE (type
), 1,
278 TREE_THIS_VOLATILE (TREE_TYPE (type
))));
286 /* Handle a "malloc" attribute; arguments as in
287 struct attribute_spec.handler. */
290 handle_malloc_attribute (tree
*node
, tree
ARG_UNUSED (name
),
291 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
292 bool * ARG_UNUSED (no_add_attrs
))
294 if (TREE_CODE (*node
) == FUNCTION_DECL
295 && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (*node
))))
296 DECL_IS_MALLOC (*node
) = 1;
304 /* Handle a "pure" attribute; arguments as in
305 struct attribute_spec.handler. */
308 handle_pure_attribute (tree
*node
, tree
ARG_UNUSED (name
),
309 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
310 bool * ARG_UNUSED (no_add_attrs
))
312 if (TREE_CODE (*node
) == FUNCTION_DECL
)
313 DECL_PURE_P (*node
) = 1;
321 /* Handle a "no vops" attribute; arguments as in
322 struct attribute_spec.handler. */
325 handle_novops_attribute (tree
*node
, tree
ARG_UNUSED (name
),
326 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
327 bool *ARG_UNUSED (no_add_attrs
))
329 gcc_assert (TREE_CODE (*node
) == FUNCTION_DECL
);
330 DECL_IS_NOVOPS (*node
) = 1;
335 /* Helper for nonnull attribute handling; fetch the operand number
336 from the attribute argument list. */
339 get_nonnull_operand (tree arg_num_expr
, unsigned HOST_WIDE_INT
*valp
)
341 /* Verify the arg number is a constant. */
342 if (!tree_fits_uhwi_p (arg_num_expr
))
345 *valp
= TREE_INT_CST_LOW (arg_num_expr
);
349 /* Handle the "nonnull" attribute. */
352 handle_nonnull_attribute (tree
*node
, tree
ARG_UNUSED (name
),
353 tree args
, int ARG_UNUSED (flags
),
354 bool * ARG_UNUSED (no_add_attrs
))
358 /* If no arguments are specified, all pointer arguments should be
359 non-null. Verify a full prototype is given so that the arguments
360 will have the correct types when we actually check them later. */
363 gcc_assert (prototype_p (type
));
367 /* Argument list specified. Verify that each argument number references
368 a pointer argument. */
369 for (; args
; args
= TREE_CHAIN (args
))
372 unsigned HOST_WIDE_INT arg_num
= 0, ck_num
;
374 if (!get_nonnull_operand (TREE_VALUE (args
), &arg_num
))
377 argument
= TYPE_ARG_TYPES (type
);
380 for (ck_num
= 1; ; ck_num
++)
382 if (!argument
|| ck_num
== arg_num
)
384 argument
= TREE_CHAIN (argument
);
388 && TREE_CODE (TREE_VALUE (argument
)) == POINTER_TYPE
);
396 /* Handle a "nothrow" attribute; arguments as in
397 struct attribute_spec.handler. */
400 handle_nothrow_attribute (tree
*node
, tree
ARG_UNUSED (name
),
401 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
402 bool * ARG_UNUSED (no_add_attrs
))
404 if (TREE_CODE (*node
) == FUNCTION_DECL
)
405 TREE_NOTHROW (*node
) = 1;
413 /* Handle a "sentinel" attribute. */
416 handle_sentinel_attribute (tree
*node
, tree
ARG_UNUSED (name
), tree args
,
417 int ARG_UNUSED (flags
),
418 bool * ARG_UNUSED (no_add_attrs
))
420 gcc_assert (stdarg_p (*node
));
424 tree position
= TREE_VALUE (args
);
425 gcc_assert (TREE_CODE (position
) == INTEGER_CST
);
426 if (tree_int_cst_lt (position
, integer_zero_node
))
433 /* Handle a "type_generic" attribute. */
436 handle_type_generic_attribute (tree
*node
, tree
ARG_UNUSED (name
),
437 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
438 bool * ARG_UNUSED (no_add_attrs
))
440 /* Ensure we have a function type. */
441 gcc_assert (TREE_CODE (*node
) == FUNCTION_TYPE
);
443 /* Ensure we have a variadic function. */
444 gcc_assert (!prototype_p (*node
) || stdarg_p (*node
));
449 /* Handle a "transaction_pure" attribute. */
452 handle_transaction_pure_attribute (tree
*node
, tree
ARG_UNUSED (name
),
453 tree
ARG_UNUSED (args
),
454 int ARG_UNUSED (flags
),
455 bool * ARG_UNUSED (no_add_attrs
))
457 /* Ensure we have a function type. */
458 gcc_assert (TREE_CODE (*node
) == FUNCTION_TYPE
);
463 /* Handle a "returns_twice" attribute. */
466 handle_returns_twice_attribute (tree
*node
, tree
ARG_UNUSED (name
),
467 tree
ARG_UNUSED (args
),
468 int ARG_UNUSED (flags
),
469 bool * ARG_UNUSED (no_add_attrs
))
471 gcc_assert (TREE_CODE (*node
) == FUNCTION_DECL
);
473 DECL_IS_RETURNS_TWICE (*node
) = 1;
478 /* Ignore the given attribute. Used when this attribute may be usefully
479 overridden by the target, but is not used generically. */
482 ignore_attribute (tree
* ARG_UNUSED (node
), tree
ARG_UNUSED (name
),
483 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
486 *no_add_attrs
= true;
490 /* Handle a "format" attribute; arguments as in
491 struct attribute_spec.handler. */
494 handle_format_attribute (tree
* ARG_UNUSED (node
), tree
ARG_UNUSED (name
),
495 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
498 *no_add_attrs
= true;
503 /* Handle a "format_arg" attribute; arguments as in
504 struct attribute_spec.handler. */
507 handle_format_arg_attribute (tree
* ARG_UNUSED (node
), tree
ARG_UNUSED (name
),
508 tree
ARG_UNUSED (args
), int ARG_UNUSED (flags
),
511 *no_add_attrs
= true;
516 /* Handle a "fn spec" attribute; arguments as in
517 struct attribute_spec.handler. */
520 handle_fnspec_attribute (tree
*node ATTRIBUTE_UNUSED
, tree
ARG_UNUSED (name
),
521 tree args
, int ARG_UNUSED (flags
),
522 bool *no_add_attrs ATTRIBUTE_UNUSED
)
525 && TREE_CODE (TREE_VALUE (args
)) == STRING_CST
526 && !TREE_CHAIN (args
));
530 /* Cribbed from c-common.c. */
533 def_fn_type (builtin_type def
, builtin_type ret
, bool var
, int n
, ...)
536 tree
*args
= XALLOCAVEC (tree
, n
);
542 for (i
= 0; i
< n
; ++i
)
544 builtin_type a
= (builtin_type
) va_arg (list
, int);
545 t
= builtin_types
[a
];
546 if (t
== error_mark_node
)
552 t
= builtin_types
[ret
];
555 if (t
== error_mark_node
)
558 t
= build_varargs_function_type_array (t
, n
, args
);
560 t
= build_function_type_array (t
, n
, args
);
562 builtin_types
[def
] = t
;
565 /* Used to help initialize the builtin-types.def table. When a type of
566 the correct size doesn't exist, use error_mark_node instead of NULL.
567 The later results in segfaults even when a decl using the type doesn't
571 builtin_type_for_size (int size
, bool unsignedp
)
573 tree type
= lto_type_for_size (size
, unsignedp
);
574 return type
? type
: error_mark_node
;
577 /* Support for DEF_BUILTIN. */
580 def_builtin_1 (enum built_in_function fncode
, const char *name
,
581 enum built_in_class fnclass
, tree fntype
, tree libtype
,
582 bool both_p
, bool fallback_p
, bool nonansi_p
,
583 tree fnattrs
, bool implicit_p
)
588 if (fntype
== error_mark_node
)
591 libname
= name
+ strlen ("__builtin_");
592 decl
= add_builtin_function (name
, fntype
, fncode
, fnclass
,
593 (fallback_p
? libname
: NULL
),
598 && !(nonansi_p
&& flag_no_nonansi_builtin
))
599 add_builtin_function (libname
, libtype
, fncode
, fnclass
,
602 set_builtin_decl (fncode
, decl
, implicit_p
);
606 /* Initialize the attribute table for all the supported builtins. */
609 lto_init_attributes (void)
611 /* Fill in the built_in_attributes array. */
612 #define DEF_ATTR_NULL_TREE(ENUM) \
613 built_in_attributes[(int) ENUM] = NULL_TREE;
614 #define DEF_ATTR_INT(ENUM, VALUE) \
615 built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE);
616 #define DEF_ATTR_STRING(ENUM, VALUE) \
617 built_in_attributes[(int) ENUM] = build_string (strlen (VALUE), VALUE);
618 #define DEF_ATTR_IDENT(ENUM, STRING) \
619 built_in_attributes[(int) ENUM] = get_identifier (STRING);
620 #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) \
621 built_in_attributes[(int) ENUM] \
622 = tree_cons (built_in_attributes[(int) PURPOSE], \
623 built_in_attributes[(int) VALUE], \
624 built_in_attributes[(int) CHAIN]);
625 #include "builtin-attrs.def"
626 #undef DEF_ATTR_NULL_TREE
628 #undef DEF_ATTR_STRING
629 #undef DEF_ATTR_IDENT
630 #undef DEF_ATTR_TREE_LIST
633 /* Create builtin types and functions. VA_LIST_REF_TYPE_NODE and
634 VA_LIST_ARG_TYPE_NODE are used in builtin-types.def. */
637 lto_define_builtins (tree va_list_ref_type_node ATTRIBUTE_UNUSED
,
638 tree va_list_arg_type_node ATTRIBUTE_UNUSED
)
640 #define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
641 builtin_types[ENUM] = VALUE;
642 #define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \
643 def_fn_type (ENUM, RETURN, 0, 0);
644 #define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1) \
645 def_fn_type (ENUM, RETURN, 0, 1, ARG1);
646 #define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \
647 def_fn_type (ENUM, RETURN, 0, 2, ARG1, ARG2);
648 #define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
649 def_fn_type (ENUM, RETURN, 0, 3, ARG1, ARG2, ARG3);
650 #define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
651 def_fn_type (ENUM, RETURN, 0, 4, ARG1, ARG2, ARG3, ARG4);
652 #define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
653 def_fn_type (ENUM, RETURN, 0, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
654 #define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
656 def_fn_type (ENUM, RETURN, 0, 6, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
657 #define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
659 def_fn_type (ENUM, RETURN, 0, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7);
660 #define DEF_FUNCTION_TYPE_8(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
662 def_fn_type (ENUM, RETURN, 0, 8, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, \
664 #define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \
665 def_fn_type (ENUM, RETURN, 1, 0);
666 #define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \
667 def_fn_type (ENUM, RETURN, 1, 1, ARG1);
668 #define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2) \
669 def_fn_type (ENUM, RETURN, 1, 2, ARG1, ARG2);
670 #define DEF_FUNCTION_TYPE_VAR_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
671 def_fn_type (ENUM, RETURN, 1, 3, ARG1, ARG2, ARG3);
672 #define DEF_FUNCTION_TYPE_VAR_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
673 def_fn_type (ENUM, RETURN, 1, 4, ARG1, ARG2, ARG3, ARG4);
674 #define DEF_FUNCTION_TYPE_VAR_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
675 def_fn_type (ENUM, RETURN, 1, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
676 #define DEF_FUNCTION_TYPE_VAR_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
678 def_fn_type (ENUM, RETURN, 1, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7);
679 #define DEF_FUNCTION_TYPE_VAR_11(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
680 ARG6, ARG7, ARG8, ARG9, ARG10, ARG11) \
681 def_fn_type (ENUM, RETURN, 1, 11, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, \
682 ARG7, ARG8, ARG9, ARG10, ARG11);
683 #define DEF_POINTER_TYPE(ENUM, TYPE) \
684 builtin_types[(int) ENUM] = build_pointer_type (builtin_types[(int) TYPE]);
686 #include "builtin-types.def"
688 #undef DEF_PRIMITIVE_TYPE
689 #undef DEF_FUNCTION_TYPE_0
690 #undef DEF_FUNCTION_TYPE_1
691 #undef DEF_FUNCTION_TYPE_2
692 #undef DEF_FUNCTION_TYPE_3
693 #undef DEF_FUNCTION_TYPE_4
694 #undef DEF_FUNCTION_TYPE_5
695 #undef DEF_FUNCTION_TYPE_6
696 #undef DEF_FUNCTION_TYPE_7
697 #undef DEF_FUNCTION_TYPE_8
698 #undef DEF_FUNCTION_TYPE_VAR_0
699 #undef DEF_FUNCTION_TYPE_VAR_1
700 #undef DEF_FUNCTION_TYPE_VAR_2
701 #undef DEF_FUNCTION_TYPE_VAR_3
702 #undef DEF_FUNCTION_TYPE_VAR_4
703 #undef DEF_FUNCTION_TYPE_VAR_5
704 #undef DEF_FUNCTION_TYPE_VAR_7
705 #undef DEF_FUNCTION_TYPE_VAR_11
706 #undef DEF_POINTER_TYPE
707 builtin_types
[(int) BT_LAST
] = NULL_TREE
;
709 lto_init_attributes ();
711 #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, FALLBACK_P,\
712 NONANSI_P, ATTRS, IMPLICIT, COND) \
714 def_builtin_1 (ENUM, NAME, CLASS, builtin_types[(int) TYPE], \
715 builtin_types[(int) LIBTYPE], BOTH_P, FALLBACK_P, \
716 NONANSI_P, built_in_attributes[(int) ATTRS], IMPLICIT);
717 #include "builtins.def"
721 static GTY(()) tree registered_builtin_types
;
723 /* Language hooks. */
726 lto_option_lang_mask (void)
732 lto_complain_wrong_lang_p (const struct cl_option
*option ATTRIBUTE_UNUSED
)
734 /* The LTO front end inherits all the options from the first front
735 end that was used. However, not all the original front end
736 options make sense in LTO.
738 A real solution would be to filter this in collect2, but collect2
739 does not have access to all the option attributes to know what to
740 filter. So, in lto1 we silently accept inherited flags and do
746 lto_init_options_struct (struct gcc_options
*opts
)
748 /* By default, C99-like requirements for complex multiply and divide.
749 ??? Until the complex method is encoded in the IL this is the only
750 safe choice. This will pessimize Fortran code with LTO unless
751 people specify a complex method manually or use -ffast-math. */
752 opts
->x_flag_complex_method
= 2;
755 /* Handle command-line option SCODE. If the option takes an argument, it is
756 stored in ARG, which is otherwise NULL. VALUE holds either a numerical
757 argument or a binary value indicating whether the positive or negative form
758 of the option was supplied. */
760 const char *resolution_file_name
;
762 lto_handle_option (size_t scode
, const char *arg
,
763 int value ATTRIBUTE_UNUSED
, int kind ATTRIBUTE_UNUSED
,
764 location_t loc ATTRIBUTE_UNUSED
,
765 const struct cl_option_handlers
*handlers ATTRIBUTE_UNUSED
)
767 enum opt_code code
= (enum opt_code
) scode
;
772 case OPT_fresolution_
:
773 resolution_file_name
= arg
;
781 flag_wpa
= value
? "" : NULL
;
791 /* Perform post-option processing. Does additional initialization based on
792 command-line options. PFILENAME is the main input filename. Returns false
793 to enable subsequent back-end initialization. */
796 lto_post_options (const char **pfilename ATTRIBUTE_UNUSED
)
798 /* -fltrans and -fwpa are mutually exclusive. Check for that here. */
799 if (flag_wpa
&& flag_ltrans
)
800 error ("-fwpa and -fltrans are mutually exclusive");
804 flag_generate_lto
= 0;
806 /* During LTRANS, we are not looking at the whole program, only
807 a subset of the whole callgraph. */
808 flag_whole_program
= 0;
812 flag_generate_lto
= 1;
814 /* Excess precision other than "fast" requires front-end
816 flag_excess_precision_cmdline
= EXCESS_PRECISION_FAST
;
818 /* Initialize the compiler back end. */
822 /* Return an integer type with PRECISION bits of precision,
823 that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */
826 lto_type_for_size (unsigned precision
, int unsignedp
)
830 if (precision
== TYPE_PRECISION (integer_type_node
))
831 return unsignedp
? unsigned_type_node
: integer_type_node
;
833 if (precision
== TYPE_PRECISION (signed_char_type_node
))
834 return unsignedp
? unsigned_char_type_node
: signed_char_type_node
;
836 if (precision
== TYPE_PRECISION (short_integer_type_node
))
837 return unsignedp
? short_unsigned_type_node
: short_integer_type_node
;
839 if (precision
== TYPE_PRECISION (long_integer_type_node
))
840 return unsignedp
? long_unsigned_type_node
: long_integer_type_node
;
842 if (precision
== TYPE_PRECISION (long_long_integer_type_node
))
844 ? long_long_unsigned_type_node
845 : long_long_integer_type_node
;
847 for (i
= 0; i
< NUM_INT_N_ENTS
; i
++)
848 if (int_n_enabled_p
[i
]
849 && precision
== int_n_data
[i
].bitsize
)
850 return (unsignedp
? int_n_trees
[i
].unsigned_type
851 : int_n_trees
[i
].signed_type
);
853 if (precision
<= TYPE_PRECISION (intQI_type_node
))
854 return unsignedp
? unsigned_intQI_type_node
: intQI_type_node
;
856 if (precision
<= TYPE_PRECISION (intHI_type_node
))
857 return unsignedp
? unsigned_intHI_type_node
: intHI_type_node
;
859 if (precision
<= TYPE_PRECISION (intSI_type_node
))
860 return unsignedp
? unsigned_intSI_type_node
: intSI_type_node
;
862 if (precision
<= TYPE_PRECISION (intDI_type_node
))
863 return unsignedp
? unsigned_intDI_type_node
: intDI_type_node
;
865 if (precision
<= TYPE_PRECISION (intTI_type_node
))
866 return unsignedp
? unsigned_intTI_type_node
: intTI_type_node
;
872 /* Return a data type that has machine mode MODE.
873 If the mode is an integer,
874 then UNSIGNEDP selects between signed and unsigned types.
875 If the mode is a fixed-point mode,
876 then UNSIGNEDP selects between saturating and nonsaturating types. */
879 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
;
899 for (i
= 0; i
< NUM_INT_N_ENTS
; i
++)
900 if (int_n_enabled_p
[i
]
901 && mode
== int_n_data
[i
].m
)
902 return (unsigned_p
? int_n_trees
[i
].unsigned_type
903 : int_n_trees
[i
].signed_type
);
906 return unsigned_p
? unsigned_intQI_type_node
: intQI_type_node
;
909 return unsigned_p
? unsigned_intHI_type_node
: intHI_type_node
;
912 return unsigned_p
? unsigned_intSI_type_node
: intSI_type_node
;
915 return unsigned_p
? unsigned_intDI_type_node
: intDI_type_node
;
917 #if HOST_BITS_PER_WIDE_INT >= 64
918 if (mode
== TYPE_MODE (intTI_type_node
))
919 return unsigned_p
? unsigned_intTI_type_node
: intTI_type_node
;
922 if (mode
== TYPE_MODE (float_type_node
))
923 return float_type_node
;
925 if (mode
== TYPE_MODE (double_type_node
))
926 return double_type_node
;
928 if (mode
== TYPE_MODE (long_double_type_node
))
929 return long_double_type_node
;
931 if (mode
== TYPE_MODE (void_type_node
))
932 return void_type_node
;
934 if (mode
== TYPE_MODE (build_pointer_type (char_type_node
)))
936 ? make_unsigned_type (GET_MODE_PRECISION (mode
))
937 : make_signed_type (GET_MODE_PRECISION (mode
)));
939 if (mode
== TYPE_MODE (build_pointer_type (integer_type_node
)))
941 ? make_unsigned_type (GET_MODE_PRECISION (mode
))
942 : make_signed_type (GET_MODE_PRECISION (mode
)));
944 if (COMPLEX_MODE_P (mode
))
946 machine_mode inner_mode
;
949 if (mode
== TYPE_MODE (complex_float_type_node
))
950 return complex_float_type_node
;
951 if (mode
== TYPE_MODE (complex_double_type_node
))
952 return complex_double_type_node
;
953 if (mode
== TYPE_MODE (complex_long_double_type_node
))
954 return complex_long_double_type_node
;
956 if (mode
== TYPE_MODE (complex_integer_type_node
) && !unsigned_p
)
957 return complex_integer_type_node
;
959 inner_mode
= GET_MODE_INNER (mode
);
960 inner_type
= lto_type_for_mode (inner_mode
, unsigned_p
);
961 if (inner_type
!= NULL_TREE
)
962 return build_complex_type (inner_type
);
964 else if (VECTOR_MODE_P (mode
))
966 machine_mode inner_mode
= GET_MODE_INNER (mode
);
967 tree inner_type
= lto_type_for_mode (inner_mode
, unsigned_p
);
968 if (inner_type
!= NULL_TREE
)
969 return build_vector_type_for_mode (inner_type
, mode
);
972 if (mode
== TYPE_MODE (dfloat32_type_node
))
973 return dfloat32_type_node
;
974 if (mode
== TYPE_MODE (dfloat64_type_node
))
975 return dfloat64_type_node
;
976 if (mode
== TYPE_MODE (dfloat128_type_node
))
977 return dfloat128_type_node
;
979 if (ALL_SCALAR_FIXED_POINT_MODE_P (mode
))
981 if (mode
== TYPE_MODE (short_fract_type_node
))
982 return unsigned_p
? sat_short_fract_type_node
: short_fract_type_node
;
983 if (mode
== TYPE_MODE (fract_type_node
))
984 return unsigned_p
? sat_fract_type_node
: fract_type_node
;
985 if (mode
== TYPE_MODE (long_fract_type_node
))
986 return unsigned_p
? sat_long_fract_type_node
: long_fract_type_node
;
987 if (mode
== TYPE_MODE (long_long_fract_type_node
))
988 return unsigned_p
? sat_long_long_fract_type_node
989 : long_long_fract_type_node
;
991 if (mode
== TYPE_MODE (unsigned_short_fract_type_node
))
992 return unsigned_p
? sat_unsigned_short_fract_type_node
993 : unsigned_short_fract_type_node
;
994 if (mode
== TYPE_MODE (unsigned_fract_type_node
))
995 return unsigned_p
? sat_unsigned_fract_type_node
996 : unsigned_fract_type_node
;
997 if (mode
== TYPE_MODE (unsigned_long_fract_type_node
))
998 return unsigned_p
? sat_unsigned_long_fract_type_node
999 : unsigned_long_fract_type_node
;
1000 if (mode
== TYPE_MODE (unsigned_long_long_fract_type_node
))
1001 return unsigned_p
? sat_unsigned_long_long_fract_type_node
1002 : unsigned_long_long_fract_type_node
;
1004 if (mode
== TYPE_MODE (short_accum_type_node
))
1005 return unsigned_p
? sat_short_accum_type_node
: short_accum_type_node
;
1006 if (mode
== TYPE_MODE (accum_type_node
))
1007 return unsigned_p
? sat_accum_type_node
: accum_type_node
;
1008 if (mode
== TYPE_MODE (long_accum_type_node
))
1009 return unsigned_p
? sat_long_accum_type_node
: long_accum_type_node
;
1010 if (mode
== TYPE_MODE (long_long_accum_type_node
))
1011 return unsigned_p
? sat_long_long_accum_type_node
1012 : long_long_accum_type_node
;
1014 if (mode
== TYPE_MODE (unsigned_short_accum_type_node
))
1015 return unsigned_p
? sat_unsigned_short_accum_type_node
1016 : unsigned_short_accum_type_node
;
1017 if (mode
== TYPE_MODE (unsigned_accum_type_node
))
1018 return unsigned_p
? sat_unsigned_accum_type_node
1019 : unsigned_accum_type_node
;
1020 if (mode
== TYPE_MODE (unsigned_long_accum_type_node
))
1021 return unsigned_p
? sat_unsigned_long_accum_type_node
1022 : unsigned_long_accum_type_node
;
1023 if (mode
== TYPE_MODE (unsigned_long_long_accum_type_node
))
1024 return unsigned_p
? sat_unsigned_long_long_accum_type_node
1025 : unsigned_long_long_accum_type_node
;
1028 return unsigned_p
? sat_qq_type_node
: qq_type_node
;
1030 return unsigned_p
? sat_hq_type_node
: hq_type_node
;
1032 return unsigned_p
? sat_sq_type_node
: sq_type_node
;
1034 return unsigned_p
? sat_dq_type_node
: dq_type_node
;
1036 return unsigned_p
? sat_tq_type_node
: tq_type_node
;
1038 if (mode
== UQQmode
)
1039 return unsigned_p
? sat_uqq_type_node
: uqq_type_node
;
1040 if (mode
== UHQmode
)
1041 return unsigned_p
? sat_uhq_type_node
: uhq_type_node
;
1042 if (mode
== USQmode
)
1043 return unsigned_p
? sat_usq_type_node
: usq_type_node
;
1044 if (mode
== UDQmode
)
1045 return unsigned_p
? sat_udq_type_node
: udq_type_node
;
1046 if (mode
== UTQmode
)
1047 return unsigned_p
? sat_utq_type_node
: utq_type_node
;
1050 return unsigned_p
? sat_ha_type_node
: ha_type_node
;
1052 return unsigned_p
? sat_sa_type_node
: sa_type_node
;
1054 return unsigned_p
? sat_da_type_node
: da_type_node
;
1056 return unsigned_p
? sat_ta_type_node
: ta_type_node
;
1058 if (mode
== UHAmode
)
1059 return unsigned_p
? sat_uha_type_node
: uha_type_node
;
1060 if (mode
== USAmode
)
1061 return unsigned_p
? sat_usa_type_node
: usa_type_node
;
1062 if (mode
== UDAmode
)
1063 return unsigned_p
? sat_uda_type_node
: uda_type_node
;
1064 if (mode
== UTAmode
)
1065 return unsigned_p
? sat_uta_type_node
: uta_type_node
;
1068 for (t
= registered_builtin_types
; t
; t
= TREE_CHAIN (t
))
1069 if (TYPE_MODE (TREE_VALUE (t
)) == mode
)
1070 return TREE_VALUE (t
);
1075 /* Return true if we are in the global binding level. */
1078 lto_global_bindings_p (void)
1080 return cfun
== NULL
;
1084 lto_set_decl_assembler_name (tree decl
)
1086 /* This is almost the same as lhd_set_decl_assembler_name, except that
1087 we need to uniquify file-scope names, even if they are not
1088 TREE_PUBLIC, to avoid conflicts between individual files. */
1091 if (TREE_PUBLIC (decl
))
1092 id
= targetm
.mangle_decl_assembler_name (decl
, DECL_NAME (decl
));
1095 const char *name
= IDENTIFIER_POINTER (DECL_NAME (decl
));
1098 ASM_FORMAT_PRIVATE_NAME (label
, name
, DECL_UID (decl
));
1099 id
= get_identifier (label
);
1102 SET_DECL_ASSEMBLER_NAME (decl
, id
);
1106 lto_pushdecl (tree t ATTRIBUTE_UNUSED
)
1108 /* Do nothing, since we get all information from DWARF and LTO
1116 /* We have our own write_globals langhook, hence the getdecls
1117 langhook shouldn't be used, except by dbxout.c, so we can't
1123 lto_builtin_function (tree decl
)
1129 lto_register_builtin_type (tree type
, const char *name
)
1133 if (!TYPE_NAME (type
))
1135 decl
= build_decl (UNKNOWN_LOCATION
, TYPE_DECL
,
1136 get_identifier (name
), type
);
1137 DECL_ARTIFICIAL (decl
) = 1;
1138 TYPE_NAME (type
) = decl
;
1141 registered_builtin_types
= tree_cons (0, type
, registered_builtin_types
);
1144 /* Build nodes that would have be created by the C front-end; necessary
1145 for including builtin-types.def and ultimately builtins.def. */
1148 lto_build_c_type_nodes (void)
1150 gcc_assert (void_type_node
);
1152 void_list_node
= build_tree_list (NULL_TREE
, void_type_node
);
1153 string_type_node
= build_pointer_type (char_type_node
);
1154 const_string_type_node
1155 = build_pointer_type (build_qualified_type (char_type_node
, TYPE_QUAL_CONST
));
1157 if (strcmp (SIZE_TYPE
, "unsigned int") == 0)
1159 intmax_type_node
= integer_type_node
;
1160 uintmax_type_node
= unsigned_type_node
;
1161 signed_size_type_node
= integer_type_node
;
1163 else if (strcmp (SIZE_TYPE
, "long unsigned int") == 0)
1165 intmax_type_node
= long_integer_type_node
;
1166 uintmax_type_node
= long_unsigned_type_node
;
1167 signed_size_type_node
= long_integer_type_node
;
1169 else if (strcmp (SIZE_TYPE
, "long long unsigned int") == 0)
1171 intmax_type_node
= long_long_integer_type_node
;
1172 uintmax_type_node
= long_long_unsigned_type_node
;
1173 signed_size_type_node
= long_long_integer_type_node
;
1179 signed_size_type_node
= NULL_TREE
;
1180 for (i
= 0; i
< NUM_INT_N_ENTS
; i
++)
1181 if (int_n_enabled_p
[i
])
1184 sprintf (name
, "__int%d unsigned", int_n_data
[i
].bitsize
);
1186 if (strcmp (name
, SIZE_TYPE
) == 0)
1188 intmax_type_node
= int_n_trees
[i
].signed_type
;
1189 uintmax_type_node
= int_n_trees
[i
].unsigned_type
;
1190 signed_size_type_node
= int_n_trees
[i
].signed_type
;
1193 if (signed_size_type_node
== NULL_TREE
)
1197 wint_type_node
= unsigned_type_node
;
1198 pid_type_node
= integer_type_node
;
1201 /* Perform LTO-specific initialization. */
1208 /* We need to generate LTO if running in WPA mode. */
1209 flag_generate_lto
= (flag_wpa
!= NULL
);
1211 /* Create the basic integer types. */
1212 build_common_tree_nodes (flag_signed_char
, flag_short_double
);
1214 /* The global tree for the main identifier is filled in by
1215 language-specific front-end initialization that is not run in the
1216 LTO back-end. It appears that all languages that perform such
1217 initialization currently do so in the same way, so we do it here. */
1218 if (main_identifier_node
== NULL_TREE
)
1219 main_identifier_node
= get_identifier ("main");
1221 /* In the C++ front-end, fileptr_type_node is defined as a variant
1222 copy of of ptr_type_node, rather than ptr_node itself. The
1223 distinction should only be relevant to the front-end, so we
1224 always use the C definition here in lto1. */
1225 gcc_assert (fileptr_type_node
== ptr_type_node
);
1226 gcc_assert (TYPE_MAIN_VARIANT (fileptr_type_node
) == ptr_type_node
);
1228 ptrdiff_type_node
= integer_type_node
;
1230 lto_build_c_type_nodes ();
1231 gcc_assert (va_list_type_node
);
1233 if (TREE_CODE (va_list_type_node
) == ARRAY_TYPE
)
1235 tree x
= build_pointer_type (TREE_TYPE (va_list_type_node
));
1236 lto_define_builtins (x
, x
);
1240 lto_define_builtins (build_reference_type (va_list_type_node
),
1245 cilk_init_builtins ();
1247 targetm
.init_builtins ();
1248 build_common_builtin_nodes ();
1250 /* Assign names to the builtin types, otherwise they'll end up
1251 as __unknown__ in debug info.
1252 ??? We simply need to stop pre-seeding the streamer cache.
1253 Below is modeled after from c-common.c:c_common_nodes_and_builtins */
1254 #define NAME_TYPE(t,n) \
1256 TYPE_NAME (t) = build_decl (UNKNOWN_LOCATION, TYPE_DECL, \
1257 get_identifier (n), t)
1258 NAME_TYPE (integer_type_node
, "int");
1259 NAME_TYPE (char_type_node
, "char");
1260 NAME_TYPE (long_integer_type_node
, "long int");
1261 NAME_TYPE (unsigned_type_node
, "unsigned int");
1262 NAME_TYPE (long_unsigned_type_node
, "long unsigned int");
1263 NAME_TYPE (long_long_integer_type_node
, "long long int");
1264 NAME_TYPE (long_long_unsigned_type_node
, "long long unsigned int");
1265 NAME_TYPE (short_integer_type_node
, "short int");
1266 NAME_TYPE (short_unsigned_type_node
, "short unsigned int");
1267 if (signed_char_type_node
!= char_type_node
)
1268 NAME_TYPE (signed_char_type_node
, "signed char");
1269 if (unsigned_char_type_node
!= char_type_node
)
1270 NAME_TYPE (unsigned_char_type_node
, "unsigned char");
1271 NAME_TYPE (float_type_node
, "float");
1272 NAME_TYPE (double_type_node
, "double");
1273 NAME_TYPE (long_double_type_node
, "long double");
1274 NAME_TYPE (void_type_node
, "void");
1275 NAME_TYPE (boolean_type_node
, "bool");
1276 NAME_TYPE (complex_float_type_node
, "complex float");
1277 NAME_TYPE (complex_double_type_node
, "complex double");
1278 NAME_TYPE (complex_long_double_type_node
, "complex long double");
1279 for (i
= 0; i
< NUM_INT_N_ENTS
; i
++)
1280 if (int_n_enabled_p
[i
])
1283 sprintf (name
, "__int%d", int_n_data
[i
].bitsize
);
1284 NAME_TYPE (int_n_trees
[i
].signed_type
, name
);
1288 /* Initialize LTO-specific data structures. */
1294 /* Initialize tree structures required by the LTO front end. */
1296 static void lto_init_ts (void)
1298 tree_contains_struct
[NAMESPACE_DECL
][TS_DECL_MINIMAL
] = 1;
1301 #undef LANG_HOOKS_NAME
1302 #define LANG_HOOKS_NAME "GNU GIMPLE"
1303 #undef LANG_HOOKS_OPTION_LANG_MASK
1304 #define LANG_HOOKS_OPTION_LANG_MASK lto_option_lang_mask
1305 #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
1306 #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lto_complain_wrong_lang_p
1307 #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
1308 #define LANG_HOOKS_INIT_OPTIONS_STRUCT lto_init_options_struct
1309 #undef LANG_HOOKS_HANDLE_OPTION
1310 #define LANG_HOOKS_HANDLE_OPTION lto_handle_option
1311 #undef LANG_HOOKS_POST_OPTIONS
1312 #define LANG_HOOKS_POST_OPTIONS lto_post_options
1313 #undef LANG_HOOKS_GET_ALIAS_SET
1314 #define LANG_HOOKS_GET_ALIAS_SET gimple_get_alias_set
1315 #undef LANG_HOOKS_TYPE_FOR_MODE
1316 #define LANG_HOOKS_TYPE_FOR_MODE lto_type_for_mode
1317 #undef LANG_HOOKS_TYPE_FOR_SIZE
1318 #define LANG_HOOKS_TYPE_FOR_SIZE lto_type_for_size
1319 #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
1320 #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lto_set_decl_assembler_name
1321 #undef LANG_HOOKS_GLOBAL_BINDINGS_P
1322 #define LANG_HOOKS_GLOBAL_BINDINGS_P lto_global_bindings_p
1323 #undef LANG_HOOKS_PUSHDECL
1324 #define LANG_HOOKS_PUSHDECL lto_pushdecl
1325 #undef LANG_HOOKS_GETDECLS
1326 #define LANG_HOOKS_GETDECLS lto_getdecls
1327 #undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
1328 #define LANG_HOOKS_REGISTER_BUILTIN_TYPE lto_register_builtin_type
1329 #undef LANG_HOOKS_BUILTIN_FUNCTION
1330 #define LANG_HOOKS_BUILTIN_FUNCTION lto_builtin_function
1331 #undef LANG_HOOKS_INIT
1332 #define LANG_HOOKS_INIT lto_init
1333 #undef LANG_HOOKS_PARSE_FILE
1334 #define LANG_HOOKS_PARSE_FILE lto_main
1335 #undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
1336 #define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
1337 #undef LANG_HOOKS_TYPES_COMPATIBLE_P
1338 #define LANG_HOOKS_TYPES_COMPATIBLE_P NULL
1339 #undef LANG_HOOKS_EH_PERSONALITY
1340 #define LANG_HOOKS_EH_PERSONALITY lto_eh_personality
1342 /* Attribute hooks. */
1343 #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
1344 #define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE lto_attribute_table
1345 #undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
1346 #define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE lto_format_attribute_table
1348 #undef LANG_HOOKS_BEGIN_SECTION
1349 #define LANG_HOOKS_BEGIN_SECTION lto_obj_begin_section
1350 #undef LANG_HOOKS_APPEND_DATA
1351 #define LANG_HOOKS_APPEND_DATA lto_obj_append_data
1352 #undef LANG_HOOKS_END_SECTION
1353 #define LANG_HOOKS_END_SECTION lto_obj_end_section
1355 #undef LANG_HOOKS_INIT_TS
1356 #define LANG_HOOKS_INIT_TS lto_init_ts
1358 struct lang_hooks lang_hooks
= LANG_HOOKS_INITIALIZER
;
1360 /* Language hooks that are not part of lang_hooks. */
1363 convert (tree type ATTRIBUTE_UNUSED
, tree expr ATTRIBUTE_UNUSED
)
1368 /* Tree walking support. */
1370 static enum lto_tree_node_structure_enum
1371 lto_tree_node_structure (union lang_tree_node
*t ATTRIBUTE_UNUSED
)
1373 return TS_LTO_GENERIC
;
1376 #include "gtype-lto.h"
1377 #include "gt-lto-lto-lang.h"