Mercurial > hg > CbC > CbC_gcc
annotate gcc/cgraphunit.c @ 63:b7f97abdc517 gcc-4.6-20100522
update gcc from gcc-4.5.0 to gcc-4.6
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 24 May 2010 12:47:05 +0900 |
parents | 77e2b8dfacca |
children | f6334be47118 |
rev | line source |
---|---|
0 | 1 /* Callgraph based interprocedural optimizations. |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 |
0 | 3 Free Software Foundation, Inc. |
4 Contributed by Jan Hubicka | |
5 | |
6 This file is part of GCC. | |
7 | |
8 GCC is free software; you can redistribute it and/or modify it under | |
9 the terms of the GNU General Public License as published by the Free | |
10 Software Foundation; either version 3, or (at your option) any later | |
11 version. | |
12 | |
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with GCC; see the file COPYING3. If not see | |
20 <http://www.gnu.org/licenses/>. */ | |
21 | |
22 /* This module implements main driver of compilation process as well as | |
23 few basic interprocedural optimizers. | |
24 | |
25 The main scope of this file is to act as an interface in between | |
26 tree based frontends and the backend (and middle end) | |
27 | |
28 The front-end is supposed to use following functionality: | |
29 | |
30 - cgraph_finalize_function | |
31 | |
32 This function is called once front-end has parsed whole body of function | |
33 and it is certain that the function body nor the declaration will change. | |
34 | |
35 (There is one exception needed for implementing GCC extern inline | |
36 function.) | |
37 | |
38 - varpool_finalize_variable | |
39 | |
40 This function has same behavior as the above but is used for static | |
41 variables. | |
42 | |
43 - cgraph_finalize_compilation_unit | |
44 | |
45 This function is called once (source level) compilation unit is finalized | |
46 and it will no longer change. | |
47 | |
48 In the the call-graph construction and local function | |
49 analysis takes place here. Bodies of unreachable functions are released | |
50 to conserve memory usage. | |
51 | |
52 The function can be called multiple times when multiple source level | |
53 compilation units are combined (such as in C frontend) | |
54 | |
55 - cgraph_optimize | |
56 | |
57 In this unit-at-a-time compilation the intra procedural analysis takes | |
58 place here. In particular the static functions whose address is never | |
59 taken are marked as local. Backend can then use this information to | |
60 modify calling conventions, do better inlining or similar optimizations. | |
61 | |
62 - cgraph_mark_needed_node | |
63 - varpool_mark_needed_node | |
64 | |
65 When function or variable is referenced by some hidden way the call-graph | |
66 data structure must be updated accordingly by this function. | |
67 There should be little need to call this function and all the references | |
68 should be made explicit to cgraph code. At present these functions are | |
69 used by C++ frontend to explicitly mark the keyed methods. | |
70 | |
71 - analyze_expr callback | |
72 | |
73 This function is responsible for lowering tree nodes not understood by | |
74 generic code into understandable ones or alternatively marking | |
75 callgraph and varpool nodes referenced by the as needed. | |
76 | |
77 ??? On the tree-ssa genericizing should take place here and we will avoid | |
78 need for these hooks (replacing them by genericizing hook) | |
79 | |
80 Analyzing of all functions is deferred | |
81 to cgraph_finalize_compilation_unit and expansion into cgraph_optimize. | |
82 | |
83 In cgraph_finalize_compilation_unit the reachable functions are | |
84 analyzed. During analysis the call-graph edges from reachable | |
85 functions are constructed and their destinations are marked as | |
86 reachable. References to functions and variables are discovered too | |
87 and variables found to be needed output to the assembly file. Via | |
88 mark_referenced call in assemble_variable functions referenced by | |
89 static variables are noticed too. | |
90 | |
91 The intra-procedural information is produced and its existence | |
92 indicated by global_info_ready. Once this flag is set it is impossible | |
93 to change function from !reachable to reachable and thus | |
94 assemble_variable no longer call mark_referenced. | |
95 | |
96 Finally the call-graph is topologically sorted and all reachable functions | |
97 that has not been completely inlined or are not external are output. | |
98 | |
99 ??? It is possible that reference to function or variable is optimized | |
100 out. We can not deal with this nicely because topological order is not | |
101 suitable for it. For tree-ssa we may consider another pass doing | |
102 optimization and re-discovering reachable functions. | |
103 | |
104 ??? Reorganize code so variables are output very last and only if they | |
105 really has been referenced by produced code, so we catch more cases | |
106 where reference has been optimized out. */ | |
107 | |
108 | |
109 #include "config.h" | |
110 #include "system.h" | |
111 #include "coretypes.h" | |
112 #include "tm.h" | |
113 #include "tree.h" | |
114 #include "rtl.h" | |
115 #include "tree-flow.h" | |
116 #include "tree-inline.h" | |
117 #include "langhooks.h" | |
118 #include "pointer-set.h" | |
119 #include "toplev.h" | |
120 #include "flags.h" | |
121 #include "ggc.h" | |
122 #include "debug.h" | |
123 #include "target.h" | |
124 #include "cgraph.h" | |
125 #include "diagnostic.h" | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
126 #include "tree-pretty-print.h" |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
127 #include "gimple-pretty-print.h" |
0 | 128 #include "timevar.h" |
129 #include "params.h" | |
130 #include "fibheap.h" | |
131 #include "intl.h" | |
132 #include "function.h" | |
133 #include "ipa-prop.h" | |
134 #include "gimple.h" | |
135 #include "tree-iterator.h" | |
136 #include "tree-pass.h" | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
137 #include "tree-dump.h" |
0 | 138 #include "output.h" |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
139 #include "coverage.h" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
140 #include "plugin.h" |
0 | 141 |
142 static void cgraph_expand_all_functions (void); | |
143 static void cgraph_mark_functions_to_output (void); | |
144 static void cgraph_expand_function (struct cgraph_node *); | |
145 static void cgraph_output_pending_asms (void); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
146 static void cgraph_analyze_function (struct cgraph_node *); |
0 | 147 |
148 static FILE *cgraph_dump_file; | |
149 | |
150 /* A vector of FUNCTION_DECLs declared as static constructors. */ | |
151 static GTY (()) VEC(tree, gc) *static_ctors; | |
152 /* A vector of FUNCTION_DECLs declared as static destructors. */ | |
153 static GTY (()) VEC(tree, gc) *static_dtors; | |
154 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
155 /* Used for vtable lookup in thunk adjusting. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
156 static GTY (()) tree vtable_entry_type; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
157 |
0 | 158 /* When target does not have ctors and dtors, we call all constructor |
159 and destructor by special initialization/destruction function | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
160 recognized by collect2. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
161 |
0 | 162 When we are going to build this function, collect all constructors and |
163 destructors and turn them into normal functions. */ | |
164 | |
165 static void | |
166 record_cdtor_fn (tree fndecl) | |
167 { | |
168 struct cgraph_node *node; | |
169 if (targetm.have_ctors_dtors | |
170 || (!DECL_STATIC_CONSTRUCTOR (fndecl) | |
171 && !DECL_STATIC_DESTRUCTOR (fndecl))) | |
172 return; | |
173 | |
174 if (DECL_STATIC_CONSTRUCTOR (fndecl)) | |
175 { | |
176 VEC_safe_push (tree, gc, static_ctors, fndecl); | |
177 DECL_STATIC_CONSTRUCTOR (fndecl) = 0; | |
178 } | |
179 if (DECL_STATIC_DESTRUCTOR (fndecl)) | |
180 { | |
181 VEC_safe_push (tree, gc, static_dtors, fndecl); | |
182 DECL_STATIC_DESTRUCTOR (fndecl) = 0; | |
183 } | |
184 node = cgraph_node (fndecl); | |
185 node->local.disregard_inline_limits = 1; | |
186 cgraph_mark_reachable_node (node); | |
187 } | |
188 | |
189 /* Define global constructors/destructor functions for the CDTORS, of | |
190 which they are LEN. The CDTORS are sorted by initialization | |
191 priority. If CTOR_P is true, these are constructors; otherwise, | |
192 they are destructors. */ | |
193 | |
194 static void | |
195 build_cdtor (bool ctor_p, tree *cdtors, size_t len) | |
196 { | |
197 size_t i; | |
198 | |
199 i = 0; | |
200 while (i < len) | |
201 { | |
202 tree body; | |
203 tree fn; | |
204 priority_type priority; | |
205 | |
206 priority = 0; | |
207 body = NULL_TREE; | |
208 /* Find the next batch of constructors/destructors with the same | |
209 initialization priority. */ | |
210 do | |
211 { | |
212 priority_type p; | |
213 fn = cdtors[i]; | |
214 p = ctor_p ? DECL_INIT_PRIORITY (fn) : DECL_FINI_PRIORITY (fn); | |
215 if (!body) | |
216 priority = p; | |
217 else if (p != priority) | |
218 break; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
219 append_to_statement_list (build_function_call_expr (UNKNOWN_LOCATION, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
220 fn, 0), |
0 | 221 &body); |
222 ++i; | |
223 } | |
224 while (i < len); | |
225 gcc_assert (body != NULL_TREE); | |
226 /* Generate a function to call all the function of like | |
227 priority. */ | |
228 cgraph_build_static_cdtor (ctor_p ? 'I' : 'D', body, priority); | |
229 } | |
230 } | |
231 | |
232 /* Comparison function for qsort. P1 and P2 are actually of type | |
233 "tree *" and point to static constructors. DECL_INIT_PRIORITY is | |
234 used to determine the sort order. */ | |
235 | |
236 static int | |
237 compare_ctor (const void *p1, const void *p2) | |
238 { | |
239 tree f1; | |
240 tree f2; | |
241 int priority1; | |
242 int priority2; | |
243 | |
244 f1 = *(const tree *)p1; | |
245 f2 = *(const tree *)p2; | |
246 priority1 = DECL_INIT_PRIORITY (f1); | |
247 priority2 = DECL_INIT_PRIORITY (f2); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
248 |
0 | 249 if (priority1 < priority2) |
250 return -1; | |
251 else if (priority1 > priority2) | |
252 return 1; | |
253 else | |
254 /* Ensure a stable sort. */ | |
255 return (const tree *)p1 - (const tree *)p2; | |
256 } | |
257 | |
258 /* Comparison function for qsort. P1 and P2 are actually of type | |
259 "tree *" and point to static destructors. DECL_FINI_PRIORITY is | |
260 used to determine the sort order. */ | |
261 | |
262 static int | |
263 compare_dtor (const void *p1, const void *p2) | |
264 { | |
265 tree f1; | |
266 tree f2; | |
267 int priority1; | |
268 int priority2; | |
269 | |
270 f1 = *(const tree *)p1; | |
271 f2 = *(const tree *)p2; | |
272 priority1 = DECL_FINI_PRIORITY (f1); | |
273 priority2 = DECL_FINI_PRIORITY (f2); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
274 |
0 | 275 if (priority1 < priority2) |
276 return -1; | |
277 else if (priority1 > priority2) | |
278 return 1; | |
279 else | |
280 /* Ensure a stable sort. */ | |
281 return (const tree *)p1 - (const tree *)p2; | |
282 } | |
283 | |
284 /* Generate functions to call static constructors and destructors | |
285 for targets that do not support .ctors/.dtors sections. These | |
286 functions have magic names which are detected by collect2. */ | |
287 | |
288 static void | |
289 cgraph_build_cdtor_fns (void) | |
290 { | |
291 if (!VEC_empty (tree, static_ctors)) | |
292 { | |
293 gcc_assert (!targetm.have_ctors_dtors); | |
294 qsort (VEC_address (tree, static_ctors), | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
295 VEC_length (tree, static_ctors), |
0 | 296 sizeof (tree), |
297 compare_ctor); | |
298 build_cdtor (/*ctor_p=*/true, | |
299 VEC_address (tree, static_ctors), | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
300 VEC_length (tree, static_ctors)); |
0 | 301 VEC_truncate (tree, static_ctors, 0); |
302 } | |
303 | |
304 if (!VEC_empty (tree, static_dtors)) | |
305 { | |
306 gcc_assert (!targetm.have_ctors_dtors); | |
307 qsort (VEC_address (tree, static_dtors), | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
308 VEC_length (tree, static_dtors), |
0 | 309 sizeof (tree), |
310 compare_dtor); | |
311 build_cdtor (/*ctor_p=*/false, | |
312 VEC_address (tree, static_dtors), | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
313 VEC_length (tree, static_dtors)); |
0 | 314 VEC_truncate (tree, static_dtors, 0); |
315 } | |
316 } | |
317 | |
318 /* Determine if function DECL is needed. That is, visible to something | |
319 either outside this translation unit, something magic in the system | |
320 configury. */ | |
321 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
322 bool |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
323 cgraph_decide_is_function_needed (struct cgraph_node *node, tree decl) |
0 | 324 { |
325 /* If the user told us it is used, then it must be so. */ | |
326 if (node->local.externally_visible) | |
327 return true; | |
328 | |
329 /* ??? If the assembler name is set by hand, it is possible to assemble | |
330 the name later after finalizing the function and the fact is noticed | |
331 in assemble_name then. This is arguably a bug. */ | |
332 if (DECL_ASSEMBLER_NAME_SET_P (decl) | |
333 && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) | |
334 return true; | |
335 | |
336 /* With -fkeep-inline-functions we are keeping all inline functions except | |
337 for extern inline ones. */ | |
338 if (flag_keep_inline_functions | |
339 && DECL_DECLARED_INLINE_P (decl) | |
340 && !DECL_EXTERNAL (decl) | |
341 && !lookup_attribute ("always_inline", DECL_ATTRIBUTES (decl))) | |
342 return true; | |
343 | |
344 /* If we decided it was needed before, but at the time we didn't have | |
345 the body of the function available, then it's still needed. We have | |
346 to go back and re-check its dependencies now. */ | |
347 if (node->needed) | |
348 return true; | |
349 | |
350 /* Externally visible functions must be output. The exception is | |
351 COMDAT functions that must be output only when they are needed. | |
352 | |
353 When not optimizing, also output the static functions. (see | |
354 PR24561), but don't do so for always_inline functions, functions | |
355 declared inline and nested functions. These was optimized out | |
356 in the original implementation and it is unclear whether we want | |
357 to change the behavior here. */ | |
358 if (((TREE_PUBLIC (decl) | |
359 || (!optimize && !node->local.disregard_inline_limits | |
360 && !DECL_DECLARED_INLINE_P (decl) | |
361 && !node->origin)) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
362 && !flag_whole_program |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
363 && !flag_lto |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
364 && !flag_whopr) |
0 | 365 && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl)) |
366 return true; | |
367 | |
368 /* Constructors and destructors are reachable from the runtime by | |
369 some mechanism. */ | |
370 if (DECL_STATIC_CONSTRUCTOR (decl) || DECL_STATIC_DESTRUCTOR (decl)) | |
371 return true; | |
372 | |
373 return false; | |
374 } | |
375 | |
376 /* Process CGRAPH_NEW_FUNCTIONS and perform actions necessary to add these | |
377 functions into callgraph in a way so they look like ordinary reachable | |
378 functions inserted into callgraph already at construction time. */ | |
379 | |
380 bool | |
381 cgraph_process_new_functions (void) | |
382 { | |
383 bool output = false; | |
384 tree fndecl; | |
385 struct cgraph_node *node; | |
386 | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
387 varpool_analyze_pending_decls (); |
0 | 388 /* Note that this queue may grow as its being processed, as the new |
389 functions may generate new ones. */ | |
390 while (cgraph_new_nodes) | |
391 { | |
392 node = cgraph_new_nodes; | |
393 fndecl = node->decl; | |
394 cgraph_new_nodes = cgraph_new_nodes->next_needed; | |
395 switch (cgraph_state) | |
396 { | |
397 case CGRAPH_STATE_CONSTRUCTION: | |
398 /* At construction time we just need to finalize function and move | |
399 it into reachable functions list. */ | |
400 | |
401 node->next_needed = NULL; | |
402 cgraph_finalize_function (fndecl, false); | |
403 cgraph_mark_reachable_node (node); | |
404 output = true; | |
405 break; | |
406 | |
407 case CGRAPH_STATE_IPA: | |
408 case CGRAPH_STATE_IPA_SSA: | |
409 /* When IPA optimization already started, do all essential | |
410 transformations that has been already performed on the whole | |
411 cgraph but not on this function. */ | |
412 | |
413 gimple_register_cfg_hooks (); | |
414 if (!node->analyzed) | |
415 cgraph_analyze_function (node); | |
416 push_cfun (DECL_STRUCT_FUNCTION (fndecl)); | |
417 current_function_decl = fndecl; | |
418 compute_inline_parameters (node); | |
419 if ((cgraph_state == CGRAPH_STATE_IPA_SSA | |
420 && !gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl))) | |
421 /* When not optimizing, be sure we run early local passes anyway | |
422 to expand OMP. */ | |
423 || !optimize) | |
424 execute_pass_list (pass_early_local_passes.pass.sub); | |
425 free_dominance_info (CDI_POST_DOMINATORS); | |
426 free_dominance_info (CDI_DOMINATORS); | |
427 pop_cfun (); | |
428 current_function_decl = NULL; | |
429 break; | |
430 | |
431 case CGRAPH_STATE_EXPANSION: | |
432 /* Functions created during expansion shall be compiled | |
433 directly. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
434 node->process = 0; |
0 | 435 cgraph_expand_function (node); |
436 break; | |
437 | |
438 default: | |
439 gcc_unreachable (); | |
440 break; | |
441 } | |
442 cgraph_call_function_insertion_hooks (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
|
443 varpool_analyze_pending_decls (); |
0 | 444 } |
445 return output; | |
446 } | |
447 | |
448 /* As an GCC extension we allow redefinition of the function. The | |
449 semantics when both copies of bodies differ is not well defined. | |
450 We replace the old body with new body so in unit at a time mode | |
451 we always use new body, while in normal mode we may end up with | |
452 old body inlined into some functions and new body expanded and | |
453 inlined in others. | |
454 | |
455 ??? It may make more sense to use one body for inlining and other | |
456 body for expanding the function but this is difficult to do. */ | |
457 | |
458 static void | |
459 cgraph_reset_node (struct cgraph_node *node) | |
460 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
461 /* If node->process is set, then we have already begun whole-unit analysis. |
0 | 462 This is *not* testing for whether we've already emitted the function. |
463 That case can be sort-of legitimately seen with real function redefinition | |
464 errors. I would argue that the front end should never present us with | |
465 such a case, but don't enforce that for now. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
466 gcc_assert (!node->process); |
0 | 467 |
468 /* Reset our data structures so we can analyze the function again. */ | |
469 memset (&node->local, 0, sizeof (node->local)); | |
470 memset (&node->global, 0, sizeof (node->global)); | |
471 memset (&node->rtl, 0, sizeof (node->rtl)); | |
472 node->analyzed = false; | |
473 node->local.redefined_extern_inline = true; | |
474 node->local.finalized = false; | |
475 | |
476 cgraph_node_remove_callees (node); | |
477 | |
478 /* We may need to re-queue the node for assembling in case | |
479 we already proceeded it and ignored as not needed or got | |
480 a re-declaration in IMA mode. */ | |
481 if (node->reachable) | |
482 { | |
483 struct cgraph_node *n; | |
484 | |
485 for (n = cgraph_nodes_queue; n; n = n->next_needed) | |
486 if (n == node) | |
487 break; | |
488 if (!n) | |
489 node->reachable = 0; | |
490 } | |
491 } | |
492 | |
493 static void | |
494 cgraph_lower_function (struct cgraph_node *node) | |
495 { | |
496 if (node->lowered) | |
497 return; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
498 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
499 if (node->nested) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
500 lower_nested_functions (node->decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
501 gcc_assert (!node->nested); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
502 |
0 | 503 tree_lowering_passes (node->decl); |
504 node->lowered = true; | |
505 } | |
506 | |
507 /* DECL has been parsed. Take it, queue it, compile it at the whim of the | |
508 logic in effect. If NESTED is true, then our caller cannot stand to have | |
509 the garbage collector run at the moment. We would need to either create | |
510 a new GC context, or just not compile right now. */ | |
511 | |
512 void | |
513 cgraph_finalize_function (tree decl, bool nested) | |
514 { | |
515 struct cgraph_node *node = cgraph_node (decl); | |
516 | |
517 if (node->local.finalized) | |
518 cgraph_reset_node (node); | |
519 | |
520 node->pid = cgraph_max_pid ++; | |
521 notice_global_symbol (decl); | |
522 node->local.finalized = true; | |
523 node->lowered = DECL_STRUCT_FUNCTION (decl)->cfg != NULL; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
524 node->finalized_by_frontend = true; |
0 | 525 record_cdtor_fn (node->decl); |
526 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
527 if (cgraph_decide_is_function_needed (node, decl)) |
0 | 528 cgraph_mark_needed_node (node); |
529 | |
530 /* Since we reclaim unreachable nodes at the end of every language | |
531 level unit, we need to be conservative about possible entry points | |
532 there. */ | |
533 if ((TREE_PUBLIC (decl) && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl))) | |
534 cgraph_mark_reachable_node (node); | |
535 | |
536 /* If we've not yet emitted decl, tell the debug info about it. */ | |
537 if (!TREE_ASM_WRITTEN (decl)) | |
538 (*debug_hooks->deferred_inline_function) (decl); | |
539 | |
540 /* Possibly warn about unused parameters. */ | |
541 if (warn_unused_parameter) | |
542 do_warn_unused_parameter (decl); | |
543 | |
544 if (!nested) | |
545 ggc_collect (); | |
546 } | |
547 | |
548 /* C99 extern inline keywords allow changing of declaration after function | |
549 has been finalized. We need to re-decide if we want to mark the function as | |
550 needed then. */ | |
551 | |
552 void | |
553 cgraph_mark_if_needed (tree decl) | |
554 { | |
555 struct cgraph_node *node = cgraph_node (decl); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
556 if (node->local.finalized && cgraph_decide_is_function_needed (node, decl)) |
0 | 557 cgraph_mark_needed_node (node); |
558 } | |
559 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
560 /* Return TRUE if NODE2 is equivalent to NODE or its clone. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
561 static bool |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
562 clone_of_p (struct cgraph_node *node, struct cgraph_node *node2) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
563 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
564 while (node != node2 && node2) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
565 node2 = node2->clone_of; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
566 return node2 != NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
567 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
568 |
0 | 569 /* Verify cgraph nodes of given cgraph node. */ |
570 void | |
571 verify_cgraph_node (struct cgraph_node *node) | |
572 { | |
573 struct cgraph_edge *e; | |
574 struct function *this_cfun = DECL_STRUCT_FUNCTION (node->decl); | |
575 struct function *saved_cfun = cfun; | |
576 basic_block this_block; | |
577 gimple_stmt_iterator gsi; | |
578 bool error_found = false; | |
579 | |
580 if (errorcount || sorrycount) | |
581 return; | |
582 | |
583 timevar_push (TV_CGRAPH_VERIFY); | |
584 /* debug_generic_stmt needs correct cfun */ | |
585 set_cfun (this_cfun); | |
586 for (e = node->callees; e; e = e->next_callee) | |
587 if (e->aux) | |
588 { | |
589 error ("aux field set for edge %s->%s", | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
590 identifier_to_locale (cgraph_node_name (e->caller)), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
591 identifier_to_locale (cgraph_node_name (e->callee))); |
0 | 592 error_found = true; |
593 } | |
594 if (node->count < 0) | |
595 { | |
596 error ("Execution count is negative"); | |
597 error_found = true; | |
598 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
599 if (node->global.inlined_to && node->local.externally_visible) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
600 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
601 error ("Externally visible inline clone"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
602 error_found = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
603 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
604 if (node->global.inlined_to && node->address_taken) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
605 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
606 error ("Inline clone with address taken"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
607 error_found = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
608 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
609 if (node->global.inlined_to && node->needed) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
610 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
611 error ("Inline clone is needed"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
612 error_found = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
613 } |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
614 for (e = node->indirect_calls; e; e = e->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
|
615 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
616 if (e->aux) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
617 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
618 error ("aux field set for indirect edge from %s", |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
619 identifier_to_locale (cgraph_node_name (e->caller))); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
620 error_found = true; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
621 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
622 if (!e->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
|
623 || !e->indirect_info) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
624 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
625 error ("An indirect edge from %s is not marked as indirect or has " |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
626 "associated indirect_info, the corresponding statement is: ", |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
627 identifier_to_locale (cgraph_node_name (e->caller))); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
628 debug_gimple_stmt (e->call_stmt); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
629 error_found = true; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
630 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
631 } |
0 | 632 for (e = node->callers; e; e = e->next_caller) |
633 { | |
634 if (e->count < 0) | |
635 { | |
636 error ("caller edge count is negative"); | |
637 error_found = true; | |
638 } | |
639 if (e->frequency < 0) | |
640 { | |
641 error ("caller edge frequency is negative"); | |
642 error_found = true; | |
643 } | |
644 if (e->frequency > CGRAPH_FREQ_MAX) | |
645 { | |
646 error ("caller edge frequency is too large"); | |
647 error_found = true; | |
648 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
649 if (gimple_has_body_p (e->caller->decl) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
650 && !e->caller->global.inlined_to |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
651 && (e->frequency |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
652 != compute_call_stmt_bb_frequency (e->caller->decl, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
653 gimple_bb (e->call_stmt)))) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
654 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
655 error ("caller edge frequency %i does not match BB freqency %i", |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
656 e->frequency, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
657 compute_call_stmt_bb_frequency (e->caller->decl, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
658 gimple_bb (e->call_stmt))); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
659 error_found = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
660 } |
0 | 661 if (!e->inline_failed) |
662 { | |
663 if (node->global.inlined_to | |
664 != (e->caller->global.inlined_to | |
665 ? e->caller->global.inlined_to : e->caller)) | |
666 { | |
667 error ("inlined_to pointer is wrong"); | |
668 error_found = true; | |
669 } | |
670 if (node->callers->next_caller) | |
671 { | |
672 error ("multiple inline callers"); | |
673 error_found = true; | |
674 } | |
675 } | |
676 else | |
677 if (node->global.inlined_to) | |
678 { | |
679 error ("inlined_to pointer set for noninline callers"); | |
680 error_found = true; | |
681 } | |
682 } | |
683 if (!node->callers && node->global.inlined_to) | |
684 { | |
685 error ("inlined_to pointer is set but no predecessors found"); | |
686 error_found = true; | |
687 } | |
688 if (node->global.inlined_to == node) | |
689 { | |
690 error ("inlined_to pointer refers to itself"); | |
691 error_found = true; | |
692 } | |
693 | |
694 if (!cgraph_node (node->decl)) | |
695 { | |
696 error ("node not found in cgraph_hash"); | |
697 error_found = true; | |
698 } | |
699 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
700 if (node->clone_of) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
701 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
702 struct cgraph_node *n; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
703 for (n = node->clone_of->clones; n; n = n->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
704 if (n == node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
705 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
706 if (!n) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
707 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
708 error ("node has wrong clone_of"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
709 error_found = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
710 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
711 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
712 if (node->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
713 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
714 struct cgraph_node *n; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
715 for (n = node->clones; n; n = n->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
716 if (n->clone_of != node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
717 break; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
718 if (n) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
719 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
720 error ("node has wrong clone list"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
721 error_found = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
722 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
723 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
724 if ((node->prev_sibling_clone || node->next_sibling_clone) && !node->clone_of) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
725 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
726 error ("node is in clone list but it is not clone"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
727 error_found = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
728 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
729 if (!node->prev_sibling_clone && node->clone_of && node->clone_of->clones != node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
730 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
731 error ("node has wrong prev_clone pointer"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
732 error_found = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
733 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
734 if (node->prev_sibling_clone && node->prev_sibling_clone->next_sibling_clone != node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
735 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
736 error ("double linked list of clones corrupted"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
737 error_found = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
738 } |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
739 if (node->same_comdat_group) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
740 { |
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 cgraph_node *n = node->same_comdat_group; |
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 if (!DECL_ONE_ONLY (node->decl)) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
744 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
745 error ("non-DECL_ONE_ONLY node in a same_comdat_group list"); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
746 error_found = true; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
747 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
748 if (n == node) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
749 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
750 error ("node is alone in a comdat group"); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
751 error_found = true; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
752 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
753 do |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
754 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
755 if (!n->same_comdat_group) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
756 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
757 error ("same_comdat_group is not a circular list"); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
758 error_found = true; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
759 break; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
760 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
761 n = n->same_comdat_group; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
762 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
763 while (n != node); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
764 } |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
765 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
766 if (node->analyzed && gimple_has_body_p (node->decl) |
0 | 767 && !TREE_ASM_WRITTEN (node->decl) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
768 && (!DECL_EXTERNAL (node->decl) || node->global.inlined_to) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
769 && !flag_wpa) |
0 | 770 { |
771 if (this_cfun->cfg) | |
772 { | |
773 /* The nodes we're interested in are never shared, so walk | |
774 the tree ignoring duplicates. */ | |
775 struct pointer_set_t *visited_nodes = pointer_set_create (); | |
776 /* Reach the trees by walking over the CFG, and note the | |
777 enclosing basic-blocks in the call edges. */ | |
778 FOR_EACH_BB_FN (this_block, this_cfun) | |
779 for (gsi = gsi_start_bb (this_block); | |
780 !gsi_end_p (gsi); | |
781 gsi_next (&gsi)) | |
782 { | |
783 gimple stmt = gsi_stmt (gsi); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
784 if (is_gimple_call (stmt)) |
0 | 785 { |
786 struct cgraph_edge *e = cgraph_edge (node, stmt); | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
787 tree decl = gimple_call_fndecl (stmt); |
0 | 788 if (e) |
789 { | |
790 if (e->aux) | |
791 { | |
792 error ("shared call_stmt:"); | |
793 debug_gimple_stmt (stmt); | |
794 error_found = true; | |
795 } | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
796 if (!e->indirect_unknown_callee) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
797 { |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
798 if (e->callee->same_body_alias) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
799 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
800 error ("edge points to same body alias:"); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
801 debug_tree (e->callee->decl); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
802 error_found = true; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
803 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
804 else 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
|
805 && !e->callee->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
|
806 && decl |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
807 && !clone_of_p (cgraph_node (decl), |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
808 e->callee)) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
809 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
810 error ("edge points to wrong declaration:"); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
811 debug_tree (e->callee->decl); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
812 fprintf (stderr," Instead of:"); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
813 debug_tree (decl); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
814 error_found = true; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
815 } |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
816 } |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
817 else if (decl) |
0 | 818 { |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
819 error ("an indirect edge with 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
|
820 "corresponding to a call_stmt with " |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
821 "a known declaration:"); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
822 error_found = 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
|
823 debug_gimple_stmt (e->call_stmt); |
0 | 824 } |
825 e->aux = (void *)1; | |
826 } | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
827 else if (decl) |
0 | 828 { |
829 error ("missing callgraph edge for call stmt:"); | |
830 debug_gimple_stmt (stmt); | |
831 error_found = true; | |
832 } | |
833 } | |
834 } | |
835 pointer_set_destroy (visited_nodes); | |
836 } | |
837 else | |
838 /* No CFG available?! */ | |
839 gcc_unreachable (); | |
840 | |
841 for (e = node->callees; e; e = e->next_callee) | |
842 { | |
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 if (!e->aux) |
0 | 844 { |
845 error ("edge %s->%s has no corresponding call_stmt", | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
846 identifier_to_locale (cgraph_node_name (e->caller)), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
847 identifier_to_locale (cgraph_node_name (e->callee))); |
0 | 848 debug_gimple_stmt (e->call_stmt); |
849 error_found = true; | |
850 } | |
851 e->aux = 0; | |
852 } | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
853 for (e = node->indirect_calls; e; e = e->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
|
854 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
855 if (!e->aux) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
856 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
857 error ("an indirect edge from %s has no corresponding call_stmt", |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
858 identifier_to_locale (cgraph_node_name (e->caller))); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
859 debug_gimple_stmt (e->call_stmt); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
860 error_found = true; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
861 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
862 e->aux = 0; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
863 } |
0 | 864 } |
865 if (error_found) | |
866 { | |
867 dump_cgraph_node (stderr, node); | |
868 internal_error ("verify_cgraph_node failed"); | |
869 } | |
870 set_cfun (saved_cfun); | |
871 timevar_pop (TV_CGRAPH_VERIFY); | |
872 } | |
873 | |
874 /* Verify whole cgraph structure. */ | |
875 void | |
876 verify_cgraph (void) | |
877 { | |
878 struct cgraph_node *node; | |
879 | |
880 if (sorrycount || errorcount) | |
881 return; | |
882 | |
883 for (node = cgraph_nodes; node; node = node->next) | |
884 verify_cgraph_node (node); | |
885 } | |
886 | |
887 /* Output all asm statements we have stored up to be output. */ | |
888 | |
889 static void | |
890 cgraph_output_pending_asms (void) | |
891 { | |
892 struct cgraph_asm_node *can; | |
893 | |
894 if (errorcount || sorrycount) | |
895 return; | |
896 | |
897 for (can = cgraph_asm_nodes; can; can = can->next) | |
898 assemble_asm (can->asm_str); | |
899 cgraph_asm_nodes = NULL; | |
900 } | |
901 | |
902 /* Analyze the function scheduled to be output. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
903 static void |
0 | 904 cgraph_analyze_function (struct cgraph_node *node) |
905 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
906 tree save = current_function_decl; |
0 | 907 tree decl = node->decl; |
908 | |
909 current_function_decl = decl; | |
910 push_cfun (DECL_STRUCT_FUNCTION (decl)); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
911 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
912 assign_assembler_name_if_neeeded (node->decl); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
913 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
914 /* Make sure to gimplify bodies only once. During analyzing a |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
915 function we lower it, which will require gimplified nested |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
916 functions, so we can end up here with an already gimplified |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
917 body. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
918 if (!gimple_body (decl)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
919 gimplify_function_tree (decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
920 dump_function (TDI_generic, decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
921 |
0 | 922 cgraph_lower_function (node); |
923 node->analyzed = true; | |
924 | |
925 pop_cfun (); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
926 current_function_decl = save; |
0 | 927 } |
928 | |
929 /* Look for externally_visible and used attributes and mark cgraph nodes | |
930 accordingly. | |
931 | |
932 We cannot mark the nodes at the point the attributes are processed (in | |
933 handle_*_attribute) because the copy of the declarations available at that | |
934 point may not be canonical. For example, in: | |
935 | |
936 void f(); | |
937 void f() __attribute__((used)); | |
938 | |
939 the declaration we see in handle_used_attribute will be the second | |
940 declaration -- but the front end will subsequently merge that declaration | |
941 with the original declaration and discard the second declaration. | |
942 | |
943 Furthermore, we can't mark these nodes in cgraph_finalize_function because: | |
944 | |
945 void f() {} | |
946 void f() __attribute__((externally_visible)); | |
947 | |
948 is valid. | |
949 | |
950 So, we walk the nodes at the end of the translation unit, applying the | |
951 attributes at that point. */ | |
952 | |
953 static void | |
954 process_function_and_variable_attributes (struct cgraph_node *first, | |
955 struct varpool_node *first_var) | |
956 { | |
957 struct cgraph_node *node; | |
958 struct varpool_node *vnode; | |
959 | |
960 for (node = cgraph_nodes; node != first; node = node->next) | |
961 { | |
962 tree decl = node->decl; | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
963 if (DECL_PRESERVE_P (decl)) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
964 cgraph_mark_needed_node (node); |
0 | 965 if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl))) |
966 { | |
967 if (! TREE_PUBLIC (node->decl)) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
968 warning_at (DECL_SOURCE_LOCATION (node->decl), OPT_Wattributes, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
969 "%<externally_visible%>" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
970 " attribute have effect only on public objects"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
971 else if (node->local.finalized) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
972 cgraph_mark_needed_node (node); |
0 | 973 } |
974 } | |
975 for (vnode = varpool_nodes; vnode != first_var; vnode = vnode->next) | |
976 { | |
977 tree decl = vnode->decl; | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
978 if (DECL_PRESERVE_P (decl)) |
0 | 979 { |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
980 vnode->force_output = true; |
0 | 981 if (vnode->finalized) |
982 varpool_mark_needed_node (vnode); | |
983 } | |
984 if (lookup_attribute ("externally_visible", DECL_ATTRIBUTES (decl))) | |
985 { | |
986 if (! TREE_PUBLIC (vnode->decl)) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
987 warning_at (DECL_SOURCE_LOCATION (vnode->decl), OPT_Wattributes, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
988 "%<externally_visible%>" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
989 " attribute have effect only on public objects"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
990 else if (vnode->finalized) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
991 varpool_mark_needed_node (vnode); |
0 | 992 } |
993 } | |
994 } | |
995 | |
996 /* Process CGRAPH_NODES_NEEDED queue, analyze each function (and transitively | |
997 each reachable functions) and build cgraph. | |
998 The function can be called multiple times after inserting new nodes | |
999 into beginning of queue. Just the new part of queue is re-scanned then. */ | |
1000 | |
1001 static void | |
1002 cgraph_analyze_functions (void) | |
1003 { | |
1004 /* Keep track of already processed nodes when called multiple times for | |
1005 intermodule optimization. */ | |
1006 static struct cgraph_node *first_analyzed; | |
1007 struct cgraph_node *first_processed = first_analyzed; | |
1008 static struct varpool_node *first_analyzed_var; | |
1009 struct cgraph_node *node, *next; | |
1010 | |
1011 process_function_and_variable_attributes (first_processed, | |
1012 first_analyzed_var); | |
1013 first_processed = cgraph_nodes; | |
1014 first_analyzed_var = varpool_nodes; | |
1015 varpool_analyze_pending_decls (); | |
1016 if (cgraph_dump_file) | |
1017 { | |
1018 fprintf (cgraph_dump_file, "Initial entry points:"); | |
1019 for (node = cgraph_nodes; node != first_analyzed; node = node->next) | |
1020 if (node->needed) | |
1021 fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); | |
1022 fprintf (cgraph_dump_file, "\n"); | |
1023 } | |
1024 cgraph_process_new_functions (); | |
1025 | |
1026 /* Propagate reachability flag and lower representation of all reachable | |
1027 functions. In the future, lowering will introduce new functions and | |
1028 new entry points on the way (by template instantiation and virtual | |
1029 method table generation for instance). */ | |
1030 while (cgraph_nodes_queue) | |
1031 { | |
1032 struct cgraph_edge *edge; | |
1033 tree decl = cgraph_nodes_queue->decl; | |
1034 | |
1035 node = cgraph_nodes_queue; | |
1036 cgraph_nodes_queue = cgraph_nodes_queue->next_needed; | |
1037 node->next_needed = NULL; | |
1038 | |
1039 /* ??? It is possible to create extern inline function and later using | |
1040 weak alias attribute to kill its body. See | |
1041 gcc.c-torture/compile/20011119-1.c */ | |
1042 if (!DECL_STRUCT_FUNCTION (decl)) | |
1043 { | |
1044 cgraph_reset_node (node); | |
1045 continue; | |
1046 } | |
1047 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1048 if (!node->analyzed) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1049 cgraph_analyze_function (node); |
0 | 1050 |
1051 for (edge = node->callees; edge; edge = edge->next_callee) | |
1052 if (!edge->callee->reachable) | |
1053 cgraph_mark_reachable_node (edge->callee); | |
1054 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1055 if (node->same_comdat_group) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1056 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1057 for (next = node->same_comdat_group; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1058 next != node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1059 next = next->same_comdat_group) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1060 cgraph_mark_reachable_node (next); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1061 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1062 |
0 | 1063 /* If decl is a clone of an abstract function, mark that abstract |
1064 function so that we don't release its body. The DECL_INITIAL() of that | |
1065 abstract function declaration will be later needed to output debug info. */ | |
1066 if (DECL_ABSTRACT_ORIGIN (decl)) | |
1067 { | |
1068 struct cgraph_node *origin_node = cgraph_node (DECL_ABSTRACT_ORIGIN (decl)); | |
1069 origin_node->abstract_and_needed = true; | |
1070 } | |
1071 | |
1072 /* We finalize local static variables during constructing callgraph | |
1073 edges. Process their attributes too. */ | |
1074 process_function_and_variable_attributes (first_processed, | |
1075 first_analyzed_var); | |
1076 first_processed = cgraph_nodes; | |
1077 first_analyzed_var = varpool_nodes; | |
1078 varpool_analyze_pending_decls (); | |
1079 cgraph_process_new_functions (); | |
1080 } | |
1081 | |
1082 /* Collect entry points to the unit. */ | |
1083 if (cgraph_dump_file) | |
1084 { | |
1085 fprintf (cgraph_dump_file, "Unit entry points:"); | |
1086 for (node = cgraph_nodes; node != first_analyzed; node = node->next) | |
1087 if (node->needed) | |
1088 fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); | |
1089 fprintf (cgraph_dump_file, "\n\nInitial "); | |
1090 dump_cgraph (cgraph_dump_file); | |
1091 } | |
1092 | |
1093 if (cgraph_dump_file) | |
1094 fprintf (cgraph_dump_file, "\nReclaiming functions:"); | |
1095 | |
1096 for (node = cgraph_nodes; node != first_analyzed; node = next) | |
1097 { | |
1098 tree decl = node->decl; | |
1099 next = node->next; | |
1100 | |
1101 if (node->local.finalized && !gimple_has_body_p (decl)) | |
1102 cgraph_reset_node (node); | |
1103 | |
1104 if (!node->reachable && gimple_has_body_p (decl)) | |
1105 { | |
1106 if (cgraph_dump_file) | |
1107 fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); | |
1108 cgraph_remove_node (node); | |
1109 continue; | |
1110 } | |
1111 else | |
1112 node->next_needed = NULL; | |
1113 gcc_assert (!node->local.finalized || gimple_has_body_p (decl)); | |
1114 gcc_assert (node->analyzed == node->local.finalized); | |
1115 } | |
1116 if (cgraph_dump_file) | |
1117 { | |
1118 fprintf (cgraph_dump_file, "\n\nReclaimed "); | |
1119 dump_cgraph (cgraph_dump_file); | |
1120 } | |
1121 first_analyzed = cgraph_nodes; | |
1122 ggc_collect (); | |
1123 } | |
1124 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1125 |
0 | 1126 /* Analyze the whole compilation unit once it is parsed completely. */ |
1127 | |
1128 void | |
1129 cgraph_finalize_compilation_unit (void) | |
1130 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1131 timevar_push (TV_CGRAPH); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1132 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1133 /* Do not skip analyzing the functions if there were errors, we |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1134 miss diagnostics for following functions otherwise. */ |
0 | 1135 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1136 /* Emit size functions we didn't inline. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1137 finalize_size_functions (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1138 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1139 /* Call functions declared with the "constructor" or "destructor" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1140 attribute. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1141 cgraph_build_cdtor_fns (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1142 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1143 /* Mark alias targets necessary and emit diagnostics. */ |
0 | 1144 finish_aliases_1 (); |
1145 | |
1146 if (!quiet_flag) | |
1147 { | |
1148 fprintf (stderr, "\nAnalyzing compilation unit\n"); | |
1149 fflush (stderr); | |
1150 } | |
1151 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1152 /* Gimplify and lower all functions, compute reachability and |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1153 remove unreachable nodes. */ |
0 | 1154 cgraph_analyze_functions (); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1155 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1156 /* Mark alias targets necessary and emit diagnostics. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1157 finish_aliases_1 (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1158 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1159 /* Gimplify and lower thunks. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1160 cgraph_analyze_functions (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1161 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1162 /* Finally drive the pass manager. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1163 cgraph_optimize (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1164 |
0 | 1165 timevar_pop (TV_CGRAPH); |
1166 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1167 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1168 |
0 | 1169 /* Figure out what functions we want to assemble. */ |
1170 | |
1171 static void | |
1172 cgraph_mark_functions_to_output (void) | |
1173 { | |
1174 struct cgraph_node *node; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1175 #ifdef ENABLE_CHECKING |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1176 bool check_same_comdat_groups = false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1177 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1178 for (node = cgraph_nodes; node; node = node->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1179 gcc_assert (!node->process); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1180 #endif |
0 | 1181 |
1182 for (node = cgraph_nodes; node; node = node->next) | |
1183 { | |
1184 tree decl = node->decl; | |
1185 struct cgraph_edge *e; | |
1186 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1187 gcc_assert (!node->process || node->same_comdat_group); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1188 if (node->process) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1189 continue; |
0 | 1190 |
1191 for (e = node->callers; e; e = e->next_caller) | |
1192 if (e->inline_failed) | |
1193 break; | |
1194 | |
1195 /* We need to output all local functions that are used and not | |
1196 always inlined, as well as those that are reachable from | |
1197 outside the current compilation unit. */ | |
1198 if (node->analyzed | |
1199 && !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
|
1200 && (node->needed || node->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
|
1201 || node->address_taken |
0 | 1202 || (e && node->reachable)) |
1203 && !TREE_ASM_WRITTEN (decl) | |
1204 && !DECL_EXTERNAL (decl)) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1205 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1206 node->process = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1207 if (node->same_comdat_group) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1208 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1209 struct cgraph_node *next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1210 for (next = node->same_comdat_group; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1211 next != node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1212 next = next->same_comdat_group) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1213 next->process = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1214 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1215 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1216 else if (node->same_comdat_group) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1217 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1218 #ifdef ENABLE_CHECKING |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1219 check_same_comdat_groups = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1220 #endif |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1221 } |
0 | 1222 else |
1223 { | |
1224 /* We should've reclaimed all functions that are not needed. */ | |
1225 #ifdef ENABLE_CHECKING | |
1226 if (!node->global.inlined_to | |
1227 && gimple_has_body_p (decl) | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1228 /* FIXME: in ltrans unit when offline copy is outside partition but inline copies |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1229 are inside partition, we can end up not removing the body since we no longer |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1230 have analyzed node pointing to it. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1231 && !node->in_other_partition |
0 | 1232 && !DECL_EXTERNAL (decl)) |
1233 { | |
1234 dump_cgraph_node (stderr, node); | |
1235 internal_error ("failed to reclaim unneeded function"); | |
1236 } | |
1237 #endif | |
1238 gcc_assert (node->global.inlined_to | |
1239 || !gimple_has_body_p (decl) | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1240 || node->in_other_partition |
0 | 1241 || DECL_EXTERNAL (decl)); |
1242 | |
1243 } | |
1244 | |
1245 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1246 #ifdef ENABLE_CHECKING |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1247 if (check_same_comdat_groups) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1248 for (node = cgraph_nodes; node; node = node->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1249 if (node->same_comdat_group && !node->process) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1250 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1251 tree decl = node->decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1252 if (!node->global.inlined_to |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1253 && gimple_has_body_p (decl) |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1254 /* FIXME: in ltrans unit when offline copy is outside partition but inline copies |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1255 are inside partition, we can end up not removing the body since we no longer |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1256 have analyzed node pointing to it. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1257 && !node->in_other_partition |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1258 && !DECL_EXTERNAL (decl)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1259 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1260 dump_cgraph_node (stderr, node); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1261 internal_error ("failed to reclaim unneeded function"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1262 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1263 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1264 #endif |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1265 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1266 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1267 /* DECL is FUNCTION_DECL. Initialize datastructures so DECL is a function |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1268 in lowered gimple form. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1269 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1270 Set current_function_decl and cfun to newly constructed empty function body. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1271 return basic block in the function body. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1272 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1273 static basic_block |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1274 init_lowered_empty_function (tree decl) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1275 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1276 basic_block bb; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1277 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1278 current_function_decl = decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1279 allocate_struct_function (decl, false); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1280 gimple_register_cfg_hooks (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1281 init_empty_tree_cfg (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1282 init_tree_ssa (cfun); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1283 init_ssa_operands (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1284 cfun->gimple_df->in_ssa_p = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1285 DECL_INITIAL (decl) = make_node (BLOCK); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1286 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1287 DECL_SAVED_TREE (decl) = error_mark_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1288 cfun->curr_properties |= |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1289 (PROP_gimple_lcf | PROP_gimple_leh | PROP_cfg | PROP_referenced_vars | |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1290 PROP_ssa); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1291 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1292 /* Create BB for body of the function and connect it properly. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1293 bb = create_basic_block (NULL, (void *) 0, ENTRY_BLOCK_PTR); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1294 make_edge (ENTRY_BLOCK_PTR, bb, 0); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1295 make_edge (bb, EXIT_BLOCK_PTR, 0); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1296 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1297 return bb; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1298 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1299 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1300 /* Adjust PTR by the constant FIXED_OFFSET, and by the vtable |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1301 offset indicated by VIRTUAL_OFFSET, if that is |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1302 non-null. THIS_ADJUSTING is nonzero for a this adjusting thunk and |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1303 zero for a result adjusting thunk. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1304 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1305 static tree |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1306 thunk_adjust (gimple_stmt_iterator * bsi, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1307 tree ptr, bool this_adjusting, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1308 HOST_WIDE_INT fixed_offset, tree virtual_offset) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1309 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1310 gimple stmt; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1311 tree ret; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1312 |
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 if (this_adjusting |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1314 && fixed_offset != 0) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1315 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1316 stmt = gimple_build_assign (ptr, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1317 fold_build2_loc (input_location, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1318 POINTER_PLUS_EXPR, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1319 TREE_TYPE (ptr), ptr, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1320 size_int (fixed_offset))); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1321 gsi_insert_after (bsi, stmt, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1322 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1323 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1324 /* If there's a virtual offset, look up that value in the vtable and |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1325 adjust the pointer again. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1326 if (virtual_offset) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1327 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1328 tree vtabletmp; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1329 tree vtabletmp2; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1330 tree vtabletmp3; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1331 tree offsettmp; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1332 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1333 if (!vtable_entry_type) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1334 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1335 tree vfunc_type = make_node (FUNCTION_TYPE); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1336 TREE_TYPE (vfunc_type) = integer_type_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1337 TYPE_ARG_TYPES (vfunc_type) = NULL_TREE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1338 layout_type (vfunc_type); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1339 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1340 vtable_entry_type = build_pointer_type (vfunc_type); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1341 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1342 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1343 vtabletmp = |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1344 create_tmp_var (build_pointer_type |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1345 (build_pointer_type (vtable_entry_type)), "vptr"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1346 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1347 /* The vptr is always at offset zero in the object. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1348 stmt = gimple_build_assign (vtabletmp, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1349 build1 (NOP_EXPR, TREE_TYPE (vtabletmp), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1350 ptr)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1351 gsi_insert_after (bsi, stmt, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1352 mark_symbols_for_renaming (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1353 find_referenced_vars_in (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1354 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1355 /* Form the vtable address. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1356 vtabletmp2 = create_tmp_var (TREE_TYPE (TREE_TYPE (vtabletmp)), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1357 "vtableaddr"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1358 stmt = gimple_build_assign (vtabletmp2, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1359 build1 (INDIRECT_REF, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1360 TREE_TYPE (vtabletmp2), vtabletmp)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1361 gsi_insert_after (bsi, stmt, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1362 mark_symbols_for_renaming (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1363 find_referenced_vars_in (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1364 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1365 /* Find the entry with the vcall offset. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1366 stmt = gimple_build_assign (vtabletmp2, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1367 fold_build2_loc (input_location, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1368 POINTER_PLUS_EXPR, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1369 TREE_TYPE (vtabletmp2), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1370 vtabletmp2, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1371 fold_convert (sizetype, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1372 virtual_offset))); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1373 gsi_insert_after (bsi, stmt, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1374 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1375 /* Get the offset itself. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1376 vtabletmp3 = create_tmp_var (TREE_TYPE (TREE_TYPE (vtabletmp2)), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1377 "vcalloffset"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1378 stmt = gimple_build_assign (vtabletmp3, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1379 build1 (INDIRECT_REF, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1380 TREE_TYPE (vtabletmp3), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1381 vtabletmp2)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1382 gsi_insert_after (bsi, stmt, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1383 mark_symbols_for_renaming (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1384 find_referenced_vars_in (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1385 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1386 /* Cast to sizetype. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1387 offsettmp = create_tmp_var (sizetype, "offset"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1388 stmt = gimple_build_assign (offsettmp, fold_convert (sizetype, vtabletmp3)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1389 gsi_insert_after (bsi, stmt, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1390 mark_symbols_for_renaming (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1391 find_referenced_vars_in (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1392 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1393 /* Adjust the `this' pointer. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1394 ptr = fold_build2_loc (input_location, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1395 POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1396 offsettmp); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1397 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1398 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1399 if (!this_adjusting |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1400 && fixed_offset != 0) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1401 /* Adjust the pointer by the constant. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1402 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1403 tree ptrtmp; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1404 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1405 if (TREE_CODE (ptr) == VAR_DECL) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1406 ptrtmp = ptr; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1407 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1408 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1409 ptrtmp = create_tmp_var (TREE_TYPE (ptr), "ptr"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1410 stmt = gimple_build_assign (ptrtmp, ptr); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1411 gsi_insert_after (bsi, stmt, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1412 mark_symbols_for_renaming (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1413 find_referenced_vars_in (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1414 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1415 ptr = fold_build2_loc (input_location, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1416 POINTER_PLUS_EXPR, TREE_TYPE (ptrtmp), ptrtmp, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1417 size_int (fixed_offset)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1418 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1419 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1420 /* Emit the statement and gimplify the adjustment expression. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1421 ret = create_tmp_var (TREE_TYPE (ptr), "adjusted_this"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1422 stmt = gimple_build_assign (ret, ptr); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1423 mark_symbols_for_renaming (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1424 find_referenced_vars_in (stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1425 gsi_insert_after (bsi, stmt, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1426 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1427 return ret; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1428 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1429 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1430 /* Produce assembler for thunk NODE. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1431 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1432 static void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1433 assemble_thunk (struct cgraph_node *node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1434 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1435 bool this_adjusting = node->thunk.this_adjusting; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1436 HOST_WIDE_INT fixed_offset = node->thunk.fixed_offset; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1437 HOST_WIDE_INT virtual_value = node->thunk.virtual_value; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1438 tree virtual_offset = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1439 tree alias = node->thunk.alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1440 tree thunk_fndecl = node->decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1441 tree a = DECL_ARGUMENTS (thunk_fndecl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1442 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1443 current_function_decl = thunk_fndecl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1444 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1445 if (this_adjusting |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1446 && targetm.asm_out.can_output_mi_thunk (thunk_fndecl, fixed_offset, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1447 virtual_value, alias)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1448 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1449 const char *fnname; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1450 tree fn_block; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1451 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1452 DECL_RESULT (thunk_fndecl) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1453 = build_decl (DECL_SOURCE_LOCATION (thunk_fndecl), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1454 RESULT_DECL, 0, integer_type_node); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1455 fnname = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (thunk_fndecl)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1456 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1457 /* The back end expects DECL_INITIAL to contain a BLOCK, so we |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1458 create one. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1459 fn_block = make_node (BLOCK); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1460 BLOCK_VARS (fn_block) = a; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1461 DECL_INITIAL (thunk_fndecl) = fn_block; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1462 init_function_start (thunk_fndecl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1463 cfun->is_thunk = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1464 assemble_start_function (thunk_fndecl, fnname); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1465 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1466 targetm.asm_out.output_mi_thunk (asm_out_file, thunk_fndecl, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1467 fixed_offset, virtual_value, alias); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1468 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1469 assemble_end_function (thunk_fndecl, fnname); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1470 init_insn_lengths (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1471 free_after_compilation (cfun); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1472 set_cfun (NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1473 TREE_ASM_WRITTEN (thunk_fndecl) = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1474 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1475 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1476 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1477 tree restype; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1478 basic_block bb, then_bb, else_bb, return_bb; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1479 gimple_stmt_iterator bsi; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1480 int nargs = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1481 tree arg; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1482 int i; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1483 tree resdecl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1484 tree restmp = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1485 VEC(tree, heap) *vargs; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1486 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1487 gimple call; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1488 gimple ret; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1489 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1490 DECL_IGNORED_P (thunk_fndecl) = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1491 bitmap_obstack_initialize (NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1492 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1493 if (node->thunk.virtual_offset_p) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1494 virtual_offset = size_int (virtual_value); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1495 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1496 /* Build the return declaration for the function. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1497 restype = TREE_TYPE (TREE_TYPE (thunk_fndecl)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1498 if (DECL_RESULT (thunk_fndecl) == NULL_TREE) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1499 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1500 resdecl = build_decl (input_location, RESULT_DECL, 0, restype); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1501 DECL_ARTIFICIAL (resdecl) = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1502 DECL_IGNORED_P (resdecl) = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1503 DECL_RESULT (thunk_fndecl) = resdecl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1504 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1505 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1506 resdecl = DECL_RESULT (thunk_fndecl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1507 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1508 bb = then_bb = else_bb = return_bb = init_lowered_empty_function (thunk_fndecl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1509 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1510 bsi = gsi_start_bb (bb); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1511 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1512 /* Build call to the function being thunked. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1513 if (!VOID_TYPE_P (restype)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1514 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1515 if (!is_gimple_reg_type (restype)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1516 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1517 restmp = resdecl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1518 cfun->local_decls = tree_cons (NULL_TREE, restmp, cfun->local_decls); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1519 BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1520 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1521 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1522 restmp = create_tmp_var_raw (restype, "retval"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1523 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1524 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1525 for (arg = a; arg; arg = TREE_CHAIN (arg)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1526 nargs++; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1527 vargs = VEC_alloc (tree, heap, nargs); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1528 if (this_adjusting) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1529 VEC_quick_push (tree, vargs, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1530 thunk_adjust (&bsi, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1531 a, 1, fixed_offset, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1532 virtual_offset)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1533 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1534 VEC_quick_push (tree, vargs, a); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1535 for (i = 1, arg = TREE_CHAIN (a); i < nargs; i++, arg = TREE_CHAIN (arg)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1536 VEC_quick_push (tree, vargs, arg); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1537 call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1538 VEC_free (tree, heap, vargs); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1539 gimple_call_set_cannot_inline (call, true); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1540 gimple_call_set_from_thunk (call, true); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1541 if (restmp) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1542 gimple_call_set_lhs (call, restmp); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1543 gsi_insert_after (&bsi, call, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1544 mark_symbols_for_renaming (call); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1545 find_referenced_vars_in (call); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1546 update_stmt (call); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1547 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1548 if (restmp && !this_adjusting) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1549 { |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1550 tree true_label = NULL_TREE; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1551 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1552 if (TREE_CODE (TREE_TYPE (restmp)) == POINTER_TYPE) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1553 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1554 gimple stmt; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1555 /* If the return type is a pointer, we need to |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1556 protect against NULL. We know there will be an |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1557 adjustment, because that's why we're emitting a |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1558 thunk. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1559 then_bb = create_basic_block (NULL, (void *) 0, bb); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1560 return_bb = create_basic_block (NULL, (void *) 0, then_bb); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1561 else_bb = create_basic_block (NULL, (void *) 0, else_bb); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1562 remove_edge (single_succ_edge (bb)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1563 true_label = gimple_block_label (then_bb); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1564 stmt = gimple_build_cond (NE_EXPR, restmp, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1565 fold_convert (TREE_TYPE (restmp), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1566 integer_zero_node), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1567 NULL_TREE, NULL_TREE); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1568 gsi_insert_after (&bsi, stmt, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1569 make_edge (bb, then_bb, EDGE_TRUE_VALUE); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1570 make_edge (bb, else_bb, EDGE_FALSE_VALUE); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1571 make_edge (return_bb, EXIT_BLOCK_PTR, 0); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1572 make_edge (then_bb, return_bb, EDGE_FALLTHRU); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1573 make_edge (else_bb, return_bb, EDGE_FALLTHRU); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1574 bsi = gsi_last_bb (then_bb); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1575 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1576 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1577 restmp = thunk_adjust (&bsi, restmp, /*this_adjusting=*/0, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1578 fixed_offset, virtual_offset); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1579 if (true_label) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1580 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1581 gimple stmt; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1582 bsi = gsi_last_bb (else_bb); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1583 stmt = gimple_build_assign (restmp, fold_convert (TREE_TYPE (restmp), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1584 integer_zero_node)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1585 gsi_insert_after (&bsi, stmt, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1586 bsi = gsi_last_bb (return_bb); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1587 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1588 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1589 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1590 gimple_call_set_tail (call, true); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1591 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1592 /* Build return value. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1593 ret = gimple_build_return (restmp); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1594 gsi_insert_after (&bsi, ret, GSI_NEW_STMT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1595 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1596 delete_unreachable_blocks (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1597 update_ssa (TODO_update_ssa); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1598 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1599 cgraph_remove_same_body_alias (node); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1600 /* Since we want to emit the thunk, we explicitly mark its name as |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1601 referenced. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1602 cgraph_add_new_function (thunk_fndecl, true); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1603 bitmap_obstack_release (NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1604 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1605 current_function_decl = NULL; |
0 | 1606 } |
1607 | |
1608 /* Expand function specified by NODE. */ | |
1609 | |
1610 static void | |
1611 cgraph_expand_function (struct cgraph_node *node) | |
1612 { | |
1613 tree decl = node->decl; | |
1614 | |
1615 /* We ought to not compile any inline clones. */ | |
1616 gcc_assert (!node->global.inlined_to); | |
1617 | |
1618 announce_function (decl); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1619 node->process = 0; |
0 | 1620 |
1621 gcc_assert (node->lowered); | |
1622 | |
1623 /* Generate RTL for the body of DECL. */ | |
1624 tree_rest_of_compilation (decl); | |
1625 | |
1626 /* Make sure that BE didn't give up on compiling. */ | |
1627 gcc_assert (TREE_ASM_WRITTEN (decl)); | |
1628 current_function_decl = NULL; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1629 if (node->same_body) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1630 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1631 struct cgraph_node *alias, *next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1632 bool saved_alias = node->alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1633 for (alias = node->same_body; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1634 alias && alias->next; alias = alias->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1635 ; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1636 /* Walk aliases in the order they were created; it is possible that |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1637 thunks reffers to the aliases made earlier. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1638 for (; alias; alias = next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1639 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1640 next = alias->previous; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1641 if (!alias->thunk.thunk_p) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1642 assemble_alias (alias->decl, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1643 DECL_ASSEMBLER_NAME (alias->thunk.alias)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1644 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1645 assemble_thunk (alias); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1646 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1647 node->alias = saved_alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1648 } |
0 | 1649 gcc_assert (!cgraph_preserve_function_body_p (decl)); |
1650 cgraph_release_function_body (node); | |
1651 /* Eliminate all call edges. This is important so the GIMPLE_CALL no longer | |
1652 points to the dead function body. */ | |
1653 cgraph_node_remove_callees (node); | |
1654 | |
1655 cgraph_function_flags_ready = true; | |
1656 } | |
1657 | |
1658 /* Return true when CALLER_DECL should be inlined into CALLEE_DECL. */ | |
1659 | |
1660 bool | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1661 cgraph_inline_p (struct cgraph_edge *e, cgraph_inline_failed_t *reason) |
0 | 1662 { |
1663 *reason = e->inline_failed; | |
1664 return !e->inline_failed; | |
1665 } | |
1666 | |
1667 | |
1668 | |
1669 /* Expand all functions that must be output. | |
1670 | |
1671 Attempt to topologically sort the nodes so function is output when | |
1672 all called functions are already assembled to allow data to be | |
1673 propagated across the callgraph. Use a stack to get smaller distance | |
1674 between a function and its callees (later we may choose to use a more | |
1675 sophisticated algorithm for function reordering; we will likely want | |
1676 to use subsections to make the output functions appear in top-down | |
1677 order). */ | |
1678 | |
1679 static void | |
1680 cgraph_expand_all_functions (void) | |
1681 { | |
1682 struct cgraph_node *node; | |
1683 struct cgraph_node **order = XCNEWVEC (struct cgraph_node *, cgraph_n_nodes); | |
1684 int order_pos, new_order_pos = 0; | |
1685 int i; | |
1686 | |
1687 order_pos = cgraph_postorder (order); | |
1688 gcc_assert (order_pos == cgraph_n_nodes); | |
1689 | |
1690 /* Garbage collector may remove inline clones we eliminate during | |
1691 optimization. So we must be sure to not reference them. */ | |
1692 for (i = 0; i < order_pos; i++) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1693 if (order[i]->process) |
0 | 1694 order[new_order_pos++] = order[i]; |
1695 | |
1696 for (i = new_order_pos - 1; i >= 0; i--) | |
1697 { | |
1698 node = order[i]; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1699 if (node->process) |
0 | 1700 { |
1701 gcc_assert (node->reachable); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1702 node->process = 0; |
0 | 1703 cgraph_expand_function (node); |
1704 } | |
1705 } | |
1706 cgraph_process_new_functions (); | |
1707 | |
1708 free (order); | |
1709 | |
1710 } | |
1711 | |
1712 /* This is used to sort the node types by the cgraph order number. */ | |
1713 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1714 enum cgraph_order_sort_kind |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1715 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1716 ORDER_UNDEFINED = 0, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1717 ORDER_FUNCTION, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1718 ORDER_VAR, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1719 ORDER_ASM |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1720 }; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1721 |
0 | 1722 struct cgraph_order_sort |
1723 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1724 enum cgraph_order_sort_kind kind; |
0 | 1725 union |
1726 { | |
1727 struct cgraph_node *f; | |
1728 struct varpool_node *v; | |
1729 struct cgraph_asm_node *a; | |
1730 } u; | |
1731 }; | |
1732 | |
1733 /* Output all functions, variables, and asm statements in the order | |
1734 according to their order fields, which is the order in which they | |
1735 appeared in the file. This implements -fno-toplevel-reorder. In | |
1736 this mode we may output functions and variables which don't really | |
1737 need to be output. */ | |
1738 | |
1739 static void | |
1740 cgraph_output_in_order (void) | |
1741 { | |
1742 int max; | |
1743 struct cgraph_order_sort *nodes; | |
1744 int i; | |
1745 struct cgraph_node *pf; | |
1746 struct varpool_node *pv; | |
1747 struct cgraph_asm_node *pa; | |
1748 | |
1749 max = cgraph_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
|
1750 nodes = XCNEWVEC (struct cgraph_order_sort, max); |
0 | 1751 |
1752 varpool_analyze_pending_decls (); | |
1753 | |
1754 for (pf = cgraph_nodes; pf; pf = pf->next) | |
1755 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1756 if (pf->process) |
0 | 1757 { |
1758 i = pf->order; | |
1759 gcc_assert (nodes[i].kind == ORDER_UNDEFINED); | |
1760 nodes[i].kind = ORDER_FUNCTION; | |
1761 nodes[i].u.f = pf; | |
1762 } | |
1763 } | |
1764 | |
1765 for (pv = varpool_nodes_queue; pv; pv = pv->next_needed) | |
1766 { | |
1767 i = pv->order; | |
1768 gcc_assert (nodes[i].kind == ORDER_UNDEFINED); | |
1769 nodes[i].kind = ORDER_VAR; | |
1770 nodes[i].u.v = pv; | |
1771 } | |
1772 | |
1773 for (pa = cgraph_asm_nodes; pa; pa = pa->next) | |
1774 { | |
1775 i = pa->order; | |
1776 gcc_assert (nodes[i].kind == ORDER_UNDEFINED); | |
1777 nodes[i].kind = ORDER_ASM; | |
1778 nodes[i].u.a = pa; | |
1779 } | |
1780 | |
1781 /* In toplevel reorder mode we output all statics; mark them as needed. */ | |
1782 for (i = 0; i < max; ++i) | |
1783 { | |
1784 if (nodes[i].kind == ORDER_VAR) | |
1785 { | |
1786 varpool_mark_needed_node (nodes[i].u.v); | |
1787 } | |
1788 } | |
1789 varpool_empty_needed_queue (); | |
1790 | |
1791 for (i = 0; i < max; ++i) | |
1792 { | |
1793 switch (nodes[i].kind) | |
1794 { | |
1795 case ORDER_FUNCTION: | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1796 nodes[i].u.f->process = 0; |
0 | 1797 cgraph_expand_function (nodes[i].u.f); |
1798 break; | |
1799 | |
1800 case ORDER_VAR: | |
1801 varpool_assemble_decl (nodes[i].u.v); | |
1802 break; | |
1803 | |
1804 case ORDER_ASM: | |
1805 assemble_asm (nodes[i].u.a->asm_str); | |
1806 break; | |
1807 | |
1808 case ORDER_UNDEFINED: | |
1809 break; | |
1810 | |
1811 default: | |
1812 gcc_unreachable (); | |
1813 } | |
1814 } | |
1815 | |
1816 cgraph_asm_nodes = 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
|
1817 free (nodes); |
0 | 1818 } |
1819 | |
1820 /* Return true when function body of DECL still needs to be kept around | |
1821 for later re-use. */ | |
1822 bool | |
1823 cgraph_preserve_function_body_p (tree decl) | |
1824 { | |
1825 struct cgraph_node *node; | |
1826 | |
1827 gcc_assert (cgraph_global_info_ready); | |
1828 /* Look if there is any clone around. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1829 node = cgraph_node (decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1830 if (node->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1831 return true; |
0 | 1832 return false; |
1833 } | |
1834 | |
1835 static void | |
1836 ipa_passes (void) | |
1837 { | |
1838 set_cfun (NULL); | |
1839 current_function_decl = NULL; | |
1840 gimple_register_cfg_hooks (); | |
1841 bitmap_obstack_initialize (NULL); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1842 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1843 invoke_plugin_callbacks (PLUGIN_ALL_IPA_PASSES_START, NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1844 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1845 if (!in_lto_p) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1846 execute_ipa_pass_list (all_small_ipa_passes); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1847 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1848 /* If pass_all_early_optimizations was not scheduled, the state of |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1849 the cgraph will not be properly updated. Update it now. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1850 if (cgraph_state < CGRAPH_STATE_IPA_SSA) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1851 cgraph_state = CGRAPH_STATE_IPA_SSA; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1852 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1853 if (!in_lto_p) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1854 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1855 /* Generate coverage variables and constructors. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1856 coverage_finish (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1857 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1858 /* Process new functions added. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1859 set_cfun (NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1860 current_function_decl = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1861 cgraph_process_new_functions (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1862 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1863 execute_ipa_summary_passes |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1864 ((struct ipa_opt_pass_d *) all_regular_ipa_passes); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1865 } |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1866 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1867 /* Some targets need to handle LTO assembler output specially. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1868 if (flag_generate_lto) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1869 targetm.asm_out.lto_start (); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1870 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1871 execute_ipa_summary_passes ((struct ipa_opt_pass_d *) all_lto_gen_passes); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1872 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1873 if (!in_lto_p) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1874 ipa_write_summaries (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1875 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1876 if (flag_generate_lto) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1877 targetm.asm_out.lto_end (); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1878 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1879 if (!flag_ltrans) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1880 execute_ipa_pass_list (all_regular_ipa_passes); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1881 invoke_plugin_callbacks (PLUGIN_ALL_IPA_PASSES_END, NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1882 |
0 | 1883 bitmap_obstack_release (NULL); |
1884 } | |
1885 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1886 |
0 | 1887 /* Perform simple optimizations based on callgraph. */ |
1888 | |
1889 void | |
1890 cgraph_optimize (void) | |
1891 { | |
1892 if (errorcount || sorrycount) | |
1893 return; | |
1894 | |
1895 #ifdef ENABLE_CHECKING | |
1896 verify_cgraph (); | |
1897 #endif | |
1898 | |
1899 /* Frontend may output common variables after the unit has been finalized. | |
1900 It is safe to deal with them here as they are always zero initialized. */ | |
1901 varpool_analyze_pending_decls (); | |
1902 | |
1903 timevar_push (TV_CGRAPHOPT); | |
1904 if (pre_ipa_mem_report) | |
1905 { | |
1906 fprintf (stderr, "Memory consumption before IPA\n"); | |
1907 dump_memory_report (false); | |
1908 } | |
1909 if (!quiet_flag) | |
1910 fprintf (stderr, "Performing interprocedural optimizations\n"); | |
1911 cgraph_state = CGRAPH_STATE_IPA; | |
1912 | |
1913 /* Don't run the IPA passes if there was any error or sorry messages. */ | |
1914 if (errorcount == 0 && sorrycount == 0) | |
1915 ipa_passes (); | |
1916 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1917 /* Do nothing else if any IPA pass found errors. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1918 if (errorcount || sorrycount) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1919 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1920 timevar_pop (TV_CGRAPHOPT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1921 return; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1922 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1923 |
0 | 1924 /* This pass remove bodies of extern inline functions we never inlined. |
1925 Do this later so other IPA passes see what is really going on. */ | |
1926 cgraph_remove_unreachable_nodes (false, dump_file); | |
1927 cgraph_global_info_ready = true; | |
1928 if (cgraph_dump_file) | |
1929 { | |
1930 fprintf (cgraph_dump_file, "Optimized "); | |
1931 dump_cgraph (cgraph_dump_file); | |
1932 dump_varpool (cgraph_dump_file); | |
1933 } | |
1934 if (post_ipa_mem_report) | |
1935 { | |
1936 fprintf (stderr, "Memory consumption after IPA\n"); | |
1937 dump_memory_report (false); | |
1938 } | |
1939 timevar_pop (TV_CGRAPHOPT); | |
1940 | |
1941 /* Output everything. */ | |
36 | 1942 (*debug_hooks->assembly_start) (); |
0 | 1943 if (!quiet_flag) |
1944 fprintf (stderr, "Assembling functions:\n"); | |
1945 #ifdef ENABLE_CHECKING | |
1946 verify_cgraph (); | |
1947 #endif | |
1948 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1949 cgraph_materialize_all_clones (); |
0 | 1950 cgraph_mark_functions_to_output (); |
1951 | |
1952 cgraph_state = CGRAPH_STATE_EXPANSION; | |
1953 if (!flag_toplevel_reorder) | |
1954 cgraph_output_in_order (); | |
1955 else | |
1956 { | |
1957 cgraph_output_pending_asms (); | |
1958 | |
1959 cgraph_expand_all_functions (); | |
1960 varpool_remove_unreferenced_decls (); | |
1961 | |
1962 varpool_assemble_pending_decls (); | |
1963 } | |
1964 cgraph_process_new_functions (); | |
1965 cgraph_state = CGRAPH_STATE_FINISHED; | |
1966 | |
1967 if (cgraph_dump_file) | |
1968 { | |
1969 fprintf (cgraph_dump_file, "\nFinal "); | |
1970 dump_cgraph (cgraph_dump_file); | |
1971 } | |
1972 #ifdef ENABLE_CHECKING | |
1973 verify_cgraph (); | |
1974 /* Double check that all inline clones are gone and that all | |
1975 function bodies have been released from memory. */ | |
1976 if (!(sorrycount || errorcount)) | |
1977 { | |
1978 struct cgraph_node *node; | |
1979 bool error_found = false; | |
1980 | |
1981 for (node = cgraph_nodes; node; node = node->next) | |
1982 if (node->analyzed | |
1983 && (node->global.inlined_to | |
1984 || gimple_has_body_p (node->decl))) | |
1985 { | |
1986 error_found = true; | |
1987 dump_cgraph_node (stderr, node); | |
1988 } | |
1989 if (error_found) | |
1990 internal_error ("nodes with unreleased memory found"); | |
1991 } | |
1992 #endif | |
1993 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1994 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
1995 |
0 | 1996 /* Generate and emit a static constructor or destructor. WHICH must |
1997 be one of 'I' (for a constructor) or 'D' (for a destructor). BODY | |
1998 is a STATEMENT_LIST containing GENERIC statements. PRIORITY is the | |
1999 initialization priority for this constructor or destructor. */ | |
2000 | |
2001 void | |
2002 cgraph_build_static_cdtor (char which, tree body, int priority) | |
2003 { | |
2004 static int counter = 0; | |
2005 char which_buf[16]; | |
2006 tree decl, name, resdecl; | |
2007 | |
2008 /* The priority is encoded in the constructor or destructor name. | |
2009 collect2 will sort the names and arrange that they are called at | |
2010 program startup. */ | |
2011 sprintf (which_buf, "%c_%.5d_%d", which, priority, counter++); | |
2012 name = get_file_function_name (which_buf); | |
2013 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2014 decl = build_decl (input_location, FUNCTION_DECL, name, |
0 | 2015 build_function_type (void_type_node, void_list_node)); |
2016 current_function_decl = decl; | |
2017 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2018 resdecl = build_decl (input_location, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2019 RESULT_DECL, NULL_TREE, void_type_node); |
0 | 2020 DECL_ARTIFICIAL (resdecl) = 1; |
2021 DECL_RESULT (decl) = resdecl; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2022 DECL_CONTEXT (resdecl) = decl; |
0 | 2023 |
2024 allocate_struct_function (decl, false); | |
2025 | |
2026 TREE_STATIC (decl) = 1; | |
2027 TREE_USED (decl) = 1; | |
2028 DECL_ARTIFICIAL (decl) = 1; | |
2029 DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (decl) = 1; | |
2030 DECL_SAVED_TREE (decl) = body; | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2031 if (!targetm.have_ctors_dtors) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2032 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2033 TREE_PUBLIC (decl) = 1; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2034 DECL_PRESERVE_P (decl) = 1; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2035 } |
0 | 2036 DECL_UNINLINABLE (decl) = 1; |
2037 | |
2038 DECL_INITIAL (decl) = make_node (BLOCK); | |
2039 TREE_USED (DECL_INITIAL (decl)) = 1; | |
2040 | |
2041 DECL_SOURCE_LOCATION (decl) = input_location; | |
2042 cfun->function_end_locus = input_location; | |
2043 | |
2044 switch (which) | |
2045 { | |
2046 case 'I': | |
2047 DECL_STATIC_CONSTRUCTOR (decl) = 1; | |
2048 decl_init_priority_insert (decl, priority); | |
2049 break; | |
2050 case 'D': | |
2051 DECL_STATIC_DESTRUCTOR (decl) = 1; | |
2052 decl_fini_priority_insert (decl, priority); | |
2053 break; | |
2054 default: | |
2055 gcc_unreachable (); | |
2056 } | |
2057 | |
2058 gimplify_function_tree (decl); | |
2059 | |
2060 cgraph_add_new_function (decl, false); | |
2061 cgraph_mark_needed_node (cgraph_node (decl)); | |
2062 set_cfun (NULL); | |
2063 } | |
2064 | |
2065 void | |
2066 init_cgraph (void) | |
2067 { | |
2068 cgraph_dump_file = dump_begin (TDI_cgraph, NULL); | |
2069 } | |
2070 | |
2071 /* The edges representing the callers of the NEW_VERSION node were | |
2072 fixed by cgraph_function_versioning (), now the call_expr in their | |
2073 respective tree code should be updated to call the NEW_VERSION. */ | |
2074 | |
2075 static void | |
2076 update_call_expr (struct cgraph_node *new_version) | |
2077 { | |
2078 struct cgraph_edge *e; | |
2079 | |
2080 gcc_assert (new_version); | |
2081 | |
2082 /* Update the call expr on the edges to call the new version. */ | |
2083 for (e = new_version->callers; e; e = e->next_caller) | |
2084 { | |
2085 struct function *inner_function = DECL_STRUCT_FUNCTION (e->caller->decl); | |
2086 gimple_call_set_fndecl (e->call_stmt, new_version->decl); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2087 maybe_clean_eh_stmt_fn (inner_function, e->call_stmt); |
0 | 2088 } |
2089 } | |
2090 | |
2091 | |
2092 /* Create a new cgraph node which is the new version of | |
2093 OLD_VERSION node. REDIRECT_CALLERS holds the callers | |
2094 edges which should be redirected to point to | |
2095 NEW_VERSION. ALL the callees edges of OLD_VERSION | |
2096 are cloned to the new version node. Return the new | |
2097 version node. */ | |
2098 | |
2099 static struct cgraph_node * | |
2100 cgraph_copy_node_for_versioning (struct cgraph_node *old_version, | |
2101 tree new_decl, | |
2102 VEC(cgraph_edge_p,heap) *redirect_callers) | |
2103 { | |
2104 struct cgraph_node *new_version; | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2105 struct cgraph_edge *e; |
0 | 2106 struct cgraph_edge *next_callee; |
2107 unsigned i; | |
2108 | |
2109 gcc_assert (old_version); | |
2110 | |
2111 new_version = cgraph_node (new_decl); | |
2112 | |
2113 new_version->analyzed = true; | |
2114 new_version->local = old_version->local; | |
2115 new_version->global = old_version->global; | |
2116 new_version->rtl = new_version->rtl; | |
2117 new_version->reachable = true; | |
2118 new_version->count = old_version->count; | |
2119 | |
2120 /* Clone the old node callees. Recursive calls are | |
2121 also cloned. */ | |
2122 for (e = old_version->callees;e; e=e->next_callee) | |
2123 { | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2124 cgraph_clone_edge (e, new_version, e->call_stmt, |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2125 e->lto_stmt_uid, REG_BR_PROB_BASE, |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2126 CGRAPH_FREQ_BASE, |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2127 e->loop_nest, true); |
0 | 2128 } |
2129 /* Fix recursive calls. | |
2130 If OLD_VERSION has a recursive call after the | |
2131 previous edge cloning, the new version will have an edge | |
2132 pointing to the old version, which is wrong; | |
2133 Redirect it to point to the new version. */ | |
2134 for (e = new_version->callees ; e; e = next_callee) | |
2135 { | |
2136 next_callee = e->next_callee; | |
2137 if (e->callee == old_version) | |
2138 cgraph_redirect_edge_callee (e, new_version); | |
2139 | |
2140 if (!next_callee) | |
2141 break; | |
2142 } | |
2143 for (i = 0; VEC_iterate (cgraph_edge_p, redirect_callers, i, e); i++) | |
2144 { | |
2145 /* Redirect calls to the old version node to point to its new | |
2146 version. */ | |
2147 cgraph_redirect_edge_callee (e, new_version); | |
2148 } | |
2149 | |
2150 return new_version; | |
2151 } | |
2152 | |
2153 /* Perform function versioning. | |
2154 Function versioning includes copying of the tree and | |
2155 a callgraph update (creating a new cgraph node and updating | |
2156 its callees and callers). | |
2157 | |
2158 REDIRECT_CALLERS varray includes the edges to be redirected | |
2159 to the new version. | |
2160 | |
2161 TREE_MAP is a mapping of tree nodes we want to replace with | |
2162 new ones (according to results of prior analysis). | |
2163 OLD_VERSION_NODE is the node that is versioned. | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2164 It returns the new version's cgraph node. |
0 | 2165 ARGS_TO_SKIP lists arguments to be omitted from functions |
2166 */ | |
2167 | |
2168 struct cgraph_node * | |
2169 cgraph_function_versioning (struct cgraph_node *old_version_node, | |
2170 VEC(cgraph_edge_p,heap) *redirect_callers, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2171 VEC (ipa_replace_map_p,gc)* tree_map, |
0 | 2172 bitmap args_to_skip) |
2173 { | |
2174 tree old_decl = old_version_node->decl; | |
2175 struct cgraph_node *new_version_node = NULL; | |
2176 tree new_decl; | |
2177 | |
2178 if (!tree_versionable_function_p (old_decl)) | |
2179 return NULL; | |
2180 | |
2181 /* Make a new FUNCTION_DECL tree node for the | |
2182 new version. */ | |
2183 if (!args_to_skip) | |
2184 new_decl = copy_node (old_decl); | |
2185 else | |
2186 new_decl = build_function_decl_skip_args (old_decl, args_to_skip); | |
2187 | |
2188 /* Create the new version's call-graph node. | |
2189 and update the edges of the new node. */ | |
2190 new_version_node = | |
2191 cgraph_copy_node_for_versioning (old_version_node, new_decl, | |
2192 redirect_callers); | |
2193 | |
2194 /* Copy the OLD_VERSION_NODE function tree to the new version. */ | |
2195 tree_function_versioning (old_decl, new_decl, tree_map, false, args_to_skip); | |
2196 | |
2197 /* Update the new version's properties. | |
2198 Make The new version visible only within this translation unit. Make sure | |
2199 that is not weak also. | |
2200 ??? We cannot use COMDAT linkage because there is no | |
2201 ABI support for this. */ | |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2202 cgraph_make_decl_local (new_version_node->decl); |
0 | 2203 DECL_VIRTUAL_P (new_version_node->decl) = 0; |
2204 new_version_node->local.externally_visible = 0; | |
2205 new_version_node->local.local = 1; | |
2206 new_version_node->lowered = true; | |
2207 | |
2208 /* Update the call_expr on the edges to call the new version node. */ | |
2209 update_call_expr (new_version_node); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2210 |
0 | 2211 cgraph_call_function_insertion_hooks (new_version_node); |
2212 return new_version_node; | |
2213 } | |
2214 | |
2215 /* Produce separate function body for inline clones so the offline copy can be | |
2216 modified without affecting them. */ | |
2217 struct cgraph_node * | |
2218 save_inline_function_body (struct cgraph_node *node) | |
2219 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2220 struct cgraph_node *first_clone, *n; |
0 | 2221 |
2222 gcc_assert (node == cgraph_node (node->decl)); | |
2223 | |
2224 cgraph_lower_function (node); | |
2225 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2226 first_clone = node->clones; |
0 | 2227 |
2228 first_clone->decl = copy_node (node->decl); | |
2229 cgraph_insert_node_to_hashtable (first_clone); | |
2230 gcc_assert (first_clone == cgraph_node (first_clone->decl)); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2231 if (first_clone->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2232 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2233 for (n = first_clone->next_sibling_clone; n->next_sibling_clone; n = n->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2234 n->clone_of = first_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2235 n->clone_of = first_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2236 n->next_sibling_clone = first_clone->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2237 if (first_clone->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2238 first_clone->clones->prev_sibling_clone = n; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2239 first_clone->clones = first_clone->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2240 first_clone->next_sibling_clone->prev_sibling_clone = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2241 first_clone->next_sibling_clone = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2242 gcc_assert (!first_clone->prev_sibling_clone); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2243 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2244 first_clone->clone_of = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2245 node->clones = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2246 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2247 if (first_clone->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2248 for (n = first_clone->clones; n != first_clone;) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2249 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2250 gcc_assert (n->decl == node->decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2251 n->decl = first_clone->decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2252 if (n->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2253 n = n->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2254 else if (n->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2255 n = n->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2256 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2257 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2258 while (n != first_clone && !n->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2259 n = n->clone_of; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2260 if (n != first_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2261 n = n->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2262 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2263 } |
0 | 2264 |
2265 /* Copy the OLD_VERSION_NODE function tree to the new version. */ | |
2266 tree_function_versioning (node->decl, first_clone->decl, NULL, true, NULL); | |
2267 | |
2268 DECL_EXTERNAL (first_clone->decl) = 0; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2269 DECL_COMDAT_GROUP (first_clone->decl) = NULL_TREE; |
0 | 2270 TREE_PUBLIC (first_clone->decl) = 0; |
2271 DECL_COMDAT (first_clone->decl) = 0; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2272 VEC_free (ipa_opt_pass, heap, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2273 first_clone->ipa_transforms_to_apply); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2274 first_clone->ipa_transforms_to_apply = NULL; |
0 | 2275 |
2276 #ifdef ENABLE_CHECKING | |
2277 verify_cgraph_node (first_clone); | |
2278 #endif | |
2279 return first_clone; | |
2280 } | |
2281 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2282 /* Given virtual clone, turn it into actual clone. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2283 static void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2284 cgraph_materialize_clone (struct cgraph_node *node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2285 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2286 bitmap_obstack_initialize (NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2287 /* Copy the OLD_VERSION_NODE function tree to the new version. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2288 tree_function_versioning (node->clone_of->decl, node->decl, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2289 node->clone.tree_map, true, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2290 node->clone.args_to_skip); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2291 if (cgraph_dump_file) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2292 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2293 dump_function_to_file (node->clone_of->decl, cgraph_dump_file, dump_flags); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2294 dump_function_to_file (node->decl, cgraph_dump_file, dump_flags); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2295 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2296 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2297 /* Function is no longer clone. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2298 if (node->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2299 node->next_sibling_clone->prev_sibling_clone = node->prev_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2300 if (node->prev_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2301 node->prev_sibling_clone->next_sibling_clone = node->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2302 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2303 node->clone_of->clones = node->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2304 node->next_sibling_clone = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2305 node->prev_sibling_clone = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2306 if (!node->clone_of->analyzed && !node->clone_of->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2307 cgraph_remove_node (node->clone_of); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2308 node->clone_of = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2309 bitmap_obstack_release (NULL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2310 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2311 |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2312 /* If necessary, change the function declaration in the call statement |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2313 associated with E so that it corresponds to the edge callee. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2314 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2315 gimple |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2316 cgraph_redirect_edge_call_stmt_to_callee (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
|
2317 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2318 tree decl = gimple_call_fndecl (e->call_stmt); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2319 gimple new_stmt; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2320 gimple_stmt_iterator gsi; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2321 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2322 if (!decl || decl == e->callee->decl |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2323 /* Don't update call from same body alias to the real function. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2324 || cgraph_get_node (decl) == cgraph_get_node (e->callee->decl)) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2325 return e->call_stmt; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2326 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2327 if (cgraph_dump_file) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2328 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2329 fprintf (cgraph_dump_file, "updating call of %s/%i -> %s/%i: ", |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2330 cgraph_node_name (e->caller), e->caller->uid, |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2331 cgraph_node_name (e->callee), e->callee->uid); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2332 print_gimple_stmt (cgraph_dump_file, e->call_stmt, 0, dump_flags); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2333 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2334 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2335 if (e->callee->clone.combined_args_to_skip) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2336 new_stmt = gimple_call_copy_skip_args (e->call_stmt, |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2337 e->callee->clone.combined_args_to_skip); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2338 else |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2339 new_stmt = e->call_stmt; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2340 if (gimple_vdef (new_stmt) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2341 && TREE_CODE (gimple_vdef (new_stmt)) == SSA_NAME) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2342 SSA_NAME_DEF_STMT (gimple_vdef (new_stmt)) = new_stmt; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2343 gimple_call_set_fndecl (new_stmt, e->callee->decl); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2344 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2345 gsi = gsi_for_stmt (e->call_stmt); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2346 gsi_replace (&gsi, new_stmt, true); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2347 update_stmt (new_stmt); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2348 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2349 /* Update EH information too, just in case. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2350 maybe_clean_or_replace_eh_stmt (e->call_stmt, new_stmt); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2351 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2352 cgraph_set_call_stmt_including_clones (e->caller, e->call_stmt, new_stmt); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2353 |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2354 if (cgraph_dump_file) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2355 { |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2356 fprintf (cgraph_dump_file, " updated to:"); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2357 print_gimple_stmt (cgraph_dump_file, e->call_stmt, 0, dump_flags); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2358 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2359 return new_stmt; |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2360 } |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2361 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2362 /* Once all functions from compilation unit are in memory, produce all clones |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2363 and update all calls. We might also do this on demand if we don't want to |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2364 bring all functions to memory prior compilation, but current WHOPR |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2365 implementation does that and it is is bit easier to keep everything right in |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2366 this order. */ |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2367 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2368 cgraph_materialize_all_clones (void) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2369 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2370 struct cgraph_node *node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2371 bool stabilized = false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2372 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2373 if (cgraph_dump_file) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2374 fprintf (cgraph_dump_file, "Materializing clones\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2375 #ifdef ENABLE_CHECKING |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2376 verify_cgraph (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2377 #endif |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2378 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2379 /* We can also do topological order, but number of iterations should be |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2380 bounded by number of IPA passes since single IPA pass is probably not |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2381 going to create clones of clones it created itself. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2382 while (!stabilized) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2383 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2384 stabilized = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2385 for (node = cgraph_nodes; node; node = node->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2386 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2387 if (node->clone_of && node->decl != node->clone_of->decl |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2388 && !gimple_has_body_p (node->decl)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2389 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2390 if (gimple_has_body_p (node->clone_of->decl)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2391 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2392 if (cgraph_dump_file) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2393 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2394 fprintf (cgraph_dump_file, "clonning %s to %s\n", |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2395 cgraph_node_name (node->clone_of), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2396 cgraph_node_name (node)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2397 if (node->clone.tree_map) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2398 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2399 unsigned int i; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2400 fprintf (cgraph_dump_file, " replace map: "); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2401 for (i = 0; i < VEC_length (ipa_replace_map_p, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2402 node->clone.tree_map); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2403 i++) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2404 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2405 struct ipa_replace_map *replace_info; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2406 replace_info = VEC_index (ipa_replace_map_p, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2407 node->clone.tree_map, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2408 i); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2409 print_generic_expr (cgraph_dump_file, replace_info->old_tree, 0); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2410 fprintf (cgraph_dump_file, " -> "); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2411 print_generic_expr (cgraph_dump_file, replace_info->new_tree, 0); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2412 fprintf (cgraph_dump_file, "%s%s;", |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2413 replace_info->replace_p ? "(replace)":"", |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2414 replace_info->ref_p ? "(ref)":""); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2415 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2416 fprintf (cgraph_dump_file, "\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2417 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2418 if (node->clone.args_to_skip) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2419 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2420 fprintf (cgraph_dump_file, " args_to_skip: "); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2421 dump_bitmap (cgraph_dump_file, node->clone.args_to_skip); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2422 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2423 if (node->clone.args_to_skip) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2424 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2425 fprintf (cgraph_dump_file, " combined_args_to_skip:"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2426 dump_bitmap (cgraph_dump_file, node->clone.combined_args_to_skip); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2427 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2428 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2429 cgraph_materialize_clone (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
|
2430 stabilized = false; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2431 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2432 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2433 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2434 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2435 for (node = cgraph_nodes; node; node = node->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2436 if (!node->analyzed && node->callees) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2437 cgraph_node_remove_callees (node); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2438 if (cgraph_dump_file) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2439 fprintf (cgraph_dump_file, "Updating call sites\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2440 for (node = cgraph_nodes; node; node = node->next) |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2441 if (node->analyzed && !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
|
2442 && gimple_has_body_p (node->decl)) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2443 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2444 struct cgraph_edge *e; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2445 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2446 current_function_decl = node->decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2447 push_cfun (DECL_STRUCT_FUNCTION (node->decl)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2448 for (e = node->callees; e; e = e->next_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
|
2449 cgraph_redirect_edge_call_stmt_to_callee (e); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2450 gcc_assert (!need_ssa_update_p (cfun)); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2451 pop_cfun (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2452 current_function_decl = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2453 #ifdef ENABLE_CHECKING |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2454 verify_cgraph_node (node); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2455 #endif |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2456 } |
63
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2457 if (cgraph_dump_file) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2458 fprintf (cgraph_dump_file, "Materialization Call site updates done.\n"); |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2459 /* All changes to parameters have been performed. In order not to |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2460 incorrectly repeat them, we simply dispose of the bitmaps that drive the |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2461 changes. */ |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2462 for (node = cgraph_nodes; node; node = node->next) |
b7f97abdc517
update gcc from gcc-4.5.0 to gcc-4.6
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
2463 node->clone.combined_args_to_skip = NULL; |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2464 #ifdef ENABLE_CHECKING |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2465 verify_cgraph (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2466 #endif |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2467 cgraph_remove_unreachable_nodes (false, cgraph_dump_file); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2468 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
36
diff
changeset
|
2469 |
0 | 2470 #include "gt-cgraphunit.h" |