OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [lto/] [lto-lang.c] - Blame information for rev 318

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 288 jeremybenn
/* Language-dependent hooks for LTO.
2
   Copyright 2009 Free Software Foundation, Inc.
3
   Contributed by CodeSourcery, Inc.
4
 
5
This file is part of GCC.
6
 
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.
11
 
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.
16
 
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/>.  */
20
 
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 "expr.h"
28
#include "target.h"
29
#include "langhooks.h"
30
#include "langhooks-def.h"
31
#include "debug.h"
32
#include "lto-tree.h"
33
#include "lto.h"
34
#include "tree-inline.h"
35
#include "gimple.h"
36
#include "toplev.h"
37
 
38
static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
39
static tree handle_const_attribute (tree *, tree, tree, int, bool *);
40
static tree handle_malloc_attribute (tree *, tree, tree, int, bool *);
41
static tree handle_pure_attribute (tree *, tree, tree, int, bool *);
42
static tree handle_novops_attribute (tree *, tree, tree, int, bool *);
43
static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
44
static tree handle_nothrow_attribute (tree *, tree, tree, int, bool *);
45
static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *);
46
static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
47
static tree handle_format_attribute (tree *, tree, tree, int, bool *);
48
static tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
49
 
50
/* Table of machine-independent attributes supported in GIMPLE.  */
51
const struct attribute_spec lto_attribute_table[] =
52
{
53
  /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
54
  { "noreturn",               0, 0, true,  false, false,
55
                              handle_noreturn_attribute },
56
  /* The same comments as for noreturn attributes apply to const ones.  */
57
  { "const",                  0, 0, true,  false, false,
58
                              handle_const_attribute },
59
  { "malloc",                 0, 0, true,  false, false,
60
                              handle_malloc_attribute },
61
  { "pure",                   0, 0, true,  false, false,
62
                              handle_pure_attribute },
63
  { "no vops",                0, 0, true,  false, false,
64
                              handle_novops_attribute },
65
  { "nonnull",                0, -1, false, true, true,
66
                              handle_nonnull_attribute },
67
  { "nothrow",                0, 0, true,  false, false,
68
                              handle_nothrow_attribute },
69
  { "sentinel",               0, 1, false, true, true,
70
                              handle_sentinel_attribute },
71
  { "type generic",           0, 0, false, true, true,
72
                              handle_type_generic_attribute },
73
  { NULL,                     0, 0, false, false, false, NULL }
74
};
75
 
76
/* Give the specifications for the format attributes, used by C and all
77
   descendants.  */
78
 
79
const struct attribute_spec lto_format_attribute_table[] =
80
{
81
  /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler } */
82
  { "format",                 3, 3, false, true,  true,
83
                              handle_format_attribute },
84
  { "format_arg",             1, 1, false, true,  true,
85
                              handle_format_arg_attribute },
86
  { NULL,                     0, 0, false, false, false, NULL }
87
};
88
 
89
enum built_in_attribute
90
{
91
#define DEF_ATTR_NULL_TREE(ENUM) ENUM,
92
#define DEF_ATTR_INT(ENUM, VALUE) ENUM,
93
#define DEF_ATTR_IDENT(ENUM, STRING) ENUM,
94
#define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) ENUM,
95
#include "builtin-attrs.def"
96
#undef DEF_ATTR_NULL_TREE
97
#undef DEF_ATTR_INT
98
#undef DEF_ATTR_IDENT
99
#undef DEF_ATTR_TREE_LIST
100
  ATTR_LAST
101
};
102
 
103
static GTY(()) tree built_in_attributes[(int) ATTR_LAST];
104
 
105
/* Builtin types.  */
106
 
107
enum lto_builtin_type
108
{
109
#define DEF_PRIMITIVE_TYPE(NAME, VALUE) NAME,
110
#define DEF_FUNCTION_TYPE_0(NAME, RETURN) NAME,
111
#define DEF_FUNCTION_TYPE_1(NAME, RETURN, ARG1) NAME,
112
#define DEF_FUNCTION_TYPE_2(NAME, RETURN, ARG1, ARG2) NAME,
113
#define DEF_FUNCTION_TYPE_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
114
#define DEF_FUNCTION_TYPE_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
115
#define DEF_FUNCTION_TYPE_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) NAME,
116
#define DEF_FUNCTION_TYPE_6(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) NAME,
117
#define DEF_FUNCTION_TYPE_7(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) NAME,
118
#define DEF_FUNCTION_TYPE_VAR_0(NAME, RETURN) NAME,
119
#define DEF_FUNCTION_TYPE_VAR_1(NAME, RETURN, ARG1) NAME,
120
#define DEF_FUNCTION_TYPE_VAR_2(NAME, RETURN, ARG1, ARG2) NAME,
121
#define DEF_FUNCTION_TYPE_VAR_3(NAME, RETURN, ARG1, ARG2, ARG3) NAME,
122
#define DEF_FUNCTION_TYPE_VAR_4(NAME, RETURN, ARG1, ARG2, ARG3, ARG4) NAME,
123
#define DEF_FUNCTION_TYPE_VAR_5(NAME, RETURN, ARG1, ARG2, ARG3, ARG4, ARG6) \
124
  NAME,
125
#define DEF_POINTER_TYPE(NAME, TYPE) NAME,
126
#include "builtin-types.def"
127
#undef DEF_PRIMITIVE_TYPE
128
#undef DEF_FUNCTION_TYPE_0
129
#undef DEF_FUNCTION_TYPE_1
130
#undef DEF_FUNCTION_TYPE_2
131
#undef DEF_FUNCTION_TYPE_3
132
#undef DEF_FUNCTION_TYPE_4
133
#undef DEF_FUNCTION_TYPE_5
134
#undef DEF_FUNCTION_TYPE_6
135
#undef DEF_FUNCTION_TYPE_7
136
#undef DEF_FUNCTION_TYPE_VAR_0
137
#undef DEF_FUNCTION_TYPE_VAR_1
138
#undef DEF_FUNCTION_TYPE_VAR_2
139
#undef DEF_FUNCTION_TYPE_VAR_3
140
#undef DEF_FUNCTION_TYPE_VAR_4
141
#undef DEF_FUNCTION_TYPE_VAR_5
142
#undef DEF_POINTER_TYPE
143
  BT_LAST
144
};
145
 
