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