annotate gcc/lto-cgraph.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Write and read the cgraph to the memory mapped representation of a
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 .o file.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
4 Copyright (C) 2009-2020 Free Software Foundation, Inc.
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 This file is part of GCC.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 GCC is free software; you can redistribute it and/or modify it under
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 the terms of the GNU General Public License as published by the Free
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 Software Foundation; either version 3, or (at your option) any later
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 version.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 for more details.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 You should have received a copy of the GNU General Public License
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 along with GCC; see the file COPYING3. If not see
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 <http://www.gnu.org/licenses/>. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #include "config.h"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #include "system.h"
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "coretypes.h"
111
kono
parents: 67
diff changeset
26 #include "backend.h"
kono
parents: 67
diff changeset
27 #include "rtl.h"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 #include "tree.h"
111
kono
parents: 67
diff changeset
29 #include "gimple.h"
kono
parents: 67
diff changeset
30 #include "predict.h"
kono
parents: 67
diff changeset
31 #include "stringpool.h"
kono
parents: 67
diff changeset
32 #include "tree-streamer.h"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 #include "cgraph.h"
111
kono
parents: 67
diff changeset
34 #include "tree-pass.h"
kono
parents: 67
diff changeset
35 #include "profile.h"
kono
parents: 67
diff changeset
36 #include "context.h"
kono
parents: 67
diff changeset
37 #include "pass_manager.h"
kono
parents: 67
diff changeset
38 #include "ipa-utils.h"
kono
parents: 67
diff changeset
39 #include "omp-offload.h"
kono
parents: 67
diff changeset
40 #include "stringpool.h"
kono
parents: 67
diff changeset
41 #include "attribs.h"
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42
111
kono
parents: 67
diff changeset
43 /* True when asm nodes has been output. */
kono
parents: 67
diff changeset
44 bool asm_nodes_output = false;
kono
parents: 67
diff changeset
45
kono
parents: 67
diff changeset
46 static void output_cgraph_opt_summary (void);
kono
parents: 67
diff changeset
47 static void input_cgraph_opt_summary (vec<symtab_node *> nodes);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
48
111
kono
parents: 67
diff changeset
49 /* Number of LDPR values known to GCC. */
kono
parents: 67
diff changeset
50 #define LDPR_NUM_KNOWN (LDPR_PREVAILING_DEF_IRONLY_EXP + 1)
kono
parents: 67
diff changeset
51
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
52 /* Cgraph streaming is organized as set of record whose type
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
53 is indicated by a tag. */
111
kono
parents: 67
diff changeset
54 enum LTO_symtab_tags
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
55 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
56 /* Must leave 0 for the stopper. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
57
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
58 /* Cgraph node without body available. */
111
kono
parents: 67
diff changeset
59 LTO_symtab_unavail_node = 1,
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
60 /* Cgraph node with function body. */
111
kono
parents: 67
diff changeset
61 LTO_symtab_analyzed_node,
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
62 /* Cgraph edges. */
111
kono
parents: 67
diff changeset
63 LTO_symtab_edge,
kono
parents: 67
diff changeset
64 LTO_symtab_indirect_edge,
kono
parents: 67
diff changeset
65 LTO_symtab_variable,
kono
parents: 67
diff changeset
66 LTO_symtab_last_tag
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
67 };
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
68
111
kono
parents: 67
diff changeset
69 /* Create a new symtab encoder.
kono
parents: 67
diff changeset
70 if FOR_INPUT, the encoder allocate only datastructures needed
kono
parents: 67
diff changeset
71 to read the symtab. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72
111
kono
parents: 67
diff changeset
73 lto_symtab_encoder_t
kono
parents: 67
diff changeset
74 lto_symtab_encoder_new (bool for_input)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 {
111
kono
parents: 67
diff changeset
76 lto_symtab_encoder_t encoder = XCNEW (struct lto_symtab_encoder_d);
kono
parents: 67
diff changeset
77
kono
parents: 67
diff changeset
78 if (!for_input)
kono
parents: 67
diff changeset
79 encoder->map = new hash_map<symtab_node *, size_t>;
kono
parents: 67
diff changeset
80 encoder->nodes.create (0);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 return encoder;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 /* Delete ENCODER and its components. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 void
111
kono
parents: 67
diff changeset
88 lto_symtab_encoder_delete (lto_symtab_encoder_t encoder)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 {
111
kono
parents: 67
diff changeset
90 encoder->nodes.release ();
kono
parents: 67
diff changeset
91 if (encoder->map)
kono
parents: 67
diff changeset
92 delete encoder->map;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 free (encoder);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96
111
kono
parents: 67
diff changeset
97 /* Return the existing reference number of NODE in the symtab encoder in
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 output block OB. Assign a new reference if this is the first time
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 NODE is encoded. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 int
111
kono
parents: 67
diff changeset
102 lto_symtab_encoder_encode (lto_symtab_encoder_t encoder,
kono
parents: 67
diff changeset
103 symtab_node *node)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 int ref;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106
111
kono
parents: 67
diff changeset
107 if (!encoder->map)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 {
111
kono
parents: 67
diff changeset
109 lto_encoder_entry entry = {node, false, false, false};
kono
parents: 67
diff changeset
110
kono
parents: 67
diff changeset
111 ref = encoder->nodes.length ();
kono
parents: 67
diff changeset
112 encoder->nodes.safe_push (entry);
kono
parents: 67
diff changeset
113 return ref;
kono
parents: 67
diff changeset
114 }
kono
parents: 67
diff changeset
115
kono
parents: 67
diff changeset
116 size_t *slot = encoder->map->get (node);
kono
parents: 67
diff changeset
117 if (!slot || !*slot)
kono
parents: 67
diff changeset
118 {
kono
parents: 67
diff changeset
119 lto_encoder_entry entry = {node, false, false, false};
kono
parents: 67
diff changeset
120 ref = encoder->nodes.length ();
kono
parents: 67
diff changeset
121 if (!slot)
kono
parents: 67
diff changeset
122 encoder->map->put (node, ref + 1);
kono
parents: 67
diff changeset
123 encoder->nodes.safe_push (entry);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 else
111
kono
parents: 67
diff changeset
126 ref = *slot - 1;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 return ref;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
111
kono
parents: 67
diff changeset
131 /* Remove NODE from encoder. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132
111
kono
parents: 67
diff changeset
133 bool
kono
parents: 67
diff changeset
134 lto_symtab_encoder_delete_node (lto_symtab_encoder_t encoder,
kono
parents: 67
diff changeset
135 symtab_node *node)
kono
parents: 67
diff changeset
136 {
kono
parents: 67
diff changeset
137 int index;
kono
parents: 67
diff changeset
138 lto_encoder_entry last_node;
kono
parents: 67
diff changeset
139
kono
parents: 67
diff changeset
140 size_t *slot = encoder->map->get (node);
kono
parents: 67
diff changeset
141 if (slot == NULL || !*slot)
kono
parents: 67
diff changeset
142 return false;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
143
111
kono
parents: 67
diff changeset
144 index = *slot - 1;
kono
parents: 67
diff changeset
145 gcc_checking_assert (encoder->nodes[index].node == node);
kono
parents: 67
diff changeset
146
kono
parents: 67
diff changeset
147 /* Remove from vector. We do this by swapping node with the last element
kono
parents: 67
diff changeset
148 of the vector. */
kono
parents: 67
diff changeset
149 last_node = encoder->nodes.pop ();
kono
parents: 67
diff changeset
150 if (last_node.node != node)
kono
parents: 67
diff changeset
151 {
kono
parents: 67
diff changeset
152 gcc_assert (encoder->map->put (last_node.node, index + 1));
kono
parents: 67
diff changeset
153
kono
parents: 67
diff changeset
154 /* Move the last element to the original spot of NODE. */
kono
parents: 67
diff changeset
155 encoder->nodes[index] = last_node;
kono
parents: 67
diff changeset
156 }
kono
parents: 67
diff changeset
157
kono
parents: 67
diff changeset
158 /* Remove element from hash table. */
kono
parents: 67
diff changeset
159 encoder->map->remove (node);
kono
parents: 67
diff changeset
160 return true;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
161 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
162
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
163
111
kono
parents: 67
diff changeset
164 /* Return TRUE if we should encode the body of NODE (if any). */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
165
111
kono
parents: 67
diff changeset
166 bool
kono
parents: 67
diff changeset
167 lto_symtab_encoder_encode_body_p (lto_symtab_encoder_t encoder,
kono
parents: 67
diff changeset
168 struct cgraph_node *node)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 {
111
kono
parents: 67
diff changeset
170 int index = lto_symtab_encoder_lookup (encoder, node);
kono
parents: 67
diff changeset
171 return encoder->nodes[index].body;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
173
111
kono
parents: 67
diff changeset
174 /* Specify that we encode the body of NODE in this partition. */
kono
parents: 67
diff changeset
175
kono
parents: 67
diff changeset
176 static void
kono
parents: 67
diff changeset
177 lto_set_symtab_encoder_encode_body (lto_symtab_encoder_t encoder,
kono
parents: 67
diff changeset
178 struct cgraph_node *node)
kono
parents: 67
diff changeset
179 {
kono
parents: 67
diff changeset
180 int index = lto_symtab_encoder_encode (encoder, node);
kono
parents: 67
diff changeset
181 gcc_checking_assert (encoder->nodes[index].node == node);
kono
parents: 67
diff changeset
182 encoder->nodes[index].body = true;
kono
parents: 67
diff changeset
183 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
184
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
185 /* Return TRUE if we should encode initializer of NODE (if any). */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
186
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
187 bool
111
kono
parents: 67
diff changeset
188 lto_symtab_encoder_encode_initializer_p (lto_symtab_encoder_t encoder,
kono
parents: 67
diff changeset
189 varpool_node *node)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
190 {
111
kono
parents: 67
diff changeset
191 int index = lto_symtab_encoder_lookup (encoder, node);
kono
parents: 67
diff changeset
192 if (index == LCC_NOT_FOUND)
kono
parents: 67
diff changeset
193 return false;
kono
parents: 67
diff changeset
194 return encoder->nodes[index].initializer;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
195 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
196
111
kono
parents: 67
diff changeset
197 /* Specify that we should encode initializer of NODE (if any). */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
198
111
kono
parents: 67
diff changeset
199 static void
kono
parents: 67
diff changeset
200 lto_set_symtab_encoder_encode_initializer (lto_symtab_encoder_t encoder,
kono
parents: 67
diff changeset
201 varpool_node *node)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
202 {
111
kono
parents: 67
diff changeset
203 int index = lto_symtab_encoder_lookup (encoder, node);
kono
parents: 67
diff changeset
204 encoder->nodes[index].initializer = true;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
205 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
206
111
kono
parents: 67
diff changeset
207 /* Return TRUE if NODE is in this partition. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
208
111
kono
parents: 67
diff changeset
209 bool
kono
parents: 67
diff changeset
210 lto_symtab_encoder_in_partition_p (lto_symtab_encoder_t encoder,
kono
parents: 67
diff changeset
211 symtab_node *node)
kono
parents: 67
diff changeset
212 {
kono
parents: 67
diff changeset
213 int index = lto_symtab_encoder_lookup (encoder, node);
kono
parents: 67
diff changeset
214 if (index == LCC_NOT_FOUND)
kono
parents: 67
diff changeset
215 return false;
kono
parents: 67
diff changeset
216 return encoder->nodes[index].in_partition;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
217 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
218
111
kono
parents: 67
diff changeset
219 /* Specify that NODE is in this partition. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
220
111
kono
parents: 67
diff changeset
221 void
kono
parents: 67
diff changeset
222 lto_set_symtab_encoder_in_partition (lto_symtab_encoder_t encoder,
kono
parents: 67
diff changeset
223 symtab_node *node)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
224 {
111
kono
parents: 67
diff changeset
225 int index = lto_symtab_encoder_encode (encoder, node);
kono
parents: 67
diff changeset
226 encoder->nodes[index].in_partition = true;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
227 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
228
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
229 /* Output the cgraph EDGE to OB using ENCODER. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
230
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
231 static void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
232 lto_output_edge (struct lto_simple_output_block *ob, struct cgraph_edge *edge,
111
kono
parents: 67
diff changeset
233 lto_symtab_encoder_t encoder)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
234 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
235 unsigned int uid;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
236 intptr_t ref;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
237 struct bitpack_d bp;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
238
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
239 if (edge->indirect_unknown_callee)
111
kono
parents: 67
diff changeset
240 streamer_write_enum (ob->main_stream, LTO_symtab_tags, LTO_symtab_last_tag,
kono
parents: 67
diff changeset
241 LTO_symtab_indirect_edge);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
242 else
111
kono
parents: 67
diff changeset
243 streamer_write_enum (ob->main_stream, LTO_symtab_tags, LTO_symtab_last_tag,
kono
parents: 67
diff changeset
244 LTO_symtab_edge);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
245
111
kono
parents: 67
diff changeset
246 ref = lto_symtab_encoder_lookup (encoder, edge->caller);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 gcc_assert (ref != LCC_NOT_FOUND);
111
kono
parents: 67
diff changeset
248 streamer_write_hwi_stream (ob->main_stream, ref);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
249
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
250 if (!edge->indirect_unknown_callee)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
251 {
111
kono
parents: 67
diff changeset
252 ref = lto_symtab_encoder_lookup (encoder, edge->callee);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
253 gcc_assert (ref != LCC_NOT_FOUND);
111
kono
parents: 67
diff changeset
254 streamer_write_hwi_stream (ob->main_stream, ref);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
255 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
256
111
kono
parents: 67
diff changeset
257 edge->count.stream_out (ob->main_stream);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
258
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
259 bp = bitpack_create (ob->main_stream);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
260 uid = !edge->call_stmt ? edge->lto_stmt_uid
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
261 : gimple_uid (edge->call_stmt) + 1;
111
kono
parents: 67
diff changeset
262 bp_pack_enum (&bp, cgraph_inline_failed_t,
kono
parents: 67
diff changeset
263 CIF_N_REASONS, edge->inline_failed);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
264 gcc_checking_assert (uid || edge->caller->thunk.thunk_p);
111
kono
parents: 67
diff changeset
265 bp_pack_var_len_unsigned (&bp, uid);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
266 bp_pack_value (&bp, edge->speculative_id, 16);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
267 bp_pack_value (&bp, edge->indirect_inlining_edge, 1);
111
kono
parents: 67
diff changeset
268 bp_pack_value (&bp, edge->speculative, 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
269 bp_pack_value (&bp, edge->call_stmt_cannot_inline_p, 1);
111
kono
parents: 67
diff changeset
270 gcc_assert (!edge->call_stmt_cannot_inline_p
kono
parents: 67
diff changeset
271 || edge->inline_failed != CIF_BODY_NOT_AVAILABLE);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
272 bp_pack_value (&bp, edge->can_throw_external, 1);
111
kono
parents: 67
diff changeset
273 bp_pack_value (&bp, edge->in_polymorphic_cdtor, 1);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
274 if (edge->indirect_unknown_callee)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
275 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
276 int flags = edge->indirect_info->ecf_flags;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
277 bp_pack_value (&bp, (flags & ECF_CONST) != 0, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
278 bp_pack_value (&bp, (flags & ECF_PURE) != 0, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
279 bp_pack_value (&bp, (flags & ECF_NORETURN) != 0, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
280 bp_pack_value (&bp, (flags & ECF_MALLOC) != 0, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
281 bp_pack_value (&bp, (flags & ECF_NOTHROW) != 0, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
282 bp_pack_value (&bp, (flags & ECF_RETURNS_TWICE) != 0, 1);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
283 /* Flags that should not appear on indirect calls. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
284 gcc_assert (!(flags & (ECF_LOOPING_CONST_OR_PURE
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
285 | ECF_MAY_BE_ALLOCA
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
286 | ECF_SIBCALL
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
287 | ECF_LEAF
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
288 | ECF_NOVOPS)));
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
289
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
290 bp_pack_value (&bp, edge->indirect_info->num_speculative_call_targets,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
291 16);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
292 }
111
kono
parents: 67
diff changeset
293 streamer_write_bitpack (&bp);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
294 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
295
111
kono
parents: 67
diff changeset
296 /* Return if NODE contain references from other partitions. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
297
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
298 bool
111
kono
parents: 67
diff changeset
299 referenced_from_other_partition_p (symtab_node *node, lto_symtab_encoder_t encoder)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
300 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
301 int i;
111
kono
parents: 67
diff changeset
302 struct ipa_ref *ref = NULL;
kono
parents: 67
diff changeset
303
kono
parents: 67
diff changeset
304 for (i = 0; node->iterate_referring (i, ref); i++)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
305 {
111
kono
parents: 67
diff changeset
306 /* Ignore references from non-offloadable nodes while streaming NODE into
kono
parents: 67
diff changeset
307 offload LTO section. */
kono
parents: 67
diff changeset
308 if (!ref->referring->need_lto_streaming)
kono
parents: 67
diff changeset
309 continue;
kono
parents: 67
diff changeset
310
kono
parents: 67
diff changeset
311 if (ref->referring->in_other_partition
kono
parents: 67
diff changeset
312 || !lto_symtab_encoder_in_partition_p (encoder, ref->referring))
kono
parents: 67
diff changeset
313 return true;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
314 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
315 return false;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
316 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
317
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
318 /* Return true when node is reachable from other partition. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
319
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
320 bool
111
kono
parents: 67
diff changeset
321 reachable_from_other_partition_p (struct cgraph_node *node, lto_symtab_encoder_t encoder)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
322 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
323 struct cgraph_edge *e;
111
kono
parents: 67
diff changeset
324 if (!node->definition)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
325 return false;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
326 if (node->inlined_to)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
327 return false;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
328 for (e = node->callers; e; e = e->next_caller)
111
kono
parents: 67
diff changeset
329 {
kono
parents: 67
diff changeset
330 /* Ignore references from non-offloadable nodes while streaming NODE into
kono
parents: 67
diff changeset
331 offload LTO section. */
kono
parents: 67
diff changeset
332 if (!e->caller->need_lto_streaming)
kono
parents: 67
diff changeset
333 continue;
kono
parents: 67
diff changeset
334
kono
parents: 67
diff changeset
335 if (e->caller->in_other_partition
kono
parents: 67
diff changeset
336 || !lto_symtab_encoder_in_partition_p (encoder, e->caller))
kono
parents: 67
diff changeset
337 return true;
kono
parents: 67
diff changeset
338 }
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
339 return false;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
340 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
341
111
kono
parents: 67
diff changeset
342 /* Return if NODE contain references from other partitions. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
343
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
344 bool
111
kono
parents: 67
diff changeset
345 referenced_from_this_partition_p (symtab_node *node,
kono
parents: 67
diff changeset
346 lto_symtab_encoder_t encoder)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
347 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
348 int i;
111
kono
parents: 67
diff changeset
349 struct ipa_ref *ref = NULL;
kono
parents: 67
diff changeset
350
kono
parents: 67
diff changeset
351 for (i = 0; node->iterate_referring (i, ref); i++)
kono
parents: 67
diff changeset
352 if (lto_symtab_encoder_in_partition_p (encoder, ref->referring))
kono
parents: 67
diff changeset
353 return true;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
354 return false;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
355 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
356
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
357 /* Return true when node is reachable from other partition. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
358
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
359 bool
111
kono
parents: 67
diff changeset
360 reachable_from_this_partition_p (struct cgraph_node *node, lto_symtab_encoder_t encoder)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
361 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
362 struct cgraph_edge *e;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
363 for (e = node->callers; e; e = e->next_caller)
111
kono
parents: 67
diff changeset
364 if (lto_symtab_encoder_in_partition_p (encoder, e->caller))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
365 return true;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
366 return false;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
367 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
368
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
369 /* Output the cgraph NODE to OB. ENCODER is used to find the
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
370 reference number of NODE->inlined_to. SET is the set of nodes we
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
371 are writing to the current file. If NODE is not in SET, then NODE
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
372 is a boundary of a cgraph_node_set and we pretend NODE just has a
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
373 decl and no callees. WRITTEN_DECLS is the set of FUNCTION_DECLs
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
374 that have had their callgraph node written so far. This is used to
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
375 determine if NODE is a clone of a previously written node. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
376
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
377 static void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
378 lto_output_node (struct lto_simple_output_block *ob, struct cgraph_node *node,
111
kono
parents: 67
diff changeset
379 lto_symtab_encoder_t encoder)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
380 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
381 unsigned int tag;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
382 struct bitpack_d bp;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
383 bool boundary_p;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
384 intptr_t ref;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
385 bool in_other_partition = false;
111
kono
parents: 67
diff changeset
386 struct cgraph_node *clone_of, *ultimate_clone_of;
kono
parents: 67
diff changeset
387 ipa_opt_pass_d *pass;
kono
parents: 67
diff changeset
388 int i;
kono
parents: 67
diff changeset
389 const char *comdat;
kono
parents: 67
diff changeset
390 const char *section;
kono
parents: 67
diff changeset
391 tree group;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
392
111
kono
parents: 67
diff changeset
393 boundary_p = !lto_symtab_encoder_in_partition_p (encoder, node);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
394
111
kono
parents: 67
diff changeset
395 if (node->analyzed && (!boundary_p || node->alias
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
396 || (node->thunk.thunk_p && !node->inlined_to)))
111
kono
parents: 67
diff changeset
397 tag = LTO_symtab_analyzed_node;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
398 else
111
kono
parents: 67
diff changeset
399 tag = LTO_symtab_unavail_node;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
400
111
kono
parents: 67
diff changeset
401 streamer_write_enum (ob->main_stream, LTO_symtab_tags, LTO_symtab_last_tag,
kono
parents: 67
diff changeset
402 tag);
kono
parents: 67
diff changeset
403 streamer_write_hwi_stream (ob->main_stream, node->order);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
404
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
405 /* In WPA mode, we only output part of the call-graph. Also, we
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
406 fake cgraph node attributes. There are two cases that we care.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
407
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
408 Boundary nodes: There are nodes that are not part of SET but are
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
409 called from within SET. We artificially make them look like
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
410 externally visible nodes with no function body.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
411
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
412 Cherry-picked nodes: These are nodes we pulled from other
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
413 translation units into SET during IPA-inlining. We make them as
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
414 local static nodes to prevent clashes with other local statics. */
111
kono
parents: 67
diff changeset
415 if (boundary_p && node->analyzed
kono
parents: 67
diff changeset
416 && node->get_partitioning_class () == SYMBOL_PARTITION)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
417 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
418 /* Inline clones cannot be part of boundary.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
419 gcc_assert (!node->inlined_to);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
420
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
421 FIXME: At the moment they can be, when partition contains an inline
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
422 clone that is clone of inline clone from outside partition. We can
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
423 reshape the clone tree and make other tree to be the root, but it
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
424 needs a bit extra work and will be promplty done by cgraph_remove_node
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
425 after reading back. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
426 in_other_partition = 1;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
427 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
428
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
429 clone_of = node->clone_of;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
430 while (clone_of
111
kono
parents: 67
diff changeset
431 && (ref = lto_symtab_encoder_lookup (encoder, clone_of)) == LCC_NOT_FOUND)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
432 if (clone_of->prev_sibling_clone)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
433 clone_of = clone_of->prev_sibling_clone;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
434 else
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
435 clone_of = clone_of->clone_of;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
436
111
kono
parents: 67
diff changeset
437 /* See if body of the master function is output. If not, we are seeing only
kono
parents: 67
diff changeset
438 an declaration and we do not need to pass down clone tree. */
kono
parents: 67
diff changeset
439 ultimate_clone_of = clone_of;
kono
parents: 67
diff changeset
440 while (ultimate_clone_of && ultimate_clone_of->clone_of)
kono
parents: 67
diff changeset
441 ultimate_clone_of = ultimate_clone_of->clone_of;
kono
parents: 67
diff changeset
442
kono
parents: 67
diff changeset
443 if (clone_of && !lto_symtab_encoder_encode_body_p (encoder, ultimate_clone_of))
kono
parents: 67
diff changeset
444 clone_of = NULL;
kono
parents: 67
diff changeset
445
kono
parents: 67
diff changeset
446 if (tag == LTO_symtab_analyzed_node)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
447 gcc_assert (clone_of || !node->clone_of);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
448 if (!clone_of)
111
kono
parents: 67
diff changeset
449 streamer_write_hwi_stream (ob->main_stream, LCC_NOT_FOUND);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
450 else
111
kono
parents: 67
diff changeset
451 streamer_write_hwi_stream (ob->main_stream, ref);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
452
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
453
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
454 lto_output_fn_decl_index (ob->decl_state, ob->main_stream, node->decl);
111
kono
parents: 67
diff changeset
455 node->count.stream_out (ob->main_stream);
kono
parents: 67
diff changeset
456 streamer_write_hwi_stream (ob->main_stream, node->count_materialization_scale);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
457
111
kono
parents: 67
diff changeset
458 streamer_write_hwi_stream (ob->main_stream,
kono
parents: 67
diff changeset
459 node->ipa_transforms_to_apply.length ());
kono
parents: 67
diff changeset
460 FOR_EACH_VEC_ELT (node->ipa_transforms_to_apply, i, pass)
kono
parents: 67
diff changeset
461 streamer_write_hwi_stream (ob->main_stream, pass->static_pass_number);
kono
parents: 67
diff changeset
462
kono
parents: 67
diff changeset
463 if (tag == LTO_symtab_analyzed_node)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
464 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
465 if (node->inlined_to)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
466 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
467 ref = lto_symtab_encoder_lookup (encoder, node->inlined_to);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
468 gcc_assert (ref != LCC_NOT_FOUND);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
469 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
470 else
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
471 ref = LCC_NOT_FOUND;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
472
111
kono
parents: 67
diff changeset
473 streamer_write_hwi_stream (ob->main_stream, ref);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
475
111
kono
parents: 67
diff changeset
476 group = node->get_comdat_group ();
kono
parents: 67
diff changeset
477 if (group)
kono
parents: 67
diff changeset
478 comdat = IDENTIFIER_POINTER (group);
kono
parents: 67
diff changeset
479 else
kono
parents: 67
diff changeset
480 comdat = "";
kono
parents: 67
diff changeset
481 streamer_write_data_stream (ob->main_stream, comdat, strlen (comdat) + 1);
kono
parents: 67
diff changeset
482
kono
parents: 67
diff changeset
483 if (group)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
484 {
111
kono
parents: 67
diff changeset
485 if (node->same_comdat_group)
kono
parents: 67
diff changeset
486 {
kono
parents: 67
diff changeset
487 ref = LCC_NOT_FOUND;
kono
parents: 67
diff changeset
488 for (struct symtab_node *n = node->same_comdat_group;
kono
parents: 67
diff changeset
489 ref == LCC_NOT_FOUND && n != node; n = n->same_comdat_group)
kono
parents: 67
diff changeset
490 ref = lto_symtab_encoder_lookup (encoder, n);
kono
parents: 67
diff changeset
491 }
kono
parents: 67
diff changeset
492 else
kono
parents: 67
diff changeset
493 ref = LCC_NOT_FOUND;
kono
parents: 67
diff changeset
494 streamer_write_hwi_stream (ob->main_stream, ref);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
495 }
111
kono
parents: 67
diff changeset
496
kono
parents: 67
diff changeset
497 section = node->get_section ();
kono
parents: 67
diff changeset
498 if (!section)
kono
parents: 67
diff changeset
499 section = "";
kono
parents: 67
diff changeset
500
kono
parents: 67
diff changeset
501 streamer_write_hwi_stream (ob->main_stream, node->tp_first_run);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
502
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
503 bp = bitpack_create (ob->main_stream);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
504 bp_pack_value (&bp, node->local, 1);
111
kono
parents: 67
diff changeset
505 bp_pack_value (&bp, node->externally_visible, 1);
kono
parents: 67
diff changeset
506 bp_pack_value (&bp, node->no_reorder, 1);
kono
parents: 67
diff changeset
507 bp_pack_value (&bp, node->definition, 1);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
508 bp_pack_value (&bp, node->versionable, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
509 bp_pack_value (&bp, node->can_change_signature, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
510 bp_pack_value (&bp, node->redefined_extern_inline, 1);
111
kono
parents: 67
diff changeset
511 bp_pack_value (&bp, node->force_output, 1);
kono
parents: 67
diff changeset
512 bp_pack_value (&bp, node->forced_by_abi, 1);
kono
parents: 67
diff changeset
513 bp_pack_value (&bp, node->unique_name, 1);
kono
parents: 67
diff changeset
514 bp_pack_value (&bp, node->body_removed, 1);
kono
parents: 67
diff changeset
515 bp_pack_value (&bp, node->implicit_section, 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
516 bp_pack_value (&bp, node->address_taken, 1);
111
kono
parents: 67
diff changeset
517 bp_pack_value (&bp, tag == LTO_symtab_analyzed_node
kono
parents: 67
diff changeset
518 && node->get_partitioning_class () == SYMBOL_PARTITION
kono
parents: 67
diff changeset
519 && (reachable_from_other_partition_p (node, encoder)
kono
parents: 67
diff changeset
520 || referenced_from_other_partition_p (node, encoder)), 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
521 bp_pack_value (&bp, node->lowered, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
522 bp_pack_value (&bp, in_other_partition, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
523 bp_pack_value (&bp, node->alias, 1);
111
kono
parents: 67
diff changeset
524 bp_pack_value (&bp, node->transparent_alias, 1);
kono
parents: 67
diff changeset
525 bp_pack_value (&bp, node->weakref, 1);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
526 bp_pack_value (&bp, node->symver, 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
527 bp_pack_value (&bp, node->frequency, 2);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
528 bp_pack_value (&bp, node->only_called_at_startup, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
529 bp_pack_value (&bp, node->only_called_at_exit, 1);
111
kono
parents: 67
diff changeset
530 bp_pack_value (&bp, node->tm_clone, 1);
kono
parents: 67
diff changeset
531 bp_pack_value (&bp, node->calls_comdat_local, 1);
kono
parents: 67
diff changeset
532 bp_pack_value (&bp, node->icf_merged, 1);
kono
parents: 67
diff changeset
533 bp_pack_value (&bp, node->nonfreeing_fn, 1);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
534 bp_pack_value (&bp, node->merged_comdat, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
535 bp_pack_value (&bp, node->merged_extern_inline, 1);
111
kono
parents: 67
diff changeset
536 bp_pack_value (&bp, node->thunk.thunk_p, 1);
kono
parents: 67
diff changeset
537 bp_pack_value (&bp, node->parallelized_function, 1);
kono
parents: 67
diff changeset
538 bp_pack_enum (&bp, ld_plugin_symbol_resolution,
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
539 LDPR_NUM_KNOWN,
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
540 /* When doing incremental link, we will get new resolution
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
541 info next time we process the file. */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
542 flag_incremental_link ? LDPR_UNKNOWN : node->resolution);
111
kono
parents: 67
diff changeset
543 bp_pack_value (&bp, node->split_part, 1);
kono
parents: 67
diff changeset
544 streamer_write_bitpack (&bp);
kono
parents: 67
diff changeset
545 streamer_write_data_stream (ob->main_stream, section, strlen (section) + 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
546
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
547 /* Stream thunk info always because we use it in
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
548 ipa_polymorphic_call_context::ipa_polymorphic_call_context
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
549 to properly interpret THIS pointers for thunks that has been converted
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
550 to Gimple. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
551 if (node->definition)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
552 {
111
kono
parents: 67
diff changeset
553 streamer_write_uhwi_stream
kono
parents: 67
diff changeset
554 (ob->main_stream,
kono
parents: 67
diff changeset
555 1 + (node->thunk.this_adjusting != 0) * 2
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
556 + (node->thunk.virtual_offset_p != 0) * 4);
111
kono
parents: 67
diff changeset
557 streamer_write_uhwi_stream (ob->main_stream, node->thunk.fixed_offset);
kono
parents: 67
diff changeset
558 streamer_write_uhwi_stream (ob->main_stream, node->thunk.virtual_value);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
559 streamer_write_uhwi_stream (ob->main_stream, node->thunk.indirect_offset);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
560 }
111
kono
parents: 67
diff changeset
561 streamer_write_hwi_stream (ob->main_stream, node->profile_id);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
562 streamer_write_hwi_stream (ob->main_stream, node->unit_id);
111
kono
parents: 67
diff changeset
563 if (DECL_STATIC_CONSTRUCTOR (node->decl))
kono
parents: 67
diff changeset
564 streamer_write_hwi_stream (ob->main_stream, node->get_init_priority ());
kono
parents: 67
diff changeset
565 if (DECL_STATIC_DESTRUCTOR (node->decl))
kono
parents: 67
diff changeset
566 streamer_write_hwi_stream (ob->main_stream, node->get_fini_priority ());
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
567 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
568
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
569 /* Output the varpool NODE to OB.
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
570 If NODE is not in SET, then NODE is a boundary. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
571
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
572 static void
111
kono
parents: 67
diff changeset
573 lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node,
kono
parents: 67
diff changeset
574 lto_symtab_encoder_t encoder)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
575 {
111
kono
parents: 67
diff changeset
576 bool boundary_p = !lto_symtab_encoder_in_partition_p (encoder, node);
kono
parents: 67
diff changeset
577 bool encode_initializer_p
kono
parents: 67
diff changeset
578 = (node->definition
kono
parents: 67
diff changeset
579 && lto_symtab_encoder_encode_initializer_p (encoder, node));
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
580 struct bitpack_d bp;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
581 int ref;
111
kono
parents: 67
diff changeset
582 const char *comdat;
kono
parents: 67
diff changeset
583 const char *section;
kono
parents: 67
diff changeset
584 tree group;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
585
111
kono
parents: 67
diff changeset
586 gcc_assert (!encode_initializer_p || node->definition);
kono
parents: 67
diff changeset
587 gcc_assert (boundary_p || encode_initializer_p);
kono
parents: 67
diff changeset
588
kono
parents: 67
diff changeset
589 streamer_write_enum (ob->main_stream, LTO_symtab_tags, LTO_symtab_last_tag,
kono
parents: 67
diff changeset
590 LTO_symtab_variable);
kono
parents: 67
diff changeset
591 streamer_write_hwi_stream (ob->main_stream, node->order);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
592 lto_output_var_decl_index (ob->decl_state, ob->main_stream, node->decl);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
593 bp = bitpack_create (ob->main_stream);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
594 bp_pack_value (&bp, node->externally_visible, 1);
111
kono
parents: 67
diff changeset
595 bp_pack_value (&bp, node->no_reorder, 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
596 bp_pack_value (&bp, node->force_output, 1);
111
kono
parents: 67
diff changeset
597 bp_pack_value (&bp, node->forced_by_abi, 1);
kono
parents: 67
diff changeset
598 bp_pack_value (&bp, node->unique_name, 1);
kono
parents: 67
diff changeset
599 bp_pack_value (&bp,
kono
parents: 67
diff changeset
600 node->body_removed
kono
parents: 67
diff changeset
601 || (!encode_initializer_p && !node->alias && node->definition),
kono
parents: 67
diff changeset
602 1);
kono
parents: 67
diff changeset
603 bp_pack_value (&bp, node->implicit_section, 1);
kono
parents: 67
diff changeset
604 bp_pack_value (&bp, node->writeonly, 1);
kono
parents: 67
diff changeset
605 bp_pack_value (&bp, node->definition && (encode_initializer_p || node->alias),
kono
parents: 67
diff changeset
606 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
607 bp_pack_value (&bp, node->alias, 1);
111
kono
parents: 67
diff changeset
608 bp_pack_value (&bp, node->transparent_alias, 1);
kono
parents: 67
diff changeset
609 bp_pack_value (&bp, node->weakref, 1);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
610 bp_pack_value (&bp, node->symver, 1);
111
kono
parents: 67
diff changeset
611 bp_pack_value (&bp, node->analyzed && (!boundary_p || node->alias), 1);
kono
parents: 67
diff changeset
612 gcc_assert (node->definition || !node->analyzed);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
613 /* Constant pool initializers can be de-unified into individual ltrans units.
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
614 FIXME: Alternatively at -Os we may want to avoid generating for them the local
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
615 labels and share them across LTRANS partitions. */
111
kono
parents: 67
diff changeset
616 if (node->get_partitioning_class () != SYMBOL_PARTITION)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
617 {
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
618 bp_pack_value (&bp, 0, 1); /* used_from_other_parition. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
619 bp_pack_value (&bp, 0, 1); /* in_other_partition. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
620 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
621 else
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
622 {
111
kono
parents: 67
diff changeset
623 bp_pack_value (&bp, node->definition
kono
parents: 67
diff changeset
624 && referenced_from_other_partition_p (node, encoder), 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
625 bp_pack_value (&bp, node->analyzed
111
kono
parents: 67
diff changeset
626 && boundary_p && !DECL_EXTERNAL (node->decl), 1);
kono
parents: 67
diff changeset
627 /* in_other_partition. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
628 }
111
kono
parents: 67
diff changeset
629 bp_pack_value (&bp, node->tls_model, 3);
kono
parents: 67
diff changeset
630 bp_pack_value (&bp, node->used_by_single_function, 1);
kono
parents: 67
diff changeset
631 bp_pack_value (&bp, node->dynamically_initialized, 1);
kono
parents: 67
diff changeset
632 streamer_write_bitpack (&bp);
kono
parents: 67
diff changeset
633
kono
parents: 67
diff changeset
634 group = node->get_comdat_group ();
kono
parents: 67
diff changeset
635 if (group)
kono
parents: 67
diff changeset
636 comdat = IDENTIFIER_POINTER (group);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
637 else
111
kono
parents: 67
diff changeset
638 comdat = "";
kono
parents: 67
diff changeset
639 streamer_write_data_stream (ob->main_stream, comdat, strlen (comdat) + 1);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
640
111
kono
parents: 67
diff changeset
641 if (group)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
642 {
111
kono
parents: 67
diff changeset
643 if (node->same_comdat_group)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
644 {
111
kono
parents: 67
diff changeset
645 ref = LCC_NOT_FOUND;
kono
parents: 67
diff changeset
646 for (struct symtab_node *n = node->same_comdat_group;
kono
parents: 67
diff changeset
647 ref == LCC_NOT_FOUND && n != node; n = n->same_comdat_group)
kono
parents: 67
diff changeset
648 ref = lto_symtab_encoder_lookup (encoder, n);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
649 }
111
kono
parents: 67
diff changeset
650 else
kono
parents: 67
diff changeset
651 ref = LCC_NOT_FOUND;
kono
parents: 67
diff changeset
652 streamer_write_hwi_stream (ob->main_stream, ref);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
653 }
111
kono
parents: 67
diff changeset
654
kono
parents: 67
diff changeset
655 section = node->get_section ();
kono
parents: 67
diff changeset
656 if (!section)
kono
parents: 67
diff changeset
657 section = "";
kono
parents: 67
diff changeset
658 streamer_write_data_stream (ob->main_stream, section, strlen (section) + 1);
kono
parents: 67
diff changeset
659
kono
parents: 67
diff changeset
660 streamer_write_enum (ob->main_stream, ld_plugin_symbol_resolution,
kono
parents: 67
diff changeset
661 LDPR_NUM_KNOWN, node->resolution);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
662 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
663
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
664 /* Output the varpool NODE to OB.
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
665 If NODE is not in SET, then NODE is a boundary. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
666
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
667 static void
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
668 lto_output_ref (struct lto_simple_output_block *ob, struct ipa_ref *ref,
111
kono
parents: 67
diff changeset
669 lto_symtab_encoder_t encoder)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
670 {
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
671 struct bitpack_d bp;
111
kono
parents: 67
diff changeset
672 int nref;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
673 int uid = !ref->stmt ? ref->lto_stmt_uid : gimple_uid (ref->stmt) + 1;
111
kono
parents: 67
diff changeset
674 struct cgraph_node *node;
kono
parents: 67
diff changeset
675
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
676 bp = bitpack_create (ob->main_stream);
111
kono
parents: 67
diff changeset
677 bp_pack_value (&bp, ref->use, 3);
kono
parents: 67
diff changeset
678 bp_pack_value (&bp, ref->speculative, 1);
kono
parents: 67
diff changeset
679 streamer_write_bitpack (&bp);
kono
parents: 67
diff changeset
680 nref = lto_symtab_encoder_lookup (encoder, ref->referred);
kono
parents: 67
diff changeset
681 gcc_assert (nref != LCC_NOT_FOUND);
kono
parents: 67
diff changeset
682 streamer_write_hwi_stream (ob->main_stream, nref);
kono
parents: 67
diff changeset
683
kono
parents: 67
diff changeset
684 node = dyn_cast <cgraph_node *> (ref->referring);
kono
parents: 67
diff changeset
685 if (node)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
686 {
111
kono
parents: 67
diff changeset
687 if (ref->stmt)
kono
parents: 67
diff changeset
688 uid = gimple_uid (ref->stmt) + 1;
kono
parents: 67
diff changeset
689 streamer_write_hwi_stream (ob->main_stream, uid);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
690 bp_pack_value (&bp, ref->speculative_id, 16);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
691 streamer_write_bitpack (&bp);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
692 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
693 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
694
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
695 /* Stream out profile_summary to OB. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
696
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
697 static void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
698 output_profile_summary (struct lto_simple_output_block *ob)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
699 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
700 if (profile_info)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
701 {
111
kono
parents: 67
diff changeset
702 /* We do not output num and run_max, they are not used by
kono
parents: 67
diff changeset
703 GCC profile feedback and they are difficult to merge from multiple
kono
parents: 67
diff changeset
704 units. */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
705 unsigned runs = (profile_info->runs);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
706 streamer_write_uhwi_stream (ob->main_stream, runs);
111
kono
parents: 67
diff changeset
707
kono
parents: 67
diff changeset
708 /* IPA-profile computes hot bb threshold based on cumulated
kono
parents: 67
diff changeset
709 whole program profile. We need to stream it down to ltrans. */
kono
parents: 67
diff changeset
710 if (flag_wpa)
kono
parents: 67
diff changeset
711 streamer_write_gcov_count_stream (ob->main_stream,
kono
parents: 67
diff changeset
712 get_hot_bb_threshold ());
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
713 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
714 else
111
kono
parents: 67
diff changeset
715 streamer_write_uhwi_stream (ob->main_stream, 0);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
716 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
717
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
718 /* Output all callees or indirect outgoing edges. EDGE must be the first such
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
719 edge. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
720
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
721 static void
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
722 output_outgoing_cgraph_edges (struct cgraph_edge *edge,
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
723 struct lto_simple_output_block *ob,
111
kono
parents: 67
diff changeset
724 lto_symtab_encoder_t encoder)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
725 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
726 if (!edge)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
727 return;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
728
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
729 /* Output edges in backward direction, so the reconstructed callgraph match
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
730 and it is easy to associate call sites in the IPA pass summaries. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
731 while (edge->next_callee)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
732 edge = edge->next_callee;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
733 for (; edge; edge = edge->prev_callee)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
734 lto_output_edge (ob, edge, encoder);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
735 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
736
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
737 /* Output the part of the cgraph in SET. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
738
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
739 static void
111
kono
parents: 67
diff changeset
740 output_refs (lto_symtab_encoder_t encoder)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
741 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
742 struct lto_simple_output_block *ob;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
743 int count;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
744 struct ipa_ref *ref;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
745
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
746 ob = lto_create_simple_output_block (LTO_section_refs);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
747
111
kono
parents: 67
diff changeset
748 for (int i = 0; i < lto_symtab_encoder_size (encoder); i++)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
749 {
111
kono
parents: 67
diff changeset
750 symtab_node *node = lto_symtab_encoder_deref (encoder, i);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
751
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
752 /* IPA_REF_ALIAS references are always preserved
111
kono
parents: 67
diff changeset
753 in the boundary. Alias node can't have other references and
kono
parents: 67
diff changeset
754 can be always handled as if it's not in the boundary. */
kono
parents: 67
diff changeset
755 if (!node->alias && !lto_symtab_encoder_in_partition_p (encoder, node))
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
756 continue;
111
kono
parents: 67
diff changeset
757
kono
parents: 67
diff changeset
758 count = node->ref_list.nreferences ();
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
759 if (count)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
760 {
111
kono
parents: 67
diff changeset
761 streamer_write_gcov_count_stream (ob->main_stream, count);
kono
parents: 67
diff changeset
762 streamer_write_uhwi_stream (ob->main_stream,
kono
parents: 67
diff changeset
763 lto_symtab_encoder_lookup (encoder, node));
kono
parents: 67
diff changeset
764 for (int i = 0; node->iterate_reference (i, ref); i++)
kono
parents: 67
diff changeset
765 lto_output_ref (ob, ref, encoder);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
766 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
767 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
768
111
kono
parents: 67
diff changeset
769 streamer_write_uhwi_stream (ob->main_stream, 0);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
770
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
771 lto_destroy_simple_output_block (ob);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
772 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
773
111
kono
parents: 67
diff changeset
774 /* Add NODE into encoder as well as nodes it is cloned from.
kono
parents: 67
diff changeset
775 Do it in a way so clones appear first. */
kono
parents: 67
diff changeset
776
kono
parents: 67
diff changeset
777 static void
kono
parents: 67
diff changeset
778 add_node_to (lto_symtab_encoder_t encoder, struct cgraph_node *node,
kono
parents: 67
diff changeset
779 bool include_body)
kono
parents: 67
diff changeset
780 {
kono
parents: 67
diff changeset
781 if (node->clone_of)
kono
parents: 67
diff changeset
782 add_node_to (encoder, node->clone_of, include_body);
kono
parents: 67
diff changeset
783 else if (include_body)
kono
parents: 67
diff changeset
784 lto_set_symtab_encoder_encode_body (encoder, node);
kono
parents: 67
diff changeset
785 lto_symtab_encoder_encode (encoder, node);
kono
parents: 67
diff changeset
786 }
kono
parents: 67
diff changeset
787
kono
parents: 67
diff changeset
788 /* Add all references in NODE to encoders. */
kono
parents: 67
diff changeset
789
kono
parents: 67
diff changeset
790 static void
kono
parents: 67
diff changeset
791 create_references (lto_symtab_encoder_t encoder, symtab_node *node)
kono
parents: 67
diff changeset
792 {
kono
parents: 67
diff changeset
793 int i;
kono
parents: 67
diff changeset
794 struct ipa_ref *ref = NULL;
kono
parents: 67
diff changeset
795 for (i = 0; node->iterate_reference (i, ref); i++)
kono
parents: 67
diff changeset
796 if (is_a <cgraph_node *> (ref->referred))
kono
parents: 67
diff changeset
797 add_node_to (encoder, dyn_cast <cgraph_node *> (ref->referred), false);
kono
parents: 67
diff changeset
798 else
kono
parents: 67
diff changeset
799 lto_symtab_encoder_encode (encoder, ref->referred);
kono
parents: 67
diff changeset
800 }
kono
parents: 67
diff changeset
801
kono
parents: 67
diff changeset
802 /* Select what needs to be streamed out. In regular lto mode stream everything.
kono
parents: 67
diff changeset
803 In offload lto mode stream only nodes marked as offloadable. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
804 void
111
kono
parents: 67
diff changeset
805 select_what_to_stream (void)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
806 {
111
kono
parents: 67
diff changeset
807 struct symtab_node *snode;
kono
parents: 67
diff changeset
808 FOR_EACH_SYMBOL (snode)
kono
parents: 67
diff changeset
809 snode->need_lto_streaming = !lto_stream_offload_p || snode->offloadable;
kono
parents: 67
diff changeset
810 }
kono
parents: 67
diff changeset
811
kono
parents: 67
diff changeset
812 /* Find all symbols we want to stream into given partition and insert them
kono
parents: 67
diff changeset
813 to encoders.
kono
parents: 67
diff changeset
814
kono
parents: 67
diff changeset
815 The function actually replaces IN_ENCODER by new one. The reason is that
kono
parents: 67
diff changeset
816 streaming code needs clone's origin to be streamed before clone. This
kono
parents: 67
diff changeset
817 means that we need to insert the nodes in specific order. This order is
kono
parents: 67
diff changeset
818 ignored by the partitioning logic earlier. */
kono
parents: 67
diff changeset
819
kono
parents: 67
diff changeset
820 lto_symtab_encoder_t
kono
parents: 67
diff changeset
821 compute_ltrans_boundary (lto_symtab_encoder_t in_encoder)
kono
parents: 67
diff changeset
822 {
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
823 struct cgraph_edge *edge;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
824 int i;
111
kono
parents: 67
diff changeset
825 lto_symtab_encoder_t encoder;
kono
parents: 67
diff changeset
826 lto_symtab_encoder_iterator lsei;
kono
parents: 67
diff changeset
827 hash_set<void *> reachable_call_targets;
kono
parents: 67
diff changeset
828
kono
parents: 67
diff changeset
829 encoder = lto_symtab_encoder_new (false);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
830
111
kono
parents: 67
diff changeset
831 /* Go over all entries in the IN_ENCODER and duplicate them to
kono
parents: 67
diff changeset
832 ENCODER. At the same time insert masters of clones so
kono
parents: 67
diff changeset
833 every master appears before clone. */
kono
parents: 67
diff changeset
834 for (lsei = lsei_start_function_in_partition (in_encoder);
kono
parents: 67
diff changeset
835 !lsei_end_p (lsei); lsei_next_function_in_partition (&lsei))
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
836 {
111
kono
parents: 67
diff changeset
837 struct cgraph_node *node = lsei_cgraph_node (lsei);
kono
parents: 67
diff changeset
838 if (!node->need_lto_streaming)
kono
parents: 67
diff changeset
839 continue;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
840 add_node_to (encoder, node, true);
111
kono
parents: 67
diff changeset
841 lto_set_symtab_encoder_in_partition (encoder, node);
kono
parents: 67
diff changeset
842 create_references (encoder, node);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
843 }
111
kono
parents: 67
diff changeset
844 for (lsei = lsei_start_variable_in_partition (in_encoder);
kono
parents: 67
diff changeset
845 !lsei_end_p (lsei); lsei_next_variable_in_partition (&lsei))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
846 {
111
kono
parents: 67
diff changeset
847 varpool_node *vnode = lsei_varpool_node (lsei);
kono
parents: 67
diff changeset
848
kono
parents: 67
diff changeset
849 if (!vnode->need_lto_streaming)
kono
parents: 67
diff changeset
850 continue;
kono
parents: 67
diff changeset
851 lto_set_symtab_encoder_in_partition (encoder, vnode);
kono
parents: 67
diff changeset
852 lto_set_symtab_encoder_encode_initializer (encoder, vnode);
kono
parents: 67
diff changeset
853 create_references (encoder, vnode);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
854 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
855 /* Pickle in also the initializer of all referenced readonly variables
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
856 to help folding. Constant pool variables are not shared, so we must
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
857 pickle those too. */
111
kono
parents: 67
diff changeset
858 for (i = 0; i < lto_symtab_encoder_size (encoder); i++)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
859 {
111
kono
parents: 67
diff changeset
860 symtab_node *node = lto_symtab_encoder_deref (encoder, i);
kono
parents: 67
diff changeset
861 if (varpool_node *vnode = dyn_cast <varpool_node *> (node))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
862 {
111
kono
parents: 67
diff changeset
863 if (!lto_symtab_encoder_encode_initializer_p (encoder,
kono
parents: 67
diff changeset
864 vnode)
kono
parents: 67
diff changeset
865 && (((vnode->ctor_useable_for_folding_p ()
kono
parents: 67
diff changeset
866 && (!DECL_VIRTUAL_P (vnode->decl)
kono
parents: 67
diff changeset
867 || !flag_wpa
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
868 || flag_ltrans_devirtualize)))))
111
kono
parents: 67
diff changeset
869 {
kono
parents: 67
diff changeset
870 lto_set_symtab_encoder_encode_initializer (encoder, vnode);
kono
parents: 67
diff changeset
871 create_references (encoder, vnode);
kono
parents: 67
diff changeset
872 }
kono
parents: 67
diff changeset
873 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
874 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
875
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
876 /* Go over all the nodes again to include callees that are not in
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
877 SET. */
111
kono
parents: 67
diff changeset
878 for (lsei = lsei_start_function_in_partition (encoder);
kono
parents: 67
diff changeset
879 !lsei_end_p (lsei); lsei_next_function_in_partition (&lsei))
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
880 {
111
kono
parents: 67
diff changeset
881 struct cgraph_node *node = lsei_cgraph_node (lsei);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
882 for (edge = node->callees; edge; edge = edge->next_callee)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
883 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
884 struct cgraph_node *callee = edge->callee;
111
kono
parents: 67
diff changeset
885 if (!lto_symtab_encoder_in_partition_p (encoder, callee))
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
886 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
887 /* We should have moved all the inlines. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
888 gcc_assert (!callee->inlined_to);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
889 add_node_to (encoder, callee, false);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
890 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
891 }
111
kono
parents: 67
diff changeset
892 /* Add all possible targets for late devirtualization. */
kono
parents: 67
diff changeset
893 if (flag_ltrans_devirtualize || !flag_wpa)
kono
parents: 67
diff changeset
894 for (edge = node->indirect_calls; edge; edge = edge->next_callee)
kono
parents: 67
diff changeset
895 if (edge->indirect_info->polymorphic)
kono
parents: 67
diff changeset
896 {
kono
parents: 67
diff changeset
897 unsigned int i;
kono
parents: 67
diff changeset
898 void *cache_token;
kono
parents: 67
diff changeset
899 bool final;
kono
parents: 67
diff changeset
900 vec <cgraph_node *>targets
kono
parents: 67
diff changeset
901 = possible_polymorphic_call_targets
kono
parents: 67
diff changeset
902 (edge, &final, &cache_token);
kono
parents: 67
diff changeset
903 if (!reachable_call_targets.add (cache_token))
kono
parents: 67
diff changeset
904 {
kono
parents: 67
diff changeset
905 for (i = 0; i < targets.length (); i++)
kono
parents: 67
diff changeset
906 {
kono
parents: 67
diff changeset
907 struct cgraph_node *callee = targets[i];
kono
parents: 67
diff changeset
908
kono
parents: 67
diff changeset
909 /* Adding an external declarations into the unit serves
kono
parents: 67
diff changeset
910 no purpose and just increases its boundary. */
kono
parents: 67
diff changeset
911 if (callee->definition
kono
parents: 67
diff changeset
912 && !lto_symtab_encoder_in_partition_p
kono
parents: 67
diff changeset
913 (encoder, callee))
kono
parents: 67
diff changeset
914 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
915 gcc_assert (!callee->inlined_to);
111
kono
parents: 67
diff changeset
916 add_node_to (encoder, callee, false);
kono
parents: 67
diff changeset
917 }
kono
parents: 67
diff changeset
918 }
kono
parents: 67
diff changeset
919 }
kono
parents: 67
diff changeset
920 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
921 }
111
kono
parents: 67
diff changeset
922 /* Be sure to also insert alias targert and thunk callees. These needs
kono
parents: 67
diff changeset
923 to stay to aid local calling conventions. */
kono
parents: 67
diff changeset
924 for (i = 0; i < lto_symtab_encoder_size (encoder); i++)
kono
parents: 67
diff changeset
925 {
kono
parents: 67
diff changeset
926 symtab_node *node = lto_symtab_encoder_deref (encoder, i);
kono
parents: 67
diff changeset
927 cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
kono
parents: 67
diff changeset
928
kono
parents: 67
diff changeset
929 if (node->alias && node->analyzed)
kono
parents: 67
diff changeset
930 create_references (encoder, node);
kono
parents: 67
diff changeset
931 if (cnode
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
932 && cnode->thunk.thunk_p && !cnode->inlined_to)
111
kono
parents: 67
diff changeset
933 add_node_to (encoder, cnode->callees->callee, false);
kono
parents: 67
diff changeset
934 while (node->transparent_alias && node->analyzed)
kono
parents: 67
diff changeset
935 {
kono
parents: 67
diff changeset
936 node = node->get_alias_target ();
kono
parents: 67
diff changeset
937 if (is_a <cgraph_node *> (node))
kono
parents: 67
diff changeset
938 add_node_to (encoder, dyn_cast <cgraph_node *> (node),
kono
parents: 67
diff changeset
939 false);
kono
parents: 67
diff changeset
940 else
kono
parents: 67
diff changeset
941 lto_symtab_encoder_encode (encoder, node);
kono
parents: 67
diff changeset
942 }
kono
parents: 67
diff changeset
943 }
kono
parents: 67
diff changeset
944 lto_symtab_encoder_delete (in_encoder);
kono
parents: 67
diff changeset
945 return encoder;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
946 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
947
111
kono
parents: 67
diff changeset
948 /* Output the part of the symtab in SET and VSET. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
949
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
950 void
111
kono
parents: 67
diff changeset
951 output_symtab (void)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
952 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
953 struct cgraph_node *node;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
954 struct lto_simple_output_block *ob;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
955 int i, n_nodes;
111
kono
parents: 67
diff changeset
956 lto_symtab_encoder_t encoder;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
957
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
958 if (flag_wpa)
111
kono
parents: 67
diff changeset
959 output_cgraph_opt_summary ();
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
960
111
kono
parents: 67
diff changeset
961 ob = lto_create_simple_output_block (LTO_section_symtab_nodes);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
962
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
963 output_profile_summary (ob);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
964
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
965 /* An encoder for cgraph nodes should have been created by
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
966 ipa_write_summaries_1. */
111
kono
parents: 67
diff changeset
967 gcc_assert (ob->decl_state->symtab_node_encoder);
kono
parents: 67
diff changeset
968 encoder = ob->decl_state->symtab_node_encoder;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
969
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
970 /* Write out the nodes. We must first output a node and then its clones,
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
971 otherwise at a time reading back the node there would be nothing to clone
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
972 from. */
111
kono
parents: 67
diff changeset
973 n_nodes = lto_symtab_encoder_size (encoder);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
974 for (i = 0; i < n_nodes; i++)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
975 {
111
kono
parents: 67
diff changeset
976 symtab_node *node = lto_symtab_encoder_deref (encoder, i);
kono
parents: 67
diff changeset
977 if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
kono
parents: 67
diff changeset
978 lto_output_node (ob, cnode, encoder);
kono
parents: 67
diff changeset
979 else
kono
parents: 67
diff changeset
980 lto_output_varpool_node (ob, dyn_cast<varpool_node *> (node), encoder);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
981 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
982
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
983 /* Go over the nodes in SET again to write edges. */
111
kono
parents: 67
diff changeset
984 for (int i = 0; i < lto_symtab_encoder_size (encoder); i++)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
985 {
111
kono
parents: 67
diff changeset
986 node = dyn_cast <cgraph_node *> (lto_symtab_encoder_deref (encoder, i));
kono
parents: 67
diff changeset
987 if (node
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
988 && ((node->thunk.thunk_p && !node->inlined_to)
111
kono
parents: 67
diff changeset
989 || lto_symtab_encoder_in_partition_p (encoder, node)))
kono
parents: 67
diff changeset
990 {
kono
parents: 67
diff changeset
991 output_outgoing_cgraph_edges (node->callees, ob, encoder);
kono
parents: 67
diff changeset
992 output_outgoing_cgraph_edges (node->indirect_calls, ob, encoder);
kono
parents: 67
diff changeset
993 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
994 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
995
111
kono
parents: 67
diff changeset
996 streamer_write_uhwi_stream (ob->main_stream, 0);
kono
parents: 67
diff changeset
997
kono
parents: 67
diff changeset
998 lto_destroy_simple_output_block (ob);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
999
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1000 /* Emit toplevel asms.
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1001 When doing WPA we must output every asm just once. Since we do not partition asm
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1002 nodes at all, output them to first output. This is kind of hack, but should work
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1003 well. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1004 if (!asm_nodes_output)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1005 {
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1006 asm_nodes_output = true;
111
kono
parents: 67
diff changeset
1007 lto_output_toplevel_asms ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1008 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1009
111
kono
parents: 67
diff changeset
1010 output_refs (encoder);
kono
parents: 67
diff changeset
1011 }
kono
parents: 67
diff changeset
1012
kono
parents: 67
diff changeset
1013 /* Return identifier encoded in IB as a plain string. */
kono
parents: 67
diff changeset
1014
kono
parents: 67
diff changeset
1015 static tree
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1016 read_identifier (class lto_input_block *ib)
111
kono
parents: 67
diff changeset
1017 {
kono
parents: 67
diff changeset
1018 unsigned int len = strnlen (ib->data + ib->p, ib->len - ib->p - 1);
kono
parents: 67
diff changeset
1019 tree id;
kono
parents: 67
diff changeset
1020
kono
parents: 67
diff changeset
1021 if (ib->data[ib->p + len])
kono
parents: 67
diff changeset
1022 lto_section_overrun (ib);
kono
parents: 67
diff changeset
1023 if (!len)
kono
parents: 67
diff changeset
1024 {
kono
parents: 67
diff changeset
1025 ib->p++;
kono
parents: 67
diff changeset
1026 return NULL;
kono
parents: 67
diff changeset
1027 }
kono
parents: 67
diff changeset
1028 id = get_identifier (ib->data + ib->p);
kono
parents: 67
diff changeset
1029 ib->p += len + 1;
kono
parents: 67
diff changeset
1030 return id;
kono
parents: 67
diff changeset
1031 }
kono
parents: 67
diff changeset
1032
kono
parents: 67
diff changeset
1033 /* Return string encoded in IB, NULL if string is empty. */
kono
parents: 67
diff changeset
1034
kono
parents: 67
diff changeset
1035 static const char *
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1036 read_string (class lto_input_block *ib)
111
kono
parents: 67
diff changeset
1037 {
kono
parents: 67
diff changeset
1038 unsigned int len = strnlen (ib->data + ib->p, ib->len - ib->p - 1);
kono
parents: 67
diff changeset
1039 const char *str;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1040
111
kono
parents: 67
diff changeset
1041 if (ib->data[ib->p + len])
kono
parents: 67
diff changeset
1042 lto_section_overrun (ib);
kono
parents: 67
diff changeset
1043 if (!len)
kono
parents: 67
diff changeset
1044 {
kono
parents: 67
diff changeset
1045 ib->p++;
kono
parents: 67
diff changeset
1046 return NULL;
kono
parents: 67
diff changeset
1047 }
kono
parents: 67
diff changeset
1048 str = ib->data + ib->p;
kono
parents: 67
diff changeset
1049 ib->p += len + 1;
kono
parents: 67
diff changeset
1050 return str;
kono
parents: 67
diff changeset
1051 }
kono
parents: 67
diff changeset
1052
kono
parents: 67
diff changeset
1053 /* Output function/variable tables that will allow libgomp to look up offload
kono
parents: 67
diff changeset
1054 target code.
kono
parents: 67
diff changeset
1055 OFFLOAD_FUNCS is filled in expand_omp_target, OFFLOAD_VARS is filled in
kono
parents: 67
diff changeset
1056 varpool_node::get_create. In WHOPR (partitioned) mode during the WPA stage
kono
parents: 67
diff changeset
1057 both OFFLOAD_FUNCS and OFFLOAD_VARS are filled by input_offload_tables. */
kono
parents: 67
diff changeset
1058
kono
parents: 67
diff changeset
1059 void
kono
parents: 67
diff changeset
1060 output_offload_tables (void)
kono
parents: 67
diff changeset
1061 {
kono
parents: 67
diff changeset
1062 if (vec_safe_is_empty (offload_funcs) && vec_safe_is_empty (offload_vars))
kono
parents: 67
diff changeset
1063 return;
kono
parents: 67
diff changeset
1064
kono
parents: 67
diff changeset
1065 struct lto_simple_output_block *ob
kono
parents: 67
diff changeset
1066 = lto_create_simple_output_block (LTO_section_offload_table);
kono
parents: 67
diff changeset
1067
kono
parents: 67
diff changeset
1068 for (unsigned i = 0; i < vec_safe_length (offload_funcs); i++)
kono
parents: 67
diff changeset
1069 {
kono
parents: 67
diff changeset
1070 streamer_write_enum (ob->main_stream, LTO_symtab_tags,
kono
parents: 67
diff changeset
1071 LTO_symtab_last_tag, LTO_symtab_unavail_node);
kono
parents: 67
diff changeset
1072 lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
kono
parents: 67
diff changeset
1073 (*offload_funcs)[i]);
kono
parents: 67
diff changeset
1074 }
kono
parents: 67
diff changeset
1075
kono
parents: 67
diff changeset
1076 for (unsigned i = 0; i < vec_safe_length (offload_vars); i++)
kono
parents: 67
diff changeset
1077 {
kono
parents: 67
diff changeset
1078 streamer_write_enum (ob->main_stream, LTO_symtab_tags,
kono
parents: 67
diff changeset
1079 LTO_symtab_last_tag, LTO_symtab_variable);
kono
parents: 67
diff changeset
1080 lto_output_var_decl_index (ob->decl_state, ob->main_stream,
kono
parents: 67
diff changeset
1081 (*offload_vars)[i]);
kono
parents: 67
diff changeset
1082 }
kono
parents: 67
diff changeset
1083
kono
parents: 67
diff changeset
1084 streamer_write_uhwi_stream (ob->main_stream, 0);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1085 lto_destroy_simple_output_block (ob);
111
kono
parents: 67
diff changeset
1086
kono
parents: 67
diff changeset
1087 /* In WHOPR mode during the WPA stage the joint offload tables need to be
kono
parents: 67
diff changeset
1088 streamed to one partition only. That's why we free offload_funcs and
kono
parents: 67
diff changeset
1089 offload_vars after the first call of output_offload_tables. */
kono
parents: 67
diff changeset
1090 if (flag_wpa)
kono
parents: 67
diff changeset
1091 {
kono
parents: 67
diff changeset
1092 vec_free (offload_funcs);
kono
parents: 67
diff changeset
1093 vec_free (offload_vars);
kono
parents: 67
diff changeset
1094 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1095 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1096
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1097 /* Verify the partitioning of NODE. */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1098
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1099 static inline void
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1100 verify_node_partition (symtab_node *node)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1101 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1102 if (flag_ltrans)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1103 return;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1104
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1105 #ifdef ACCEL_COMPILER
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1106 if (node->in_other_partition)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1107 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1108 if (TREE_CODE (node->decl) == FUNCTION_DECL)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1109 error_at (DECL_SOURCE_LOCATION (node->decl),
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1110 "function %qs has been referenced in offloaded code but"
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1111 " hasn%'t been marked to be included in the offloaded code",
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1112 node->name ());
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1113 else if (VAR_P (node->decl))
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1114 error_at (DECL_SOURCE_LOCATION (node->decl),
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1115 "variable %qs has been referenced in offloaded code but"
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1116 " hasn%'t been marked to be included in the offloaded code",
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1117 node->name ());
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1118 else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1119 gcc_unreachable ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1120 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1121 #else
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1122 gcc_assert (!node->in_other_partition
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1123 && !node->used_from_other_partition);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1124 #endif
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1125 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1126
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1127 /* Overwrite the information in NODE based on FILE_DATA, TAG, FLAGS,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1128 STACK_SIZE, SELF_TIME and SELF_SIZE. This is called either to initialize
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1129 NODE or to replace the values in it, for instance because the first
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1130 time we saw it, the function body was not available but now it
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1131 is. BP is a bitpack with all the bitflags for NODE read from the
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1132 stream. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1133
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1134 static void
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1135 input_overwrite_node (struct lto_file_decl_data *file_data,
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1136 struct cgraph_node *node,
111
kono
parents: 67
diff changeset
1137 enum LTO_symtab_tags tag,
kono
parents: 67
diff changeset
1138 struct bitpack_d *bp)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1139 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1140 node->aux = (void *) tag;
111
kono
parents: 67
diff changeset
1141 node->lto_file_data = file_data;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1142
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1143 node->local = bp_unpack_value (bp, 1);
111
kono
parents: 67
diff changeset
1144 node->externally_visible = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1145 node->no_reorder = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1146 node->definition = bp_unpack_value (bp, 1);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1147 node->versionable = bp_unpack_value (bp, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1148 node->can_change_signature = bp_unpack_value (bp, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1149 node->redefined_extern_inline = bp_unpack_value (bp, 1);
111
kono
parents: 67
diff changeset
1150 node->force_output = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1151 node->forced_by_abi = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1152 node->unique_name = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1153 node->body_removed = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1154 node->implicit_section = bp_unpack_value (bp, 1);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1155 node->address_taken = bp_unpack_value (bp, 1);
111
kono
parents: 67
diff changeset
1156 node->used_from_other_partition = bp_unpack_value (bp, 1);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1157 node->lowered = bp_unpack_value (bp, 1);
111
kono
parents: 67
diff changeset
1158 node->analyzed = tag == LTO_symtab_analyzed_node;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1159 node->in_other_partition = bp_unpack_value (bp, 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1160 if (node->in_other_partition
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1161 /* Avoid updating decl when we are seeing just inline clone.
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1162 When inlining function that has functions already inlined into it,
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1163 we produce clones of inline clones.
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1164
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1165 WPA partitioning might put each clone into different unit and
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1166 we might end up streaming inline clone from other partition
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1167 to support clone we are interested in. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1168 && (!node->clone_of
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1169 || node->clone_of->decl != node->decl))
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1170 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1171 DECL_EXTERNAL (node->decl) = 1;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1172 TREE_STATIC (node->decl) = 0;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1173 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1174 node->alias = bp_unpack_value (bp, 1);
111
kono
parents: 67
diff changeset
1175 node->transparent_alias = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1176 node->weakref = bp_unpack_value (bp, 1);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1177 node->symver = bp_unpack_value (bp, 1);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1178 node->frequency = (enum node_frequency)bp_unpack_value (bp, 2);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1179 node->only_called_at_startup = bp_unpack_value (bp, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1180 node->only_called_at_exit = bp_unpack_value (bp, 1);
111
kono
parents: 67
diff changeset
1181 node->tm_clone = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1182 node->calls_comdat_local = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1183 node->icf_merged = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1184 node->nonfreeing_fn = bp_unpack_value (bp, 1);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1185 node->merged_comdat = bp_unpack_value (bp, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1186 node->merged_extern_inline = bp_unpack_value (bp, 1);
111
kono
parents: 67
diff changeset
1187 node->thunk.thunk_p = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1188 node->parallelized_function = bp_unpack_value (bp, 1);
kono
parents: 67
diff changeset
1189 node->resolution = bp_unpack_enum (bp, ld_plugin_symbol_resolution,
kono
parents: 67
diff changeset
1190 LDPR_NUM_KNOWN);
kono
parents: 67
diff changeset
1191 node->split_part = bp_unpack_value (bp, 1);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1192 verify_node_partition (node);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1193 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1194
111
kono
parents: 67
diff changeset
1195 /* Return string alias is alias of. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1196
111
kono
parents: 67
diff changeset
1197 static tree
kono
parents: 67
diff changeset
1198 get_alias_symbol (tree decl)
kono
parents: 67
diff changeset
1199 {
kono
parents: 67
diff changeset
1200 tree alias = lookup_attribute ("alias", DECL_ATTRIBUTES (decl));
kono
parents: 67
diff changeset
1201 return get_identifier (TREE_STRING_POINTER
kono
parents: 67
diff changeset
1202 (TREE_VALUE (TREE_VALUE (alias))));
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1203 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1204
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1205 /* Read a node from input_block IB. TAG is the node's tag just read.
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1206 Return the node read or overwriten. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1207
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1208 static struct cgraph_node *
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1209 input_node (struct lto_file_decl_data *file_data,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1210 class lto_input_block *ib,
111
kono
parents: 67
diff changeset
1211 enum LTO_symtab_tags tag,
kono
parents: 67
diff changeset
1212 vec<symtab_node *> nodes)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1213 {
111
kono
parents: 67
diff changeset
1214 gcc::pass_manager *passes = g->get_passes ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1215 tree fn_decl;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1216 struct cgraph_node *node;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1217 struct bitpack_d bp;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1218 unsigned decl_index;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1219 int ref = LCC_NOT_FOUND, ref2 = LCC_NOT_FOUND;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1220 int clone_ref;
111
kono
parents: 67
diff changeset
1221 int order;
kono
parents: 67
diff changeset
1222 int i, count;
kono
parents: 67
diff changeset
1223 tree group;
kono
parents: 67
diff changeset
1224 const char *section;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1225 order = streamer_read_hwi (ib) + file_data->order_base;
111
kono
parents: 67
diff changeset
1226 clone_ref = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1227
111
kono
parents: 67
diff changeset
1228 decl_index = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1229 fn_decl = lto_file_decl_data_get_fn_decl (file_data, decl_index);
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1230
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1231 if (clone_ref != LCC_NOT_FOUND)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1232 {
111
kono
parents: 67
diff changeset
1233 node = dyn_cast<cgraph_node *> (nodes[clone_ref])->create_clone (fn_decl,
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1234 profile_count::uninitialized (), false,
111
kono
parents: 67
diff changeset
1235 vNULL, false, NULL, NULL);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1236 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1237 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1238 {
111
kono
parents: 67
diff changeset
1239 /* Declaration of functions can be already merged with a declaration
kono
parents: 67
diff changeset
1240 from other input file. We keep cgraph unmerged until after streaming
kono
parents: 67
diff changeset
1241 of ipa passes is done. Alays forcingly create a fresh node. */
kono
parents: 67
diff changeset
1242 node = symtab->create_empty ();
kono
parents: 67
diff changeset
1243 node->decl = fn_decl;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1244 if (lookup_attribute ("ifunc", DECL_ATTRIBUTES (fn_decl)))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1245 node->ifunc_resolver = 1;
111
kono
parents: 67
diff changeset
1246 node->register_symbol ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1247 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1248
111
kono
parents: 67
diff changeset
1249 node->order = order;
kono
parents: 67
diff changeset
1250 if (order >= symtab->order)
kono
parents: 67
diff changeset
1251 symtab->order = order + 1;
kono
parents: 67
diff changeset
1252
kono
parents: 67
diff changeset
1253 node->count = profile_count::stream_in (ib);
kono
parents: 67
diff changeset
1254 node->count_materialization_scale = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
1255
kono
parents: 67
diff changeset
1256 count = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
1257 node->ipa_transforms_to_apply = vNULL;
kono
parents: 67
diff changeset
1258 for (i = 0; i < count; i++)
kono
parents: 67
diff changeset
1259 {
kono
parents: 67
diff changeset
1260 opt_pass *pass;
kono
parents: 67
diff changeset
1261 int pid = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
1262
kono
parents: 67
diff changeset
1263 gcc_assert (pid < passes->passes_by_id_size);
kono
parents: 67
diff changeset
1264 pass = passes->passes_by_id[pid];
kono
parents: 67
diff changeset
1265 node->ipa_transforms_to_apply.safe_push ((ipa_opt_pass_d *) pass);
kono
parents: 67
diff changeset
1266 }
kono
parents: 67
diff changeset
1267
kono
parents: 67
diff changeset
1268 if (tag == LTO_symtab_analyzed_node)
kono
parents: 67
diff changeset
1269 ref = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
1270
kono
parents: 67
diff changeset
1271 group = read_identifier (ib);
kono
parents: 67
diff changeset
1272 if (group)
kono
parents: 67
diff changeset
1273 ref2 = streamer_read_hwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1274
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1275 /* Make sure that we have not read this node before. Nodes that
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1276 have already been read will have their tag stored in the 'aux'
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1277 field. Since built-in functions can be referenced in multiple
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1278 functions, they are expected to be read more than once. */
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1279 if (node->aux && !fndecl_built_in_p (node->decl))
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1280 internal_error ("bytecode stream: found multiple instances of cgraph "
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1281 "node with uid %d", node->get_uid ());
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1282
111
kono
parents: 67
diff changeset
1283 node->tp_first_run = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1284
111
kono
parents: 67
diff changeset
1285 bp = streamer_read_bitpack (ib);
kono
parents: 67
diff changeset
1286
kono
parents: 67
diff changeset
1287 input_overwrite_node (file_data, node, tag, &bp);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1288
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1289 /* Store a reference for now, and fix up later to be a pointer. */
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1290 node->inlined_to = (cgraph_node *) (intptr_t) ref;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1291
111
kono
parents: 67
diff changeset
1292 if (group)
kono
parents: 67
diff changeset
1293 {
kono
parents: 67
diff changeset
1294 node->set_comdat_group (group);
kono
parents: 67
diff changeset
1295 /* Store a reference for now, and fix up later to be a pointer. */
kono
parents: 67
diff changeset
1296 node->same_comdat_group = (symtab_node *) (intptr_t) ref2;
kono
parents: 67
diff changeset
1297 }
kono
parents: 67
diff changeset
1298 else
kono
parents: 67
diff changeset
1299 node->same_comdat_group = (symtab_node *) (intptr_t) LCC_NOT_FOUND;
kono
parents: 67
diff changeset
1300 section = read_string (ib);
kono
parents: 67
diff changeset
1301 if (section)
kono
parents: 67
diff changeset
1302 node->set_section_for_node (section);
kono
parents: 67
diff changeset
1303
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1304 if (node->definition)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1305 {
111
kono
parents: 67
diff changeset
1306 int type = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1307 HOST_WIDE_INT fixed_offset = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1308 HOST_WIDE_INT virtual_value = streamer_read_uhwi (ib);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1309 HOST_WIDE_INT indirect_offset = streamer_read_uhwi (ib);
111
kono
parents: 67
diff changeset
1310
kono
parents: 67
diff changeset
1311 node->thunk.fixed_offset = fixed_offset;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1312 node->thunk.virtual_value = virtual_value;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1313 node->thunk.indirect_offset = indirect_offset;
111
kono
parents: 67
diff changeset
1314 node->thunk.this_adjusting = (type & 2);
kono
parents: 67
diff changeset
1315 node->thunk.virtual_offset_p = (type & 4);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1316 }
111
kono
parents: 67
diff changeset
1317 if (node->alias && !node->analyzed && node->weakref)
kono
parents: 67
diff changeset
1318 node->alias_target = get_alias_symbol (node->decl);
kono
parents: 67
diff changeset
1319 node->profile_id = streamer_read_hwi (ib);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1320 node->unit_id = streamer_read_hwi (ib) + file_data->unit_base;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1321 if (symtab->max_unit < node->unit_id)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1322 symtab->max_unit = node->unit_id;
111
kono
parents: 67
diff changeset
1323 if (DECL_STATIC_CONSTRUCTOR (node->decl))
kono
parents: 67
diff changeset
1324 node->set_init_priority (streamer_read_hwi (ib));
kono
parents: 67
diff changeset
1325 if (DECL_STATIC_DESTRUCTOR (node->decl))
kono
parents: 67
diff changeset
1326 node->set_fini_priority (streamer_read_hwi (ib));
kono
parents: 67
diff changeset
1327
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1328 return node;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1329 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1330
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1331 /* Read a node from input_block IB. TAG is the node's tag just read.
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1332 Return the node read or overwriten. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1333
111
kono
parents: 67
diff changeset
1334 static varpool_node *
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1335 input_varpool_node (struct lto_file_decl_data *file_data,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1336 class lto_input_block *ib)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1337 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1338 int decl_index;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1339 tree var_decl;
111
kono
parents: 67
diff changeset
1340 varpool_node *node;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1341 struct bitpack_d bp;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1342 int ref = LCC_NOT_FOUND;
111
kono
parents: 67
diff changeset
1343 int order;
kono
parents: 67
diff changeset
1344 tree group;
kono
parents: 67
diff changeset
1345 const char *section;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1346
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1347 order = streamer_read_hwi (ib) + file_data->order_base;
111
kono
parents: 67
diff changeset
1348 decl_index = streamer_read_uhwi (ib);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1349 var_decl = lto_file_decl_data_get_var_decl (file_data, decl_index);
111
kono
parents: 67
diff changeset
1350
kono
parents: 67
diff changeset
1351 /* Declaration of functions can be already merged with a declaration
kono
parents: 67
diff changeset
1352 from other input file. We keep cgraph unmerged until after streaming
kono
parents: 67
diff changeset
1353 of ipa passes is done. Alays forcingly create a fresh node. */
kono
parents: 67
diff changeset
1354 node = varpool_node::create_empty ();
kono
parents: 67
diff changeset
1355 node->decl = var_decl;
kono
parents: 67
diff changeset
1356 node->register_symbol ();
kono
parents: 67
diff changeset
1357
kono
parents: 67
diff changeset
1358 node->order = order;
kono
parents: 67
diff changeset
1359 if (order >= symtab->order)
kono
parents: 67
diff changeset
1360 symtab->order = order + 1;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1361 node->lto_file_data = file_data;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1362
111
kono
parents: 67
diff changeset
1363 bp = streamer_read_bitpack (ib);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1364 node->externally_visible = bp_unpack_value (&bp, 1);
111
kono
parents: 67
diff changeset
1365 node->no_reorder = bp_unpack_value (&bp, 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1366 node->force_output = bp_unpack_value (&bp, 1);
111
kono
parents: 67
diff changeset
1367 node->forced_by_abi = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1368 node->unique_name = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1369 node->body_removed = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1370 node->implicit_section = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1371 node->writeonly = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1372 node->definition = bp_unpack_value (&bp, 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1373 node->alias = bp_unpack_value (&bp, 1);
111
kono
parents: 67
diff changeset
1374 node->transparent_alias = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1375 node->weakref = bp_unpack_value (&bp, 1);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1376 node->symver = bp_unpack_value (&bp, 1);
111
kono
parents: 67
diff changeset
1377 node->analyzed = bp_unpack_value (&bp, 1);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1378 node->used_from_other_partition = bp_unpack_value (&bp, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1379 node->in_other_partition = bp_unpack_value (&bp, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1380 if (node->in_other_partition)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1381 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1382 DECL_EXTERNAL (node->decl) = 1;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1383 TREE_STATIC (node->decl) = 0;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1384 }
111
kono
parents: 67
diff changeset
1385 if (node->alias && !node->analyzed && node->weakref)
kono
parents: 67
diff changeset
1386 node->alias_target = get_alias_symbol (node->decl);
kono
parents: 67
diff changeset
1387 node->tls_model = (enum tls_model)bp_unpack_value (&bp, 3);
kono
parents: 67
diff changeset
1388 node->used_by_single_function = (enum tls_model)bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1389 node->dynamically_initialized = bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1390 group = read_identifier (ib);
kono
parents: 67
diff changeset
1391 if (group)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1392 {
111
kono
parents: 67
diff changeset
1393 node->set_comdat_group (group);
kono
parents: 67
diff changeset
1394 ref = streamer_read_hwi (ib);
kono
parents: 67
diff changeset
1395 /* Store a reference for now, and fix up later to be a pointer. */
kono
parents: 67
diff changeset
1396 node->same_comdat_group = (symtab_node *) (intptr_t) ref;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1397 }
111
kono
parents: 67
diff changeset
1398 else
kono
parents: 67
diff changeset
1399 node->same_comdat_group = (symtab_node *) (intptr_t) LCC_NOT_FOUND;
kono
parents: 67
diff changeset
1400 section = read_string (ib);
kono
parents: 67
diff changeset
1401 if (section)
kono
parents: 67
diff changeset
1402 node->set_section_for_node (section);
kono
parents: 67
diff changeset
1403 node->resolution = streamer_read_enum (ib, ld_plugin_symbol_resolution,
kono
parents: 67
diff changeset
1404 LDPR_NUM_KNOWN);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1405 verify_node_partition (node);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1406 return node;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1407 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1408
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1409 /* Read a node from input_block IB. TAG is the node's tag just read.
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1410 Return the node read or overwriten. */
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1411
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1412 static void
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1413 input_ref (class lto_input_block *ib,
111
kono
parents: 67
diff changeset
1414 symtab_node *referring_node,
kono
parents: 67
diff changeset
1415 vec<symtab_node *> nodes)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1416 {
111
kono
parents: 67
diff changeset
1417 symtab_node *node = NULL;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1418 struct bitpack_d bp;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1419 enum ipa_ref_use use;
111
kono
parents: 67
diff changeset
1420 bool speculative;
kono
parents: 67
diff changeset
1421 struct ipa_ref *ref;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1422
111
kono
parents: 67
diff changeset
1423 bp = streamer_read_bitpack (ib);
kono
parents: 67
diff changeset
1424 use = (enum ipa_ref_use) bp_unpack_value (&bp, 3);
kono
parents: 67
diff changeset
1425 speculative = (enum ipa_ref_use) bp_unpack_value (&bp, 1);
kono
parents: 67
diff changeset
1426 node = nodes[streamer_read_hwi (ib)];
kono
parents: 67
diff changeset
1427 ref = referring_node->create_reference (node, use);
kono
parents: 67
diff changeset
1428 ref->speculative = speculative;
kono
parents: 67
diff changeset
1429 if (is_a <cgraph_node *> (referring_node))
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1430 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1431 ref->lto_stmt_uid = streamer_read_hwi (ib);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1432 bp = streamer_read_bitpack (ib);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1433 ref->speculative_id = bp_unpack_value (&bp, 16);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1434 }
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1435 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1436
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1437 /* Read an edge from IB. NODES points to a vector of previously read nodes for
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1438 decoding caller and callee of the edge to be read. If INDIRECT is true, the
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1439 edge being read is indirect (in the sense that it has
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1440 indirect_unknown_callee set). */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1441
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1442 static void
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1443 input_edge (class lto_input_block *ib, vec<symtab_node *> nodes,
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1444 bool indirect)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1445 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1446 struct cgraph_node *caller, *callee;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1447 struct cgraph_edge *edge;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1448 unsigned int stmt_id, speculative_id;
111
kono
parents: 67
diff changeset
1449 profile_count count;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1450 cgraph_inline_failed_t inline_failed;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1451 struct bitpack_d bp;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1452 int ecf_flags = 0;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1453
111
kono
parents: 67
diff changeset
1454 caller = dyn_cast<cgraph_node *> (nodes[streamer_read_hwi (ib)]);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1455 if (caller == NULL || caller->decl == NULL_TREE)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1456 internal_error ("bytecode stream: no caller found while reading edge");
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1457
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1458 if (!indirect)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1459 {
111
kono
parents: 67
diff changeset
1460 callee = dyn_cast<cgraph_node *> (nodes[streamer_read_hwi (ib)]);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1461 if (callee == NULL || callee->decl == NULL_TREE)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1462 internal_error ("bytecode stream: no callee found while reading edge");
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1463 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1464 else
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1465 callee = NULL;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1466
111
kono
parents: 67
diff changeset
1467 count = profile_count::stream_in (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1468
111
kono
parents: 67
diff changeset
1469 bp = streamer_read_bitpack (ib);
kono
parents: 67
diff changeset
1470 inline_failed = bp_unpack_enum (&bp, cgraph_inline_failed_t, CIF_N_REASONS);
kono
parents: 67
diff changeset
1471 stmt_id = bp_unpack_var_len_unsigned (&bp);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1472 speculative_id = bp_unpack_value (&bp, 16);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1473
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1474 if (indirect)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1475 edge = caller->create_indirect_edge (NULL, 0, count);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1476 else
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1477 edge = caller->create_edge (callee, NULL, count);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1478
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1479 edge->indirect_inlining_edge = bp_unpack_value (&bp, 1);
111
kono
parents: 67
diff changeset
1480 edge->speculative = bp_unpack_value (&bp, 1);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1481 edge->lto_stmt_uid = stmt_id;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1482 edge->speculative_id = speculative_id;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1483 edge->inline_failed = inline_failed;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1484 edge->call_stmt_cannot_inline_p = bp_unpack_value (&bp, 1);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1485 edge->can_throw_external = bp_unpack_value (&bp, 1);
111
kono
parents: 67
diff changeset
1486 edge->in_polymorphic_cdtor = bp_unpack_value (&bp, 1);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1487 if (indirect)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1488 {
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1489 if (bp_unpack_value (&bp, 1))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1490 ecf_flags |= ECF_CONST;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1491 if (bp_unpack_value (&bp, 1))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1492 ecf_flags |= ECF_PURE;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1493 if (bp_unpack_value (&bp, 1))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1494 ecf_flags |= ECF_NORETURN;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1495 if (bp_unpack_value (&bp, 1))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1496 ecf_flags |= ECF_MALLOC;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1497 if (bp_unpack_value (&bp, 1))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1498 ecf_flags |= ECF_NOTHROW;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1499 if (bp_unpack_value (&bp, 1))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1500 ecf_flags |= ECF_RETURNS_TWICE;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1501 edge->indirect_info->ecf_flags = ecf_flags;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1502
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1503 edge->indirect_info->num_speculative_call_targets
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1504 = bp_unpack_value (&bp, 16);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1505 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1506 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1507
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1508
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1509 /* Read a cgraph from IB using the info in FILE_DATA. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1510
111
kono
parents: 67
diff changeset
1511 static vec<symtab_node *>
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1512 input_cgraph_1 (struct lto_file_decl_data *file_data,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1513 class lto_input_block *ib)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1514 {
111
kono
parents: 67
diff changeset
1515 enum LTO_symtab_tags tag;
kono
parents: 67
diff changeset
1516 vec<symtab_node *> nodes = vNULL;
kono
parents: 67
diff changeset
1517 symtab_node *node;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1518 unsigned i;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1519
111
kono
parents: 67
diff changeset
1520 tag = streamer_read_enum (ib, LTO_symtab_tags, LTO_symtab_last_tag);
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1521 file_data->order_base = symtab->order;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1522 file_data->unit_base = symtab->max_unit + 1;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1523 while (tag)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1524 {
111
kono
parents: 67
diff changeset
1525 if (tag == LTO_symtab_edge)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1526 input_edge (ib, nodes, false);
111
kono
parents: 67
diff changeset
1527 else if (tag == LTO_symtab_indirect_edge)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1528 input_edge (ib, nodes, true);
111
kono
parents: 67
diff changeset
1529 else if (tag == LTO_symtab_variable)
kono
parents: 67
diff changeset
1530 {
kono
parents: 67
diff changeset
1531 node = input_varpool_node (file_data, ib);
kono
parents: 67
diff changeset
1532 nodes.safe_push (node);
kono
parents: 67
diff changeset
1533 lto_symtab_encoder_encode (file_data->symtab_node_encoder, node);
kono
parents: 67
diff changeset
1534 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1535 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1536 {
111
kono
parents: 67
diff changeset
1537 node = input_node (file_data, ib, tag, nodes);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1538 if (node == NULL || node->decl == NULL_TREE)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1539 internal_error ("bytecode stream: found empty cgraph node");
111
kono
parents: 67
diff changeset
1540 nodes.safe_push (node);
kono
parents: 67
diff changeset
1541 lto_symtab_encoder_encode (file_data->symtab_node_encoder, node);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1542 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1543
111
kono
parents: 67
diff changeset
1544 tag = streamer_read_enum (ib, LTO_symtab_tags, LTO_symtab_last_tag);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1545 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1546
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1547 lto_input_toplevel_asms (file_data, file_data->order_base);
111
kono
parents: 67
diff changeset
1548
kono
parents: 67
diff changeset
1549 /* AUX pointers should be all non-zero for function nodes read from the stream. */
kono
parents: 67
diff changeset
1550 if (flag_checking)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1551 {
111
kono
parents: 67
diff changeset
1552 FOR_EACH_VEC_ELT (nodes, i, node)
kono
parents: 67
diff changeset
1553 gcc_assert (node->aux || !is_a <cgraph_node *> (node));
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1554 }
111
kono
parents: 67
diff changeset
1555 FOR_EACH_VEC_ELT (nodes, i, node)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1556 {
111
kono
parents: 67
diff changeset
1557 int ref;
kono
parents: 67
diff changeset
1558 if (cgraph_node *cnode = dyn_cast <cgraph_node *> (node))
kono
parents: 67
diff changeset
1559 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1560 ref = (int) (intptr_t) cnode->inlined_to;
111
kono
parents: 67
diff changeset
1561
kono
parents: 67
diff changeset
1562 /* We share declaration of builtins, so we may read same node twice. */
kono
parents: 67
diff changeset
1563 if (!node->aux)
kono
parents: 67
diff changeset
1564 continue;
kono
parents: 67
diff changeset
1565 node->aux = NULL;
kono
parents: 67
diff changeset
1566
kono
parents: 67
diff changeset
1567 /* Fixup inlined_to from reference to pointer. */
kono
parents: 67
diff changeset
1568 if (ref != LCC_NOT_FOUND)
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1569 dyn_cast<cgraph_node *> (node)->inlined_to
111
kono
parents: 67
diff changeset
1570 = dyn_cast<cgraph_node *> (nodes[ref]);
kono
parents: 67
diff changeset
1571 else
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1572 cnode->inlined_to = NULL;
111
kono
parents: 67
diff changeset
1573 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1574
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1575 ref = (int) (intptr_t) node->same_comdat_group;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1576
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1577 /* Fixup same_comdat_group from reference to pointer. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1578 if (ref != LCC_NOT_FOUND)
111
kono
parents: 67
diff changeset
1579 node->same_comdat_group = nodes[ref];
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1580 else
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1581 node->same_comdat_group = NULL;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1582 }
111
kono
parents: 67
diff changeset
1583 FOR_EACH_VEC_ELT (nodes, i, node)
kono
parents: 67
diff changeset
1584 node->aux = is_a <cgraph_node *> (node) ? (void *)1 : NULL;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1585 return nodes;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1586 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1587
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1588 /* Input ipa_refs. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1589
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1590 static void
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1591 input_refs (class lto_input_block *ib,
111
kono
parents: 67
diff changeset
1592 vec<symtab_node *> nodes)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1593 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1594 int count;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1595 int idx;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1596 while (true)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1597 {
111
kono
parents: 67
diff changeset
1598 symtab_node *node;
kono
parents: 67
diff changeset
1599 count = streamer_read_uhwi (ib);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1600 if (!count)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1601 break;
111
kono
parents: 67
diff changeset
1602 idx = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1603 node = nodes[idx];
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1604 while (count)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1605 {
111
kono
parents: 67
diff changeset
1606 input_ref (ib, node, nodes);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1607 count--;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1608 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1609 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1610 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1611
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1612 /* Input profile_info from IB. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1613 static void
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1614 input_profile_summary (class lto_input_block *ib,
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1615 struct lto_file_decl_data *file_data)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1616 {
111
kono
parents: 67
diff changeset
1617 unsigned int runs = streamer_read_uhwi (ib);
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1618 if (runs)
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1619 {
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1620 file_data->profile_info.runs = runs;
111
kono
parents: 67
diff changeset
1621
kono
parents: 67
diff changeset
1622 /* IPA-profile computes hot bb threshold based on cumulated
kono
parents: 67
diff changeset
1623 whole program profile. We need to stream it down to ltrans. */
kono
parents: 67
diff changeset
1624 if (flag_ltrans)
kono
parents: 67
diff changeset
1625 set_hot_bb_threshold (streamer_read_gcov_count (ib));
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1626 }
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1627
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1628 }
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1629
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1630 /* Rescale profile summaries to the same number of runs in the whole unit. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1631
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1632 static void
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1633 merge_profile_summaries (struct lto_file_decl_data **file_data_vec)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1634 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1635 struct lto_file_decl_data *file_data;
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1636 unsigned int j;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1637 gcov_unsigned_t max_runs = 0;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1638 struct cgraph_node *node;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1639 struct cgraph_edge *edge;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1640
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1641 /* Find unit with maximal number of runs. If we ever get serious about
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1642 roundoff errors, we might also consider computing smallest common
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1643 multiply. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1644 for (j = 0; (file_data = file_data_vec[j]) != NULL; j++)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1645 if (max_runs < file_data->profile_info.runs)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1646 max_runs = file_data->profile_info.runs;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1647
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1648 if (!max_runs)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1649 return;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1650
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1651 /* Simple overflow check. We probably don't need to support that many train
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1652 runs. Such a large value probably imply data corruption anyway. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1653 if (max_runs > INT_MAX / REG_BR_PROB_BASE)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1654 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1655 sorry ("At most %i profile runs is supported. Perhaps corrupted profile?",
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1656 INT_MAX / REG_BR_PROB_BASE);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1657 return;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1658 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1659
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1660 profile_info = XCNEW (gcov_summary);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1661 profile_info->runs = max_runs;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1662
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1663 /* If merging already happent at WPA time, we are done. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1664 if (flag_ltrans)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1665 return;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1666
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1667 /* Now compute count_materialization_scale of each node.
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1668 During LTRANS we already have values of count_materialization_scale
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1669 computed, so just update them. */
111
kono
parents: 67
diff changeset
1670 FOR_EACH_FUNCTION (node)
kono
parents: 67
diff changeset
1671 if (node->lto_file_data
kono
parents: 67
diff changeset
1672 && node->lto_file_data->profile_info.runs)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1673 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1674 int scale;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1675
111
kono
parents: 67
diff changeset
1676 scale = RDIV (node->count_materialization_scale * max_runs,
kono
parents: 67
diff changeset
1677 node->lto_file_data->profile_info.runs);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1678 node->count_materialization_scale = scale;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1679 if (scale < 0)
111
kono
parents: 67
diff changeset
1680 fatal_error (input_location, "Profile information in %s corrupted",
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1681 file_data->file_name);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1682
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1683 if (scale == REG_BR_PROB_BASE)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1684 continue;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1685 for (edge = node->callees; edge; edge = edge->next_callee)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1686 if (edge->count.ipa ().nonzero_p ())
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1687 edge->count = edge->count.apply_scale (scale, REG_BR_PROB_BASE);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1688 for (edge = node->indirect_calls; edge; edge = edge->next_callee)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1689 if (edge->count.ipa ().nonzero_p ())
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1690 edge->count = edge->count.apply_scale (scale, REG_BR_PROB_BASE);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1691 if (node->count.ipa ().nonzero_p ())
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1692 node->count = node->count.apply_scale (scale, REG_BR_PROB_BASE);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1693 }
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1694 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1695
111
kono
parents: 67
diff changeset
1696 /* Input and merge the symtab from each of the .o files passed to
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1697 lto1. */
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1698
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1699 void
111
kono
parents: 67
diff changeset
1700 input_symtab (void)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1701 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1702 struct lto_file_decl_data **file_data_vec = lto_get_file_decl_data ();
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1703 struct lto_file_decl_data *file_data;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1704 unsigned int j = 0;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1705 struct cgraph_node *node;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1706
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1707 while ((file_data = file_data_vec[j++]))
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1708 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1709 const char *data;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1710 size_t len;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1711 class lto_input_block *ib;
111
kono
parents: 67
diff changeset
1712 vec<symtab_node *> nodes;
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1713
111
kono
parents: 67
diff changeset
1714 ib = lto_create_simple_input_block (file_data, LTO_section_symtab_nodes,
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1715 &data, &len);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1716 if (!ib)
111
kono
parents: 67
diff changeset
1717 fatal_error (input_location,
kono
parents: 67
diff changeset
1718 "cannot find LTO cgraph in %s", file_data->file_name);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1719 input_profile_summary (ib, file_data);
111
kono
parents: 67
diff changeset
1720 file_data->symtab_node_encoder = lto_symtab_encoder_new (true);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1721 nodes = input_cgraph_1 (file_data, ib);
111
kono
parents: 67
diff changeset
1722 lto_destroy_simple_input_block (file_data, LTO_section_symtab_nodes,
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1723 ib, data, len);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1724
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1725 ib = lto_create_simple_input_block (file_data, LTO_section_refs,
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1726 &data, &len);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1727 if (!ib)
111
kono
parents: 67
diff changeset
1728 fatal_error (input_location, "cannot find LTO section refs in %s",
kono
parents: 67
diff changeset
1729 file_data->file_name);
kono
parents: 67
diff changeset
1730 input_refs (ib, nodes);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1731 lto_destroy_simple_input_block (file_data, LTO_section_refs,
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1732 ib, data, len);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1733 if (flag_ltrans)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1734 input_cgraph_opt_summary (nodes);
111
kono
parents: 67
diff changeset
1735 nodes.release ();
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1736 }
111
kono
parents: 67
diff changeset
1737
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1738 merge_profile_summaries (file_data_vec);
111
kono
parents: 67
diff changeset
1739
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1740 /* Clear out the aux field that was used to store enough state to
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1741 tell which nodes should be overwritten. */
111
kono
parents: 67
diff changeset
1742 FOR_EACH_FUNCTION (node)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1743 {
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1744 /* Some nodes may have been created by cgraph_node. This
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1745 happens when the callgraph contains nested functions. If the
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1746 node for the parent function was never emitted to the gimple
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1747 file, cgraph_node will create a node for it when setting the
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1748 context of the nested function. */
111
kono
parents: 67
diff changeset
1749 if (node->lto_file_data)
55
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1750 node->aux = NULL;
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1751 }
77e2b8dfacca update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1752 }
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1753
111
kono
parents: 67
diff changeset
1754 /* Input function/variable tables that will allow libgomp to look up offload
kono
parents: 67
diff changeset
1755 target code, and store them into OFFLOAD_FUNCS and OFFLOAD_VARS. */
kono
parents: 67
diff changeset
1756
kono
parents: 67
diff changeset
1757 void
kono
parents: 67
diff changeset
1758 input_offload_tables (bool do_force_output)
kono
parents: 67
diff changeset
1759 {
kono
parents: 67
diff changeset
1760 struct lto_file_decl_data **file_data_vec = lto_get_file_decl_data ();
kono
parents: 67
diff changeset
1761 struct lto_file_decl_data *file_data;
kono
parents: 67
diff changeset
1762 unsigned int j = 0;
kono
parents: 67
diff changeset
1763
kono
parents: 67
diff changeset
1764 while ((file_data = file_data_vec[j++]))
kono
parents: 67
diff changeset
1765 {
kono
parents: 67
diff changeset
1766 const char *data;
kono
parents: 67
diff changeset
1767 size_t len;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1768 class lto_input_block *ib
111
kono
parents: 67
diff changeset
1769 = lto_create_simple_input_block (file_data, LTO_section_offload_table,
kono
parents: 67
diff changeset
1770 &data, &len);
kono
parents: 67
diff changeset
1771 if (!ib)
kono
parents: 67
diff changeset
1772 continue;
kono
parents: 67
diff changeset
1773
kono
parents: 67
diff changeset
1774 enum LTO_symtab_tags tag
kono
parents: 67
diff changeset
1775 = streamer_read_enum (ib, LTO_symtab_tags, LTO_symtab_last_tag);
kono
parents: 67
diff changeset
1776 while (tag)
kono
parents: 67
diff changeset
1777 {
kono
parents: 67
diff changeset
1778 if (tag == LTO_symtab_unavail_node)
kono
parents: 67
diff changeset
1779 {
kono
parents: 67
diff changeset
1780 int decl_index = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1781 tree fn_decl
kono
parents: 67
diff changeset
1782 = lto_file_decl_data_get_fn_decl (file_data, decl_index);
kono
parents: 67
diff changeset
1783 vec_safe_push (offload_funcs, fn_decl);
kono
parents: 67
diff changeset
1784
kono
parents: 67
diff changeset
1785 /* Prevent IPA from removing fn_decl as unreachable, since there
kono
parents: 67
diff changeset
1786 may be no refs from the parent function to child_fn in offload
kono
parents: 67
diff changeset
1787 LTO mode. */
kono
parents: 67
diff changeset
1788 if (do_force_output)
kono
parents: 67
diff changeset
1789 cgraph_node::get (fn_decl)->mark_force_output ();
kono
parents: 67
diff changeset
1790 }
kono
parents: 67
diff changeset
1791 else if (tag == LTO_symtab_variable)
kono
parents: 67
diff changeset
1792 {
kono
parents: 67
diff changeset
1793 int decl_index = streamer_read_uhwi (ib);
kono
parents: 67
diff changeset
1794 tree var_decl
kono
parents: 67
diff changeset
1795 = lto_file_decl_data_get_var_decl (file_data, decl_index);
kono
parents: 67
diff changeset
1796 vec_safe_push (offload_vars, var_decl);
kono
parents: 67
diff changeset
1797
kono
parents: 67
diff changeset
1798 /* Prevent IPA from removing var_decl as unused, since there
kono
parents: 67
diff changeset
1799 may be no refs to var_decl in offload LTO mode. */
kono
parents: 67
diff changeset
1800 if (do_force_output)
kono
parents: 67
diff changeset
1801 varpool_node::get (var_decl)->force_output = 1;
kono
parents: 67
diff changeset
1802 }
kono
parents: 67
diff changeset
1803 else
kono
parents: 67
diff changeset
1804 fatal_error (input_location,
kono
parents: 67
diff changeset
1805 "invalid offload table in %s", file_data->file_name);
kono
parents: 67
diff changeset
1806
kono
parents: 67
diff changeset
1807 tag = streamer_read_enum (ib, LTO_symtab_tags, LTO_symtab_last_tag);
kono
parents: 67
diff changeset
1808 }
kono
parents: 67
diff changeset
1809
kono
parents: 67
diff changeset
1810 lto_destroy_simple_input_block (file_data, LTO_section_offload_table,
kono
parents: 67
diff changeset
1811 ib, data, len);
kono
parents: 67
diff changeset
1812 }
kono
parents: 67
diff changeset
1813 }
kono
parents: 67
diff changeset
1814
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1815 /* True when we need optimization summary for NODE. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1816
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1817 static int
111
kono
parents: 67
diff changeset
1818 output_cgraph_opt_summary_p (struct cgraph_node *node)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1819 {
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
1820 return ((node->clone_of || node->former_clone_of)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1821 && (node->clone.tree_map
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1822 || node->clone.param_adjustments));
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1823 }
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1824
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1825 /* Output optimization summary for EDGE to OB. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1826 static void
111
kono
parents: 67
diff changeset
1827 output_edge_opt_summary (struct output_block *ob ATTRIBUTE_UNUSED,
kono
parents: 67
diff changeset
1828 struct cgraph_edge *edge ATTRIBUTE_UNUSED)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1829 {
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1830 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1831
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1832 /* Output optimization summary for NODE to OB. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1833
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1834 static void
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1835 output_node_opt_summary (struct output_block *ob,
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1836 struct cgraph_node *node,
111
kono
parents: 67
diff changeset
1837 lto_symtab_encoder_t encoder)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1838 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1839 struct ipa_replace_map *map;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1840 int i;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1841 struct cgraph_edge *e;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1842
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1843 /* TODO: Should this code be moved to ipa-param-manipulation? */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1844 struct bitpack_d bp;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1845 bp = bitpack_create (ob->main_stream);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1846 bp_pack_value (&bp, (node->clone.param_adjustments != NULL), 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1847 streamer_write_bitpack (&bp);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1848 if (ipa_param_adjustments *adjustments = node->clone.param_adjustments)
111
kono
parents: 67
diff changeset
1849 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1850 streamer_write_uhwi (ob, vec_safe_length (adjustments->m_adj_params));
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1851 ipa_adjusted_param *adj;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1852 FOR_EACH_VEC_SAFE_ELT (adjustments->m_adj_params, i, adj)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1853 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1854 bp = bitpack_create (ob->main_stream);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1855 bp_pack_value (&bp, adj->base_index, IPA_PARAM_MAX_INDEX_BITS);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1856 bp_pack_value (&bp, adj->prev_clone_index, IPA_PARAM_MAX_INDEX_BITS);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1857 bp_pack_value (&bp, adj->op, 2);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1858 bp_pack_value (&bp, adj->param_prefix_index, 2);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1859 bp_pack_value (&bp, adj->prev_clone_adjustment, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1860 bp_pack_value (&bp, adj->reverse, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1861 bp_pack_value (&bp, adj->user_flag, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1862 streamer_write_bitpack (&bp);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1863 if (adj->op == IPA_PARAM_OP_SPLIT
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1864 || adj->op == IPA_PARAM_OP_NEW)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1865 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1866 stream_write_tree (ob, adj->type, true);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1867 if (adj->op == IPA_PARAM_OP_SPLIT)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1868 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1869 stream_write_tree (ob, adj->alias_ptr_type, true);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1870 streamer_write_uhwi (ob, adj->unit_offset);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1871 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1872 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1873 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1874 streamer_write_hwi (ob, adjustments->m_always_copy_start);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1875 bp = bitpack_create (ob->main_stream);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1876 bp_pack_value (&bp, node->clone.param_adjustments->m_skip_return, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1877 streamer_write_bitpack (&bp);
111
kono
parents: 67
diff changeset
1878 }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1879
111
kono
parents: 67
diff changeset
1880 streamer_write_uhwi (ob, vec_safe_length (node->clone.tree_map));
kono
parents: 67
diff changeset
1881 FOR_EACH_VEC_SAFE_ELT (node->clone.tree_map, i, map)
kono
parents: 67
diff changeset
1882 {
kono
parents: 67
diff changeset
1883 streamer_write_uhwi (ob, map->parm_num);
kono
parents: 67
diff changeset
1884 gcc_assert (EXPR_LOCATION (map->new_tree) == UNKNOWN_LOCATION);
kono
parents: 67
diff changeset
1885 stream_write_tree (ob, map->new_tree, true);
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1886 }
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1887
111
kono
parents: 67
diff changeset
1888 if (lto_symtab_encoder_in_partition_p (encoder, node))
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1889 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1890 for (e = node->callees; e; e = e->next_callee)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1891 output_edge_opt_summary (ob, e);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1892 for (e = node->indirect_calls; e; e = e->next_callee)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1893 output_edge_opt_summary (ob, e);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1894 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1895 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1896
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1897 /* Output optimization summaries stored in callgraph.
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1898 At the moment it is the clone info structure. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1899
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1900 static void
111
kono
parents: 67
diff changeset
1901 output_cgraph_opt_summary (void)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1902 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1903 int i, n_nodes;
111
kono
parents: 67
diff changeset
1904 lto_symtab_encoder_t encoder;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1905 struct output_block *ob = create_output_block (LTO_section_cgraph_opt_sum);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1906 unsigned count = 0;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1907
111
kono
parents: 67
diff changeset
1908 ob->symbol = NULL;
kono
parents: 67
diff changeset
1909 encoder = ob->decl_state->symtab_node_encoder;
kono
parents: 67
diff changeset
1910 n_nodes = lto_symtab_encoder_size (encoder);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1911 for (i = 0; i < n_nodes; i++)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1912 {
111
kono
parents: 67
diff changeset
1913 symtab_node *node = lto_symtab_encoder_deref (encoder, i);
kono
parents: 67
diff changeset
1914 cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
kono
parents: 67
diff changeset
1915 if (cnode && output_cgraph_opt_summary_p (cnode))
kono
parents: 67
diff changeset
1916 count++;
kono
parents: 67
diff changeset
1917 }
kono
parents: 67
diff changeset
1918 streamer_write_uhwi (ob, count);
kono
parents: 67
diff changeset
1919 for (i = 0; i < n_nodes; i++)
kono
parents: 67
diff changeset
1920 {
kono
parents: 67
diff changeset
1921 symtab_node *node = lto_symtab_encoder_deref (encoder, i);
kono
parents: 67
diff changeset
1922 cgraph_node *cnode = dyn_cast <cgraph_node *> (node);
kono
parents: 67
diff changeset
1923 if (cnode && output_cgraph_opt_summary_p (cnode))
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1924 {
111
kono
parents: 67
diff changeset
1925 streamer_write_uhwi (ob, i);
kono
parents: 67
diff changeset
1926 output_node_opt_summary (ob, cnode, encoder);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1927 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1928 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1929 produce_asm (ob, NULL);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1930 destroy_output_block (ob);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1931 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1932
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1933 /* Input optimisation summary of EDGE. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1934
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1935 static void
111
kono
parents: 67
diff changeset
1936 input_edge_opt_summary (struct cgraph_edge *edge ATTRIBUTE_UNUSED,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1937 class lto_input_block *ib_main ATTRIBUTE_UNUSED)
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1938 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1939 }
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1940
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1941 /* Input optimisation summary of NODE. */
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1942
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1943 static void
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1944 input_node_opt_summary (struct cgraph_node *node,
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1945 class lto_input_block *ib_main,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1946 class data_in *data_in)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1947 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1948 int i;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1949 int count;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
1950 struct cgraph_edge *e;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1951
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1952 /* TODO: Should this code be moved to ipa-param-manipulation? */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1953 struct bitpack_d bp;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1954 bp = streamer_read_bitpack (ib_main);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1955 bool have_adjustments = bp_unpack_value (&bp, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1956 if (have_adjustments)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1957 {
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1958 count = streamer_read_uhwi (ib_main);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1959 vec<ipa_adjusted_param, va_gc> *new_params = NULL;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1960 for (i = 0; i < count; i++)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1961 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1962 ipa_adjusted_param adj;
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1963 memset (&adj, 0, sizeof (adj));
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1964 bp = streamer_read_bitpack (ib_main);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1965 adj.base_index = bp_unpack_value (&bp, IPA_PARAM_MAX_INDEX_BITS);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1966 adj.prev_clone_index
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1967 = bp_unpack_value (&bp, IPA_PARAM_MAX_INDEX_BITS);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1968 adj.op = (enum ipa_parm_op) bp_unpack_value (&bp, 2);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1969 adj.param_prefix_index = bp_unpack_value (&bp, 2);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1970 adj.prev_clone_adjustment = bp_unpack_value (&bp, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1971 adj.reverse = bp_unpack_value (&bp, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1972 adj.user_flag = bp_unpack_value (&bp, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1973 if (adj.op == IPA_PARAM_OP_SPLIT
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1974 || adj.op == IPA_PARAM_OP_NEW)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1975 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1976 adj.type = stream_read_tree (ib_main, data_in);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1977 if (adj.op == IPA_PARAM_OP_SPLIT)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1978 {
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1979 adj.alias_ptr_type = stream_read_tree (ib_main, data_in);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1980 adj.unit_offset = streamer_read_uhwi (ib_main);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1981 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1982 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1983 vec_safe_push (new_params, adj);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1984 }
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1985 int always_copy_start = streamer_read_hwi (ib_main);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1986 bp = streamer_read_bitpack (ib_main);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1987 bool skip_return = bp_unpack_value (&bp, 1);
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1988 node->clone.param_adjustments
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1989 = (new (ggc_alloc <ipa_param_adjustments> ())
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1990 ipa_param_adjustments (new_params, always_copy_start, skip_return));
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1991 }
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
1992
111
kono
parents: 67
diff changeset
1993 count = streamer_read_uhwi (ib_main);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1994 for (i = 0; i < count; i++)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1995 {
111
kono
parents: 67
diff changeset
1996 struct ipa_replace_map *map = ggc_alloc<ipa_replace_map> ();
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
1997
111
kono
parents: 67
diff changeset
1998 vec_safe_push (node->clone.tree_map, map);
kono
parents: 67
diff changeset
1999 map->parm_num = streamer_read_uhwi (ib_main);
kono
parents: 67
diff changeset
2000 map->new_tree = stream_read_tree (ib_main, data_in);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2001 }
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2002 for (e = node->callees; e; e = e->next_callee)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2003 input_edge_opt_summary (e, ib_main);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2004 for (e = node->indirect_calls; e; e = e->next_callee)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2005 input_edge_opt_summary (e, ib_main);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2006 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2007
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2008 /* Read section in file FILE_DATA of length LEN with data DATA. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2009
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2010 static void
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2011 input_cgraph_opt_section (struct lto_file_decl_data *file_data,
111
kono
parents: 67
diff changeset
2012 const char *data, size_t len,
kono
parents: 67
diff changeset
2013 vec<symtab_node *> nodes)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2014 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2015 const struct lto_function_header *header =
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2016 (const struct lto_function_header *) data;
111
kono
parents: 67
diff changeset
2017 const int cfg_offset = sizeof (struct lto_function_header);
kono
parents: 67
diff changeset
2018 const int main_offset = cfg_offset + header->cfg_size;
kono
parents: 67
diff changeset
2019 const int string_offset = main_offset + header->main_size;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2020 class data_in *data_in;
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2021 unsigned int i;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2022 unsigned int count;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2023
111
kono
parents: 67
diff changeset
2024 lto_input_block ib_main ((const char *) data + main_offset,
kono
parents: 67
diff changeset
2025 header->main_size, file_data->mode_table);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2026
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2027 data_in =
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2028 lto_data_in_create (file_data, (const char *) data + string_offset,
111
kono
parents: 67
diff changeset
2029 header->string_size, vNULL);
kono
parents: 67
diff changeset
2030 count = streamer_read_uhwi (&ib_main);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2031
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2032 for (i = 0; i < count; i++)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2033 {
111
kono
parents: 67
diff changeset
2034 int ref = streamer_read_uhwi (&ib_main);
kono
parents: 67
diff changeset
2035 input_node_opt_summary (dyn_cast<cgraph_node *> (nodes[ref]),
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2036 &ib_main, data_in);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2037 }
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 63
diff changeset
2038 lto_free_section_data (file_data, LTO_section_cgraph_opt_sum, NULL, data,
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2039 len);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2040 lto_data_in_delete (data_in);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2041 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2042
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2043 /* Input optimization summary of cgraph. */
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2044
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2045 static void
111
kono
parents: 67
diff changeset
2046 input_cgraph_opt_summary (vec<symtab_node *> nodes)
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2047 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2048 struct lto_file_decl_data **file_data_vec = lto_get_file_decl_data ();
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2049 struct lto_file_decl_data *file_data;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2050 unsigned int j = 0;
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2051
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2052 while ((file_data = file_data_vec[j++]))
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2053 {
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2054 size_t len;
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2055 const char *data
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2056 = lto_get_summary_section_data (file_data, LTO_section_cgraph_opt_sum,
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2057 &len);
63
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2058 if (data)
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2059 input_cgraph_opt_section (file_data, data, len, nodes);
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2060 }
b7f97abdc517 update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents: 55
diff changeset
2061 }