146
typedef enum lto_builtin_type builtin_type;
147
 
148
static GTY(()) tree builtin_types[(int) BT_LAST + 1];
149
 
150
static GTY(()) tree string_type_node;
151
static GTY(()) tree const_string_type_node;
152
static GTY(()) tree wint_type_node;
153
static GTY(()) tree intmax_type_node;
154
static GTY(()) tree uintmax_type_node;
155
static GTY(()) tree signed_size_type_node;
156
 
157
/* Flags needed to process builtins.def.  */
158
int flag_no_builtin;
159
int flag_no_nonansi_builtin;
160
int flag_isoc94;
161
int flag_isoc99;
162
 
163
/* Attribute handlers.  */
164
 
165
/* Handle a "noreturn" attribute; arguments as in
166
   struct attribute_spec.handler.  */
167
 
168
static tree
169
handle_noreturn_attribute (tree *node, tree ARG_UNUSED (name),
170
                           tree ARG_UNUSED (args), int ARG_UNUSED (flags),
171
                           bool * ARG_UNUSED (no_add_attrs))
172
{
173
  tree type = TREE_TYPE (*node);
174
 
175
  if (TREE_CODE (*node) == FUNCTION_DECL)
176
    TREE_THIS_VOLATILE (*node) = 1;
177
  else if (TREE_CODE (type) == POINTER_TYPE
178
           && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
179
    TREE_TYPE (*node)
180
      = build_pointer_type
181
        (build_type_variant (TREE_TYPE (type),
182
                             TYPE_READONLY (TREE_TYPE (type)), 1));
183
  else
184
    gcc_unreachable ();
185
 
186
  return NULL_TREE;
187
}
188
 
189
 
190
/* Handle a "const" attribute; arguments as in
191
   struct attribute_spec.handler.  */
192
 
193
static tree
194
handle_const_attribute (tree *node, tree ARG_UNUSED (name),
195
                        tree ARG_UNUSED (args), int ARG_UNUSED (flags),
196
                        bool * ARG_UNUSED (no_add_attrs))
197
{
198
  tree type = TREE_TYPE (*node);
199
 
200
  /* See FIXME comment on noreturn in c_common_attribute_table.  */
201
  if (TREE_CODE (*node) == FUNCTION_DECL)
202
    TREE_READONLY (*node) = 1;
203
  else if (TREE_CODE (type) == POINTER_TYPE
204
           && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
205
    TREE_TYPE (*node)
206
      = build_pointer_type
207
        (build_type_variant (TREE_TYPE (type), 1,
208
                             TREE_THIS_VOLATILE (TREE_TYPE (type))));
209
  else
210
    gcc_unreachable ();
211
 
212
  return NULL_TREE;
213
}
214
 
215
 
216
/* Handle a "malloc" attribute; arguments as in
217
   struct attribute_spec.handler.  */
218
 
219
static tree
220
handle_malloc_attribute (tree *node, tree ARG_UNUSED (name),
221
                         tree ARG_UNUSED (args), int ARG_UNUSED (flags),
222
                         bool * ARG_UNUSED (no_add_attrs))
223
{
224
  if (TREE_CODE (*node) == FUNCTION_DECL
225
      && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (*node))))
226
    DECL_IS_MALLOC (*node) = 1;
227
  else
228
    gcc_unreachable ();
229
 
230
  return NULL_TREE;
231
}
232
 
233
 
234
/* Handle a "pure" attribute; arguments as in
235
   struct attribute_spec.handler.  */
236
 
237
static tree
238
handle_pure_attribute (tree *node, tree ARG_UNUSED (name),
239
                       tree ARG_UNUSED (args), int ARG_UNUSED (flags),
240
                       bool * ARG_UNUSED (no_add_attrs))
241
{
242
  if (TREE_CODE (*node) == FUNCTION_DECL)
243
    DECL_PURE_P (*node) = 1;
244
  else
245
    gcc_unreachable ();
246
 
247
  return NULL_TREE;
248
}
249
 
250
 
251
/* Handle a "no vops" attribute; arguments as in
252
   struct attribute_spec.handler.  */
253
 
254
static tree
255
handle_novops_attribute (tree *node, tree ARG_UNUSED (name),
256
                         tree ARG_UNUSED (args), int ARG_UNUSED (flags),
257
                         bool *ARG_UNUSED (no_add_attrs))
258
{
259
  gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
260
  DECL_IS_NOVOPS (*node) = 1;
261
  return NULL_TREE;
262
}
263
 
264
 
265
/* Helper for nonnull attribute handling; fetch the operand number
266
   from the attribute argument list.  */
267
 
268
static bool
269
get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp)
270
{
271
  /* Verify the arg number is a constant.  */
272
  if (TREE_CODE (arg_num_expr) != INTEGER_CST
273
      || TREE_INT_CST_HIGH (arg_num_expr) != 0)
274
    return false;
275
 
276
  *valp = TREE_INT_CST_LOW (arg_num_expr);
277
  return true;
278
}
279
 
280
/* Handle the "nonnull" attribute.  */
281
 
282
static tree
283
handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name),
284
                          tree args, int ARG_UNUSED (flags),
285
                          bool * ARG_UNUSED (no_add_attrs))
286
{
287
  tree type = *node;
288
 
289
  /* If no arguments are specified, all pointer arguments should be
290
     non-null.  Verify a full prototype is given so that the arguments
291
     will have the correct types when we actually check them later.  */
292
  if (!args)
293
    {
294
      gcc_assert (TYPE_ARG_TYPES (type));
295
      return NULL_TREE;
296
    }
297
 
298
  /* Argument list specified.  Verify that each argument number references
299
     a pointer argument.  */
300
  for (; args; args = TREE_CHAIN (args))
301
    {
302
      tree argument;
303
      unsigned HOST_WIDE_INT arg_num = 0, ck_num;
304
 
305
      if (!get_nonnull_operand (TREE_VALUE (args), &arg_num))
306
        gcc_unreachable ();
307
 
308
      argument = TYPE_ARG_TYPES (type);
309
      if (argument)
310
        {
311
          for (ck_num = 1; ; ck_num++)
312
            {
313
              if (!argument || ck_num == arg_num)
314
                break;
315
              argument = TREE_CHAIN (argument);
316
            }
317
 
318
          gcc_assert (argument
319
                      && TREE_CODE (TREE_VALUE (argument)) == POINTER_TYPE);
320
        }
321
    }
322
 
323
  return NULL_TREE;
324
}
325
 
