Mercurial > hg > CbC > CbC_gcc
annotate gcc/cgraph.c @ 55:77e2b8dfacca gcc-4.4.5
update it from 4.4.3 to 4.5.0
author | ryoma <e075725@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 12 Feb 2010 23:39:51 +0900 |
parents | a06113de4d67 |
children | b7f97abdc517 |
rev | line source |
---|---|
0 | 1 /* Callgraph handling code. |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
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 file contains basic routines manipulating call graph | |
23 | |
24 The callgraph: | |
25 | |
26 The call-graph is data structure designed for intra-procedural optimization | |
27 but it is also used in non-unit-at-a-time compilation to allow easier code | |
28 sharing. | |
29 | |
30 The call-graph consist of nodes and edges represented via linked lists. | |
31 Each function (external or not) corresponds to the unique node. | |
32 | |
33 The mapping from declarations to call-graph nodes is done using hash table | |
34 based on DECL_UID. The call-graph nodes are created lazily using | |
35 cgraph_node function when called for unknown declaration. | |
36 | |
37 The callgraph at the moment does not represent indirect calls or calls | |
38 from other compilation unit. Flag NEEDED is set for each node that may | |
39 be accessed in such an invisible way and it shall be considered an | |
40 entry point to the callgraph. | |
41 | |
42 Interprocedural information: | |
43 | |
44 Callgraph is place to store data needed for interprocedural optimization. | |
45 All data structures are divided into three components: local_info that | |
46 is produced while analyzing the function, global_info that is result | |
47 of global walking of the callgraph on the end of compilation and | |
48 rtl_info used by RTL backend to propagate data from already compiled | |
49 functions to their callers. | |
50 | |
51 Inlining plans: | |
52 | |
53 The function inlining information is decided in advance and maintained | |
54 in the callgraph as so called inline plan. | |
55 For each inlined call, the callee's node is cloned to represent the | |
56 new function copy produced by inliner. | |
57 Each inlined call gets a unique corresponding clone node of the callee | |
58 and the data structure is updated while inlining is performed, so | |
59 the clones are eliminated and their callee edges redirected to the | |
60 caller. | |
61 | |
62 Each edge has "inline_failed" field. When the field is set to NULL, | |
63 the call will be inlined. When it is non-NULL it contains a reason | |
64 why inlining wasn't performed. */ | |
65 | |
66 #include "config.h" | |
67 #include "system.h" | |
68 #include "coretypes.h" | |
69 #include "tm.h" | |
70 #include "tree.h" | |
71 #include "tree-inline.h" | |
72 #include "langhooks.h" | |
73 #include "hashtab.h" | |
74 #include "toplev.h" | |
75 #include "flags.h" | |
76 #include "ggc.h" | |
77 #include "debug.h" | |
78 #include "target.h" | |
79 #include "basic-block.h" | |
80 #include "cgraph.h" | |
81 #include "output.h" | |
82 #include "intl.h" | |
83 #include "gimple.h" | |
84 #include "tree-dump.h" | |
85 #include "tree-flow.h" | |
86 #include "value-prof.h" | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
87 #include "except.h" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
88 #include "diagnostic.h" |
0 | 89 |
90 static void cgraph_node_remove_callers (struct cgraph_node *node); | |
91 static inline void cgraph_edge_remove_caller (struct cgraph_edge *e); | |
92 static inline void cgraph_edge_remove_callee (struct cgraph_edge *e); | |
93 | |
94 /* Hash table used to convert declarations into nodes. */ | |
95 static GTY((param_is (struct cgraph_node))) htab_t cgraph_hash; | |
96 /* Hash table used to convert assembler names into nodes. */ | |
97 static GTY((param_is (struct cgraph_node))) htab_t assembler_name_hash; | |
98 | |
99 /* The linked list of cgraph nodes. */ | |
100 struct cgraph_node *cgraph_nodes; | |
101 | |
102 /* Queue of cgraph nodes scheduled to be lowered. */ | |
103 struct cgraph_node *cgraph_nodes_queue; | |
104 | |
105 /* Queue of cgraph nodes scheduled to be added into cgraph. This is a | |
106 secondary queue used during optimization to accommodate passes that | |
107 may generate new functions that need to be optimized and expanded. */ | |
108 struct cgraph_node *cgraph_new_nodes; | |
109 | |
110 /* Number of nodes in existence. */ | |
111 int cgraph_n_nodes; | |
112 | |
113 /* Maximal uid used in cgraph nodes. */ | |
114 int cgraph_max_uid; | |
115 | |
116 /* Maximal uid used in cgraph edges. */ | |
117 int cgraph_edge_max_uid; | |
118 | |
119 /* Maximal pid used for profiling */ | |
120 int cgraph_max_pid; | |
121 | |
122 /* Set when whole unit has been analyzed so we can access global info. */ | |
123 bool cgraph_global_info_ready = false; | |
124 | |
125 /* What state callgraph is in right now. */ | |
126 enum cgraph_state cgraph_state = CGRAPH_STATE_CONSTRUCTION; | |
127 | |
128 /* Set when the cgraph is fully build and the basic flags are computed. */ | |
129 bool cgraph_function_flags_ready = false; | |
130 | |
131 /* Linked list of cgraph asm nodes. */ | |
132 struct cgraph_asm_node *cgraph_asm_nodes; | |
133 | |
134 /* Last node in cgraph_asm_nodes. */ | |
135 static GTY(()) struct cgraph_asm_node *cgraph_asm_last_node; | |
136 | |
137 /* The order index of the next cgraph node to be created. This is | |
138 used so that we can sort the cgraph nodes in order by when we saw | |
139 them, to support -fno-toplevel-reorder. */ | |
140 int cgraph_order; | |
141 | |
142 /* List of hooks trigerred on cgraph_edge events. */ | |
143 struct cgraph_edge_hook_list { | |
144 cgraph_edge_hook hook; | |
145 void *data; | |
146 struct cgraph_edge_hook_list *next; | |
147 }; | |
148 | |
149 /* List of hooks trigerred on cgraph_node events. */ | |
150 struct cgraph_node_hook_list { | |
151 cgraph_node_hook hook; | |
152 void *data; | |
153 struct cgraph_node_hook_list *next; | |
154 }; | |
155 | |
156 /* List of hooks trigerred on events involving two cgraph_edges. */ | |
157 struct cgraph_2edge_hook_list { | |
158 cgraph_2edge_hook hook; | |
159 void *data; | |
160 struct cgraph_2edge_hook_list *next; | |
161 }; | |
162 | |
163 /* List of hooks trigerred on events involving two cgraph_nodes. */ | |
164 struct cgraph_2node_hook_list { | |
165 cgraph_2node_hook hook; | |
166 void *data; | |
167 struct cgraph_2node_hook_list *next; | |
168 }; | |
169 | |
170 /* List of hooks triggered when an edge is removed. */ | |
171 struct cgraph_edge_hook_list *first_cgraph_edge_removal_hook; | |
172 /* List of hooks triggered when a node is removed. */ | |
173 struct cgraph_node_hook_list *first_cgraph_node_removal_hook; | |
174 /* List of hooks triggered when an edge is duplicated. */ | |
175 struct cgraph_2edge_hook_list *first_cgraph_edge_duplicated_hook; | |
176 /* List of hooks triggered when a node is duplicated. */ | |
177 struct cgraph_2node_hook_list *first_cgraph_node_duplicated_hook; | |
178 /* List of hooks triggered when an function is inserted. */ | |
179 struct cgraph_node_hook_list *first_cgraph_function_insertion_hook; | |
180 | |
181 /* Head of a linked list of unused (freed) call graph nodes. | |
182 Do not GTY((delete)) this list so UIDs gets reliably recycled. */ | |
183 static GTY(()) struct cgraph_node *free_nodes; | |
184 /* Head of a linked list of unused (freed) call graph edges. | |
185 Do not GTY((delete)) this list so UIDs gets reliably recycled. */ | |
186 static GTY(()) struct cgraph_edge *free_edges; | |
187 | |
188 /* Macros to access the next item in the list of free cgraph nodes and | |
189 edges. */ | |
190 #define NEXT_FREE_NODE(NODE) (NODE)->next | |
191 #define NEXT_FREE_EDGE(EDGE) (EDGE)->prev_caller | |
192 | |
193 /* Register HOOK to be called with DATA on each removed edge. */ | |
194 struct cgraph_edge_hook_list * | |
195 cgraph_add_edge_removal_hook (cgraph_edge_hook hook, void *data) | |
196 { | |
197 struct cgraph_edge_hook_list *entry; | |
198 struct cgraph_edge_hook_list **ptr = &first_cgraph_edge_removal_hook; | |
199 | |
200 entry = (struct cgraph_edge_hook_list *) xmalloc (sizeof (*entry)); | |
201 entry->hook = hook; | |
202 entry->data = data; | |
203 entry->next = NULL; | |
204 while (*ptr) | |
205 ptr = &(*ptr)->next; | |
206 *ptr = entry; | |
207 return entry; | |
208 } | |
209 | |
210 /* Remove ENTRY from the list of hooks called on removing edges. */ | |
211 void | |
212 cgraph_remove_edge_removal_hook (struct cgraph_edge_hook_list *entry) | |
213 { | |
214 struct cgraph_edge_hook_list **ptr = &first_cgraph_edge_removal_hook; | |
215 | |
216 while (*ptr != entry) | |
217 ptr = &(*ptr)->next; | |
218 *ptr = entry->next; | |
219 free (entry); | |
220 } | |
221 | |
222 /* Call all edge removal hooks. */ | |
223 static void | |
224 cgraph_call_edge_removal_hooks (struct cgraph_edge *e) | |
225 { | |
226 struct cgraph_edge_hook_list *entry = first_cgraph_edge_removal_hook; | |
227 while (entry) | |
228 { | |
229 entry->hook (e, entry->data); | |
230 entry = entry->next; | |
231 } | |
232 } | |
233 | |
234 /* Register HOOK to be called with DATA on each removed node. */ | |
235 struct cgraph_node_hook_list * | |
236 cgraph_add_node_removal_hook (cgraph_node_hook hook, void *data) | |
237 { | |
238 struct cgraph_node_hook_list *entry; | |
239 struct cgraph_node_hook_list **ptr = &first_cgraph_node_removal_hook; | |
240 | |
241 entry = (struct cgraph_node_hook_list *) xmalloc (sizeof (*entry)); | |
242 entry->hook = hook; | |
243 entry->data = data; | |
244 entry->next = NULL; | |
245 while (*ptr) | |
246 ptr = &(*ptr)->next; | |
247 *ptr = entry; | |
248 return entry; | |
249 } | |
250 | |
251 /* Remove ENTRY from the list of hooks called on removing nodes. */ | |
252 void | |
253 cgraph_remove_node_removal_hook (struct cgraph_node_hook_list *entry) | |
254 { | |
255 struct cgraph_node_hook_list **ptr = &first_cgraph_node_removal_hook; | |
256 | |
257 while (*ptr != entry) | |
258 ptr = &(*ptr)->next; | |
259 *ptr = entry->next; | |
260 free (entry); | |
261 } | |
262 | |
263 /* Call all node removal hooks. */ | |
264 static void | |
265 cgraph_call_node_removal_hooks (struct cgraph_node *node) | |
266 { | |
267 struct cgraph_node_hook_list *entry = first_cgraph_node_removal_hook; | |
268 while (entry) | |
269 { | |
270 entry->hook (node, entry->data); | |
271 entry = entry->next; | |
272 } | |
273 } | |
274 | |
275 /* Register HOOK to be called with DATA on each removed node. */ | |
276 struct cgraph_node_hook_list * | |
277 cgraph_add_function_insertion_hook (cgraph_node_hook hook, void *data) | |
278 { | |
279 struct cgraph_node_hook_list *entry; | |
280 struct cgraph_node_hook_list **ptr = &first_cgraph_function_insertion_hook; | |
281 | |
282 entry = (struct cgraph_node_hook_list *) xmalloc (sizeof (*entry)); | |
283 entry->hook = hook; | |
284 entry->data = data; | |
285 entry->next = NULL; | |
286 while (*ptr) | |
287 ptr = &(*ptr)->next; | |
288 *ptr = entry; | |
289 return entry; | |
290 } | |
291 | |
292 /* Remove ENTRY from the list of hooks called on removing nodes. */ | |
293 void | |
294 cgraph_remove_function_insertion_hook (struct cgraph_node_hook_list *entry) | |
295 { | |
296 struct cgraph_node_hook_list **ptr = &first_cgraph_function_insertion_hook; | |
297 | |
298 while (*ptr != entry) | |
299 ptr = &(*ptr)->next; | |
300 *ptr = entry->next; | |
301 free (entry); | |
302 } | |
303 | |
304 /* Call all node removal hooks. */ | |
305 void | |
306 cgraph_call_function_insertion_hooks (struct cgraph_node *node) | |
307 { | |
308 struct cgraph_node_hook_list *entry = first_cgraph_function_insertion_hook; | |
309 while (entry) | |
310 { | |
311 entry->hook (node, entry->data); | |
312 entry = entry->next; | |
313 } | |
314 } | |
315 | |
316 /* Register HOOK to be called with DATA on each duplicated edge. */ | |
317 struct cgraph_2edge_hook_list * | |
318 cgraph_add_edge_duplication_hook (cgraph_2edge_hook hook, void *data) | |
319 { | |
320 struct cgraph_2edge_hook_list *entry; | |
321 struct cgraph_2edge_hook_list **ptr = &first_cgraph_edge_duplicated_hook; | |
322 | |
323 entry = (struct cgraph_2edge_hook_list *) xmalloc (sizeof (*entry)); | |
324 entry->hook = hook; | |
325 entry->data = data; | |
326 entry->next = NULL; | |
327 while (*ptr) | |
328 ptr = &(*ptr)->next; | |
329 *ptr = entry; | |
330 return entry; | |
331 } | |
332 | |
333 /* Remove ENTRY from the list of hooks called on duplicating edges. */ | |
334 void | |
335 cgraph_remove_edge_duplication_hook (struct cgraph_2edge_hook_list *entry) | |
336 { | |
337 struct cgraph_2edge_hook_list **ptr = &first_cgraph_edge_duplicated_hook; | |
338 | |
339 while (*ptr != entry) | |
340 ptr = &(*ptr)->next; | |
341 *ptr = entry->next; | |
342 free (entry); | |
343 } | |
344 | |
345 /* Call all edge duplication hooks. */ | |
346 static void | |
347 cgraph_call_edge_duplication_hooks (struct cgraph_edge *cs1, | |
348 struct cgraph_edge *cs2) | |
349 { | |
350 struct cgraph_2edge_hook_list *entry = first_cgraph_edge_duplicated_hook; | |
351 while (entry) | |
352 { | |
353 entry->hook (cs1, cs2, entry->data); | |
354 entry = entry->next; | |
355 } | |
356 } | |
357 | |
358 /* Register HOOK to be called with DATA on each duplicated node. */ | |
359 struct cgraph_2node_hook_list * | |
360 cgraph_add_node_duplication_hook (cgraph_2node_hook hook, void *data) | |
361 { | |
362 struct cgraph_2node_hook_list *entry; | |
363 struct cgraph_2node_hook_list **ptr = &first_cgraph_node_duplicated_hook; | |
364 | |
365 entry = (struct cgraph_2node_hook_list *) xmalloc (sizeof (*entry)); | |
366 entry->hook = hook; | |
367 entry->data = data; | |
368 entry->next = NULL; | |
369 while (*ptr) | |
370 ptr = &(*ptr)->next; | |
371 *ptr = entry; | |
372 return entry; | |
373 } | |
374 | |
375 /* Remove ENTRY from the list of hooks called on duplicating nodes. */ | |
376 void | |
377 cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *entry) | |
378 { | |
379 struct cgraph_2node_hook_list **ptr = &first_cgraph_node_duplicated_hook; | |
380 | |
381 while (*ptr != entry) | |
382 ptr = &(*ptr)->next; | |
383 *ptr = entry->next; | |
384 free (entry); | |
385 } | |
386 | |
387 /* Call all node duplication hooks. */ | |
388 static void | |
389 cgraph_call_node_duplication_hooks (struct cgraph_node *node1, | |
390 struct cgraph_node *node2) | |
391 { | |
392 struct cgraph_2node_hook_list *entry = first_cgraph_node_duplicated_hook; | |
393 while (entry) | |
394 { | |
395 entry->hook (node1, node2, entry->data); | |
396 entry = entry->next; | |
397 } | |
398 } | |
399 | |
400 /* Returns a hash code for P. */ | |
401 | |
402 static hashval_t | |
403 hash_node (const void *p) | |
404 { | |
405 const struct cgraph_node *n = (const struct cgraph_node *) p; | |
406 return (hashval_t) DECL_UID (n->decl); | |
407 } | |
408 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
409 |
0 | 410 /* Returns nonzero if P1 and P2 are equal. */ |
411 | |
412 static int | |
413 eq_node (const void *p1, const void *p2) | |
414 { | |
415 const struct cgraph_node *n1 = (const struct cgraph_node *) p1; | |
416 const struct cgraph_node *n2 = (const struct cgraph_node *) p2; | |
417 return DECL_UID (n1->decl) == DECL_UID (n2->decl); | |
418 } | |
419 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
420 /* Allocate new callgraph node. */ |
0 | 421 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
422 static inline struct cgraph_node * |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
423 cgraph_allocate_node (void) |
0 | 424 { |
425 struct cgraph_node *node; | |
426 | |
427 if (free_nodes) | |
428 { | |
429 node = free_nodes; | |
430 free_nodes = NEXT_FREE_NODE (node); | |
431 } | |
432 else | |
433 { | |
434 node = GGC_CNEW (struct cgraph_node); | |
435 node->uid = cgraph_max_uid++; | |
436 } | |
437 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
438 return node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
439 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
440 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
441 /* Allocate new callgraph node and insert it into basic data structures. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
442 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
443 static struct cgraph_node * |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
444 cgraph_create_node (void) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
445 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
446 struct cgraph_node *node = cgraph_allocate_node (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
447 |
0 | 448 node->next = cgraph_nodes; |
449 node->pid = -1; | |
450 node->order = cgraph_order++; | |
451 if (cgraph_nodes) | |
452 cgraph_nodes->previous = node; | |
453 node->previous = NULL; | |
454 node->global.estimated_growth = INT_MIN; | |
455 cgraph_nodes = node; | |
456 cgraph_n_nodes++; | |
457 return node; | |
458 } | |
459 | |
460 /* Return cgraph node assigned to DECL. Create new one when needed. */ | |
461 | |
462 struct cgraph_node * | |
463 cgraph_node (tree decl) | |
464 { | |
465 struct cgraph_node key, *node, **slot; | |
466 | |
467 gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); | |
468 | |
469 if (!cgraph_hash) | |
470 cgraph_hash = htab_create_ggc (10, hash_node, eq_node, NULL); | |
471 | |
472 key.decl = decl; | |
473 | |
474 slot = (struct cgraph_node **) htab_find_slot (cgraph_hash, &key, INSERT); | |
475 | |
476 if (*slot) | |
477 { | |
478 node = *slot; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
479 if (node->same_body_alias) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
480 node = node->same_body; |
0 | 481 return node; |
482 } | |
483 | |
484 node = cgraph_create_node (); | |
485 node->decl = decl; | |
486 *slot = node; | |
487 if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL) | |
488 { | |
489 node->origin = cgraph_node (DECL_CONTEXT (decl)); | |
490 node->next_nested = node->origin->nested; | |
491 node->origin->nested = node; | |
492 } | |
493 if (assembler_name_hash) | |
494 { | |
495 void **aslot; | |
496 tree name = DECL_ASSEMBLER_NAME (decl); | |
497 | |
498 aslot = htab_find_slot_with_hash (assembler_name_hash, name, | |
499 decl_assembler_name_hash (name), | |
500 INSERT); | |
501 /* We can have multiple declarations with same assembler name. For C++ | |
502 it is __builtin_strlen and strlen, for instance. Do we need to | |
503 record them all? Original implementation marked just first one | |
504 so lets hope for the best. */ | |
505 if (*aslot == NULL) | |
506 *aslot = node; | |
507 } | |
508 return node; | |
509 } | |
510 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
511 /* Mark ALIAS as an alias to DECL. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
512 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
513 static struct cgraph_node * |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
514 cgraph_same_body_alias_1 (tree alias, tree decl) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
515 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
516 struct cgraph_node key, *alias_node, *decl_node, **slot; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
517 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
518 gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
519 gcc_assert (TREE_CODE (alias) == FUNCTION_DECL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
520 decl_node = cgraph_node (decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
521 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
522 key.decl = alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
523 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
524 slot = (struct cgraph_node **) htab_find_slot (cgraph_hash, &key, INSERT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
525 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
526 /* If the cgraph_node has been already created, fail. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
527 if (*slot) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
528 return NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
529 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
530 alias_node = cgraph_allocate_node (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
531 alias_node->decl = alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
532 alias_node->same_body_alias = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
533 alias_node->same_body = decl_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
534 alias_node->previous = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
535 if (decl_node->same_body) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
536 decl_node->same_body->previous = alias_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
537 alias_node->next = decl_node->same_body; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
538 alias_node->thunk.alias = decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
539 decl_node->same_body = alias_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
540 *slot = alias_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
541 return alias_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
542 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
543 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
544 /* Attempt to mark ALIAS as an alias to DECL. Return TRUE if successful. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
545 Same body aliases are output whenever the body of DECL is output, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
546 and cgraph_node (ALIAS) transparently returns cgraph_node (DECL). */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
547 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
548 bool |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
549 cgraph_same_body_alias (tree alias, tree decl) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
550 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
551 #ifndef ASM_OUTPUT_DEF |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
552 /* If aliases aren't supported by the assembler, fail. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
553 return false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
554 #endif |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
555 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
556 /*gcc_assert (!assembler_name_hash);*/ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
557 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
558 return cgraph_same_body_alias_1 (alias, decl) != NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
559 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
560 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
561 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
562 cgraph_add_thunk (tree alias, tree decl, bool this_adjusting, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
563 HOST_WIDE_INT fixed_offset, HOST_WIDE_INT virtual_value, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
564 tree virtual_offset, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
565 tree real_alias) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
566 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
567 struct cgraph_node *node = cgraph_get_node (alias); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
568 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
569 if (node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
570 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
571 gcc_assert (node->local.finalized); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
572 gcc_assert (!node->same_body); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
573 cgraph_remove_node (node); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
574 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
575 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
576 node = cgraph_same_body_alias_1 (alias, decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
577 gcc_assert (node); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
578 #ifdef ENABLE_CHECKING |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
579 gcc_assert (!virtual_offset |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
580 || tree_int_cst_equal (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:
0
diff
changeset
|
581 #endif |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
582 node->thunk.fixed_offset = fixed_offset; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
583 node->thunk.this_adjusting = this_adjusting; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
584 node->thunk.virtual_value = virtual_value; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
585 node->thunk.virtual_offset_p = virtual_offset != NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
586 node->thunk.alias = real_alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
587 node->thunk.thunk_p = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
588 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
589 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
590 /* Returns the cgraph node assigned to DECL or NULL if no cgraph node |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
591 is assigned. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
592 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
593 struct cgraph_node * |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
594 cgraph_get_node (tree decl) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
595 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
596 struct cgraph_node key, *node = NULL, **slot; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
597 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
598 gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
599 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
600 if (!cgraph_hash) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
601 return NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
602 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
603 key.decl = decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
604 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
605 slot = (struct cgraph_node **) htab_find_slot (cgraph_hash, &key, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
606 NO_INSERT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
607 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
608 if (slot && *slot) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
609 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
610 node = *slot; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
611 if (node->same_body_alias) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
612 node = node->same_body; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
613 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
614 return node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
615 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
616 |
0 | 617 /* Insert already constructed node into hashtable. */ |
618 | |
619 void | |
620 cgraph_insert_node_to_hashtable (struct cgraph_node *node) | |
621 { | |
622 struct cgraph_node **slot; | |
623 | |
624 slot = (struct cgraph_node **) htab_find_slot (cgraph_hash, node, INSERT); | |
625 | |
626 gcc_assert (!*slot); | |
627 *slot = node; | |
628 } | |
629 | |
630 /* Returns a hash code for P. */ | |
631 | |
632 static hashval_t | |
633 hash_node_by_assembler_name (const void *p) | |
634 { | |
635 const struct cgraph_node *n = (const struct cgraph_node *) p; | |
636 return (hashval_t) decl_assembler_name_hash (DECL_ASSEMBLER_NAME (n->decl)); | |
637 } | |
638 | |
639 /* Returns nonzero if P1 and P2 are equal. */ | |
640 | |
641 static int | |
642 eq_assembler_name (const void *p1, const void *p2) | |
643 { | |
644 const struct cgraph_node *n1 = (const struct cgraph_node *) p1; | |
645 const_tree name = (const_tree)p2; | |
646 return (decl_assembler_name_equal (n1->decl, name)); | |
647 } | |
648 | |
649 /* Return the cgraph node that has ASMNAME for its DECL_ASSEMBLER_NAME. | |
650 Return NULL if there's no such node. */ | |
651 | |
652 struct cgraph_node * | |
653 cgraph_node_for_asm (tree asmname) | |
654 { | |
655 struct cgraph_node *node; | |
656 void **slot; | |
657 | |
658 if (!assembler_name_hash) | |
659 { | |
660 assembler_name_hash = | |
661 htab_create_ggc (10, hash_node_by_assembler_name, eq_assembler_name, | |
662 NULL); | |
663 for (node = cgraph_nodes; node; node = node->next) | |
664 if (!node->global.inlined_to) | |
665 { | |
666 tree name = DECL_ASSEMBLER_NAME (node->decl); | |
667 slot = htab_find_slot_with_hash (assembler_name_hash, name, | |
668 decl_assembler_name_hash (name), | |
669 INSERT); | |
670 /* We can have multiple declarations with same assembler name. For C++ | |
671 it is __builtin_strlen and strlen, for instance. Do we need to | |
672 record them all? Original implementation marked just first one | |
673 so lets hope for the best. */ | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
674 if (!*slot) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
675 *slot = node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
676 if (node->same_body) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
677 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
678 struct cgraph_node *alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
679 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
680 for (alias = node->same_body; alias; alias = alias->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
681 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
682 hashval_t hash; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
683 name = DECL_ASSEMBLER_NAME (alias->decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
684 hash = decl_assembler_name_hash (name); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
685 slot = htab_find_slot_with_hash (assembler_name_hash, name, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
686 hash, INSERT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
687 if (!*slot) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
688 *slot = alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
689 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
690 } |
0 | 691 } |
692 } | |
693 | |
694 slot = htab_find_slot_with_hash (assembler_name_hash, asmname, | |
695 decl_assembler_name_hash (asmname), | |
696 NO_INSERT); | |
697 | |
698 if (slot) | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
699 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
700 node = (struct cgraph_node *) *slot; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
701 if (node->same_body_alias) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
702 node = node->same_body; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
703 return node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
704 } |
0 | 705 return NULL; |
706 } | |
707 | |
708 /* Returns a hash value for X (which really is a die_struct). */ | |
709 | |
710 static hashval_t | |
711 edge_hash (const void *x) | |
712 { | |
713 return htab_hash_pointer (((const struct cgraph_edge *) x)->call_stmt); | |
714 } | |
715 | |
716 /* Return nonzero if decl_id of die_struct X is the same as UID of decl *Y. */ | |
717 | |
718 static int | |
719 edge_eq (const void *x, const void *y) | |
720 { | |
721 return ((const struct cgraph_edge *) x)->call_stmt == y; | |
722 } | |
723 | |
724 | |
725 /* Return the callgraph edge representing the GIMPLE_CALL statement | |
726 CALL_STMT. */ | |
727 | |
728 struct cgraph_edge * | |
729 cgraph_edge (struct cgraph_node *node, gimple call_stmt) | |
730 { | |
731 struct cgraph_edge *e, *e2; | |
732 int n = 0; | |
733 | |
734 if (node->call_site_hash) | |
735 return (struct cgraph_edge *) | |
736 htab_find_with_hash (node->call_site_hash, call_stmt, | |
737 htab_hash_pointer (call_stmt)); | |
738 | |
739 /* This loop may turn out to be performance problem. In such case adding | |
740 hashtables into call nodes with very many edges is probably best | |
741 solution. It is not good idea to add pointer into CALL_EXPR itself | |
742 because we want to make possible having multiple cgraph nodes representing | |
743 different clones of the same body before the body is actually cloned. */ | |
744 for (e = node->callees; e; e= e->next_callee) | |
745 { | |
746 if (e->call_stmt == call_stmt) | |
747 break; | |
748 n++; | |
749 } | |
750 | |
751 if (n > 100) | |
752 { | |
753 node->call_site_hash = htab_create_ggc (120, edge_hash, edge_eq, NULL); | |
754 for (e2 = node->callees; e2; e2 = e2->next_callee) | |
755 { | |
756 void **slot; | |
757 slot = htab_find_slot_with_hash (node->call_site_hash, | |
758 e2->call_stmt, | |
759 htab_hash_pointer (e2->call_stmt), | |
760 INSERT); | |
761 gcc_assert (!*slot); | |
762 *slot = e2; | |
763 } | |
764 } | |
765 | |
766 return e; | |
767 } | |
768 | |
769 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
770 /* Change field call_stmt of edge E to NEW_STMT. */ |
0 | 771 |
772 void | |
773 cgraph_set_call_stmt (struct cgraph_edge *e, gimple new_stmt) | |
774 { | |
775 if (e->caller->call_site_hash) | |
776 { | |
777 htab_remove_elt_with_hash (e->caller->call_site_hash, | |
778 e->call_stmt, | |
779 htab_hash_pointer (e->call_stmt)); | |
780 } | |
781 e->call_stmt = new_stmt; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
782 push_cfun (DECL_STRUCT_FUNCTION (e->caller->decl)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
783 e->can_throw_external = stmt_can_throw_external (new_stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
784 pop_cfun (); |
0 | 785 if (e->caller->call_site_hash) |
786 { | |
787 void **slot; | |
788 slot = htab_find_slot_with_hash (e->caller->call_site_hash, | |
789 e->call_stmt, | |
790 htab_hash_pointer | |
791 (e->call_stmt), INSERT); | |
792 gcc_assert (!*slot); | |
793 *slot = e; | |
794 } | |
795 } | |
796 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
797 /* Like cgraph_set_call_stmt but walk the clone tree and update all |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
798 clones sharing the same function body. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
799 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
800 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
801 cgraph_set_call_stmt_including_clones (struct cgraph_node *orig, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
802 gimple old_stmt, gimple new_stmt) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
803 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
804 struct cgraph_node *node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
805 struct cgraph_edge *edge = cgraph_edge (orig, old_stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
806 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
807 if (edge) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
808 cgraph_set_call_stmt (edge, new_stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
809 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
810 node = orig->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
811 if (node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
812 while (node != orig) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
813 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
814 struct cgraph_edge *edge = cgraph_edge (node, old_stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
815 if (edge) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
816 cgraph_set_call_stmt (edge, new_stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
817 if (node->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
818 node = node->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
819 else if (node->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
820 node = node->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
821 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
822 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
823 while (node != orig && !node->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
824 node = node->clone_of; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
825 if (node != orig) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
826 node = node->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
827 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
828 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
829 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
830 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
831 /* Like cgraph_create_edge walk the clone tree and update all clones sharing |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
832 same function body. If clones already have edge for OLD_STMT; only |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
833 update the edge same way as cgraph_set_call_stmt_including_clones does. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
834 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
835 TODO: COUNT and LOOP_DEPTH should be properly distributed based on relative |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
836 frequencies of the clones. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
837 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
838 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
839 cgraph_create_edge_including_clones (struct cgraph_node *orig, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
840 struct cgraph_node *callee, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
841 gimple old_stmt, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
842 gimple stmt, gcov_type count, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
843 int freq, int loop_depth, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
844 cgraph_inline_failed_t reason) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
845 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
846 struct cgraph_node *node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
847 struct cgraph_edge *edge; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
848 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
849 if (!cgraph_edge (orig, stmt)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
850 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
851 edge = cgraph_create_edge (orig, callee, stmt, count, freq, loop_depth); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
852 edge->inline_failed = reason; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
853 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
854 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
855 node = orig->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
856 if (node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
857 while (node != orig) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
858 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
859 struct cgraph_edge *edge = cgraph_edge (node, old_stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
860 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
861 /* It is possible that clones already contain the edge while |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
862 master didn't. Either we promoted indirect call into direct |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
863 call in the clone or we are processing clones of unreachable |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
864 master where edges has been rmeoved. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
865 if (edge) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
866 cgraph_set_call_stmt (edge, stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
867 else if (!cgraph_edge (node, stmt)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
868 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
869 edge = cgraph_create_edge (node, callee, stmt, count, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
870 freq, loop_depth); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
871 edge->inline_failed = reason; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
872 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
873 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
874 if (node->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
875 node = node->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
876 else if (node->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
877 node = node->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
878 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
879 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
880 while (node != orig && !node->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
881 node = node->clone_of; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
882 if (node != orig) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
883 node = node->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
884 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
885 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
886 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
887 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
888 /* Give initial reasons why inlining would fail on EDGE. This gets either |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
889 nullified or usually overwritten by more precise reasons later. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
890 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
891 static void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
892 initialize_inline_failed (struct cgraph_edge *e) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
893 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
894 struct cgraph_node *callee = e->callee; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
895 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
896 if (!callee->analyzed) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
897 e->inline_failed = CIF_BODY_NOT_AVAILABLE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
898 else if (callee->local.redefined_extern_inline) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
899 e->inline_failed = CIF_REDEFINED_EXTERN_INLINE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
900 else if (!callee->local.inlinable) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
901 e->inline_failed = CIF_FUNCTION_NOT_INLINABLE; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
902 else if (e->call_stmt && gimple_call_cannot_inline_p (e->call_stmt)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
903 e->inline_failed = CIF_MISMATCHED_ARGUMENTS; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
904 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
905 e->inline_failed = CIF_FUNCTION_NOT_CONSIDERED; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
906 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
907 |
0 | 908 /* Create edge from CALLER to CALLEE in the cgraph. */ |
909 | |
910 struct cgraph_edge * | |
911 cgraph_create_edge (struct cgraph_node *caller, struct cgraph_node *callee, | |
912 gimple call_stmt, gcov_type count, int freq, int nest) | |
913 { | |
914 struct cgraph_edge *edge; | |
915 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
916 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
917 /* LTO does not actually have access to the call_stmt since these |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
918 have not been loaded yet. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
919 if (call_stmt) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
920 { |
0 | 921 #ifdef ENABLE_CHECKING |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
922 /* This is rather pricely check possibly trigerring construction of |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
923 call stmt hashtable. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
924 gcc_assert (!cgraph_edge (caller, call_stmt)); |
0 | 925 #endif |
926 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
927 gcc_assert (is_gimple_call (call_stmt)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
928 } |
0 | 929 |
930 if (free_edges) | |
931 { | |
932 edge = free_edges; | |
933 free_edges = NEXT_FREE_EDGE (edge); | |
934 } | |
935 else | |
936 { | |
937 edge = GGC_NEW (struct cgraph_edge); | |
938 edge->uid = cgraph_edge_max_uid++; | |
939 } | |
940 | |
941 edge->aux = NULL; | |
942 | |
943 edge->caller = caller; | |
944 edge->callee = callee; | |
945 edge->call_stmt = call_stmt; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
946 push_cfun (DECL_STRUCT_FUNCTION (caller->decl)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
947 edge->can_throw_external |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
948 = call_stmt ? stmt_can_throw_external (call_stmt) : false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
949 pop_cfun (); |
0 | 950 edge->prev_caller = NULL; |
951 edge->next_caller = callee->callers; | |
952 if (callee->callers) | |
953 callee->callers->prev_caller = edge; | |
954 edge->prev_callee = NULL; | |
955 edge->next_callee = caller->callees; | |
956 if (caller->callees) | |
957 caller->callees->prev_callee = edge; | |
958 caller->callees = edge; | |
959 callee->callers = edge; | |
960 edge->count = count; | |
961 gcc_assert (count >= 0); | |
962 edge->frequency = freq; | |
963 gcc_assert (freq >= 0); | |
964 gcc_assert (freq <= CGRAPH_FREQ_MAX); | |
965 edge->loop_nest = nest; | |
966 edge->indirect_call = 0; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
967 edge->call_stmt_cannot_inline_p = |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
968 (call_stmt ? gimple_call_cannot_inline_p (call_stmt) : false); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
969 if (call_stmt && caller->call_site_hash) |
0 | 970 { |
971 void **slot; | |
972 slot = htab_find_slot_with_hash (caller->call_site_hash, | |
973 edge->call_stmt, | |
974 htab_hash_pointer | |
975 (edge->call_stmt), | |
976 INSERT); | |
977 gcc_assert (!*slot); | |
978 *slot = edge; | |
979 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
980 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
981 initialize_inline_failed (edge); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
982 |
0 | 983 return edge; |
984 } | |
985 | |
986 /* Remove the edge E from the list of the callers of the callee. */ | |
987 | |
988 static inline void | |
989 cgraph_edge_remove_callee (struct cgraph_edge *e) | |
990 { | |
991 if (e->prev_caller) | |
992 e->prev_caller->next_caller = e->next_caller; | |
993 if (e->next_caller) | |
994 e->next_caller->prev_caller = e->prev_caller; | |
995 if (!e->prev_caller) | |
996 e->callee->callers = e->next_caller; | |
997 } | |
998 | |
999 /* Remove the edge E from the list of the callees of the caller. */ | |
1000 | |
1001 static inline void | |
1002 cgraph_edge_remove_caller (struct cgraph_edge *e) | |
1003 { | |
1004 if (e->prev_callee) | |
1005 e->prev_callee->next_callee = e->next_callee; | |
1006 if (e->next_callee) | |
1007 e->next_callee->prev_callee = e->prev_callee; | |
1008 if (!e->prev_callee) | |
1009 e->caller->callees = e->next_callee; | |
1010 if (e->caller->call_site_hash) | |
1011 htab_remove_elt_with_hash (e->caller->call_site_hash, | |
1012 e->call_stmt, | |
1013 htab_hash_pointer (e->call_stmt)); | |
1014 } | |
1015 | |
1016 /* Put the edge onto the free list. */ | |
1017 | |
1018 static void | |
1019 cgraph_free_edge (struct cgraph_edge *e) | |
1020 { | |
1021 int uid = e->uid; | |
1022 | |
1023 /* Clear out the edge so we do not dangle pointers. */ | |
1024 memset (e, 0, sizeof (*e)); | |
1025 e->uid = uid; | |
1026 NEXT_FREE_EDGE (e) = free_edges; | |
1027 free_edges = e; | |
1028 } | |
1029 | |
1030 /* Remove the edge E in the cgraph. */ | |
1031 | |
1032 void | |
1033 cgraph_remove_edge (struct cgraph_edge *e) | |
1034 { | |
1035 /* Call all edge removal hooks. */ | |
1036 cgraph_call_edge_removal_hooks (e); | |
1037 | |
1038 /* Remove from callers list of the callee. */ | |
1039 cgraph_edge_remove_callee (e); | |
1040 | |
1041 /* Remove from callees list of the callers. */ | |
1042 cgraph_edge_remove_caller (e); | |
1043 | |
1044 /* Put the edge onto the free list. */ | |
1045 cgraph_free_edge (e); | |
1046 } | |
1047 | |
1048 /* Redirect callee of E to N. The function does not update underlying | |
1049 call expression. */ | |
1050 | |
1051 void | |
1052 cgraph_redirect_edge_callee (struct cgraph_edge *e, struct cgraph_node *n) | |
1053 { | |
1054 /* Remove from callers list of the current callee. */ | |
1055 cgraph_edge_remove_callee (e); | |
1056 | |
1057 /* Insert to callers list of the new callee. */ | |
1058 e->prev_caller = NULL; | |
1059 if (n->callers) | |
1060 n->callers->prev_caller = e; | |
1061 e->next_caller = n->callers; | |
1062 n->callers = e; | |
1063 e->callee = n; | |
1064 } | |
1065 | |
1066 | |
1067 /* Update or remove the corresponding cgraph edge if a GIMPLE_CALL | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1068 OLD_STMT changed into NEW_STMT. OLD_CALL is gimple_call_fndecl |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1069 of OLD_STMT if it was previously call statement. */ |
0 | 1070 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1071 static void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1072 cgraph_update_edges_for_call_stmt_node (struct cgraph_node *node, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1073 gimple old_stmt, tree old_call, gimple new_stmt) |
0 | 1074 { |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1075 tree new_call = (is_gimple_call (new_stmt)) ? gimple_call_fndecl (new_stmt) : 0; |
0 | 1076 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1077 /* We are seeing indirect calls, then there is nothing to update. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1078 if (!new_call && !old_call) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1079 return; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1080 /* See if we turned indirect call into direct call or folded call to one builtin |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1081 into different bultin. */ |
0 | 1082 if (old_call != new_call) |
1083 { | |
1084 struct cgraph_edge *e = cgraph_edge (node, old_stmt); | |
1085 struct cgraph_edge *ne = NULL; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1086 gcov_type count; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1087 int frequency; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1088 int loop_nest; |
0 | 1089 |
1090 if (e) | |
1091 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1092 /* See if the call is already there. It might be because of indirect |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1093 inlining already found it. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1094 if (new_call && e->callee->decl == new_call) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1095 return; |
0 | 1096 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1097 /* Otherwise remove edge and create new one; we can't simply redirect |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1098 since function has changed, so inline plan and other information |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1099 attached to edge is invalid. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1100 count = e->count; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1101 frequency = e->frequency; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1102 loop_nest = e->loop_nest; |
0 | 1103 cgraph_remove_edge (e); |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1104 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1105 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1106 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1107 /* We are seeing new direct call; compute profile info based on BB. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1108 basic_block bb = gimple_bb (new_stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1109 count = bb->count; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1110 frequency = compute_call_stmt_bb_frequency (current_function_decl, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1111 bb); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1112 loop_nest = bb->loop_depth; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1113 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1114 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1115 if (new_call) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1116 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1117 ne = cgraph_create_edge (node, cgraph_node (new_call), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1118 new_stmt, count, frequency, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1119 loop_nest); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1120 gcc_assert (ne->inline_failed); |
0 | 1121 } |
1122 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1123 /* We only updated the call stmt; update pointer in cgraph edge.. */ |
0 | 1124 else if (old_stmt != new_stmt) |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1125 cgraph_set_call_stmt (cgraph_edge (node, old_stmt), new_stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1126 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1127 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1128 /* Update or remove the corresponding cgraph edge if a GIMPLE_CALL |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1129 OLD_STMT changed into NEW_STMT. OLD_DECL is gimple_call_fndecl |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1130 of OLD_STMT before it was updated (updating can happen inplace). */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1131 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1132 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1133 cgraph_update_edges_for_call_stmt (gimple old_stmt, tree old_decl, gimple new_stmt) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1134 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1135 struct cgraph_node *orig = cgraph_node (cfun->decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1136 struct cgraph_node *node; |
0 | 1137 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1138 cgraph_update_edges_for_call_stmt_node (orig, old_stmt, old_decl, new_stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1139 if (orig->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1140 for (node = orig->clones; node != orig;) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1141 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1142 cgraph_update_edges_for_call_stmt_node (node, old_stmt, old_decl, new_stmt); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1143 if (node->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1144 node = node->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1145 else if (node->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1146 node = node->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1147 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1148 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1149 while (node != orig && !node->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1150 node = node->clone_of; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1151 if (node != orig) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1152 node = node->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1153 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1154 } |
0 | 1155 } |
1156 | |
1157 | |
1158 /* Remove all callees from the node. */ | |
1159 | |
1160 void | |
1161 cgraph_node_remove_callees (struct cgraph_node *node) | |
1162 { | |
1163 struct cgraph_edge *e, *f; | |
1164 | |
1165 /* It is sufficient to remove the edges from the lists of callers of | |
1166 the callees. The callee list of the node can be zapped with one | |
1167 assignment. */ | |
1168 for (e = node->callees; e; e = f) | |
1169 { | |
1170 f = e->next_callee; | |
1171 cgraph_call_edge_removal_hooks (e); | |
1172 cgraph_edge_remove_callee (e); | |
1173 cgraph_free_edge (e); | |
1174 } | |
1175 node->callees = NULL; | |
1176 if (node->call_site_hash) | |
1177 { | |
1178 htab_delete (node->call_site_hash); | |
1179 node->call_site_hash = NULL; | |
1180 } | |
1181 } | |
1182 | |
1183 /* Remove all callers from the node. */ | |
1184 | |
1185 static void | |
1186 cgraph_node_remove_callers (struct cgraph_node *node) | |
1187 { | |
1188 struct cgraph_edge *e, *f; | |
1189 | |
1190 /* It is sufficient to remove the edges from the lists of callees of | |
1191 the callers. The caller list of the node can be zapped with one | |
1192 assignment. */ | |
1193 for (e = node->callers; e; e = f) | |
1194 { | |
1195 f = e->next_caller; | |
1196 cgraph_call_edge_removal_hooks (e); | |
1197 cgraph_edge_remove_caller (e); | |
1198 cgraph_free_edge (e); | |
1199 } | |
1200 node->callers = NULL; | |
1201 } | |
1202 | |
1203 /* Release memory used to represent body of function NODE. */ | |
1204 | |
1205 void | |
1206 cgraph_release_function_body (struct cgraph_node *node) | |
1207 { | |
1208 if (DECL_STRUCT_FUNCTION (node->decl)) | |
1209 { | |
1210 tree old_decl = current_function_decl; | |
1211 push_cfun (DECL_STRUCT_FUNCTION (node->decl)); | |
1212 if (cfun->gimple_df) | |
1213 { | |
1214 current_function_decl = node->decl; | |
1215 delete_tree_ssa (); | |
1216 delete_tree_cfg_annotations (); | |
1217 cfun->eh = NULL; | |
1218 current_function_decl = old_decl; | |
1219 } | |
1220 if (cfun->cfg) | |
1221 { | |
1222 gcc_assert (dom_computed[0] == DOM_NONE); | |
1223 gcc_assert (dom_computed[1] == DOM_NONE); | |
1224 clear_edges (); | |
1225 } | |
1226 if (cfun->value_histograms) | |
1227 free_histograms (); | |
1228 gcc_assert (!current_loops); | |
1229 pop_cfun(); | |
1230 gimple_set_body (node->decl, NULL); | |
1231 VEC_free (ipa_opt_pass, heap, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1232 node->ipa_transforms_to_apply); |
0 | 1233 /* Struct function hangs a lot of data that would leak if we didn't |
1234 removed all pointers to it. */ | |
1235 ggc_free (DECL_STRUCT_FUNCTION (node->decl)); | |
1236 DECL_STRUCT_FUNCTION (node->decl) = NULL; | |
1237 } | |
1238 DECL_SAVED_TREE (node->decl) = NULL; | |
1239 /* If the node is abstract and needed, then do not clear DECL_INITIAL | |
1240 of its associated function function declaration because it's | |
1241 needed to emit debug info later. */ | |
1242 if (!node->abstract_and_needed) | |
1243 DECL_INITIAL (node->decl) = error_mark_node; | |
1244 } | |
1245 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1246 /* Remove same body alias node. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1247 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1248 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1249 cgraph_remove_same_body_alias (struct cgraph_node *node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1250 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1251 void **slot; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1252 int uid = node->uid; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1253 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1254 gcc_assert (node->same_body_alias); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1255 if (node->previous) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1256 node->previous->next = node->next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1257 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1258 node->same_body->same_body = node->next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1259 if (node->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1260 node->next->previous = node->previous; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1261 node->next = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1262 node->previous = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1263 slot = htab_find_slot (cgraph_hash, node, NO_INSERT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1264 if (*slot == node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1265 htab_clear_slot (cgraph_hash, slot); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1266 if (assembler_name_hash) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1267 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1268 tree name = DECL_ASSEMBLER_NAME (node->decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1269 slot = htab_find_slot_with_hash (assembler_name_hash, name, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1270 decl_assembler_name_hash (name), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1271 NO_INSERT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1272 if (slot && *slot == node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1273 htab_clear_slot (assembler_name_hash, slot); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1274 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1275 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1276 /* Clear out the node to NULL all pointers and add the node to the free |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1277 list. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1278 memset (node, 0, sizeof(*node)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1279 node->uid = uid; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1280 NEXT_FREE_NODE (node) = free_nodes; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1281 free_nodes = node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1282 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1283 |
0 | 1284 /* Remove the node from cgraph. */ |
1285 | |
1286 void | |
1287 cgraph_remove_node (struct cgraph_node *node) | |
1288 { | |
1289 void **slot; | |
1290 bool kill_body = false; | |
1291 struct cgraph_node *n; | |
1292 int uid = node->uid; | |
1293 | |
1294 cgraph_call_node_removal_hooks (node); | |
1295 cgraph_node_remove_callers (node); | |
1296 cgraph_node_remove_callees (node); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1297 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:
0
diff
changeset
|
1298 node->ipa_transforms_to_apply); |
0 | 1299 |
1300 /* Incremental inlining access removed nodes stored in the postorder list. | |
1301 */ | |
1302 node->needed = node->reachable = false; | |
1303 for (n = node->nested; n; n = n->next_nested) | |
1304 n->origin = NULL; | |
1305 node->nested = NULL; | |
1306 if (node->origin) | |
1307 { | |
1308 struct cgraph_node **node2 = &node->origin->nested; | |
1309 | |
1310 while (*node2 != node) | |
1311 node2 = &(*node2)->next_nested; | |
1312 *node2 = node->next_nested; | |
1313 } | |
1314 if (node->previous) | |
1315 node->previous->next = node->next; | |
1316 else | |
1317 cgraph_nodes = node->next; | |
1318 if (node->next) | |
1319 node->next->previous = node->previous; | |
1320 node->next = NULL; | |
1321 node->previous = NULL; | |
1322 slot = htab_find_slot (cgraph_hash, node, NO_INSERT); | |
1323 if (*slot == node) | |
1324 { | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1325 struct cgraph_node *next_inline_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1326 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1327 for (next_inline_clone = node->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1328 next_inline_clone && next_inline_clone->decl != node->decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1329 next_inline_clone = next_inline_clone->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1330 ; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1331 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1332 /* If there is inline clone of the node being removed, we need |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1333 to put it into the position of removed node and reorganize all |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1334 other clones to be based on it. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1335 if (next_inline_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1336 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1337 struct cgraph_node *n; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1338 struct cgraph_node *new_clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1339 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1340 *slot = next_inline_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1341 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1342 /* Unlink inline clone from the list of clones of removed node. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1343 if (next_inline_clone->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1344 next_inline_clone->next_sibling_clone->prev_sibling_clone |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1345 = next_inline_clone->prev_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1346 if (next_inline_clone->prev_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1347 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1348 gcc_assert (node->clones != next_inline_clone); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1349 next_inline_clone->prev_sibling_clone->next_sibling_clone |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1350 = next_inline_clone->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1351 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1352 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1353 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1354 gcc_assert (node->clones == next_inline_clone); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1355 node->clones = next_inline_clone->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1356 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1357 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1358 new_clones = node->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1359 node->clones = NULL; |
0 | 1360 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1361 /* Copy clone info. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1362 next_inline_clone->clone = node->clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1363 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1364 /* Now place it into clone tree at same level at NODE. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1365 next_inline_clone->clone_of = node->clone_of; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1366 next_inline_clone->prev_sibling_clone = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1367 next_inline_clone->next_sibling_clone = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1368 if (node->clone_of) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1369 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1370 if (node->clone_of->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1371 node->clone_of->clones->prev_sibling_clone = next_inline_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1372 next_inline_clone->next_sibling_clone = node->clone_of->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1373 node->clone_of->clones = next_inline_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1374 } |
0 | 1375 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1376 /* Merge the clone list. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1377 if (new_clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1378 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1379 if (!next_inline_clone->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1380 next_inline_clone->clones = new_clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1381 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1382 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1383 n = next_inline_clone->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1384 while (n->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1385 n = n->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1386 n->next_sibling_clone = new_clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1387 new_clones->prev_sibling_clone = n; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1388 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1389 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1390 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1391 /* Update clone_of pointers. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1392 n = new_clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1393 while (n) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1394 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1395 n->clone_of = next_inline_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1396 n = n->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1397 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1398 } |
0 | 1399 else |
1400 { | |
1401 htab_clear_slot (cgraph_hash, slot); | |
1402 kill_body = true; | |
1403 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1404 |
0 | 1405 } |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1406 if (node->prev_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1407 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:
0
diff
changeset
|
1408 else if (node->clone_of) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1409 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:
0
diff
changeset
|
1410 if (node->next_sibling_clone) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1411 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:
0
diff
changeset
|
1412 if (node->clones) |
0 | 1413 { |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1414 struct cgraph_node *n, *next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1415 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1416 if (node->clone_of) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1417 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1418 for (n = node->clones; 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:
0
diff
changeset
|
1419 n->clone_of = node->clone_of; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1420 n->clone_of = node->clone_of; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1421 n->next_sibling_clone = node->clone_of->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1422 if (node->clone_of->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1423 node->clone_of->clones->prev_sibling_clone = n; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1424 node->clone_of->clones = node->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1425 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1426 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1427 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1428 /* We are removing node with clones. this makes clones inconsistent, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1429 but assume they will be removed subsequently and just keep clone |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1430 tree intact. This can happen in unreachable function removal since |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1431 we remove unreachable functions in random order, not by bottom-up |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1432 walk of clone trees. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1433 for (n = node->clones; n; n = next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1434 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1435 next = n->next_sibling_clone; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1436 n->next_sibling_clone = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1437 n->prev_sibling_clone = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1438 n->clone_of = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1439 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1440 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1441 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1442 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1443 while (node->same_body) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1444 cgraph_remove_same_body_alias (node->same_body); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1445 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1446 if (node->same_comdat_group) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1447 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1448 struct cgraph_node *prev; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1449 for (prev = node->same_comdat_group; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1450 prev->same_comdat_group != node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1451 prev = prev->same_comdat_group) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1452 ; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1453 if (node->same_comdat_group == prev) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1454 prev->same_comdat_group = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1455 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1456 prev->same_comdat_group = node->same_comdat_group; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1457 node->same_comdat_group = NULL; |
0 | 1458 } |
1459 | |
1460 /* While all the clones are removed after being proceeded, the function | |
1461 itself is kept in the cgraph even after it is compiled. Check whether | |
1462 we are done with this body and reclaim it proactively if this is the case. | |
1463 */ | |
1464 if (!kill_body && *slot) | |
1465 { | |
1466 struct cgraph_node *n = (struct cgraph_node *) *slot; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1467 if (!n->clones && !n->clone_of && !n->global.inlined_to |
0 | 1468 && (cgraph_global_info_ready |
1469 && (TREE_ASM_WRITTEN (n->decl) || DECL_EXTERNAL (n->decl)))) | |
1470 kill_body = true; | |
1471 } | |
1472 if (assembler_name_hash) | |
1473 { | |
1474 tree name = DECL_ASSEMBLER_NAME (node->decl); | |
1475 slot = htab_find_slot_with_hash (assembler_name_hash, name, | |
1476 decl_assembler_name_hash (name), | |
1477 NO_INSERT); | |
1478 /* Inline clones are not hashed. */ | |
1479 if (slot && *slot == node) | |
1480 htab_clear_slot (assembler_name_hash, slot); | |
1481 } | |
1482 | |
1483 if (kill_body) | |
1484 cgraph_release_function_body (node); | |
1485 node->decl = NULL; | |
1486 if (node->call_site_hash) | |
1487 { | |
1488 htab_delete (node->call_site_hash); | |
1489 node->call_site_hash = NULL; | |
1490 } | |
1491 cgraph_n_nodes--; | |
1492 | |
1493 /* Clear out the node to NULL all pointers and add the node to the free | |
1494 list. */ | |
1495 memset (node, 0, sizeof(*node)); | |
1496 node->uid = uid; | |
1497 NEXT_FREE_NODE (node) = free_nodes; | |
1498 free_nodes = node; | |
1499 } | |
1500 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1501 /* Remove the node from cgraph. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1502 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1503 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1504 cgraph_remove_node_and_inline_clones (struct cgraph_node *node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1505 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1506 struct cgraph_edge *e, *next; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1507 for (e = node->callees; e; e = next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1508 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1509 next = e->next_callee; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1510 if (!e->inline_failed) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1511 cgraph_remove_node_and_inline_clones (e->callee); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1512 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1513 cgraph_remove_node (node); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1514 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1515 |
0 | 1516 /* Notify finalize_compilation_unit that given node is reachable. */ |
1517 | |
1518 void | |
1519 cgraph_mark_reachable_node (struct cgraph_node *node) | |
1520 { | |
1521 if (!node->reachable && node->local.finalized) | |
1522 { | |
1523 notice_global_symbol (node->decl); | |
1524 node->reachable = 1; | |
1525 gcc_assert (!cgraph_global_info_ready); | |
1526 | |
1527 node->next_needed = cgraph_nodes_queue; | |
1528 cgraph_nodes_queue = node; | |
1529 } | |
1530 } | |
1531 | |
1532 /* Likewise indicate that a node is needed, i.e. reachable via some | |
1533 external means. */ | |
1534 | |
1535 void | |
1536 cgraph_mark_needed_node (struct cgraph_node *node) | |
1537 { | |
1538 node->needed = 1; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1539 gcc_assert (!node->global.inlined_to); |
0 | 1540 cgraph_mark_reachable_node (node); |
1541 } | |
1542 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1543 /* Likewise indicate that a node is having address taken. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1544 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1545 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1546 cgraph_mark_address_taken_node (struct cgraph_node *node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1547 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1548 node->address_taken = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1549 cgraph_mark_needed_node (node); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1550 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1551 |
0 | 1552 /* Return local info for the compiled function. */ |
1553 | |
1554 struct cgraph_local_info * | |
1555 cgraph_local_info (tree decl) | |
1556 { | |
1557 struct cgraph_node *node; | |
1558 | |
1559 gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); | |
1560 node = cgraph_node (decl); | |
1561 return &node->local; | |
1562 } | |
1563 | |
1564 /* Return local info for the compiled function. */ | |
1565 | |
1566 struct cgraph_global_info * | |
1567 cgraph_global_info (tree decl) | |
1568 { | |
1569 struct cgraph_node *node; | |
1570 | |
1571 gcc_assert (TREE_CODE (decl) == FUNCTION_DECL && cgraph_global_info_ready); | |
1572 node = cgraph_node (decl); | |
1573 return &node->global; | |
1574 } | |
1575 | |
1576 /* Return local info for the compiled function. */ | |
1577 | |
1578 struct cgraph_rtl_info * | |
1579 cgraph_rtl_info (tree decl) | |
1580 { | |
1581 struct cgraph_node *node; | |
1582 | |
1583 gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); | |
1584 node = cgraph_node (decl); | |
1585 if (decl != current_function_decl | |
1586 && !TREE_ASM_WRITTEN (node->decl)) | |
1587 return NULL; | |
1588 return &node->rtl; | |
1589 } | |
1590 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1591 /* Return a string describing the failure REASON. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1592 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1593 const char* |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1594 cgraph_inline_failed_string (cgraph_inline_failed_t reason) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1595 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1596 #undef DEFCIFCODE |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1597 #define DEFCIFCODE(code, string) string, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1598 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1599 static const char *cif_string_table[CIF_N_REASONS] = { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1600 #include "cif-code.def" |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1601 }; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1602 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1603 /* Signedness of an enum type is implementation defined, so cast it |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1604 to unsigned before testing. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1605 gcc_assert ((unsigned) reason < CIF_N_REASONS); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1606 return cif_string_table[reason]; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1607 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1608 |
0 | 1609 /* Return name of the node used in debug output. */ |
1610 const char * | |
1611 cgraph_node_name (struct cgraph_node *node) | |
1612 { | |
1613 return lang_hooks.decl_printable_name (node->decl, 2); | |
1614 } | |
1615 | |
1616 /* Names used to print out the availability enum. */ | |
1617 const char * const cgraph_availability_names[] = | |
1618 {"unset", "not_available", "overwritable", "available", "local"}; | |
1619 | |
1620 | |
1621 /* Dump call graph node NODE to file F. */ | |
1622 | |
1623 void | |
1624 dump_cgraph_node (FILE *f, struct cgraph_node *node) | |
1625 { | |
1626 struct cgraph_edge *edge; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1627 fprintf (f, "%s/%i(%i)", cgraph_node_name (node), node->uid, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1628 node->pid); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1629 dump_addr (f, " @", (void *)node); |
0 | 1630 if (node->global.inlined_to) |
1631 fprintf (f, " (inline copy in %s/%i)", | |
1632 cgraph_node_name (node->global.inlined_to), | |
1633 node->global.inlined_to->uid); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1634 if (node->clone_of) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1635 fprintf (f, " (clone of %s/%i)", |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1636 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:
0
diff
changeset
|
1637 node->clone_of->uid); |
0 | 1638 if (cgraph_function_flags_ready) |
1639 fprintf (f, " availability:%s", | |
1640 cgraph_availability_names [cgraph_function_body_availability (node)]); | |
1641 if (node->count) | |
1642 fprintf (f, " executed "HOST_WIDEST_INT_PRINT_DEC"x", | |
1643 (HOST_WIDEST_INT)node->count); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1644 if (node->local.inline_summary.self_time) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1645 fprintf (f, " %i time, %i benefit", node->local.inline_summary.self_time, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1646 node->local.inline_summary.time_inlining_benefit); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1647 if (node->global.time && node->global.time |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1648 != node->local.inline_summary.self_time) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1649 fprintf (f, " (%i after inlining)", node->global.time); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1650 if (node->local.inline_summary.self_size) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1651 fprintf (f, " %i size, %i benefit", node->local.inline_summary.self_size, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1652 node->local.inline_summary.size_inlining_benefit); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1653 if (node->global.size && node->global.size |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1654 != node->local.inline_summary.self_size) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1655 fprintf (f, " (%i after inlining)", node->global.size); |
0 | 1656 if (node->local.inline_summary.estimated_self_stack_size) |
1657 fprintf (f, " %i bytes stack usage", (int)node->local.inline_summary.estimated_self_stack_size); | |
1658 if (node->global.estimated_stack_size != node->local.inline_summary.estimated_self_stack_size) | |
1659 fprintf (f, " %i bytes after inlining", (int)node->global.estimated_stack_size); | |
1660 if (node->origin) | |
1661 fprintf (f, " nested in: %s", cgraph_node_name (node->origin)); | |
1662 if (node->needed) | |
1663 fprintf (f, " needed"); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1664 if (node->address_taken) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1665 fprintf (f, " address_taken"); |
0 | 1666 else if (node->reachable) |
1667 fprintf (f, " reachable"); | |
1668 if (gimple_has_body_p (node->decl)) | |
1669 fprintf (f, " body"); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1670 if (node->process) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1671 fprintf (f, " process"); |
0 | 1672 if (node->local.local) |
1673 fprintf (f, " local"); | |
1674 if (node->local.externally_visible) | |
1675 fprintf (f, " externally_visible"); | |
1676 if (node->local.finalized) | |
1677 fprintf (f, " finalized"); | |
1678 if (node->local.disregard_inline_limits) | |
1679 fprintf (f, " always_inline"); | |
1680 else if (node->local.inlinable) | |
1681 fprintf (f, " inlinable"); | |
1682 if (node->local.redefined_extern_inline) | |
1683 fprintf (f, " redefined_extern_inline"); | |
1684 if (TREE_ASM_WRITTEN (node->decl)) | |
1685 fprintf (f, " asm_written"); | |
1686 | |
1687 fprintf (f, "\n called by: "); | |
1688 for (edge = node->callers; edge; edge = edge->next_caller) | |
1689 { | |
1690 fprintf (f, "%s/%i ", cgraph_node_name (edge->caller), | |
1691 edge->caller->uid); | |
1692 if (edge->count) | |
1693 fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ", | |
1694 (HOST_WIDEST_INT)edge->count); | |
1695 if (edge->frequency) | |
1696 fprintf (f, "(%.2f per call) ", | |
1697 edge->frequency / (double)CGRAPH_FREQ_BASE); | |
1698 if (!edge->inline_failed) | |
1699 fprintf(f, "(inlined) "); | |
1700 if (edge->indirect_call) | |
1701 fprintf(f, "(indirect) "); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1702 if (edge->can_throw_external) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1703 fprintf(f, "(can throw external) "); |
0 | 1704 } |
1705 | |
1706 fprintf (f, "\n calls: "); | |
1707 for (edge = node->callees; edge; edge = edge->next_callee) | |
1708 { | |
1709 fprintf (f, "%s/%i ", cgraph_node_name (edge->callee), | |
1710 edge->callee->uid); | |
1711 if (!edge->inline_failed) | |
1712 fprintf(f, "(inlined) "); | |
1713 if (edge->indirect_call) | |
1714 fprintf(f, "(indirect) "); | |
1715 if (edge->count) | |
1716 fprintf (f, "("HOST_WIDEST_INT_PRINT_DEC"x) ", | |
1717 (HOST_WIDEST_INT)edge->count); | |
1718 if (edge->frequency) | |
1719 fprintf (f, "(%.2f per call) ", | |
1720 edge->frequency / (double)CGRAPH_FREQ_BASE); | |
1721 if (edge->loop_nest) | |
1722 fprintf (f, "(nested in %i loops) ", edge->loop_nest); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1723 if (edge->can_throw_external) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1724 fprintf(f, "(can throw external) "); |
0 | 1725 } |
1726 fprintf (f, "\n"); | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1727 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1728 if (node->same_body) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1729 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1730 struct cgraph_node *n; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1731 fprintf (f, " aliases & thunks:"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1732 for (n = node->same_body; n; n = n->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1733 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1734 fprintf (f, " %s/%i", cgraph_node_name (n), n->uid); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1735 if (n->thunk.thunk_p) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1736 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1737 fprintf (f, " (thunk of %s fixed ofset %i virtual value %i has " |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1738 "virtual offset %i", |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1739 lang_hooks.decl_printable_name (n->thunk.alias, 2), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1740 (int)n->thunk.fixed_offset, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1741 (int)n->thunk.virtual_value, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1742 (int)n->thunk.virtual_offset_p); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1743 fprintf (f, ")"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1744 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1745 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1746 fprintf (f, "\n"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1747 } |
0 | 1748 } |
1749 | |
1750 | |
1751 /* Dump call graph node NODE to stderr. */ | |
1752 | |
1753 void | |
1754 debug_cgraph_node (struct cgraph_node *node) | |
1755 { | |
1756 dump_cgraph_node (stderr, node); | |
1757 } | |
1758 | |
1759 | |
1760 /* Dump the callgraph to file F. */ | |
1761 | |
1762 void | |
1763 dump_cgraph (FILE *f) | |
1764 { | |
1765 struct cgraph_node *node; | |
1766 | |
1767 fprintf (f, "callgraph:\n\n"); | |
1768 for (node = cgraph_nodes; node; node = node->next) | |
1769 dump_cgraph_node (f, node); | |
1770 } | |
1771 | |
1772 | |
1773 /* Dump the call graph to stderr. */ | |
1774 | |
1775 void | |
1776 debug_cgraph (void) | |
1777 { | |
1778 dump_cgraph (stderr); | |
1779 } | |
1780 | |
1781 | |
1782 /* Set the DECL_ASSEMBLER_NAME and update cgraph hashtables. */ | |
1783 | |
1784 void | |
1785 change_decl_assembler_name (tree decl, tree name) | |
1786 { | |
1787 gcc_assert (!assembler_name_hash); | |
1788 if (!DECL_ASSEMBLER_NAME_SET_P (decl)) | |
1789 { | |
1790 SET_DECL_ASSEMBLER_NAME (decl, name); | |
1791 return; | |
1792 } | |
1793 if (name == DECL_ASSEMBLER_NAME (decl)) | |
1794 return; | |
1795 | |
1796 if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) | |
1797 && DECL_RTL_SET_P (decl)) | |
1798 warning (0, "%D renamed after being referenced in assembly", decl); | |
1799 | |
1800 SET_DECL_ASSEMBLER_NAME (decl, name); | |
1801 } | |
1802 | |
1803 /* Add a top-level asm statement to the list. */ | |
1804 | |
1805 struct cgraph_asm_node * | |
1806 cgraph_add_asm_node (tree asm_str) | |
1807 { | |
1808 struct cgraph_asm_node *node; | |
1809 | |
1810 node = GGC_CNEW (struct cgraph_asm_node); | |
1811 node->asm_str = asm_str; | |
1812 node->order = cgraph_order++; | |
1813 node->next = NULL; | |
1814 if (cgraph_asm_nodes == NULL) | |
1815 cgraph_asm_nodes = node; | |
1816 else | |
1817 cgraph_asm_last_node->next = node; | |
1818 cgraph_asm_last_node = node; | |
1819 return node; | |
1820 } | |
1821 | |
1822 /* Return true when the DECL can possibly be inlined. */ | |
1823 bool | |
1824 cgraph_function_possibly_inlined_p (tree decl) | |
1825 { | |
1826 if (!cgraph_global_info_ready) | |
1827 return !DECL_UNINLINABLE (decl); | |
1828 return DECL_POSSIBLY_INLINED (decl); | |
1829 } | |
1830 | |
1831 /* Create clone of E in the node N represented by CALL_EXPR the callgraph. */ | |
1832 struct cgraph_edge * | |
1833 cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1834 gimple call_stmt, unsigned stmt_uid, gcov_type count_scale, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1835 int freq_scale, int loop_nest, bool update_original) |
0 | 1836 { |
1837 struct cgraph_edge *new_edge; | |
1838 gcov_type count = e->count * count_scale / REG_BR_PROB_BASE; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1839 gcov_type freq; |
0 | 1840 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1841 /* We do not want to ignore loop nest after frequency drops to 0. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1842 if (!freq_scale) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1843 freq_scale = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1844 freq = e->frequency * (gcov_type) freq_scale / CGRAPH_FREQ_BASE; |
0 | 1845 if (freq > CGRAPH_FREQ_MAX) |
1846 freq = CGRAPH_FREQ_MAX; | |
1847 new_edge = cgraph_create_edge (n, e->callee, call_stmt, count, freq, | |
1848 e->loop_nest + loop_nest); | |
1849 | |
1850 new_edge->inline_failed = e->inline_failed; | |
1851 new_edge->indirect_call = e->indirect_call; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1852 new_edge->lto_stmt_uid = stmt_uid; |
0 | 1853 if (update_original) |
1854 { | |
1855 e->count -= new_edge->count; | |
1856 if (e->count < 0) | |
1857 e->count = 0; | |
1858 } | |
1859 cgraph_call_edge_duplication_hooks (e, new_edge); | |
1860 return new_edge; | |
1861 } | |
1862 | |
1863 /* Create node representing clone of N executed COUNT times. Decrease | |
1864 the execution counts from original node too. | |
1865 | |
1866 When UPDATE_ORIGINAL is true, the counts are subtracted from the original | |
1867 function's profile to reflect the fact that part of execution is handled | |
1868 by node. */ | |
1869 struct cgraph_node * | |
1870 cgraph_clone_node (struct cgraph_node *n, gcov_type count, int freq, | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1871 int loop_nest, bool update_original, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1872 VEC(cgraph_edge_p,heap) *redirect_callers) |
0 | 1873 { |
1874 struct cgraph_node *new_node = cgraph_create_node (); | |
1875 struct cgraph_edge *e; | |
1876 gcov_type count_scale; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1877 unsigned i; |
0 | 1878 |
1879 new_node->decl = n->decl; | |
1880 new_node->origin = n->origin; | |
1881 if (new_node->origin) | |
1882 { | |
1883 new_node->next_nested = new_node->origin->nested; | |
1884 new_node->origin->nested = new_node; | |
1885 } | |
1886 new_node->analyzed = n->analyzed; | |
1887 new_node->local = n->local; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1888 new_node->local.externally_visible = false; |
0 | 1889 new_node->global = n->global; |
1890 new_node->rtl = n->rtl; | |
1891 new_node->count = count; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1892 new_node->clone = n->clone; |
0 | 1893 if (n->count) |
1894 { | |
1895 if (new_node->count > n->count) | |
1896 count_scale = REG_BR_PROB_BASE; | |
1897 else | |
1898 count_scale = new_node->count * REG_BR_PROB_BASE / n->count; | |
1899 } | |
1900 else | |
1901 count_scale = 0; | |
1902 if (update_original) | |
1903 { | |
1904 n->count -= count; | |
1905 if (n->count < 0) | |
1906 n->count = 0; | |
1907 } | |
1908 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1909 for (i = 0; VEC_iterate (cgraph_edge_p, redirect_callers, i, e); i++) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1910 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1911 /* Redirect calls to the old version node to point to its new |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1912 version. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1913 cgraph_redirect_edge_callee (e, new_node); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1914 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1915 |
0 | 1916 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1917 for (e = n->callees;e; e=e->next_callee) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1918 cgraph_clone_edge (e, new_node, e->call_stmt, e->lto_stmt_uid, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1919 count_scale, freq, loop_nest, update_original); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1920 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1921 new_node->next_sibling_clone = n->clones; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1922 if (n->clones) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1923 n->clones->prev_sibling_clone = new_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1924 n->clones = new_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1925 new_node->clone_of = n; |
0 | 1926 |
1927 cgraph_call_node_duplication_hooks (n, new_node); | |
1928 return new_node; | |
1929 } | |
1930 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1931 /* Create a new name for omp child function. Returns an identifier. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1932 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1933 static GTY(()) unsigned int clone_fn_id_num; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1934 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1935 static tree |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1936 clone_function_name (tree decl) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1937 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1938 tree name = DECL_ASSEMBLER_NAME (decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1939 size_t len = IDENTIFIER_LENGTH (name); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1940 char *tmp_name, *prefix; |
0 | 1941 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1942 prefix = XALLOCAVEC (char, len + strlen ("_clone") + 1); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1943 memcpy (prefix, IDENTIFIER_POINTER (name), len); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1944 strcpy (prefix + len, "_clone"); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1945 #ifndef NO_DOT_IN_LABEL |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1946 prefix[len] = '.'; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1947 #elif !defined NO_DOLLAR_IN_LABEL |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1948 prefix[len] = '$'; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1949 #endif |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1950 ASM_FORMAT_PRIVATE_NAME (tmp_name, prefix, clone_fn_id_num++); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1951 return get_identifier (tmp_name); |
0 | 1952 } |
1953 | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1954 /* Create callgraph node clone with new declaration. The actual body will |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1955 be copied later at compilation stage. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1956 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1957 TODO: after merging in ipa-sra use function call notes instead of args_to_skip |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1958 bitmap interface. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1959 */ |
0 | 1960 struct cgraph_node * |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1961 cgraph_create_virtual_clone (struct cgraph_node *old_node, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1962 VEC(cgraph_edge_p,heap) *redirect_callers, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1963 VEC(ipa_replace_map_p,gc) *tree_map, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1964 bitmap args_to_skip) |
0 | 1965 { |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1966 tree old_decl = old_node->decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1967 struct cgraph_node *new_node = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1968 tree new_decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1969 struct cgraph_node key, **slot; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1970 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1971 gcc_assert (tree_versionable_function_p (old_decl)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1972 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1973 /* Make a new FUNCTION_DECL tree node */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1974 if (!args_to_skip) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1975 new_decl = copy_node (old_decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1976 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1977 new_decl = build_function_decl_skip_args (old_decl, args_to_skip); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1978 DECL_STRUCT_FUNCTION (new_decl) = NULL; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1979 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1980 /* Generate a new name for the new version. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1981 DECL_NAME (new_decl) = clone_function_name (old_decl); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1982 SET_DECL_ASSEMBLER_NAME (new_decl, DECL_NAME (new_decl)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1983 SET_DECL_RTL (new_decl, NULL); |
0 | 1984 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1985 new_node = cgraph_clone_node (old_node, old_node->count, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1986 CGRAPH_FREQ_BASE, 0, false, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1987 redirect_callers); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1988 new_node->decl = new_decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1989 /* Update the properties. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1990 Make clone visible only within this translation unit. Make sure |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1991 that is not weak also. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1992 ??? We cannot use COMDAT linkage because there is no |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1993 ABI support for this. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1994 DECL_EXTERNAL (new_node->decl) = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1995 DECL_COMDAT_GROUP (new_node->decl) = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1996 TREE_PUBLIC (new_node->decl) = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1997 DECL_COMDAT (new_node->decl) = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1998 DECL_WEAK (new_node->decl) = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
1999 new_node->clone.tree_map = tree_map; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2000 new_node->clone.args_to_skip = args_to_skip; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2001 if (!args_to_skip) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2002 new_node->clone.combined_args_to_skip = old_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:
0
diff
changeset
|
2003 else if (old_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:
0
diff
changeset
|
2004 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2005 int newi = 0, oldi = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2006 tree arg; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2007 bitmap new_args_to_skip = BITMAP_GGC_ALLOC (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2008 struct cgraph_node *orig_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2009 for (orig_node = old_node; orig_node->clone_of; orig_node = orig_node->clone_of) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2010 ; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2011 for (arg = DECL_ARGUMENTS (orig_node->decl); arg; arg = TREE_CHAIN (arg), oldi++) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2012 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2013 if (bitmap_bit_p (old_node->clone.combined_args_to_skip, oldi)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2014 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2015 bitmap_set_bit (new_args_to_skip, oldi); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2016 continue; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2017 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2018 if (bitmap_bit_p (args_to_skip, newi)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2019 bitmap_set_bit (new_args_to_skip, oldi); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2020 newi++; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2021 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2022 new_node->clone.combined_args_to_skip = new_args_to_skip; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2023 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2024 else |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2025 new_node->clone.combined_args_to_skip = args_to_skip; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2026 new_node->local.externally_visible = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2027 new_node->local.local = 1; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2028 new_node->lowered = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2029 new_node->reachable = true; |
0 | 2030 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2031 key.decl = new_decl; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2032 slot = (struct cgraph_node **) htab_find_slot (cgraph_hash, &key, INSERT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2033 gcc_assert (!*slot); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2034 *slot = new_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2035 if (assembler_name_hash) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2036 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2037 void **aslot; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2038 tree name = DECL_ASSEMBLER_NAME (new_decl); |
0 | 2039 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2040 aslot = htab_find_slot_with_hash (assembler_name_hash, name, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2041 decl_assembler_name_hash (name), |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2042 INSERT); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2043 gcc_assert (!*aslot); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2044 *aslot = new_node; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2045 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2046 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2047 return new_node; |
0 | 2048 } |
2049 | |
2050 /* NODE is no longer nested function; update cgraph accordingly. */ | |
2051 void | |
2052 cgraph_unnest_node (struct cgraph_node *node) | |
2053 { | |
2054 struct cgraph_node **node2 = &node->origin->nested; | |
2055 gcc_assert (node->origin); | |
2056 | |
2057 while (*node2 != node) | |
2058 node2 = &(*node2)->next_nested; | |
2059 *node2 = node->next_nested; | |
2060 node->origin = NULL; | |
2061 } | |
2062 | |
2063 /* Return function availability. See cgraph.h for description of individual | |
2064 return values. */ | |
2065 enum availability | |
2066 cgraph_function_body_availability (struct cgraph_node *node) | |
2067 { | |
2068 enum availability avail; | |
2069 gcc_assert (cgraph_function_flags_ready); | |
2070 if (!node->analyzed) | |
2071 avail = AVAIL_NOT_AVAILABLE; | |
2072 else if (node->local.local) | |
2073 avail = AVAIL_LOCAL; | |
2074 else if (!node->local.externally_visible) | |
2075 avail = AVAIL_AVAILABLE; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2076 /* Inline functions are safe to be analyzed even if their sybol can |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2077 be overwritten at runtime. It is not meaningful to enfore any sane |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2078 behaviour on replacing inline function by different body. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2079 else if (DECL_DECLARED_INLINE_P (node->decl)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2080 avail = AVAIL_AVAILABLE; |
0 | 2081 |
2082 /* If the function can be overwritten, return OVERWRITABLE. Take | |
2083 care at least of two notable extensions - the COMDAT functions | |
2084 used to share template instantiations in C++ (this is symmetric | |
2085 to code cp_cannot_inline_tree_fn and probably shall be shared and | |
2086 the inlinability hooks completely eliminated). | |
2087 | |
2088 ??? Does the C++ one definition rule allow us to always return | |
2089 AVAIL_AVAILABLE here? That would be good reason to preserve this | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2090 bit. */ |
0 | 2091 |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2092 else if (DECL_REPLACEABLE_P (node->decl) && !DECL_EXTERNAL (node->decl)) |
0 | 2093 avail = AVAIL_OVERWRITABLE; |
2094 else avail = AVAIL_AVAILABLE; | |
2095 | |
2096 return avail; | |
2097 } | |
2098 | |
2099 /* Add the function FNDECL to the call graph. | |
2100 Unlike cgraph_finalize_function, this function is intended to be used | |
2101 by middle end and allows insertion of new function at arbitrary point | |
2102 of compilation. The function can be either in high, low or SSA form | |
2103 GIMPLE. | |
2104 | |
2105 The function is assumed to be reachable and have address taken (so no | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2106 API breaking optimizations are performed on it). |
0 | 2107 |
2108 Main work done by this function is to enqueue the function for later | |
2109 processing to avoid need the passes to be re-entrant. */ | |
2110 | |
2111 void | |
2112 cgraph_add_new_function (tree fndecl, bool lowered) | |
2113 { | |
2114 struct cgraph_node *node; | |
2115 switch (cgraph_state) | |
2116 { | |
2117 case CGRAPH_STATE_CONSTRUCTION: | |
2118 /* Just enqueue function to be processed at nearest occurrence. */ | |
2119 node = cgraph_node (fndecl); | |
2120 node->next_needed = cgraph_new_nodes; | |
2121 if (lowered) | |
2122 node->lowered = true; | |
2123 cgraph_new_nodes = node; | |
2124 break; | |
2125 | |
2126 case CGRAPH_STATE_IPA: | |
2127 case CGRAPH_STATE_IPA_SSA: | |
2128 case CGRAPH_STATE_EXPANSION: | |
2129 /* Bring the function into finalized state and enqueue for later | |
2130 analyzing and compilation. */ | |
2131 node = cgraph_node (fndecl); | |
2132 node->local.local = false; | |
2133 node->local.finalized = true; | |
2134 node->reachable = node->needed = true; | |
2135 if (!lowered && cgraph_state == CGRAPH_STATE_EXPANSION) | |
2136 { | |
2137 push_cfun (DECL_STRUCT_FUNCTION (fndecl)); | |
2138 current_function_decl = fndecl; | |
2139 gimple_register_cfg_hooks (); | |
2140 tree_lowering_passes (fndecl); | |
2141 bitmap_obstack_initialize (NULL); | |
2142 if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl))) | |
2143 execute_pass_list (pass_early_local_passes.pass.sub); | |
2144 bitmap_obstack_release (NULL); | |
2145 pop_cfun (); | |
2146 current_function_decl = NULL; | |
2147 | |
2148 lowered = true; | |
2149 } | |
2150 if (lowered) | |
2151 node->lowered = true; | |
2152 node->next_needed = cgraph_new_nodes; | |
2153 cgraph_new_nodes = node; | |
2154 break; | |
2155 | |
2156 case CGRAPH_STATE_FINISHED: | |
2157 /* At the very end of compilation we have to do all the work up | |
2158 to expansion. */ | |
2159 push_cfun (DECL_STRUCT_FUNCTION (fndecl)); | |
2160 current_function_decl = fndecl; | |
2161 gimple_register_cfg_hooks (); | |
2162 if (!lowered) | |
2163 tree_lowering_passes (fndecl); | |
2164 bitmap_obstack_initialize (NULL); | |
2165 if (!gimple_in_ssa_p (DECL_STRUCT_FUNCTION (fndecl))) | |
2166 execute_pass_list (pass_early_local_passes.pass.sub); | |
2167 bitmap_obstack_release (NULL); | |
2168 tree_rest_of_compilation (fndecl); | |
2169 pop_cfun (); | |
2170 current_function_decl = NULL; | |
2171 break; | |
2172 } | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2173 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2174 /* Set a personality if required and we already passed EH lowering. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2175 if (lowered |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2176 && (function_needs_eh_personality (DECL_STRUCT_FUNCTION (fndecl)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2177 == eh_personality_lang)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2178 DECL_FUNCTION_PERSONALITY (fndecl) = lang_hooks.eh_personality (); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2179 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2180 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2181 /* Return true if NODE can be made local for API change. |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2182 Extern inline functions and C++ COMDAT functions can be made local |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2183 at the expense of possible code size growth if function is used in multiple |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2184 compilation units. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2185 bool |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2186 cgraph_node_can_be_local_p (struct cgraph_node *node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2187 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2188 return (!node->needed |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2189 && ((DECL_COMDAT (node->decl) && !node->same_comdat_group) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2190 || !node->local.externally_visible)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2191 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2192 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2193 /* Bring NODE local. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2194 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2195 cgraph_make_node_local (struct cgraph_node *node) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2196 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2197 gcc_assert (cgraph_node_can_be_local_p (node)); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2198 if (DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl)) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2199 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2200 DECL_COMDAT (node->decl) = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2201 DECL_COMDAT_GROUP (node->decl) = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2202 TREE_PUBLIC (node->decl) = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2203 DECL_WEAK (node->decl) = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2204 DECL_EXTERNAL (node->decl) = 0; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2205 node->local.externally_visible = false; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2206 node->local.local = true; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2207 gcc_assert (cgraph_function_body_availability (node) == AVAIL_LOCAL); |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2208 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2209 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2210 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2211 /* Set TREE_NOTHROW on NODE's decl and on same_body aliases of NODE |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2212 if any to NOTHROW. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2213 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2214 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2215 cgraph_set_nothrow_flag (struct cgraph_node *node, bool nothrow) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2216 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2217 struct cgraph_node *alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2218 TREE_NOTHROW (node->decl) = nothrow; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2219 for (alias = node->same_body; alias; alias = alias->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2220 TREE_NOTHROW (alias->decl) = nothrow; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2221 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2222 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2223 /* Set TREE_READONLY on NODE's decl and on same_body aliases of NODE |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2224 if any to READONLY. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2225 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2226 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2227 cgraph_set_readonly_flag (struct cgraph_node *node, bool readonly) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2228 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2229 struct cgraph_node *alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2230 TREE_READONLY (node->decl) = readonly; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2231 for (alias = node->same_body; alias; alias = alias->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2232 TREE_READONLY (alias->decl) = readonly; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2233 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2234 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2235 /* Set DECL_PURE_P on NODE's decl and on same_body aliases of NODE |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2236 if any to PURE. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2237 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2238 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2239 cgraph_set_pure_flag (struct cgraph_node *node, bool pure) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2240 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2241 struct cgraph_node *alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2242 DECL_PURE_P (node->decl) = pure; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2243 for (alias = node->same_body; alias; alias = alias->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2244 DECL_PURE_P (alias->decl) = pure; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2245 } |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2246 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2247 /* Set DECL_LOOPING_CONST_OR_PURE_P on NODE's decl and on |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2248 same_body aliases of NODE if any to LOOPING_CONST_OR_PURE. */ |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2249 |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2250 void |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2251 cgraph_set_looping_const_or_pure_flag (struct cgraph_node *node, |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2252 bool looping_const_or_pure) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2253 { |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2254 struct cgraph_node *alias; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2255 DECL_LOOPING_CONST_OR_PURE_P (node->decl) = looping_const_or_pure; |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2256 for (alias = node->same_body; alias; alias = alias->next) |
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
2257 DECL_LOOPING_CONST_OR_PURE_P (alias->decl) = looping_const_or_pure; |
0 | 2258 } |
2259 | |
2260 #include "gt-cgraph.h" |