aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-section-in.h
blob: ebd17db44e86223559e411dbe3607071e4f87a0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* LTO input code.
   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
   Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */

#ifndef GCC_LTO_SECTION_IN_H
#define GCC_LTO_SECTION_IN_H

struct lto_input_block 
{
  const char *data;
  unsigned int p;
  unsigned int len;
};

#define LTO_INIT_INPUT_BLOCK(BASE,D,P,L)   \
  do {                                     \
    BASE.data = D;                         \
    BASE.p = P;                            \
    BASE.len = L;                          \
  } while (0)

/* Hash table entry to hold the start offset and length of an lto
   section in a .o file.  */

struct lto_section_slot {
  const char * name;
  unsigned int start;
  unsigned int len;
};


/* One of these is allocated for each object file that being compiled
   by lto.  This structure contains the tables that are needed for the
   by the serialized functions and ipa passes to connect themselves to
   the global types and decls as they are reconstituted.  */
struct lto_file_decl_data
{
  tree *field_decls;            /* The field decls.  */
  tree *fn_decls;               /* The function decls.  */
  tree *var_decls;              /* The global or static var_decls.  */
  tree *type_decls;             /* The type_decls.  */
  tree *namespace_decls;        /* The namespace_decls.  */
  tree *types;                  /* All of the types.  */
  unsigned int num_field_decls; /* The number of field decls.  */
  unsigned int num_fn_decls;    /* The number of function decls.  */
  unsigned int num_var_decls;   /* The number of global or static var_decls.  */
  unsigned int num_type_decls;  /* The number of type_decls.  */
  unsigned int num_namespace_decls; /* The number of namespace_decls.  */
  unsigned int num_types;       /* All number of of the types.  */

  /* The .o file that these offsets relate to.  

  FIXME!!! This will most likely have to be upgraded if the .o files
  have been archived.  */ 
  const char * file_name;

  /* Hash table to contains the location of the lto bodies in file_name. */
  htab_t section_hash_table;
};

/* DATA is the LTO data written out during ordinary compilation,
   encoding the initializers for the static and external vars.
   FILE_DATA are the tables holding all of the global types and decls
   used un that file.   */
extern void
lto_input_cgraph (struct lto_file_decl_data* file_data, const char *data);

extern unsigned char lto_input_1_unsigned (struct lto_input_block *);
extern unsigned HOST_WIDE_INT lto_input_uleb128 (struct lto_input_block *);
extern unsigned HOST_WIDEST_INT lto_input_widest_uint_uleb128 (struct lto_input_block *);
extern HOST_WIDE_INT lto_input_sleb128 (struct lto_input_block *);
extern tree lto_input_integer (struct lto_input_block *, tree);
extern char *lto_get_section_data (struct lto_file_decl_data *, enum lto_section_type,
				   const char*);

#ifdef LTO_STREAM_DEBUGGING
extern void lto_debug_in_fun (struct lto_debug_context *, char);
#endif

#endif  /* GCC_LTO_SECTION_IN_H  */