326
 
327
/* Handle a "nothrow" attribute; arguments as in
328
   struct attribute_spec.handler.  */
329
 
330
static tree
331
handle_nothrow_attribute (tree *node, tree ARG_UNUSED (name),
332
                          tree ARG_UNUSED (args), int ARG_UNUSED (flags),
333
                          bool * ARG_UNUSED (no_add_attrs))
334
{
335
  if (TREE_CODE (*node) == FUNCTION_DECL)
336
    TREE_NOTHROW (*node) = 1;
337
  else
338
    gcc_unreachable ();
339
 
340
  return NULL_TREE;
341
}
342
 
343
 
344
/* Handle a "sentinel" attribute.  */
345
 
346
static tree
347
handle_sentinel_attribute (tree *node, tree ARG_UNUSED (name), tree args,
348
                           int ARG_UNUSED (flags),
349
                           bool * ARG_UNUSED (no_add_attrs))
350
{
351
  tree params = TYPE_ARG_TYPES (*node);
352
  gcc_assert (params);
353
 
354
  while (TREE_CHAIN (params))
355
    params = TREE_CHAIN (params);
356
 
357
  gcc_assert (!VOID_TYPE_P (TREE_VALUE (params)));
358
 
359
  if (args)
360
    {
361
      tree position = TREE_VALUE (args);
362
      gcc_assert (TREE_CODE (position) == INTEGER_CST);
363
      if (tree_int_cst_lt (position, integer_zero_node))
364
        gcc_unreachable ();
365
    }
366
 
367
  return NULL_TREE;
368
}
369
 
370
/* Handle a "type_generic" attribute.  */
371
 
372
static tree
373
handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name),
374
                               tree ARG_UNUSED (args), int ARG_UNUSED (flags),
375
                               bool * ARG_UNUSED (no_add_attrs))
376
{
377
  tree params;
378
 
379
  /* Ensure we have a function type.  */
380
  gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
381
 
382
  params = TYPE_ARG_TYPES (*node);
383
  while (params && ! VOID_TYPE_P (TREE_VALUE (params)))
384
    params = TREE_CHAIN (params);
385
 
386
  /* Ensure we have a variadic function.  */
387
  gcc_assert (!params);
388
 
389
  return NULL_TREE;
390
}
391
 
392
/* Handle a "format" attribute; arguments as in
393
   struct attribute_spec.handler.  */
394
 
395
static tree
396
handle_format_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
397
                         tree ARG_UNUSED (args), int ARG_UNUSED (flags),
398
                         bool *no_add_attrs)
399
{
400
  *no_add_attrs = true;
401
  return NULL_TREE;
402
}
403
 
404
 
405
/* Handle a "format_arg" attribute; arguments as in
406
   struct attribute_spec.handler.  */
407
 
408
tree
409
handle_format_arg_attribute (tree * ARG_UNUSED (node), tree ARG_UNUSED (name),
410
                             tree ARG_UNUSED (args), int ARG_UNUSED (flags),
411
                             bool *no_add_attrs)
412
{
413
  *no_add_attrs = true;
414
  return NULL_TREE;
415
}
416
 
417
 
418
/* Cribbed from c-common.c.  */
419
 
420
static void
421
def_fn_type (builtin_type def, builtin_type ret, bool var, int n, ...)
422
{
423
  tree args = NULL, t;
424
  va_list list;
425
  int i;
426
 
427
  va_start (list, n);
428
  for (i = 0; i < n; ++i)
429
    {
430
      builtin_type a = (builtin_type) va_arg (list, int);
431
      t = builtin_types[a];
432
      if (t == error_mark_node)
433
        goto egress;
434
      args = tree_cons (NULL_TREE, t, args);
435
    }
436
  va_end (list);
437
 
438
  args = nreverse (args);
439
  if (!var)
440
    args = chainon (args, void_list_node);
441
 
442
  t = builtin_types[ret];
443
  if (t == error_mark_node)
444
    goto egress;
445
  t = build_function_type (t, args);
446
 
447
 egress:
448
  builtin_types[def] = t;
449
}
450
 
451
/* Used to help initialize the builtin-types.def table.  When a type of
452
   the correct size doesn't exist, use error_mark_node instead of NULL.
453
   The later results in segfaults even when a decl using the type doesn't
454
   get invoked.  */
455
 
456
static tree
457
builtin_type_for_size (int size, bool unsignedp)
458
{
459
  tree type = lang_hooks.types.type_for_size (size, unsignedp);
460
  return type ? type : error_mark_node;
461
}
462
 
463
/* Support for DEF_BUILTIN.  */
464
 
465
static void
466
def_builtin_1 (enum built_in_function fncode, const char *name,
467
               enum built_in_class fnclass, tree fntype, tree libtype,
468
               bool both_p, bool fallback_p, bool nonansi_p,
469
               tree fnattrs, bool implicit_p)
470
{
471
  tree decl;
472
  const char *libname;
473
 
474
  if (fntype == error_mark_node)
475
    return;
476
 
477
  libname = name + strlen ("__builtin_");
478
  decl = add_builtin_function (name, fntype, fncode, fnclass,
479
                               (fallback_p ? libname : NULL),
480
                               fnattrs);
481
 
482
  if (both_p
483
      && !flag_no_builtin
484
      && !(nonansi_p && flag_no_nonansi_builtin))
485
    add_builtin_function (libname, libtype, fncode, fnclass,
486
                          NULL, fnattrs);
487
 
488
  built_in_decls[(int) fncode] = decl;
489
  if (implicit_p)
490
    implicit_built_in_decls[(int) fncode] = decl;
491
}
492
 
493
 
494
/* Initialize the attribute table for all the supported builtins.  */
495
 
496
static void
497
lto_init_attributes (void)
498
{
499
  /* Fill in the built_in_attributes array.  */
500
#define DEF_ATTR_NULL_TREE(ENUM)                                \
501
  built_in_attributes[(int) ENUM] = NULL_TREE;
502
#define DEF_ATTR_INT(ENUM, VALUE)                               \
503
  built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE);
504
#define DEF_ATTR_IDENT(ENUM, STRING)                            \
505
  built_in_attributes[(int) ENUM] = get_identifier (STRING);
