New vectorizer messages; message format change.
[official-gcc.git] / gcc / lto / lto-lang.c
blob87a756d57639bb83095764f40f16b39688772e69
1 /* Language-dependent hooks for LTO.
2 Copyright (C) 2009-2013 Free Software Foundation, Inc.
3 Contributed by CodeSourcery, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "flags.h"
25 #include "tm.h"
26 #include "tree.h"
27 #include "target.h"
28 #include "langhooks.h"
29 #include "langhooks-def.h"
30 #include "debug.h"
31 #include "lto-tree.h"
32 #include "lto.h"
33 #include "tree-inline.h"
34 #include "gimple.h"
35 #include "diagnostic-core.h"
36 #include "toplev.h"
37 #include "lto-streamer.h"
39 static tree lto_type_for_size (unsigned, int);
41 static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
42 static tree handle_leaf_attribute (tree *, tree, tree, int, bool *);
43 static tree handle_const_attribute (tree *, tree, tree, int, bool *);
44 static tree handle_malloc_attribute (tree *, tree, tree, int, bool *);
45 static tree handle_pure_attribute (tree *, tree, tree, int, bool *);
46 static tree handle_novops_attribute (tree *, tree, tree, int, bool *);
47 static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
48 static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
49 static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
50 static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
51 static tree handle_transaction_pure_attribute (tree *, tree, tree, int, bool *);
52 static tree handle_returns_twice_attribute (tree *, tree, tree, int, bool *);
53 static tree ignore_attribute (tree *, tree, tree, int, bool *);
55 static tree handle_format_attribute (tree *, tree, tree, int, bool *);
56 static tree handle_fnspec_attribute (tree *, tree, tree, int, bool *);
57 static tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
59 /* Table of machine-independent attributes supported in GIMPLE. */
60 const struct attribute_spec lto_attribute_table[] =
62 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
63 do_diagnostic } */
64 { "noreturn", 0, 0, true, false, false,
65 handle_noreturn_attribute, false },
66 { "leaf", 0, 0, true, false, false,
67 handle_leaf_attribute, false },
68 /* The same comments as for noreturn attributes apply to const ones. */
69 { "const", 0, 0, true, false, false,
70 handle_const_attribute, false },
71 { "malloc", 0, 0, true, false, false,
72 handle_malloc_attribute, false },
73 { "pure", 0, 0, true, false, false,
74 handle_pure_attribute, false },
75 { "no vops", 0, 0, true, false, false,
76 handle_novops_attribute, false },
77 { "nonnull", 0, -1, false, true, true,
78 handle_nonnull_attribute, false },
79 { "nothrow", 0, 0, true, false, false,
80 handle_nothrow_attribute, false },
81 { "returns_twice", 0, 0, true, false, false,
82 handle_returns_twice_attribute, false },
83 { "sentinel", 0, 1, false, true, true,
84 handle_sentinel_attribute, false },
85 { "type generic", 0, 0, false, true, true,
86 handle_type_generic_attribute, false },
87 { "fn spec", 1, 1, false, true, true,
88 handle_fnspec_attribute, false },
89 { "transaction_pure", 0, 0, false, true, true,
90 handle_transaction_pure_attribute, false },
91 /* For internal use only. The leading '*' both prevents its usage in
92 source code and signals that it may be overridden by machine tables. */
93 { "*tm regparm", 0, 0, false, true, true,
94 ignore_attribute, false },
95 { NULL, 0, 0, false, false, false, NULL, false }
98 /* Give the specifications for the format attributes, used by C and all
99 descendants. */
101 const struct attribute_spec lto_format_attribute_table[] =
103 /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
104 affects_type_identity } */
105 { "format", 3, 3, false, true, true,
106 handle_format_attribute, false },
107 { "format_arg", 1, 1, false, true, true,
108 handle_format_arg_attribute, false },
109 { NULL, 0, 0, false, false, false, NULL, false }
112 enum built_in_attribute
114 #define DEF_ATTR_NULL_TREE(ENUM) ENUM,
115 #define DEF_ATTR_INT(ENUM, VALUE) ENUM,
116 #define DEF_ATTR_STRING(ENUM, VALUE) ENUM,
117 #define DEF_ATTR_IDENT(ENUM, STRING) ENUM,
118 #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) ENUM,
119 #include "builtin-attrs.def"
120 #undef DEF_ATTR_NULL_TREE
121 #undef DEF_ATTR_INT
122 #undef DEF_ATTR_STRING
123 #undef DEF_ATTR_IDENT
124 #undef DEF_ATTR_TREE_LIST
125 ATTR_LAST
128 static GTY(()) tree built_in_attributes[(int) ATTR_LAST];
130 /* Builtin types. */
132 enum lto_builtin_type
134 #define DEF_PRIMITIVE_TYPE(NAME, VALUE) NAME,
135 #define DEF_FUNCTION_TYPE_0(NAME, RETURN) NAME,
136 #define DEF_FUNCTION_TYPE_1(NAME, RETURN, ARG1) NAME,
137 #define DEF_FUNCTION_TYPE_2(NAME, RETURN, ARG1, ARG2) NAME,
138 #define DEF_FUNCTION_TYPE_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
139 #define DEF_FUNCTION_TYPE_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
140 #define DEF_FUNCTION_TYPE_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) NAME,
141 #define DEF_FUNCTION_TYPE_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) NAME,
142 #define DEF_FUNCTION_TYPE_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) NAME,
143 #define DEF_FUNCTION_TYPE_VAR_0(NAME, RETURN) NAME,
144 #define DEF_FUNCTION_TYPE_VAR_1(NAME, RETURN, ARG1) NAME,
145 #define DEF_FUNCTION_TYPE_VAR_2(NAME, RETURN, ARG1, ARG2) NAME,
146 #define DEF_FUNCTION_TYPE_VAR_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
147 #define DEF_FUNCTION_TYPE_VAR_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
148 #define DEF_FUNCTION_TYPE_VAR_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG6) \
149 NAME,
150 #define DEF_POINTER_TYPE(NAME, TYPE) NAME,
151 #include "builtin-types.def"
152 #undef DEF_PRIMITIVE_TYPE
153 #undef DEF_FUNCTION_TYPE_0
154 #undef DEF_FUNCTION_TYPE_1
155 #undef DEF_FUNCTION_TYPE_2
156 #undef DEF_FUNCTION_TYPE_3
157 #undef DEF_FUNCTION_TYPE_4
158 #undef DEF_FUNCTION_TYPE_5
159 #undef DEF_FUNCTION_TYPE_6
160 #undef DEF_FUNCTION_TYPE_7
161 #undef DEF_FUNCTION_TYPE_VAR_0
162 #undef DEF_FUNCTION_TYPE_VAR_1
163 #undef DEF_FUNCTION_TYPE_VAR_2
164 #undef DEF_FUNCTION_TYPE_VAR_3
165 #undef DEF_FUNCTION_TYPE_VAR_4
166 #undef DEF_FUNCTION_TYPE_VAR_5
167 #undef DEF_POINTER_TYPE
168 BT_LAST
171 typedef enum lto_builtin_type builtin_type;
173 static GTY(()) tree builtin_types[(int) BT_LAST + 1];
175 static GTY(()) tree string_type_node;
176 static GTY(()) tree const_string_type_node;
177 static GTY(()) tree wint_type_node;
178 static GTY(()) tree intmax_type_node;
179 static GTY(()) tree uintmax_type_node;
180 static GTY(()) tree signed_size_type_node;
182 /* Flags needed to process builtins.def. */
183 int flag_isoc94;
184 int flag_isoc99;
186 /* Attribute handlers. */
188 /* Handle a "noreturn" attribute; arguments as in
189 struct attribute_spec.handler. */
191 static tree
192 handle_noreturn_attribute (tree *node, tree ARG_UNUSED (name),
193 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
194 bool * ARG_UNUSED (no_add_attrs))
196 tree type = TREE_TYPE (*node);
198 if (TREE_CODE (*node) == FUNCTION_DECL)
199 TREE_THIS_VOLATILE (*node) = 1;
200 else if (TREE_CODE (type) == POINTER_TYPE
201 && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
202 TREE_TYPE (*node)
203 = build_pointer_type
204 (build_type_variant (TREE_TYPE (type),
205 TYPE_READONLY (TREE_TYPE (type)), 1));
206 else
207 gcc_unreachable ();
209 return NULL_TREE;
212 /* Handle a "leaf" attribute; arguments as in
213 struct attribute_spec.handler. */
215 static tree
216 handle_leaf_attribute (tree *node, tree name,
217 tree ARG_UNUSED (args),
218 int ARG_UNUSED (flags), bool *no_add_attrs)
220 if (TREE_CODE (*node) != FUNCTION_DECL)
222 warning (OPT_Wattributes, "%qE attribute ignored", name);
223 *no_add_attrs = true;
225 if (!TREE_PUBLIC (*node))
227 warning (OPT_Wattributes, "%qE attribute has no effect on unit local functions", name);
228 *no_add_attrs = true;
231 return NULL_TREE;
234 /* Handle a "const" attribute; arguments as in
235 struct attribute_spec.handler. */
237 static tree
238 handle_const_attribute (tree *node, tree ARG_UNUSED (name),
239 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
240 bool * ARG_UNUSED (no_add_attrs))
242 tree type = TREE_TYPE (*node);
244 /* See FIXME comment on noreturn in c_common_attribute_table. */
245 if (TREE_CODE (*node) == FUNCTION_DECL)
246 TREE_READONLY (*node) = 1;
247 else if (TREE_CODE (type) == POINTER_TYPE
248 && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
249 TREE_TYPE (*node)
250 = build_pointer_type
251 (build_type_variant (TREE_TYPE (type), 1,
252 TREE_THIS_VOLATILE (TREE_TYPE (type))));
253 else
254 gcc_unreachable ();
256 return NULL_TREE;
260 /* Handle a "malloc" attribute; arguments as in
261 struct attribute_spec.handler. */
263 static tree
264 handle_malloc_attribute (tree *node, tree ARG_UNUSED (name),
265 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
266 bool * ARG_UNUSED (no_add_attrs))
268 if (TREE_CODE (*node) == FUNCTION_DECL
269 && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (*node))))
270 DECL_IS_MALLOC (*node) = 1;
271 else
272 gcc_unreachable ();
274 return NULL_TREE;
278 /* Handle a "pure" attribute; arguments as in
279 struct attribute_spec.handler. */
281 static tree
282 handle_pure_attribute (tree *node, tree ARG_UNUSED (name),
283 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
284 bool * ARG_UNUSED (no_add_attrs))
286 if (TREE_CODE (*node) == FUNCTION_DECL)
287 DECL_PURE_P (*node) = 1;
288 else
289 gcc_unreachable ();
291 return NULL_TREE;
295 /* Handle a "no vops" attribute; arguments as in
296 struct attribute_spec.handler. */
298 static tree
299 handle_novops_attribute (tree *node, tree ARG_UNUSED (name),
300 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
301 bool *ARG_UNUSED (no_add_attrs))
303 gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
304 DECL_IS_NOVOPS (*node) = 1;
305 return NULL_TREE;
309 /* Helper for nonnull attribute handling; fetch the operand number
310 from the attribute argument list. */
312 static bool
313 get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp)
315 /* Verify the arg number is a constant. */
316 if (TREE_CODE (arg_num_expr) != INTEGER_CST
317 || TREE_INT_CST_HIGH (arg_num_expr) != 0)
318 return false;
320 *valp = TREE_INT_CST_LOW (arg_num_expr);
321 return true;
324 /* Handle the "nonnull" attribute. */
326 static tree
327 handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
328 tree args, int ARG_UNUSED (flags),
329 bool * ARG_UNUSED (no_add_attrs))
331 tree type = *node;
333 /* If no arguments are specified, all pointer arguments should be
334 non-null. Verify a full prototype is given so that the arguments
335 will have the correct types when we actually check them later. */
336 if (!args)
338 gcc_assert (prototype_p (type));
339 return NULL_TREE;
342 /* Argument list specified. Verify that each argument number references
343 a pointer argument. */
344 for (; args; args = TREE_CHAIN (args))
346 tree argument;
347 unsigned HOST_WIDE_INT arg_num = 0, ck_num;
349 if (!get_nonnull_operand (TREE_VALUE (args), &arg_num))
350 gcc_unreachable ();
352 argument = TYPE_ARG_TYPES (type);
353 if (argument)
355 for (ck_num = 1; ; ck_num++)
357 if (!argument || ck_num == arg_num)
358 break;
359 argument = TREE_CHAIN (argument);
362 gcc_assert (argument
363 && TREE_CODE (TREE_VALUE (argument)) == POINTER_TYPE);
367 return NULL_TREE;
371 /* Handle a "nothrow" attribute; arguments as in
372 struct attribute_spec.handler. */
374 static tree
375 handle_nothrow_attribute (tree *node, tree ARG_UNUSED (name),
376 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
377 bool * ARG_UNUSED (no_add_attrs))
379 if (TREE_CODE (*node) == FUNCTION_DECL)
380 TREE_NOTHROW (*node) = 1;
381 else
382 gcc_unreachable ();
384 return NULL_TREE;
388 /* Handle a "sentinel" attribute. */
390 static tree
391 handle_sentinel_attribute (tree *node, tree ARG_UNUSED (name), tree args,
392 int ARG_UNUSED (flags),
393 bool * ARG_UNUSED (no_add_attrs))
395 gcc_assert (stdarg_p (*node));
397 if (args)
399 tree position = TREE_VALUE (args);
400 gcc_assert (TREE_CODE (position) == INTEGER_CST);
401 if (tree_int_cst_lt (position, integer_zero_node))
402 gcc_unreachable ();
405 return NULL_TREE;
408 /* Handle a "type_generic" attribute. */
410 static tree
411 handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
412 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
413 bool * ARG_UNUSED (no_add_attrs))
415 /* Ensure we have a function type. */
416 gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
418 /* Ensure we have a variadic function. */
419 gcc_assert (!prototype_p (*node) || stdarg_p (*node));
421 return NULL_TREE;
424 /* Handle a "transaction_pure" attribute. */
426 static tree
427 handle_transaction_pure_attribute (tree *node, tree ARG_UNUSED (name),
428 tree ARG_UNUSED (args),
429 int ARG_UNUSED (flags),
430 bool * ARG_UNUSED (no_add_attrs))
432 /* Ensure we have a function type. */
433 gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
435 return NULL_TREE;
438 /* Handle a "returns_twice" attribute. */
440 static tree
441 handle_returns_twice_attribute (tree *node, tree ARG_UNUSED (name),
442 tree ARG_UNUSED (args),
443 int ARG_UNUSED (flags),
444 bool * ARG_UNUSED (no_add_attrs))
446 gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
448 DECL_IS_RETURNS_TWICE (*node) = 1;
450 return NULL_TREE;
453 /* Ignore the given attribute. Used when this attribute may be usefully
454 overridden by the target, but is not used generically. */
456 static tree
457 ignore_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
458 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
459 bool *no_add_attrs)
461 *no_add_attrs = true;
462 return NULL_TREE;
465 /* Handle a "format" attribute; arguments as in
466 struct attribute_spec.handler. */
468 static tree
469 handle_format_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
470 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
471 bool *no_add_attrs)
473 *no_add_attrs = true;
474 return NULL_TREE;
478 /* Handle a "format_arg" attribute; arguments as in
479 struct attribute_spec.handler. */
481 tree
482 handle_format_arg_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
483 tree ARG_UNUSED (args), int ARG_UNUSED (flags),
484 bool *no_add_attrs)
486 *no_add_attrs = true;
487 return NULL_TREE;
491 /* Handle a "fn spec" attribute; arguments as in
492 struct attribute_spec.handler. */
494 static tree
495 handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name),
496 tree args, int ARG_UNUSED (flags),
497 bool *no_add_attrs ATTRIBUTE_UNUSED)
499 gcc_assert (args
500 && TREE_CODE (TREE_VALUE (args)) == STRING_CST
501 && !TREE_CHAIN (args));
502 return NULL_TREE;
505 /* Cribbed from c-common.c. */
507 static void
508 def_fn_type (builtin_type def, builtin_type ret, bool var, int n, ...)
510 tree t;
511 tree *args = XALLOCAVEC (tree, n);
512 va_list list;
513 int i;
515 va_start (list, n);
516 for (i = 0; i < n; ++i)
518 builtin_type a = (builtin_type) va_arg (list, int);
519 t = builtin_types[a];
520 if (t == error_mark_node)
521 goto egress;
522 args[i] = t;
524 va_end (list);
526 t = builtin_types[ret];
527 if (t == error_mark_node)
528 goto egress;
529 if (var)
530 t = build_varargs_function_type_array (t, n, args);
531 else
532 t = build_function_type_array (t, n, args);
534 egress:
535 builtin_types[def] = t;
536 va_end (list);
539 /* Used to help initialize the builtin-types.def table. When a type of
540 the correct size doesn't exist, use error_mark_node instead of NULL.
541 The later results in segfaults even when a decl using the type doesn't
542 get invoked. */
544 static tree
545 builtin_type_for_size (int size, bool unsignedp)
547 tree type = lto_type_for_size (size, unsignedp);
548 return type ? type : error_mark_node;
551 /* Support for DEF_BUILTIN. */
553 static void
554 def_builtin_1 (enum built_in_function fncode, const char *name,
555 enum built_in_class fnclass, tree fntype, tree libtype,
556 bool both_p, bool fallback_p, bool nonansi_p,
557 tree fnattrs, bool implicit_p)
559 tree decl;
560 const char *libname;
562 if (fntype == error_mark_node)
563 return;
565 libname = name + strlen ("__builtin_");
566 decl = add_builtin_function (name, fntype, fncode, fnclass,
567 (fallback_p ? libname : NULL),
568 fnattrs);
570 if (both_p
571 && !flag_no_builtin
572 && !(nonansi_p && flag_no_nonansi_builtin))
573 add_builtin_function (libname, libtype, fncode, fnclass,
574 NULL, fnattrs);
576 set_builtin_decl (fncode, decl, implicit_p);
580 /* Initialize the attribute table for all the supported builtins. */
582 static void
583 lto_init_attributes (void)
585 /* Fill in the built_in_attributes array. */
586 #define DEF_ATTR_NULL_TREE(ENUM) \
587 built_in_attributes[(int) ENUM] = NULL_TREE;
588 #define DEF_ATTR_INT(ENUM, VALUE) \
589 built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE);
590 #define DEF_ATTR_STRING(ENUM, VALUE) \
591 built_in_attributes[(int) ENUM] = build_string (strlen (VALUE), VALUE);
592 #define DEF_ATTR_IDENT(ENUM, STRING) \
593 built_in_attributes[(int) ENUM] = get_identifier (STRING);
594 #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) \
595 built_in_attributes[(int) ENUM] \
596 = tree_cons (built_in_attributes[(int) PURPOSE], \
597 built_in_attributes[(int) VALUE], \
598 built_in_attributes[(int) CHAIN]);
599 #include "builtin-attrs.def"
600 #undef DEF_ATTR_NULL_TREE
601 #undef DEF_ATTR_INT
602 #undef DEF_ATTR_STRING
603 #undef DEF_ATTR_IDENT
604 #undef DEF_ATTR_TREE_LIST
607 /* Create builtin types and functions. VA_LIST_REF_TYPE_NODE and
608 VA_LIST_ARG_TYPE_NODE are used in builtin-types.def. */
610 static void
611 lto_define_builtins (tree va_list_ref_type_node ATTRIBUTE_UNUSED,
612 tree va_list_arg_type_node ATTRIBUTE_UNUSED)
614 #define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
615 builtin_types[ENUM] = VALUE;
616 #define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \
617 def_fn_type (ENUM, RETURN, 0, 0);
618 #define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1) \
619 def_fn_type (ENUM, RETURN, 0, 1, ARG1);
620 #define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \
621 def_fn_type (ENUM, RETURN, 0, 2, ARG1, ARG2);
622 #define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
623 def_fn_type (ENUM, RETURN, 0, 3, ARG1, ARG2, ARG3);
624 #define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
625 def_fn_type (ENUM, RETURN, 0, 4, ARG1, ARG2, ARG3, ARG4);
626 #define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
627 def_fn_type (ENUM, RETURN, 0, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
628 #define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
629 ARG6) \
630 def_fn_type (ENUM, RETURN, 0, 6, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
631 #define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
632 ARG6, ARG7) \
633 def_fn_type (ENUM, RETURN, 0, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7);
634 #define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \
635 def_fn_type (ENUM, RETURN, 1, 0);
636 #define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \
637 def_fn_type (ENUM, RETURN, 1, 1, ARG1);
638 #define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2) \
639 def_fn_type (ENUM, RETURN, 1, 2, ARG1, ARG2);
640 #define DEF_FUNCTION_TYPE_VAR_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
641 def_fn_type (ENUM, RETURN, 1, 3, ARG1, ARG2, ARG3);
642 #define DEF_FUNCTION_TYPE_VAR_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
643 def_fn_type (ENUM, RETURN, 1, 4, ARG1, ARG2, ARG3, ARG4);
644 #define DEF_FUNCTION_TYPE_VAR_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
645 def_fn_type (ENUM, RETURN, 1, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
646 #define DEF_POINTER_TYPE(ENUM, TYPE) \
647 builtin_types[(int) ENUM] = build_pointer_type (builtin_types[(int) TYPE]);
649 #include "builtin-types.def"
651 #undef DEF_PRIMITIVE_TYPE
652 #undef DEF_FUNCTION_TYPE_1
653 #undef DEF_FUNCTION_TYPE_2
654 #undef DEF_FUNCTION_TYPE_3
655 #undef DEF_FUNCTION_TYPE_4
656 #undef DEF_FUNCTION_TYPE_5
657 #undef DEF_FUNCTION_TYPE_6
658 #undef DEF_FUNCTION_TYPE_VAR_0
659 #undef DEF_FUNCTION_TYPE_VAR_1
660 #undef DEF_FUNCTION_TYPE_VAR_2
661 #undef DEF_FUNCTION_TYPE_VAR_3
662 #undef DEF_FUNCTION_TYPE_VAR_4
663 #undef DEF_FUNCTION_TYPE_VAR_5
664 #undef DEF_POINTER_TYPE
665 builtin_types[(int) BT_LAST] = NULL_TREE;
667 lto_init_attributes ();
669 #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, FALLBACK_P,\
670 NONANSI_P, ATTRS, IMPLICIT, COND) \
671 if (NAME && COND) \
672 def_builtin_1 (ENUM, NAME, CLASS, builtin_types[(int) TYPE], \
673 builtin_types[(int) LIBTYPE], BOTH_P, FALLBACK_P, \
674 NONANSI_P, built_in_attributes[(int) ATTRS], IMPLICIT);
675 #include "builtins.def"
676 #undef DEF_BUILTIN
679 static GTY(()) tree registered_builtin_types;
681 /* Language hooks. */
683 static unsigned int
684 lto_option_lang_mask (void)
686 return CL_LTO;
689 static bool
690 lto_complain_wrong_lang_p (const struct cl_option *option ATTRIBUTE_UNUSED)
692 /* The LTO front end inherits all the options from the first front
693 end that was used. However, not all the original front end
694 options make sense in LTO.
696 A real solution would be to filter this in collect2, but collect2
697 does not have access to all the option attributes to know what to
698 filter. So, in lto1 we silently accept inherited flags and do
699 nothing about it. */
700 return false;
703 static void
704 lto_init_options_struct (struct gcc_options *opts)
706 /* By default, C99-like requirements for complex multiply and divide.
707 ??? Until the complex method is encoded in the IL this is the only
708 safe choice. This will pessimize Fortran code with LTO unless
709 people specify a complex method manually or use -ffast-math. */
710 opts->x_flag_complex_method = 2;
713 /* Handle command-line option SCODE. If the option takes an argument, it is
714 stored in ARG, which is otherwise NULL. VALUE holds either a numerical
715 argument or a binary value indicating whether the positive or negative form
716 of the option was supplied. */
718 const char *resolution_file_name;
719 static bool
720 lto_handle_option (size_t scode, const char *arg,
721 int value ATTRIBUTE_UNUSED, int kind ATTRIBUTE_UNUSED,
722 location_t loc ATTRIBUTE_UNUSED,
723 const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
725 enum opt_code code = (enum opt_code) scode;
726 bool result = true;
728 switch (code)
730 case OPT_fresolution_:
731 resolution_file_name = arg;
732 break;
734 case OPT_Wabi:
735 warn_psabi = value;
736 break;
738 default:
739 break;
742 return result;
745 /* Perform post-option processing. Does additional initialization based on
746 command-line options. PFILENAME is the main input filename. Returns false
747 to enable subsequent back-end initialization. */
749 static bool
750 lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
752 /* -fltrans and -fwpa are mutually exclusive. Check for that here. */
753 if (flag_wpa && flag_ltrans)
754 error ("-fwpa and -fltrans are mutually exclusive");
756 if (flag_ltrans)
758 flag_generate_lto = 0;
760 /* During LTRANS, we are not looking at the whole program, only
761 a subset of the whole callgraph. */
762 flag_whole_program = 0;
765 if (flag_wpa)
766 flag_generate_lto = 1;
768 /* Excess precision other than "fast" requires front-end
769 support. */
770 flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
772 /* Initialize the compiler back end. */
773 return false;
776 /* Return an integer type with PRECISION bits of precision,
777 that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */
779 static tree
780 lto_type_for_size (unsigned precision, int unsignedp)
782 if (precision == TYPE_PRECISION (integer_type_node))
783 return unsignedp ? unsigned_type_node : integer_type_node;
785 if (precision == TYPE_PRECISION (signed_char_type_node))
786 return unsignedp ? unsigned_char_type_node : signed_char_type_node;
788 if (precision == TYPE_PRECISION (short_integer_type_node))
789 return unsignedp ? short_unsigned_type_node : short_integer_type_node;
791 if (precision == TYPE_PRECISION (long_integer_type_node))
792 return unsignedp ? long_unsigned_type_node : long_integer_type_node;
794 if (precision == TYPE_PRECISION (long_long_integer_type_node))
795 return unsignedp
796 ? long_long_unsigned_type_node
797 : long_long_integer_type_node;
799 if (precision <= TYPE_PRECISION (intQI_type_node))
800 return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
802 if (precision <= TYPE_PRECISION (intHI_type_node))
803 return unsignedp ? unsigned_intHI_type_node : intHI_type_node;
805 if (precision <= TYPE_PRECISION (intSI_type_node))
806 return unsignedp ? unsigned_intSI_type_node : intSI_type_node;
808 if (precision <= TYPE_PRECISION (intDI_type_node))
809 return unsignedp ? unsigned_intDI_type_node : intDI_type_node;
811 if (precision <= TYPE_PRECISION (intTI_type_node))
812 return unsignedp ? unsigned_intTI_type_node : intTI_type_node;
814 return NULL_TREE;
818 /* Return a data type that has machine mode MODE.
819 If the mode is an integer,
820 then UNSIGNEDP selects between signed and unsigned types.
821 If the mode is a fixed-point mode,
822 then UNSIGNEDP selects between saturating and nonsaturating types. */
824 static tree
825 lto_type_for_mode (enum machine_mode mode, int unsigned_p)
827 tree t;
829 if (mode == TYPE_MODE (integer_type_node))
830 return unsigned_p ? unsigned_type_node : integer_type_node;
832 if (mode == TYPE_MODE (signed_char_type_node))
833 return unsigned_p ? unsigned_char_type_node : signed_char_type_node;
835 if (mode == TYPE_MODE (short_integer_type_node))
836 return unsigned_p ? short_unsigned_type_node : short_integer_type_node;
838 if (mode == TYPE_MODE (long_integer_type_node))
839 return unsigned_p ? long_unsigned_type_node : long_integer_type_node;
841 if (mode == TYPE_MODE (long_long_integer_type_node))
842 return unsigned_p ? long_long_unsigned_type_node : long_long_integer_type_node;
844 if (mode == QImode)
845 return unsigned_p ? unsigned_intQI_type_node : intQI_type_node;
847 if (mode == HImode)
848 return unsigned_p ? unsigned_intHI_type_node : intHI_type_node;
850 if (mode == SImode)
851 return unsigned_p ? unsigned_intSI_type_node : intSI_type_node;
853 if (mode == DImode)
854 return unsigned_p ? unsigned_intDI_type_node : intDI_type_node;
856 #if HOST_BITS_PER_WIDE_INT >= 64
857 if (mode == TYPE_MODE (intTI_type_node))
858 return unsigned_p ? unsigned_intTI_type_node : intTI_type_node;
859 #endif
861 if (mode == TYPE_MODE (float_type_node))
862 return float_type_node;
864 if (mode == TYPE_MODE (double_type_node))
865 return double_type_node;
867 if (mode == TYPE_MODE (long_double_type_node))
868 return long_double_type_node;
870 if (mode == TYPE_MODE (void_type_node))
871 return void_type_node;
873 if (mode == TYPE_MODE (build_pointer_type (char_type_node)))
874 return (unsigned_p
875 ? make_unsigned_type (GET_MODE_PRECISION (mode))
876 : make_signed_type (GET_MODE_PRECISION (mode)));
878 if (mode == TYPE_MODE (build_pointer_type (integer_type_node)))
879 return (unsigned_p
880 ? make_unsigned_type (GET_MODE_PRECISION (mode))
881 : make_signed_type (GET_MODE_PRECISION (mode)));
883 if (COMPLEX_MODE_P (mode))
885 enum machine_mode inner_mode;
886 tree inner_type;
888 if (mode == TYPE_MODE (complex_float_type_node))
889 return complex_float_type_node;
890 if (mode == TYPE_MODE (complex_double_type_node))
891 return complex_double_type_node;
892 if (mode == TYPE_MODE (complex_long_double_type_node))
893 return complex_long_double_type_node;
895 if (mode == TYPE_MODE (complex_integer_type_node) && !unsigned_p)
896 return complex_integer_type_node;
898 inner_mode = GET_MODE_INNER (mode);
899 inner_type = lto_type_for_mode (inner_mode, unsigned_p);
900 if (inner_type != NULL_TREE)
901 return build_complex_type (inner_type);
903 else if (VECTOR_MODE_P (mode))
905 enum machine_mode inner_mode = GET_MODE_INNER (mode);
906 tree inner_type = lto_type_for_mode (inner_mode, unsigned_p);
907 if (inner_type != NULL_TREE)
908 return build_vector_type_for_mode (inner_type, mode);
911 if (mode == TYPE_MODE (dfloat32_type_node))
912 return dfloat32_type_node;
913 if (mode == TYPE_MODE (dfloat64_type_node))
914 return dfloat64_type_node;
915 if (mode == TYPE_MODE (dfloat128_type_node))
916 return dfloat128_type_node;
918 if (ALL_SCALAR_FIXED_POINT_MODE_P (mode))
920 if (mode == TYPE_MODE (short_fract_type_node))
921 return unsigned_p ? sat_short_fract_type_node : short_fract_type_node;
922 if (mode == TYPE_MODE (fract_type_node))
923 return unsigned_p ? sat_fract_type_node : fract_type_node;
924 if (mode == TYPE_MODE (long_fract_type_node))
925 return unsigned_p ? sat_long_fract_type_node : long_fract_type_node;
926 if (mode == TYPE_MODE (long_long_fract_type_node))
927 return unsigned_p ? sat_long_long_fract_type_node
928 : long_long_fract_type_node;
930 if (mode == TYPE_MODE (unsigned_short_fract_type_node))
931 return unsigned_p ? sat_unsigned_short_fract_type_node
932 : unsigned_short_fract_type_node;
933 if (mode == TYPE_MODE (unsigned_fract_type_node))
934 return unsigned_p ? sat_unsigned_fract_type_node
935 : unsigned_fract_type_node;
936 if (mode == TYPE_MODE (unsigned_long_fract_type_node))
937 return unsigned_p ? sat_unsigned_long_fract_type_node
938 : unsigned_long_fract_type_node;
939 if (mode == TYPE_MODE (unsigned_long_long_fract_type_node))
940 return unsigned_p ? sat_unsigned_long_long_fract_type_node
941 : unsigned_long_long_fract_type_node;
943 if (mode == TYPE_MODE (short_accum_type_node))
944 return unsigned_p ? sat_short_accum_type_node : short_accum_type_node;
945 if (mode == TYPE_MODE (accum_type_node))
946 return unsigned_p ? sat_accum_type_node : accum_type_node;
947 if (mode == TYPE_MODE (long_accum_type_node))
948 return unsigned_p ? sat_long_accum_type_node : long_accum_type_node;
949 if (mode == TYPE_MODE (long_long_accum_type_node))
950 return unsigned_p ? sat_long_long_accum_type_node
951 : long_long_accum_type_node;
953 if (mode == TYPE_MODE (unsigned_short_accum_type_node))
954 return unsigned_p ? sat_unsigned_short_accum_type_node
955 : unsigned_short_accum_type_node;
956 if (mode == TYPE_MODE (unsigned_accum_type_node))
957 return unsigned_p ? sat_unsigned_accum_type_node
958 : unsigned_accum_type_node;
959 if (mode == TYPE_MODE (unsigned_long_accum_type_node))
960 return unsigned_p ? sat_unsigned_long_accum_type_node
961 : unsigned_long_accum_type_node;
962 if (mode == TYPE_MODE (unsigned_long_long_accum_type_node))
963 return unsigned_p ? sat_unsigned_long_long_accum_type_node
964 : unsigned_long_long_accum_type_node;
966 if (mode == QQmode)
967 return unsigned_p ? sat_qq_type_node : qq_type_node;
968 if (mode == HQmode)
969 return unsigned_p ? sat_hq_type_node : hq_type_node;
970 if (mode == SQmode)
971 return unsigned_p ? sat_sq_type_node : sq_type_node;
972 if (mode == DQmode)
973 return unsigned_p ? sat_dq_type_node : dq_type_node;
974 if (mode == TQmode)
975 return unsigned_p ? sat_tq_type_node : tq_type_node;
977 if (mode == UQQmode)
978 return unsigned_p ? sat_uqq_type_node : uqq_type_node;
979 if (mode == UHQmode)
980 return unsigned_p ? sat_uhq_type_node : uhq_type_node;
981 if (mode == USQmode)
982 return unsigned_p ? sat_usq_type_node : usq_type_node;
983 if (mode == UDQmode)
984 return unsigned_p ? sat_udq_type_node : udq_type_node;
985 if (mode == UTQmode)
986 return unsigned_p ? sat_utq_type_node : utq_type_node;
988 if (mode == HAmode)
989 return unsigned_p ? sat_ha_type_node : ha_type_node;
990 if (mode == SAmode)
991 return unsigned_p ? sat_sa_type_node : sa_type_node;
992 if (mode == DAmode)
993 return unsigned_p ? sat_da_type_node : da_type_node;
994 if (mode == TAmode)
995 return unsigned_p ? sat_ta_type_node : ta_type_node;
997 if (mode == UHAmode)
998 return unsigned_p ? sat_uha_type_node : uha_type_node;
999 if (mode == USAmode)
1000 return unsigned_p ? sat_usa_type_node : usa_type_node;
1001 if (mode == UDAmode)
1002 return unsigned_p ? sat_uda_type_node : uda_type_node;
1003 if (mode == UTAmode)
1004 return unsigned_p ? sat_uta_type_node : uta_type_node;
1007 for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
1008 if (TYPE_MODE (TREE_VALUE (t)) == mode)
1009 return TREE_VALUE (t);
1011 return NULL_TREE;
1014 /* Return true if we are in the global binding level. */
1016 static bool
1017 lto_global_bindings_p (void)
1019 return cfun == NULL;
1022 static void
1023 lto_set_decl_assembler_name (tree decl)
1025 /* This is almost the same as lhd_set_decl_assembler_name, except that
1026 we need to uniquify file-scope names, even if they are not
1027 TREE_PUBLIC, to avoid conflicts between individual files. */
1028 tree id;
1030 if (TREE_PUBLIC (decl))
1031 id = targetm.mangle_decl_assembler_name (decl, DECL_NAME (decl));
1032 else
1034 const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
1035 char *label;
1037 ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl));
1038 id = get_identifier (label);
1041 SET_DECL_ASSEMBLER_NAME (decl, id);
1044 static tree
1045 lto_pushdecl (tree t ATTRIBUTE_UNUSED)
1047 /* Do nothing, since we get all information from DWARF and LTO
1048 sections. */
1049 return NULL_TREE;
1052 static tree
1053 lto_getdecls (void)
1055 /* We have our own write_globals langhook, hence the getdecls
1056 langhook shouldn't be used, except by dbxout.c, so we can't
1057 just abort here. */
1058 return NULL_TREE;
1061 static void
1062 lto_write_globals (void)
1064 tree *vec = lto_global_var_decls->address ();
1065 int len = lto_global_var_decls->length ();
1066 wrapup_global_declarations (vec, len);
1067 emit_debug_global_declarations (vec, len);
1068 vec_free (lto_global_var_decls);
1071 static tree
1072 lto_builtin_function (tree decl)
1074 return decl;
1077 static void
1078 lto_register_builtin_type (tree type, const char *name)
1080 tree decl;
1082 if (!TYPE_NAME (type))
1084 decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL,
1085 get_identifier (name), type);
1086 DECL_ARTIFICIAL (decl) = 1;
1087 TYPE_NAME (type) = decl;
1090 registered_builtin_types = tree_cons (0, type, registered_builtin_types);
1093 /* Build nodes that would have be created by the C front-end; necessary
1094 for including builtin-types.def and ultimately builtins.def. */
1096 static void
1097 lto_build_c_type_nodes (void)
1099 gcc_assert (void_type_node);
1101 void_list_node = build_tree_list (NULL_TREE, void_type_node);
1102 string_type_node = build_pointer_type (char_type_node);
1103 const_string_type_node
1104 = build_pointer_type (build_qualified_type (char_type_node, TYPE_QUAL_CONST));
1106 if (strcmp (SIZE_TYPE, "unsigned int") == 0)
1108 intmax_type_node = integer_type_node;
1109 uintmax_type_node = unsigned_type_node;
1110 signed_size_type_node = integer_type_node;
1112 else if (strcmp (SIZE_TYPE, "long unsigned int") == 0)
1114 intmax_type_node = long_integer_type_node;
1115 uintmax_type_node = long_unsigned_type_node;
1116 signed_size_type_node = long_integer_type_node;
1118 else if (strcmp (SIZE_TYPE, "long long unsigned int") == 0)
1120 intmax_type_node = long_long_integer_type_node;
1121 uintmax_type_node = long_long_unsigned_type_node;
1122 signed_size_type_node = long_long_integer_type_node;
1124 else
1125 gcc_unreachable ();
1127 wint_type_node = unsigned_type_node;
1128 pid_type_node = integer_type_node;
1131 /* Re-compute TYPE_CANONICAL for NODE and related types. */
1133 static void
1134 lto_register_canonical_types (tree node)
1136 if (!node
1137 || !TYPE_P (node))
1138 return;
1140 TYPE_CANONICAL (node) = NULL_TREE;
1141 TYPE_CANONICAL (node) = gimple_register_canonical_type (node);
1143 if (POINTER_TYPE_P (node)
1144 || TREE_CODE (node) == COMPLEX_TYPE
1145 || TREE_CODE (node) == ARRAY_TYPE)
1146 lto_register_canonical_types (TREE_TYPE (node));
1149 /* Perform LTO-specific initialization. */
1151 static bool
1152 lto_init (void)
1154 unsigned i;
1156 /* We need to generate LTO if running in WPA mode. */
1157 flag_generate_lto = flag_wpa;
1159 /* Create the basic integer types. */
1160 build_common_tree_nodes (flag_signed_char, /*short_double=*/false);
1162 /* The global tree for the main identifier is filled in by
1163 language-specific front-end initialization that is not run in the
1164 LTO back-end. It appears that all languages that perform such
1165 initialization currently do so in the same way, so we do it here. */
1166 if (main_identifier_node == NULL_TREE)
1167 main_identifier_node = get_identifier ("main");
1169 /* In the C++ front-end, fileptr_type_node is defined as a variant
1170 copy of of ptr_type_node, rather than ptr_node itself. The
1171 distinction should only be relevant to the front-end, so we
1172 always use the C definition here in lto1. */
1173 gcc_assert (fileptr_type_node == ptr_type_node);
1174 gcc_assert (TYPE_MAIN_VARIANT (fileptr_type_node) == ptr_type_node);
1176 ptrdiff_type_node = integer_type_node;
1178 lto_build_c_type_nodes ();
1179 gcc_assert (va_list_type_node);
1181 if (TREE_CODE (va_list_type_node) == ARRAY_TYPE)
1183 tree x = build_pointer_type (TREE_TYPE (va_list_type_node));
1184 lto_define_builtins (x, x);
1186 else
1188 lto_define_builtins (va_list_type_node,
1189 build_reference_type (va_list_type_node));
1192 targetm.init_builtins ();
1193 build_common_builtin_nodes ();
1195 /* Assign names to the builtin types, otherwise they'll end up
1196 as __unknown__ in debug info.
1197 ??? We simply need to stop pre-seeding the streamer cache.
1198 Below is modeled after from c-common.c:c_common_nodes_and_builtins */
1199 #define NAME_TYPE(t,n) \
1200 if (t) \
1201 TYPE_NAME (t) = build_decl (UNKNOWN_LOCATION, TYPE_DECL, \
1202 get_identifier (n), t)
1203 NAME_TYPE (integer_type_node, "int");
1204 NAME_TYPE (char_type_node, "char");
1205 NAME_TYPE (long_integer_type_node, "long int");
1206 NAME_TYPE (unsigned_type_node, "unsigned int");
1207 NAME_TYPE (long_unsigned_type_node, "long unsigned int");
1208 NAME_TYPE (long_long_integer_type_node, "long long int");
1209 NAME_TYPE (long_long_unsigned_type_node, "long long unsigned int");
1210 NAME_TYPE (short_integer_type_node, "short int");
1211 NAME_TYPE (short_unsigned_type_node, "short unsigned int");
1212 if (signed_char_type_node != char_type_node)
1213 NAME_TYPE (signed_char_type_node, "signed char");
1214 if (unsigned_char_type_node != char_type_node)
1215 NAME_TYPE (unsigned_char_type_node, "unsigned char");
1216 NAME_TYPE (float_type_node, "float");
1217 NAME_TYPE (double_type_node, "double");
1218 NAME_TYPE (long_double_type_node, "long double");
1219 NAME_TYPE (void_type_node, "void");
1220 NAME_TYPE (boolean_type_node, "bool");
1221 #undef NAME_TYPE
1223 /* Register the common node types with the canonical type machinery so
1224 we properly share alias-sets across languages and TUs. Do not
1225 expose the common nodes as type merge target - those that should be
1226 are already exposed so by pre-loading the LTO streamer caches. */
1227 for (i = 0; i < itk_none; ++i)
1228 lto_register_canonical_types (integer_types[i]);
1229 /* The sizetypes are not used to access data so we do not need to
1230 do anything about them. */
1231 for (i = 0; i < TI_MAX; ++i)
1232 lto_register_canonical_types (global_trees[i]);
1234 /* Initialize LTO-specific data structures. */
1235 vec_alloc (lto_global_var_decls, 256);
1236 in_lto_p = true;
1238 return true;
1241 /* Initialize tree structures required by the LTO front end. */
1243 static void lto_init_ts (void)
1245 tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
1248 #undef LANG_HOOKS_NAME
1249 #define LANG_HOOKS_NAME "GNU GIMPLE"
1250 #undef LANG_HOOKS_OPTION_LANG_MASK
1251 #define LANG_HOOKS_OPTION_LANG_MASK lto_option_lang_mask
1252 #undef LANG_HOOKS_COMPLAIN_WRONG_LANG_P
1253 #define LANG_HOOKS_COMPLAIN_WRONG_LANG_P lto_complain_wrong_lang_p
1254 #undef LANG_HOOKS_INIT_OPTIONS_STRUCT
1255 #define LANG_HOOKS_INIT_OPTIONS_STRUCT lto_init_options_struct
1256 #undef LANG_HOOKS_HANDLE_OPTION
1257 #define LANG_HOOKS_HANDLE_OPTION lto_handle_option
1258 #undef LANG_HOOKS_POST_OPTIONS
1259 #define LANG_HOOKS_POST_OPTIONS lto_post_options
1260 #undef LANG_HOOKS_GET_ALIAS_SET
1261 #define LANG_HOOKS_GET_ALIAS_SET gimple_get_alias_set
1262 #undef LANG_HOOKS_TYPE_FOR_MODE
1263 #define LANG_HOOKS_TYPE_FOR_MODE lto_type_for_mode
1264 #undef LANG_HOOKS_TYPE_FOR_SIZE
1265 #define LANG_HOOKS_TYPE_FOR_SIZE lto_type_for_size
1266 #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
1267 #define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lto_set_decl_assembler_name
1268 #undef LANG_HOOKS_GLOBAL_BINDINGS_P
1269 #define LANG_HOOKS_GLOBAL_BINDINGS_P lto_global_bindings_p
1270 #undef LANG_HOOKS_PUSHDECL
1271 #define LANG_HOOKS_PUSHDECL lto_pushdecl
1272 #undef LANG_HOOKS_GETDECLS
1273 #define LANG_HOOKS_GETDECLS lto_getdecls
1274 #undef LANG_HOOKS_WRITE_GLOBALS
1275 #define LANG_HOOKS_WRITE_GLOBALS lto_write_globals
1276 #undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
1277 #define LANG_HOOKS_REGISTER_BUILTIN_TYPE lto_register_builtin_type
1278 #undef LANG_HOOKS_BUILTIN_FUNCTION
1279 #define LANG_HOOKS_BUILTIN_FUNCTION lto_builtin_function
1280 #undef LANG_HOOKS_INIT
1281 #define LANG_HOOKS_INIT lto_init
1282 #undef LANG_HOOKS_PARSE_FILE
1283 #define LANG_HOOKS_PARSE_FILE lto_main
1284 #undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
1285 #define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
1286 #undef LANG_HOOKS_TYPES_COMPATIBLE_P
1287 #define LANG_HOOKS_TYPES_COMPATIBLE_P NULL
1288 #undef LANG_HOOKS_EH_PERSONALITY
1289 #define LANG_HOOKS_EH_PERSONALITY lto_eh_personality
1291 /* Attribute hooks. */
1292 #undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
1293 #define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE lto_attribute_table
1294 #undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
1295 #define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE lto_format_attribute_table
1297 #undef LANG_HOOKS_BEGIN_SECTION
1298 #define LANG_HOOKS_BEGIN_SECTION lto_obj_begin_section
1299 #undef LANG_HOOKS_APPEND_DATA
1300 #define LANG_HOOKS_APPEND_DATA lto_obj_append_data
1301 #undef LANG_HOOKS_END_SECTION
1302 #define LANG_HOOKS_END_SECTION lto_obj_end_section
1304 #undef LANG_HOOKS_INIT_TS
1305 #define LANG_HOOKS_INIT_TS lto_init_ts
1307 struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
1309 /* Language hooks that are not part of lang_hooks. */
1311 tree
1312 convert (tree type ATTRIBUTE_UNUSED, tree expr ATTRIBUTE_UNUSED)
1314 gcc_unreachable ();
1317 /* Tree walking support. */
1319 static enum lto_tree_node_structure_enum
1320 lto_tree_node_structure (union lang_tree_node *t ATTRIBUTE_UNUSED)
1322 return TS_LTO_GENERIC;
1325 #include "ggc.h"
1326 #include "gtype-lto.h"
1327 #include "gt-lto-lto-lang.h"