506
#define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) \
507
  built_in_attributes[(int) ENUM]                       \
508
    = tree_cons (built_in_attributes[(int) PURPOSE],    \
509
                 built_in_attributes[(int) VALUE],      \
510
                 built_in_attributes[(int) CHAIN]);
511
#include "builtin-attrs.def"
512
#undef DEF_ATTR_NULL_TREE
513
#undef DEF_ATTR_INT
514
#undef DEF_ATTR_IDENT
515
#undef DEF_ATTR_TREE_LIST
516
}
517
 
518
/* Create builtin types and functions.  VA_LIST_REF_TYPE_NODE and
519
   VA_LIST_ARG_TYPE_NODE are used in builtin-types.def.  */
520
 
521
static void
522
lto_define_builtins (tree va_list_ref_type_node ATTRIBUTE_UNUSED,
523
                     tree va_list_arg_type_node ATTRIBUTE_UNUSED)
524
{
525
#define DEF_PRIMITIVE_TYPE(ENUM, VALUE) \
526
  builtin_types[ENUM] = VALUE;
527
#define DEF_FUNCTION_TYPE_0(ENUM, RETURN) \
528
  def_fn_type (ENUM, RETURN, 0, 0);
529
#define DEF_FUNCTION_TYPE_1(ENUM, RETURN, ARG1) \
530
  def_fn_type (ENUM, RETURN, 0, 1, ARG1);
531
#define DEF_FUNCTION_TYPE_2(ENUM, RETURN, ARG1, ARG2) \
532
  def_fn_type (ENUM, RETURN, 0, 2, ARG1, ARG2);
533
#define DEF_FUNCTION_TYPE_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
534
  def_fn_type (ENUM, RETURN, 0, 3, ARG1, ARG2, ARG3);
535
#define DEF_FUNCTION_TYPE_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
536
  def_fn_type (ENUM, RETURN, 0, 4, ARG1, ARG2, ARG3, ARG4);
537
#define DEF_FUNCTION_TYPE_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
538
  def_fn_type (ENUM, RETURN, 0, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
539
#define DEF_FUNCTION_TYPE_6(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
540
                            ARG6)                                       \
541
  def_fn_type (ENUM, RETURN, 0, 6, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6);
542
#define DEF_FUNCTION_TYPE_7(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5, \
543
                            ARG6, ARG7)                                 \
544
  def_fn_type (ENUM, RETURN, 0, 7, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7);
545
#define DEF_FUNCTION_TYPE_VAR_0(ENUM, RETURN) \
546
  def_fn_type (ENUM, RETURN, 1, 0);
547
#define DEF_FUNCTION_TYPE_VAR_1(ENUM, RETURN, ARG1) \
548
  def_fn_type (ENUM, RETURN, 1, 1, ARG1);
549
#define DEF_FUNCTION_TYPE_VAR_2(ENUM, RETURN, ARG1, ARG2) \
550
  def_fn_type (ENUM, RETURN, 1, 2, ARG1, ARG2);
551
#define DEF_FUNCTION_TYPE_VAR_3(ENUM, RETURN, ARG1, ARG2, ARG3) \
552
  def_fn_type (ENUM, RETURN, 1, 3, ARG1, ARG2, ARG3);
553
#define DEF_FUNCTION_TYPE_VAR_4(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4) \
554
  def_fn_type (ENUM, RETURN, 1, 4, ARG1, ARG2, ARG3, ARG4);
555
#define DEF_FUNCTION_TYPE_VAR_5(ENUM, RETURN, ARG1, ARG2, ARG3, ARG4, ARG5) \
556
  def_fn_type (ENUM, RETURN, 1, 5, ARG1, ARG2, ARG3, ARG4, ARG5);
557
#define DEF_POINTER_TYPE(ENUM, TYPE) \
558
  builtin_types[(int) ENUM] = build_pointer_type (builtin_types[(int) TYPE]);
559
 
560
#include "builtin-types.def"
561
 
562
#undef DEF_PRIMITIVE_TYPE
563
#undef DEF_FUNCTION_TYPE_1
564
#undef DEF_FUNCTION_TYPE_2
565
#undef DEF_FUNCTION_TYPE_3
566
#undef DEF_FUNCTION_TYPE_4
567
#undef DEF_FUNCTION_TYPE_5
568
#undef DEF_FUNCTION_TYPE_6
569
#undef DEF_FUNCTION_TYPE_VAR_0
570
#undef DEF_FUNCTION_TYPE_VAR_1
571
#undef DEF_FUNCTION_TYPE_VAR_2
572
#undef DEF_FUNCTION_TYPE_VAR_3
573
#undef DEF_FUNCTION_TYPE_VAR_4
574
#undef DEF_FUNCTION_TYPE_VAR_5
575
#undef DEF_POINTER_TYPE
576
  builtin_types[(int) BT_LAST] = NULL_TREE;
577
 
578
  lto_init_attributes ();
579
 
580
#define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, BOTH_P, FALLBACK_P,\
581
                    NONANSI_P, ATTRS, IMPLICIT, COND)                   \
582
    if (NAME && COND)                                                   \
583
      def_builtin_1 (ENUM, NAME, CLASS, builtin_types[(int) TYPE],      \
584
                     builtin_types[(int) LIBTYPE], BOTH_P, FALLBACK_P,  \
585
                     NONANSI_P, built_in_attributes[(int) ATTRS], IMPLICIT);
586
#include "builtins.def"
587
#undef DEF_BUILTIN
588
}
589
 
590
static GTY(()) tree registered_builtin_types;
591
 
592
/* A chain of builtin functions that we need to recognize.  We will
593
   assume that all other function names we see will be defined by the
594
   user's program.  */
595
static GTY(()) tree registered_builtin_fndecls;
596
 
597
/* Language hooks.  */
598
 
599
static unsigned int
600
lto_init_options (unsigned int argc ATTRIBUTE_UNUSED,
601
                  const char **argv ATTRIBUTE_UNUSED)
602
{
603
  /* By default, C99-like requirements for complex multiply and divide.
604
     ???  Until the complex method is encoded in the IL this is the only
605
     safe choice.  This will pessimize Fortran code with LTO unless
606
     people specify a complex method manually or use -ffast-math.  */
607
  flag_complex_method = 2;
608
 
609
  return CL_LTO;
610
}
611
 
612
/* Handle command-line option SCODE.  If the option takes an argument, it is
613
   stored in ARG, which is otherwise NULL.  VALUE holds either a numerical
614
   argument or a binary value indicating whether the positive or negative form
615
   of the option was supplied.  */
616
 
617
const char *resolution_file_name;
618
static int
619
lto_handle_option (size_t scode, const char *arg, int value ATTRIBUTE_UNUSED)
620
{
621
  enum opt_code code = (enum opt_code) scode;
622
  int result = 1;
623
 
624
  switch (code)
625
    {
626
    case OPT_fresolution:
627
      resolution_file_name = arg;
628
      result = 1;
629
      break;
630
 
631
    case OPT_Wabi:
632
      warn_psabi = value;
633
      break;
634
 
635
    case OPT_fsigned_char:
636
      flag_signed_char = value;
637
      break;
638
 
639
    case OPT_funsigned_char:
640
      flag_signed_char = !value;
641
      break;
642
 
643
    default:
644
      break;
645
    }
646
 
647
  return result;
648
}
649
 
650
/* Perform post-option processing.  Does additional initialization based on
651
   command-line options.  PFILENAME is the main input filename.  Returns false
652
   to enable subsequent back-end initialization.  */
653
 
654
static bool
655
lto_post_options (const char **pfilename ATTRIBUTE_UNUSED)
656
{
657
  /* -fltrans and -fwpa are mutually exclusive.  Check for that here.  */
658
  if (flag_wpa && flag_ltrans)
659
    error ("-fwpa and -fltrans are mutually exclusive");
660
 
661
  if (flag_ltrans)
662
    {
663
      flag_generate_lto = 0;
664
 
665
      /* During LTRANS, we are not looking at the whole program, only
666
         a subset of the whole callgraph.  */
667
      flag_whole_program = 0;
668
    }
669
 
670
  if (flag_wpa)
671
    flag_generate_lto = 1;
672
 
673
  /* Excess precision other than "fast" requires front-end
674
     support.  */
675
  flag_excess_precision_cmdline = EXCESS_PRECISION_FAST;
676
 
677
  lto_read_all_file_options ();
678
 
679
  /* Initialize the compiler back end.  */
680
  return false;
681
}
682
 
683
/* Return an integer type with PRECISION bits of precision,
684
   that is unsigned if UNSIGNEDP is nonzero, otherwise signed.  */
685
 
686
static tree
687
lto_type_for_size (unsigned precision, int unsignedp)
688
{
689
  if (precision == TYPE_PRECISION (integer_type_node))
690
    return unsignedp ? unsigned_type_node : integer_type_node;
691
 
692
  if (precision == TYPE_PRECISION (signed_char_type_node))
693
    return unsignedp ? unsigned_char_type_node : signed_char_type_node;
694
 
695
  if (precision == TYPE_PRECISION (short_integer_type_node))
696
    return unsignedp ? short_unsigned_type_node : short_integer_type_node;
697
 
698
  if (precision == TYPE_PRECISION (long_integer_type_node))
699
    return unsignedp ? long_unsigned_type_node : long_integer_type_node;
700
 
701
  if (precision == TYPE_PRECISION (long_long_integer_type_node))
702
    return unsignedp
703
           ? long_long_unsigned_type_node
704
           : long_long_integer_type_node;
705
 
706
  if (precision <= TYPE_PRECISION (intQI_type_node))
707
    return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
708
 
709
  if (precision <= TYPE_PRECISION (intHI_type_node))
710
    return unsignedp ? unsigned_intHI_type_node : intHI_type_node;
711
 
712
  if (precision <= TYPE_PRECISION (intSI_type_node))
713
    return unsignedp ? unsigned_intSI_type_node : intSI_type_node;
714
 
715
  if (precision <= TYPE_PRECISION (intDI_type_node))
716
    return unsignedp ? unsigned_intDI_type_node : intDI_type_node;
717
 
718
  if (precision <= TYPE_PRECISION (intTI_type_node))
719
    return unsignedp ? unsigned_intTI_type_node : intTI_type_node;
720
 
721
  return NULL_TREE;
722
}
723
 
724
 
725
/* Return a data type that has machine mode MODE.
726
   If the mode is an integer,
727
   then UNSIGNEDP selects between signed and unsigned types.
728
   If the mode is a fixed-point mode,
729
   then UNSIGNEDP selects between saturating and nonsaturating types.  */
730
 
731
static tree
732
lto_type_for_mode (enum machine_mode mode, int unsigned_p)
733
{
734
  tree t;
735
 
736
  if (mode == TYPE_MODE (integer_type_node))
737
    return unsigned_p ? unsigned_type_node : integer_type_node;
738
 
739
  if (mode == TYPE_MODE (signed_char_type_node))
740
    return unsigned_p ? unsigned_char_type_node : signed_char_type_node;
741
 
742
  if (mode == TYPE_MODE (short_integer_type_node))
743
    return unsigned_p ? short_unsigned_type_node : short_integer_type_node;
744
 
745
  if (mode == TYPE_MODE (long_integer_type_node))
746
    return unsigned_p ? long_unsigned_type_node : long_integer_type_node;
747
 
748
  if (mode == TYPE_MODE (long_long_integer_type_node))
749
    return unsigned_p ? long_long_unsigned_type_node : long_long_integer_type_node;
750
 
751
  if (mode == QImode)
752
    return unsigned_p ? unsigned_intQI_type_node : intQI_type_node;
753
 
754
  if (mode == HImode)
755
    return unsigned_p ? unsigned_intHI_type_node : intHI_type_node;
756
 
757
  if (mode == SImode)
758
    return unsigned_p ? unsigned_intSI_type_node : intSI_type_node;
759
 
760
  if (mode == DImode)
761
    return unsigned_p ? unsigned_intDI_type_node : intDI_type_node;
762
 
763
#if HOST_BITS_PER_WIDE_INT >= 64
764
  if (mode == TYPE_MODE (intTI_type_node))
765
    return unsigned_p ? unsigned_intTI_type_node : intTI_type_node;
766
#endif
767
 
768
  if (mode == TYPE_MODE (float_type_node))
769
    return float_type_node;
770
 
771
  if (mode == TYPE_MODE (double_type_node))
772
    return double_type_node;
773
 
774
  if (mode == TYPE_MODE (long_double_type_node))
775
    return long_double_type_node;
776
 
777
  if (mode == TYPE_MODE (void_type_node))
778
    return void_type_node;
779
 
780
  if (mode == TYPE_MODE (build_pointer_type (char_type_node)))
781
    return (unsigned_p
782
            ? make_unsigned_type (GET_MODE_PRECISION (mode))
783
            : make_signed_type (GET_MODE_PRECISION (mode)));
784
 
785
  if (mode == TYPE_MODE (build_pointer_type (integer_type_node)))
786
    return (unsigned_p
787
            ? make_unsigned_type (GET_MODE_PRECISION (mode))
788
            : make_signed_type (GET_MODE_PRECISION (mode)));
789
 
790
  if (COMPLEX_MODE_P (mode))
791
    {
792
      enum machine_mode inner_mode;
793
      tree inner_type;
794
 
795
      if (mode == TYPE_MODE (complex_float_type_node))
796
        return complex_float_type_node;
797
      if (mode == TYPE_MODE (complex_double_type_node))
798
        return complex_double_type_node;
799
      if (mode == TYPE_MODE (complex_long_double_type_node))
800
        return complex_long_double_type_node;
801
 
802
      if (mode == TYPE_MODE (complex_integer_type_node) && !unsigned_p)
803
        return complex_integer_type_node;
804
 
805
      inner_mode = GET_MODE_INNER (mode);
806
      inner_type = lto_type_for_mode (inner_mode, unsigned_p);
807
      if (inner_type != NULL_TREE)
808
        return build_complex_type (inner_type);
809
    }
810
  else if (VECTOR_MODE_P (mode))
811
    {
812
      enum machine_mode inner_mode = GET_MODE_INNER (mode);
813
      tree inner_type = lto_type_for_mode (inner_mode, unsigned_p);
814
      if (inner_type != NULL_TREE)
815
        return build_vector_type_for_mode (inner_type, mode);
816
    }
817
 
818
  if (mode == TYPE_MODE (dfloat32_type_node))
819
    return dfloat32_type_node;
820
  if (mode == TYPE_MODE (dfloat64_type_node))
821
    return dfloat64_type_node;
822
  if (mode == TYPE_MODE (dfloat128_type_node))
823
    return dfloat128_type_node;
824
 
825
  if (ALL_SCALAR_FIXED_POINT_MODE_P (mode))
826
    {
827
      if (mode == TYPE_MODE (short_fract_type_node))
828
        return unsigned_p ? sat_short_fract_type_node : short_fract_type_node;
829
      if (mode == TYPE_MODE (fract_type_node))
830
        return unsigned_p ? sat_fract_type_node : fract_type_node;
831
      if (mode == TYPE_MODE (long_fract_type_node))
832
        return unsigned_p ? sat_long_fract_type_node : long_fract_type_node;
833
      if (mode == TYPE_MODE (long_long_fract_type_node))
834
        return unsigned_p ? sat_long_long_fract_type_node
835
                         : long_long_fract_type_node;
836
 
837
      if (mode == TYPE_MODE (unsigned_short_fract_type_node))
838
        return unsigned_p ? sat_unsigned_short_fract_type_node
839
                         : unsigned_short_fract_type_node;
840
      if (mode == TYPE_MODE (unsigned_fract_type_node))
841
        return unsigned_p ? sat_unsigned_fract_type_node
842
                         : unsigned_fract_type_node;
843
      if (mode == TYPE_MODE (unsigned_long_fract_type_node))
844
        return unsigned_p ? sat_unsigned_long_fract_type_node
845
                         : unsigned_long_fract_type_node;
846
      if (mode == TYPE_MODE (unsigned_long_long_fract_type_node))
847
        return unsigned_p ? sat_unsigned_long_long_fract_type_node
848
                         : unsigned_long_long_fract_type_node;
849
 
850
      if (mode == TYPE_MODE (short_accum_type_node))
851
        return unsigned_p ? sat_short_accum_type_node : short_accum_type_node;
852
      if (mode == TYPE_MODE (accum_type_node))
853
        return unsigned_p ? sat_accum_type_node : accum_type_node;
854
      if (mode == TYPE_MODE (long_accum_type_node))
855
        return unsigned_p ? sat_long_accum_type_node : long_accum_type_node;
856
      if (mode == TYPE_MODE (long_long_accum_type_node))
857
        return unsigned_p ? sat_long_long_accum_type_node
858
                         : long_long_accum_type_node;
859
 
860
      if (mode == TYPE_MODE (unsigned_short_accum_type_node))
861
        return unsigned_p ? sat_unsigned_short_accum_type_node
862
                         : unsigned_short_accum_type_node;
863
      if (mode == TYPE_MODE (unsigned_accum_type_node))
864
        return unsigned_p ? sat_unsigned_accum_type_node
865
                         : unsigned_accum_type_node;
866
      if (mode == TYPE_MODE (unsigned_long_accum_type_node))
867
        return unsigned_p ? sat_unsigned_long_accum_type_node
868
                         : unsigned_long_accum_type_node;
869
      if (mode == TYPE_MODE (unsigned_long_long_accum_type_node))
870
        return unsigned_p ? sat_unsigned_long_long_accum_type_node
871
                         : unsigned_long_long_accum_type_node;
872
 
873
      if (mode == QQmode)
874
        return unsigned_p ? sat_qq_type_node : qq_type_node;
875
      if (mode == HQmode)
876
        return unsigned_p ? sat_hq_type_node : hq_type_node;
877
      if (mode == SQmode)
878
        return unsigned_p ? sat_sq_type_node : sq_type_node;
879
      if (mode == DQmode)
880
        return unsigned_p ? sat_dq_type_node : dq_type_node;
881
      if (mode == TQmode)
882
        return unsigned_p ? sat_tq_type_node : tq_type_node;
883
 
884
      if (mode == UQQmode)
885
        return unsigned_p ? sat_uqq_type_node : uqq_type_node;
886
      if (mode == UHQmode)
887
        return unsigned_p ? sat_uhq_type_node : uhq_type_node;
888
      if (mode == USQmode)
889
        return unsigned_p ? sat_usq_type_node : usq_type_node;
890
      if (mode == UDQmode)
891
        return unsigned_p ? sat_udq_type_node : udq_type_node;
892
      if (mode == UTQmode)
893
        return unsigned_p ? sat_utq_type_node : utq_type_node;
894
 
895
      if (mode == HAmode)
896
        return unsigned_p ? sat_ha_type_node : ha_type_node;
897
      if (mode == SAmode)
898
        return unsigned_p ? sat_sa_type_node : sa_type_node;
899
      if (mode == DAmode)
900
        return unsigned_p ? sat_da_type_node : da_type_node;
901
      if (mode == TAmode)
902
        return unsigned_p ? sat_ta_type_node : ta_type_node;
903
 
904
      if (mode == UHAmode)
905
        return unsigned_p ? sat_uha_type_node : uha_type_node;
906
      if (mode == USAmode)
907
        return unsigned_p ? sat_usa_type_node : usa_type_node;
908
      if (mode == UDAmode)
909
        return unsigned_p ? sat_uda_type_node : uda_type_node;
910
      if (mode == UTAmode)
911
        return unsigned_p ? sat_uta_type_node : uta_type_node;
912
    }
913
 
914
  for (t = registered_builtin_types; t; t = TREE_CHAIN (t))
915
    if (TYPE_MODE (TREE_VALUE (t)) == mode)
916
      return TREE_VALUE (t);
917
 
918
  return NULL_TREE;
919
}
920
 
921
static int
922
lto_global_bindings_p (void)
923
{
924
  return cfun == NULL;
925
}
926
 
927
static void
928
lto_set_decl_assembler_name (tree decl)
929
{
930
  /* This is almost the same as lhd_set_decl_assembler_name, except that
931
     we need to uniquify file-scope names, even if they are not
932
     TREE_PUBLIC, to avoid conflicts between individual files.  */
933
  tree id;
934
 
935
  if (TREE_PUBLIC (decl))
936
    id = targetm.mangle_decl_assembler_name (decl, DECL_NAME (decl));
937
  else
938
    {
939
      const char *name = IDENTIFIER_POINTER (DECL_NAME (decl));
940
      char *label;
941
 
942
      ASM_FORMAT_PRIVATE_NAME (label, name, DECL_UID (decl));
943
      id = get_identifier (label);
944
    }
945
 
946
  SET_DECL_ASSEMBLER_NAME (decl, id);
947
}
948
 
949
static tree
950
lto_pushdecl (tree t ATTRIBUTE_UNUSED)
951
{
952
  /* Do nothing, since we get all information from DWARF and LTO
953
     sections.  */
954
  return NULL_TREE;
955
}
956
 
957
static tree
958
lto_getdecls (void)
959
{
960
  return registered_builtin_fndecls;
961
}
962
 
963
static void
964
lto_write_globals (void)
965
{
966
  tree *vec = VEC_address (tree, lto_global_var_decls);
967
  int len = VEC_length (tree, lto_global_var_decls);
968
  wrapup_global_declarations (vec, len);
969
  emit_debug_global_declarations (vec, len);
970
  VEC_free (tree, gc, lto_global_var_decls);
971
}
972
 
973
static tree
974
lto_builtin_function (tree decl)
975
{
976
  /* Record it.  */
977
  TREE_CHAIN (decl) = registered_builtin_fndecls;
978
  registered_builtin_fndecls = decl;
979
 
980
  return decl;
981
}
982
 
983
static void
984
lto_register_builtin_type (tree type, const char *name)
985
{
986
  tree decl;
987
 
988
  decl = build_decl (UNKNOWN_LOCATION, TYPE_DECL, get_identifier (name), type);
989
  DECL_ARTIFICIAL (decl) = 1;
990
  if (!TYPE_NAME (type))
991
    TYPE_NAME (type) = decl;
992
 
993
  registered_builtin_types = tree_cons (0, type, registered_builtin_types);
994
}
995
 
996
/* Build nodes that would have be created by the C front-end; necessary
997
   for including builtin-types.def and ultimately builtins.def.  */
998
 
999
static void
1000
lto_build_c_type_nodes (void)
1001
{
1002
  gcc_assert (void_type_node);
1003
 
1004
  void_list_node = build_tree_list (NULL_TREE, void_type_node);
1005
  string_type_node = build_pointer_type (char_type_node);
1006
  const_string_type_node
1007
    = build_pointer_type (build_qualified_type (char_type_node, TYPE_QUAL_CONST));
1008
 
1009
  if (strcmp (SIZE_TYPE, "unsigned int") == 0)
1010
    {
1011
      intmax_type_node = integer_type_node;
1012
      uintmax_type_node = unsigned_type_node;
1013
      signed_size_type_node = integer_type_node;
1014
    }
1015
  else if (strcmp (SIZE_TYPE, "long unsigned int") == 0)
1016
    {
1017
      intmax_type_node = long_integer_type_node;
1018
      uintmax_type_node = long_unsigned_type_node;
1019
      signed_size_type_node = long_integer_type_node;
1020
    }
1021
  else
1022
    gcc_unreachable ();
1023
 
1024
  wint_type_node = unsigned_type_node;
1025
  pid_type_node = integer_type_node;
1026
}
1027
 
1028
 
1029
/* Perform LTO-specific initialization.  */
1030
 
1031
static bool
1032
lto_init (void)
1033
{
1034
  /* We need to generate LTO if running in WPA mode.  */
1035
  flag_generate_lto = flag_wpa;
1036
 
1037
  /* Initialize libcpp line maps for gcc_assert to work.  */
1038
  linemap_add (line_table, LC_RENAME, 0, NULL, 0);
1039
  linemap_add (line_table, LC_RENAME, 0, NULL, 0);
1040
 
1041
  /* Create the basic integer types.  */
1042
  build_common_tree_nodes (flag_signed_char, /*signed_sizetype=*/false);
1043
 
1044
  /* Share char_type_node with whatever would be the default for the target.
1045
     char_type_node will be used for internal types such as
1046
     va_list_type_node but will not be present in the lto stream.  */
1047
  /* ???  This breaks the more common case of consistent but non-standard
1048
     setting of flag_signed_char, so share according to flag_signed_char.
1049
     See PR42528.  */
1050
  char_type_node
1051
    = flag_signed_char ? signed_char_type_node : unsigned_char_type_node;
1052
 
1053
  /* Tell the middle end what type to use for the size of objects.  */
1054
  if (strcmp (SIZE_TYPE, "unsigned int") == 0)
1055
    {
1056
      set_sizetype (unsigned_type_node);
1057
      size_type_node = unsigned_type_node;
1058
    }
1059
  else if (strcmp (SIZE_TYPE, "long unsigned int") == 0)
1060
    {
1061
      set_sizetype (long_unsigned_type_node);
1062
      size_type_node = long_unsigned_type_node;
1063
    }
1064
  else
1065
    gcc_unreachable ();
1066
 
1067
  /* The global tree for the main identifier is filled in by
1068
     language-specific front-end initialization that is not run in the
1069
     LTO back-end.  It appears that all languages that perform such
1070
     initialization currently do so in the same way, so we do it here.  */
1071
  if (main_identifier_node == NULL_TREE)
1072
    main_identifier_node = get_identifier ("main");
1073
 
1074
  /* In the C++ front-end, fileptr_type_node is defined as a variant
1075
     copy of of ptr_type_node, rather than ptr_node itself.  The
1076
     distinction should only be relevant to the front-end, so we
1077
     always use the C definition here in lto1.  */
1078
  gcc_assert (fileptr_type_node == ptr_type_node);
1079
 
1080
  ptrdiff_type_node = integer_type_node;
1081
 
1082
  /* Create other basic types.  */
1083
  build_common_tree_nodes_2 (/*short_double=*/false);
1084
  lto_build_c_type_nodes ();
1085
  gcc_assert (va_list_type_node);
1086
 
1087
  if (TREE_CODE (va_list_type_node) == ARRAY_TYPE)
1088
    {
1089
      tree x = build_pointer_type (TREE_TYPE (va_list_type_node));
1090
      lto_define_builtins (x, x);
1091
    }
1092
  else
1093
    {
1094
      lto_define_builtins (va_list_type_node,
1095
                           build_reference_type (va_list_type_node));
1096
    }
1097
 
1098
  targetm.init_builtins ();
1099
  build_common_builtin_nodes ();
1100
 
1101
  /* Initialize LTO-specific data structures.  */
1102
  lto_global_var_decls = VEC_alloc (tree, gc, 256);
1103
  in_lto_p = true;
1104
 
1105
  return true;
1106
}
1107
 
1108
/* Initialize tree structures required by the LTO front end.  */
1109
 
1110
static void lto_init_ts (void)
1111
{
1112
  tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1;
1113
}
1114
 
1115
#undef LANG_HOOKS_NAME
1116
#define LANG_HOOKS_NAME "GNU GIMPLE"
1117
#undef LANG_HOOKS_INIT_OPTIONS
1118
#define LANG_HOOKS_INIT_OPTIONS lto_init_options
1119
#undef LANG_HOOKS_HANDLE_OPTION
1120
#define LANG_HOOKS_HANDLE_OPTION lto_handle_option
1121
#undef LANG_HOOKS_POST_OPTIONS
1122
#define LANG_HOOKS_POST_OPTIONS lto_post_options
1123
#undef LANG_HOOKS_GET_ALIAS_SET
1124
#define LANG_HOOKS_GET_ALIAS_SET gimple_get_alias_set
1125
#undef LANG_HOOKS_TYPE_FOR_MODE
1126
#define LANG_HOOKS_TYPE_FOR_MODE lto_type_for_mode
1127
#undef LANG_HOOKS_TYPE_FOR_SIZE
1128
#define LANG_HOOKS_TYPE_FOR_SIZE lto_type_for_size
1129
#undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME
1130
#define LANG_HOOKS_SET_DECL_ASSEMBLER_NAME lto_set_decl_assembler_name
1131
#undef LANG_HOOKS_GLOBAL_BINDINGS_P
1132
#define LANG_HOOKS_GLOBAL_BINDINGS_P lto_global_bindings_p
1133
#undef LANG_HOOKS_PUSHDECL
1134
#define LANG_HOOKS_PUSHDECL lto_pushdecl
1135
#undef LANG_HOOKS_GETDECLS
1136
#define LANG_HOOKS_GETDECLS lto_getdecls
1137
#undef LANG_HOOKS_WRITE_GLOBALS
1138
#define LANG_HOOKS_WRITE_GLOBALS lto_write_globals
1139
#undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
1140
#define LANG_HOOKS_REGISTER_BUILTIN_TYPE lto_register_builtin_type
1141
#undef LANG_HOOKS_BUILTIN_FUNCTION
1142
#define LANG_HOOKS_BUILTIN_FUNCTION lto_builtin_function
1143
#undef LANG_HOOKS_INIT
1144
#define LANG_HOOKS_INIT lto_init
1145
#undef LANG_HOOKS_PARSE_FILE
1146
#define LANG_HOOKS_PARSE_FILE lto_main
1147
#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
1148
#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION tree_rest_of_compilation
1149
#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
1150
#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
1151
#undef LANG_HOOKS_TYPES_COMPATIBLE_P
1152
#define LANG_HOOKS_TYPES_COMPATIBLE_P NULL
1153
 
1154
/* Attribute hooks.  */
1155
#undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
1156
#define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE lto_attribute_table
1157
#undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
1158
#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE lto_format_attribute_table
1159
 
1160
#undef LANG_HOOKS_BEGIN_SECTION
1161
#define LANG_HOOKS_BEGIN_SECTION lto_obj_begin_section
1162
#undef LANG_HOOKS_APPEND_DATA
1163
#define LANG_HOOKS_APPEND_DATA lto_obj_append_data
1164
#undef LANG_HOOKS_END_SECTION
1165
#define LANG_HOOKS_END_SECTION lto_obj_end_section
1166
 
1167
#undef LANG_HOOKS_INIT_TS
1168
#define LANG_HOOKS_INIT_TS lto_init_ts
1169
 
1170
struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
1171
 
1172
/* Language hooks that are not part of lang_hooks.  */
1173
 
1174
tree
1175
convert (tree type ATTRIBUTE_UNUSED, tree expr ATTRIBUTE_UNUSED)
1176
{
1177
  gcc_unreachable ();
1178
}
1179
 
1180
/* Tree walking support.  */
1181
 
1182
static enum lto_tree_node_structure_enum
1183
lto_tree_node_structure (union lang_tree_node *t ATTRIBUTE_UNUSED)
1184
{
1185
  return TS_LTO_GENERIC;
1186
}
1187
 
1188
#include "ggc.h"
1189
#include "gtype-lto.h"
1190
#include "gt-lto-lto-lang.h"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.