]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/cgraph.h
re PR tree-optimization/48149 (Piecewise complex pass-through not optimized)
[thirdparty/gcc.git] / gcc / cgraph.h
CommitLineData
1c4a429a 1/* Callgraph handling code.
7fece979 2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
2bafad93 3 Free Software Foundation, Inc.
1c4a429a
JH
4 Contributed by Jan Hubicka
5
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
9dcd6f09 10Software Foundation; either version 3, or (at your option) any later
1c4a429a
JH
11version.
12
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
17
18You should have received a copy of the GNU General Public License
9dcd6f09
NC
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
1c4a429a
JH
21
22#ifndef GCC_CGRAPH_H
23#define GCC_CGRAPH_H
7a8cba34 24
051f8cc6 25#include "plugin-api.h"
7a8cba34 26#include "vec.h"
6674a6ce 27#include "tree.h"
e42922b1 28#include "basic-block.h"
7a8cba34
SB
29#include "function.h"
30#include "ipa-ref.h" /* FIXME: inappropriate dependency of cgraph on IPA. */
1c4a429a 31
6b02a499
JH
32enum availability
33{
34 /* Not yet set by cgraph_function_body_availability. */
35 AVAIL_UNSET,
36 /* Function body/variable initializer is unknown. */
37 AVAIL_NOT_AVAILABLE,
38 /* Function body/variable initializer is known but might be replaced
39 by a different one from other compilation unit and thus needs to
40 be dealt with a care. Like AVAIL_NOT_AVAILABLE it can have
41 arbitrary side effects on escaping variables and functions, while
42 like AVAILABLE it might access static variables. */
43 AVAIL_OVERWRITABLE,
44 /* Function body/variable initializer is known and will be used in final
45 program. */
46 AVAIL_AVAILABLE,
47 /* Function body/variable initializer is known and all it's uses are explicitly
48 visible within current unit (ie it's address is never taken and it is not
49 exported to other units).
50 Currently used only for functions. */
51 AVAIL_LOCAL
52};
53
d7f09764
DN
54/* This is the information that is put into the cgraph local structure
55 to recover a function. */
56struct lto_file_decl_data;
57
8a4a83ed 58extern const char * const cgraph_availability_names[];
430c6ceb 59extern const char * const ld_plugin_symbol_resolution_names[];
8a4a83ed 60
6744a6ab
JH
61/* Information about thunk, used only for same body aliases. */
62
63struct GTY(()) cgraph_thunk_info {
64 /* Information about the thunk. */
65 HOST_WIDE_INT fixed_offset;
66 HOST_WIDE_INT virtual_value;
67 tree alias;
68 bool this_adjusting;
69 bool virtual_offset_p;
70 /* Set to true when alias node is thunk. */
71 bool thunk_p;
72};
73
dafc5b82 74/* Information about the function collected locally.
25c84396 75 Available after function is analyzed. */
dafc5b82 76
d1b38208 77struct GTY(()) cgraph_local_info {
d7f09764 78 /* File stream where this node is being written to. */
49ba8180 79 struct lto_file_decl_data * lto_file_data;
d7f09764 80
e0bb17a8 81 /* Set when function function is visible in current compilation unit only
e2209b03 82 and its address is never taken. */
b4e19405 83 unsigned local : 1;
6674a6ce 84
e7d6beb0 85 /* Set when function is visible by other units. */
b4e19405 86 unsigned externally_visible : 1;
6d41cd02 87
f6981e16 88 /* Set once it has been finalized so we consider it to be output. */
b4e19405 89 unsigned finalized : 1;
b58b1157 90
61e03ffc
JH
91 /* False when function calling convention and signature can not be changed.
92 This is the case when __builtin_apply_args is used. */
93 unsigned can_change_signature : 1;
94
95c755e9
JH
95 /* True when the function has been originally extern inline, but it is
96 redefined now. */
b4e19405 97 unsigned redefined_extern_inline : 1;
dafc5b82
JH
98};
99
100/* Information about the function that needs to be computed globally
726a989a 101 once compilation is finished. Available only with -funit-at-a-time. */
dafc5b82 102
d1b38208 103struct GTY(()) cgraph_global_info {
726a989a
RB
104 /* For inline clones this points to the function they will be
105 inlined into. */
18c6ada9 106 struct cgraph_node *inlined_to;
dafc5b82
JH
107};
108
b255a036
JH
109/* Information about the function that is propagated by the RTL backend.
110 Available only for functions that has been already assembled. */
111
d1b38208 112struct GTY(()) cgraph_rtl_info {
17b29c0a 113 unsigned int preferred_incoming_stack_boundary;
b255a036
JH
114};
115
9187e02d
JH
116/* Represent which DECL tree (or reference to such tree)
117 will be replaced by another tree while versioning. */
118struct GTY(()) ipa_replace_map
119{
120 /* The tree that will be replaced. */
121 tree old_tree;
122 /* The new (replacing) tree. */
123 tree new_tree;
922f15c2
JH
124 /* Parameter number to replace, when old_tree is NULL. */
125 int parm_num;
9187e02d
JH
126 /* True when a substitution should be done, false otherwise. */
127 bool replace_p;
128 /* True when we replace a reference to old_tree. */
129 bool ref_p;
130};
131typedef struct ipa_replace_map *ipa_replace_map_p;
132DEF_VEC_P(ipa_replace_map_p);
133DEF_VEC_ALLOC_P(ipa_replace_map_p,gc);
134
135struct GTY(()) cgraph_clone_info
136{
137 VEC(ipa_replace_map_p,gc)* tree_map;
138 bitmap args_to_skip;
08ad1d6d 139 bitmap combined_args_to_skip;
9187e02d
JH
140};
141
5fefcf92 142
ba228239 143/* The cgraph data structure.
e0bb17a8 144 Each function decl has assigned cgraph_node listing callees and callers. */
1c4a429a 145
d1b38208 146struct GTY((chain_next ("%h.next"), chain_prev ("%h.previous"))) cgraph_node {
1c4a429a
JH
147 tree decl;
148 struct cgraph_edge *callees;
149 struct cgraph_edge *callers;
ed2df68b
JH
150 struct cgraph_node *next;
151 struct cgraph_node *previous;
e33c6cd6
MJ
152 /* List of edges representing indirect calls with a yet undetermined
153 callee. */
154 struct cgraph_edge *indirect_calls;
1c4a429a
JH
155 /* For nested functions points to function the node is nested in. */
156 struct cgraph_node *origin;
157 /* Points to first nested function, if any. */
158 struct cgraph_node *nested;
159 /* Pointer to the next function with same origin, if any. */
160 struct cgraph_node *next_nested;
8bd87c4e
JH
161 /* Pointer to the next function in cgraph_nodes_queue. */
162 struct cgraph_node *next_needed;
18c6ada9 163 /* Pointer to the next clone. */
9187e02d
JH
164 struct cgraph_node *next_sibling_clone;
165 struct cgraph_node *prev_sibling_clone;
166 struct cgraph_node *clones;
167 struct cgraph_node *clone_of;
b66887e4
JJ
168 /* Circular list of nodes in the same comdat group if non-NULL. */
169 struct cgraph_node *same_comdat_group;
70d539ce
JH
170 /* For functions with many calls sites it holds map from call expression
171 to the edge to speed up cgraph_edge function. */
172 htab_t GTY((param_is (struct cgraph_edge))) call_site_hash;
97ba0040
JH
173 /* Declaration node used to be clone of. */
174 tree former_clone_of;
c22cacf3 175
1431042e 176 PTR GTY ((skip)) aux;
1c4a429a 177
0e3776db
JH
178 /* Interprocedural passes scheduled to have their transform functions
179 applied next time we execute local pass on them. We maintain it
180 per-function in order to allow IPA passes to introduce new functions. */
181 VEC(ipa_opt_pass,heap) * GTY((skip)) ipa_transforms_to_apply;
182
369451ec 183 struct ipa_ref_list ref_list;
95c755e9
JH
184 struct cgraph_local_info local;
185 struct cgraph_global_info global;
186 struct cgraph_rtl_info rtl;
9187e02d 187 struct cgraph_clone_info clone;
6744a6ab 188 struct cgraph_thunk_info thunk;
c22cacf3 189
e42922b1
JH
190 /* Expected number of executions: calculated in profile.c. */
191 gcov_type count;
db0bf14f
JH
192 /* How to scale counts at materialization time; used to merge
193 LTO units with different number of profile runs. */
194 int count_materialization_scale;
95c755e9
JH
195 /* Unique id of the node. */
196 int uid;
474eccc6
ILT
197 /* Ordering of all cgraph nodes. */
198 int order;
b4e19405 199
051f8cc6 200 enum ld_plugin_symbol_resolution resolution;
3691626c 201
0e3776db
JH
202 /* Set when function must be output for some reason. The primary
203 use of this flag is to mark functions needed to be output for
204 non-standard reason. Functions that are externally visible
205 or reachable from functions needed to be output are marked
206 by specialized flags. */
b4e19405 207 unsigned needed : 1;
0e3776db
JH
208 /* Set when function has address taken.
209 In current implementation it imply needed flag. */
39ff5a96 210 unsigned address_taken : 1;
6b20f353
DS
211 /* Set when decl is an abstract function pointed to by the
212 ABSTRACT_DECL_ORIGIN of a reachable function. */
213 unsigned abstract_and_needed : 1;
1c4a429a 214 /* Set when function is reachable by call from other function
b8698a0f 215 that is either reachable or needed.
0e3776db
JH
216 This flag is computed at original cgraph construction and then
217 updated in cgraph_remove_unreachable_nodes. Note that after
218 cgraph_remove_unreachable_nodes cgraph still can contain unreachable
219 nodes when they are needed for virtual clone instantiation. */
b4e19405 220 unsigned reachable : 1;
a837268b
JH
221 /* Set when function is reachable by call from other LTRANS partition. */
222 unsigned reachable_from_other_partition : 1;
50674e96 223 /* Set once the function is lowered (i.e. its CFG is built). */
b4e19405 224 unsigned lowered : 1;
25c84396
RH
225 /* Set once the function has been instantiated and its callee
226 lists created. */
b4e19405 227 unsigned analyzed : 1;
92eb4438
JH
228 /* Set when function is available in the other LTRANS partition.
229 During WPA output it is used to mark nodes that are present in
230 multiple partitions. */
a837268b 231 unsigned in_other_partition : 1;
257eb6e3
JH
232 /* Set when function is scheduled to be processed by local passes. */
233 unsigned process : 1;
12527dce 234 /* Set for aliases once they got through assemble_alias. */
b4e19405 235 unsigned alias : 1;
39e2db00 236 /* Set for aliases created as C++ same body aliases. */
b2583345 237 unsigned same_body_alias : 1;
5fefcf92
JH
238 /* How commonly executed the node is. Initialized during branch
239 probabilities pass. */
240 ENUM_BITFIELD (node_frequency) frequency : 2;
844db5d0
JH
241 /* True when function can only be called at startup (from static ctor). */
242 unsigned only_called_at_startup : 1;
243 /* True when function can only be called at startup (from static dtor). */
244 unsigned only_called_at_exit : 1;
1c4a429a
JH
245};
246
fed5ae11
DK
247typedef struct cgraph_node *cgraph_node_ptr;
248
249DEF_VEC_P(cgraph_node_ptr);
250DEF_VEC_ALLOC_P(cgraph_node_ptr,heap);
251DEF_VEC_ALLOC_P(cgraph_node_ptr,gc);
252
253/* A cgraph node set is a collection of cgraph nodes. A cgraph node
254 can appear in multiple sets. */
1cb1a99f 255struct cgraph_node_set_def
fed5ae11 256{
1cb1a99f
JH
257 struct pointer_map_t *map;
258 VEC(cgraph_node_ptr, heap) *nodes;
fed5ae11
DK
259};
260
2942c502
JH
261typedef struct varpool_node *varpool_node_ptr;
262
263DEF_VEC_P(varpool_node_ptr);
264DEF_VEC_ALLOC_P(varpool_node_ptr,heap);
265DEF_VEC_ALLOC_P(varpool_node_ptr,gc);
266
267/* A varpool node set is a collection of varpool nodes. A varpool node
268 can appear in multiple sets. */
1cb1a99f 269struct varpool_node_set_def
2942c502 270{
1cb1a99f
JH
271 struct pointer_map_t * map;
272 VEC(varpool_node_ptr, heap) *nodes;
2942c502
JH
273};
274
fed5ae11
DK
275typedef struct cgraph_node_set_def *cgraph_node_set;
276
277DEF_VEC_P(cgraph_node_set);
278DEF_VEC_ALLOC_P(cgraph_node_set,gc);
279DEF_VEC_ALLOC_P(cgraph_node_set,heap);
280
2942c502
JH
281typedef struct varpool_node_set_def *varpool_node_set;
282
283DEF_VEC_P(varpool_node_set);
284DEF_VEC_ALLOC_P(varpool_node_set,gc);
285DEF_VEC_ALLOC_P(varpool_node_set,heap);
286
fed5ae11
DK
287/* Iterator structure for cgraph node sets. */
288typedef struct
289{
290 cgraph_node_set set;
291 unsigned index;
292} cgraph_node_set_iterator;
293
2942c502
JH
294/* Iterator structure for varpool node sets. */
295typedef struct
296{
297 varpool_node_set set;
298 unsigned index;
299} varpool_node_set_iterator;
300
61a05df1
JH
301#define DEFCIFCODE(code, string) CIF_ ## code,
302/* Reasons for inlining failures. */
533c07c5 303typedef enum cgraph_inline_failed_enum {
61a05df1
JH
304#include "cif-code.def"
305 CIF_N_REASONS
306} cgraph_inline_failed_t;
307
e33c6cd6
MJ
308/* Structure containing additional information about an indirect call. */
309
310struct GTY(()) cgraph_indirect_call_info
311{
b258210c
MJ
312 /* Offset accumulated from ancestor jump functions of inlined call graph
313 edges. */
314 HOST_WIDE_INT anc_offset;
315 /* OBJ_TYPE_REF_TOKEN of a polymorphic call (if polymorphic is set). */
316 HOST_WIDE_INT otr_token;
317 /* Type of the object from OBJ_TYPE_REF_OBJECT. */
318 tree otr_type;
e33c6cd6
MJ
319 /* Index of the parameter that is called. */
320 int param_index;
5f902d76
JH
321 /* ECF flags determined from the caller. */
322 int ecf_flags;
b258210c
MJ
323
324 /* Set when the call is a virtual call with the parameter being the
325 associated object pointer rather than a simple direct call. */
326 unsigned polymorphic : 1;
e33c6cd6
MJ
327};
328
d1b38208 329struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"))) cgraph_edge {
6009ee7b
MJ
330 /* Expected number of executions: calculated in profile.c. */
331 gcov_type count;
ed2df68b
JH
332 struct cgraph_node *caller;
333 struct cgraph_node *callee;
2563c224 334 struct cgraph_edge *prev_caller;
1c4a429a 335 struct cgraph_edge *next_caller;
2563c224 336 struct cgraph_edge *prev_callee;
1c4a429a 337 struct cgraph_edge *next_callee;
726a989a 338 gimple call_stmt;
e33c6cd6
MJ
339 /* Additional information about an indirect call. Not cleared when an edge
340 becomes direct. */
341 struct cgraph_indirect_call_info *indirect_info;
18c6ada9 342 PTR GTY ((skip (""))) aux;
61a05df1
JH
343 /* When equal to CIF_OK, inline this call. Otherwise, points to the
344 explanation why function was not inlined. */
345 cgraph_inline_failed_t inline_failed;
6009ee7b
MJ
346 /* The stmt_uid of call_stmt. This is used by LTO to recover the call_stmt
347 when the function is serialized in. */
348 unsigned int lto_stmt_uid;
b8698a0f 349 /* Expected frequency of executions within the function.
45a80bb9
JH
350 When set to CGRAPH_FREQ_BASE, the edge is expected to be called once
351 per function call. The range is 0 to CGRAPH_FREQ_MAX. */
352 int frequency;
6009ee7b
MJ
353 /* Unique id of the edge. */
354 int uid;
e33c6cd6
MJ
355 /* Whether this edge was made direct by indirect inlining. */
356 unsigned int indirect_inlining_edge : 1;
357 /* Whether this edge describes an indirect call with an undetermined
358 callee. */
359 unsigned int indirect_unknown_callee : 1;
360 /* Whether this edge is still a dangling */
d7f09764
DN
361 /* True if the corresponding CALL stmt cannot be inlined. */
362 unsigned int call_stmt_cannot_inline_p : 1;
2505c5ed
JH
363 /* Can this call throw externally? */
364 unsigned int can_throw_external : 1;
1c4a429a
JH
365};
366
45a80bb9
JH
367#define CGRAPH_FREQ_BASE 1000
368#define CGRAPH_FREQ_MAX 100000
369
b2c0ad40
KH
370typedef struct cgraph_edge *cgraph_edge_p;
371
372DEF_VEC_P(cgraph_edge_p);
373DEF_VEC_ALLOC_P(cgraph_edge_p,heap);
374
8a4a83ed
JH
375/* The varpool data structure.
376 Each static variable decl has assigned varpool_node. */
e69529cd 377
369451ec 378struct GTY((chain_next ("%h.next"), chain_prev ("%h.prev"))) varpool_node {
e69529cd 379 tree decl;
cd35bcf7
JH
380 /* For aliases points to declaration DECL is alias of. */
381 tree alias_of;
8a4a83ed 382 /* Pointer to the next function in varpool_nodes. */
2942c502 383 struct varpool_node *next, *prev;
8a4a83ed 384 /* Pointer to the next function in varpool_nodes_queue. */
2942c502 385 struct varpool_node *next_needed, *prev_needed;
9f90e80a
JH
386 /* Circular list of nodes in the same comdat group if non-NULL. */
387 struct varpool_node *same_comdat_group;
369451ec 388 struct ipa_ref_list ref_list;
d4c0c9f6
RG
389 /* File stream where this node is being written to. */
390 struct lto_file_decl_data * lto_file_data;
b34fd25c 391 PTR GTY ((skip)) aux;
474eccc6
ILT
392 /* Ordering of all cgraph nodes. */
393 int order;
051f8cc6 394 enum ld_plugin_symbol_resolution resolution;
e69529cd
JH
395
396 /* Set when function must be output - it is externally visible
e2209b03 397 or its address is taken. */
b4e19405 398 unsigned needed : 1;
cd9c7bd2
JH
399 /* Needed variables might become dead by optimization. This flag
400 forces the variable to be output even if it appears dead otherwise. */
b4e19405 401 unsigned force_output : 1;
cd9c7bd2
JH
402 /* Set once the variable has been instantiated and its callee
403 lists created. */
b4e19405 404 unsigned analyzed : 1;
e69529cd 405 /* Set once it has been finalized so we consider it to be output. */
b4e19405 406 unsigned finalized : 1;
6b02a499 407 /* Set when variable is scheduled to be assembled. */
b4e19405 408 unsigned output : 1;
e7d6beb0 409 /* Set when function is visible by other units. */
b4e19405 410 unsigned externally_visible : 1;
2c71ac78
JM
411 /* Set for aliases once they got through assemble_alias. Also set for
412 extra name aliases in varpool_extra_name_alias. */
b4e19405 413 unsigned alias : 1;
cd35bcf7 414 unsigned extra_name_alias : 1;
2942c502
JH
415 /* Set when variable is used from other LTRANS partition. */
416 unsigned used_from_other_partition : 1;
92eb4438
JH
417 /* Set when variable is available in the other LTRANS partition.
418 During WPA output it is used to mark nodes that are present in
419 multiple partitions. */
2942c502 420 unsigned in_other_partition : 1;
e69529cd
JH
421};
422
474eccc6
ILT
423/* Every top level asm statement is put into a cgraph_asm_node. */
424
d1b38208 425struct GTY(()) cgraph_asm_node {
474eccc6
ILT
426 /* Next asm node. */
427 struct cgraph_asm_node *next;
428 /* String for this asm node. */
429 tree asm_str;
430 /* Ordering of all cgraph nodes. */
431 int order;
432};
433
ed2df68b
JH
434extern GTY(()) struct cgraph_node *cgraph_nodes;
435extern GTY(()) int cgraph_n_nodes;
b58b1157 436extern GTY(()) int cgraph_max_uid;
9088c1cc 437extern GTY(()) int cgraph_edge_max_uid;
dafc5b82 438extern bool cgraph_global_info_ready;
f45e0ad1
JH
439enum cgraph_state
440{
441 /* Callgraph is being constructed. It is safe to add new functions. */
442 CGRAPH_STATE_CONSTRUCTION,
443 /* Callgraph is built and IPA passes are being run. */
444 CGRAPH_STATE_IPA,
7a388ee4
JH
445 /* Callgraph is built and all functions are transformed to SSA form. */
446 CGRAPH_STATE_IPA_SSA,
f45e0ad1
JH
447 /* Functions are now ordered and being passed to RTL expanders. */
448 CGRAPH_STATE_EXPANSION,
449 /* All cgraph expansion is done. */
450 CGRAPH_STATE_FINISHED
451};
452extern enum cgraph_state cgraph_state;
e7d6beb0 453extern bool cgraph_function_flags_ready;
ed2df68b 454extern GTY(()) struct cgraph_node *cgraph_nodes_queue;
f45e0ad1 455extern GTY(()) struct cgraph_node *cgraph_new_nodes;
1c4a429a 456
474eccc6
ILT
457extern GTY(()) struct cgraph_asm_node *cgraph_asm_nodes;
458extern GTY(()) int cgraph_order;
39e2db00 459extern bool same_body_aliases_done;
e69529cd 460
1c4a429a 461/* In cgraph.c */
439f7bc3 462void dump_cgraph (FILE *);
c4e622b6 463void debug_cgraph (void);
18c6ada9 464void dump_cgraph_node (FILE *, struct cgraph_node *);
c4e622b6 465void debug_cgraph_node (struct cgraph_node *);
ea99e0be 466void cgraph_insert_node_to_hashtable (struct cgraph_node *node);
18c6ada9 467void cgraph_remove_edge (struct cgraph_edge *);
439f7bc3 468void cgraph_remove_node (struct cgraph_node *);
2fda8e14 469void cgraph_add_to_same_comdat_group (struct cgraph_node *, struct cgraph_node *);
9187e02d 470void cgraph_remove_node_and_inline_clones (struct cgraph_node *);
3a40c18a 471void cgraph_release_function_body (struct cgraph_node *);
2563c224 472void cgraph_node_remove_callees (struct cgraph_node *node);
18c6ada9
JH
473struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
474 struct cgraph_node *,
898b8927 475 gimple, gcov_type, int);
ce47fda3 476struct cgraph_edge *cgraph_create_indirect_edge (struct cgraph_node *, gimple,
898b8927 477 int, gcov_type, int);
ce47fda3 478struct cgraph_indirect_call_info *cgraph_allocate_init_indirect_info (void);
051f8cc6 479struct cgraph_node * cgraph_get_node (const_tree);
a358e188
MJ
480struct cgraph_node * cgraph_create_node (tree);
481struct cgraph_node * cgraph_get_create_node (tree);
87e7b310
JH
482struct cgraph_node * cgraph_same_body_alias (struct cgraph_node *, tree, tree);
483struct cgraph_node * cgraph_add_thunk (struct cgraph_node *, tree, tree, bool, HOST_WIDE_INT,
051f8cc6 484 HOST_WIDE_INT, tree, tree);
4537ec0c 485struct cgraph_node *cgraph_node_for_asm (tree);
726a989a
RB
486struct cgraph_edge *cgraph_edge (struct cgraph_node *, gimple);
487void cgraph_set_call_stmt (struct cgraph_edge *, gimple);
9187e02d
JH
488void cgraph_set_call_stmt_including_clones (struct cgraph_node *, gimple, gimple);
489void cgraph_create_edge_including_clones (struct cgraph_node *,
490 struct cgraph_node *,
898b8927 491 gimple, gimple, gcov_type, int,
9187e02d 492 cgraph_inline_failed_t);
4b685e14 493void cgraph_update_edges_for_call_stmt (gimple, tree, gimple);
439f7bc3
AJ
494struct cgraph_local_info *cgraph_local_info (tree);
495struct cgraph_global_info *cgraph_global_info (tree);
496struct cgraph_rtl_info *cgraph_rtl_info (tree);
497const char * cgraph_node_name (struct cgraph_node *);
c5a4444c 498struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *,
d7f09764 499 struct cgraph_node *, gimple,
898b8927
JH
500 unsigned, gcov_type, int, bool);
501struct cgraph_node * cgraph_clone_node (struct cgraph_node *, tree, gcov_type,
74605a11
JH
502 int, bool, VEC(cgraph_edge_p,heap) *,
503 bool);
39e2db00 504struct cgraph_node *cgraph_create_function_alias (tree, tree);
1c4a429a 505
18c6ada9 506void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *);
81fa35bd 507void cgraph_make_edge_direct (struct cgraph_edge *, struct cgraph_node *);
be330ed4 508bool cgraph_only_called_directly_p (struct cgraph_node *);
e69529cd 509
474eccc6
ILT
510struct cgraph_asm_node *cgraph_add_asm_node (tree);
511
1bb17c21 512bool cgraph_function_possibly_inlined_p (tree);
e42922b1 513void cgraph_unnest_node (struct cgraph_node *);
1bb17c21 514
6b02a499 515enum availability cgraph_function_body_availability (struct cgraph_node *);
f45e0ad1 516void cgraph_add_new_function (tree, bool);
61a05df1 517const char* cgraph_inline_failed_string (cgraph_inline_failed_t);
9187e02d
JH
518struct cgraph_node * cgraph_create_virtual_clone (struct cgraph_node *old_node,
519 VEC(cgraph_edge_p,heap)*,
520 VEC(ipa_replace_map_p,gc)* tree_map,
036546e5
JH
521 bitmap args_to_skip,
522 const char *clone_name);
6b02a499 523
20cdc2be 524void cgraph_set_nothrow_flag (struct cgraph_node *, bool);
530f3a1b
JH
525void cgraph_set_const_flag (struct cgraph_node *, bool, bool);
526void cgraph_set_pure_flag (struct cgraph_node *, bool, bool);
036546e5 527tree clone_function_name (tree decl, const char *);
d56026c2
JH
528bool cgraph_node_cannot_return (struct cgraph_node *);
529bool cgraph_edge_cannot_lead_to_return (struct cgraph_edge *);
508e4757
JH
530bool cgraph_will_be_removed_from_program_if_no_direct_calls
531 (struct cgraph_node *node);
532bool cgraph_can_remove_if_no_direct_calls_and_refs_p
533 (struct cgraph_node *node);
9aa3f5c5 534bool cgraph_can_remove_if_no_direct_calls_p (struct cgraph_node *node);
be330ed4
JH
535bool resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution);
536bool cgraph_used_from_object_file_p (struct cgraph_node *);
537bool varpool_used_from_object_file_p (struct varpool_node *);
538bool cgraph_for_node_thunks_and_aliases (struct cgraph_node *,
539 bool (*) (struct cgraph_node *, void *),
540 void *,
541 bool);
542bool cgraph_for_node_and_aliases (struct cgraph_node *,
543 bool (*) (struct cgraph_node *, void *),
544 void *, bool);
545VEC (cgraph_edge_p, heap) * collect_callers_of_node (struct cgraph_node *node);
546
20cdc2be 547
1c4a429a 548/* In cgraphunit.c */
0a5fa5a1 549extern FILE *cgraph_dump_file;
6b00c969 550void cgraph_finalize_function (tree, bool);
f0c882ab 551void cgraph_mark_if_needed (tree);
322dd859 552void cgraph_analyze_function (struct cgraph_node *);
439f7bc3 553void cgraph_finalize_compilation_unit (void);
d7f09764 554void cgraph_optimize (void);
8dafba3c 555void cgraph_mark_needed_node (struct cgraph_node *);
39ff5a96 556void cgraph_mark_address_taken_node (struct cgraph_node *);
8dafba3c 557void cgraph_mark_reachable_node (struct cgraph_node *);
61a05df1 558bool cgraph_inline_p (struct cgraph_edge *, cgraph_inline_failed_t *reason);
85ad2ef5 559bool cgraph_preserve_function_body_p (struct cgraph_node *);
18c6ada9
JH
560void verify_cgraph (void);
561void verify_cgraph_node (struct cgraph_node *);
35b6fdcf 562void cgraph_build_static_cdtor (char which, tree body, int priority);
6674a6ce 563void cgraph_reset_static_var_maps (void);
9b3e897d 564void init_cgraph (void);
57fb5341 565struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
c22cacf3 566 VEC(cgraph_edge_p,heap)*,
9187e02d 567 VEC(ipa_replace_map_p,gc)*,
91382288
JH
568 bitmap, bitmap, basic_block,
569 const char *);
570void tree_function_versioning (tree, tree, VEC (ipa_replace_map_p,gc)*, bool, bitmap,
571 bitmap, basic_block);
625f802c 572void record_references_in_initializer (tree, bool);
f45e0ad1 573bool cgraph_process_new_functions (void);
39e2db00 574void cgraph_process_same_body_aliases (void);
1c4a429a 575
d7f09764
DN
576bool cgraph_decide_is_function_needed (struct cgraph_node *, tree);
577
9088c1cc
MJ
578typedef void (*cgraph_edge_hook)(struct cgraph_edge *, void *);
579typedef void (*cgraph_node_hook)(struct cgraph_node *, void *);
580typedef void (*cgraph_2edge_hook)(struct cgraph_edge *, struct cgraph_edge *,
581 void *);
582typedef void (*cgraph_2node_hook)(struct cgraph_node *, struct cgraph_node *,
583 void *);
584struct cgraph_edge_hook_list;
585struct cgraph_node_hook_list;
586struct cgraph_2edge_hook_list;
587struct cgraph_2node_hook_list;
588struct cgraph_edge_hook_list *cgraph_add_edge_removal_hook (cgraph_edge_hook, void *);
589void cgraph_remove_edge_removal_hook (struct cgraph_edge_hook_list *);
590struct cgraph_node_hook_list *cgraph_add_node_removal_hook (cgraph_node_hook,
591 void *);
592void cgraph_remove_node_removal_hook (struct cgraph_node_hook_list *);
129a37fc
JH
593struct cgraph_node_hook_list *cgraph_add_function_insertion_hook (cgraph_node_hook,
594 void *);
595void cgraph_remove_function_insertion_hook (struct cgraph_node_hook_list *);
596void cgraph_call_function_insertion_hooks (struct cgraph_node *node);
9088c1cc
MJ
597struct cgraph_2edge_hook_list *cgraph_add_edge_duplication_hook (cgraph_2edge_hook, void *);
598void cgraph_remove_edge_duplication_hook (struct cgraph_2edge_hook_list *);
599struct cgraph_2node_hook_list *cgraph_add_node_duplication_hook (cgraph_2node_hook, void *);
600void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *);
9187e02d 601void cgraph_materialize_all_clones (void);
8132a837 602gimple cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *);
fa5f5e27 603bool cgraph_propagate_frequency (struct cgraph_node *node);
917948d3
ZD
604/* In cgraphbuild.c */
605unsigned int rebuild_cgraph_edges (void);
99b766fc 606void cgraph_rebuild_references (void);
d7f09764 607void reset_inline_failed (struct cgraph_node *);
9187e02d 608int compute_call_stmt_bb_frequency (tree, basic_block bb);
917948d3 609
ca31b95f
JH
610/* In ipa.c */
611bool cgraph_remove_unreachable_nodes (bool, FILE *);
fed5ae11
DK
612cgraph_node_set cgraph_node_set_new (void);
613cgraph_node_set_iterator cgraph_node_set_find (cgraph_node_set,
614 struct cgraph_node *);
615void cgraph_node_set_add (cgraph_node_set, struct cgraph_node *);
616void cgraph_node_set_remove (cgraph_node_set, struct cgraph_node *);
617void dump_cgraph_node_set (FILE *, cgraph_node_set);
618void debug_cgraph_node_set (cgraph_node_set);
1cb1a99f 619void free_cgraph_node_set (cgraph_node_set);
fed5ae11 620
2942c502
JH
621varpool_node_set varpool_node_set_new (void);
622varpool_node_set_iterator varpool_node_set_find (varpool_node_set,
623 struct varpool_node *);
624void varpool_node_set_add (varpool_node_set, struct varpool_node *);
625void varpool_node_set_remove (varpool_node_set, struct varpool_node *);
626void dump_varpool_node_set (FILE *, varpool_node_set);
627void debug_varpool_node_set (varpool_node_set);
1cb1a99f 628void free_varpool_node_set (varpool_node_set);
4a444e58 629void ipa_discover_readonly_nonaddressable_vars (void);
430c6ceb 630bool cgraph_comdat_can_be_unshared_p (struct cgraph_node *);
ca31b95f 631
fed5ae11 632/* In predict.c */
ca30a539 633bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e);
e6416b30 634bool cgraph_optimize_for_size_p (struct cgraph_node *);
ca30a539 635
8a4a83ed 636/* In varpool.c */
8a4a83ed
JH
637extern GTY(()) struct varpool_node *varpool_nodes_queue;
638extern GTY(()) struct varpool_node *varpool_nodes;
639
640struct varpool_node *varpool_node (tree);
641struct varpool_node *varpool_node_for_asm (tree asmname);
642void varpool_mark_needed_node (struct varpool_node *);
d85478c2 643void debug_varpool (void);
8a4a83ed
JH
644void dump_varpool (FILE *);
645void dump_varpool_node (FILE *, struct varpool_node *);
646
647void varpool_finalize_decl (tree);
648bool decide_is_variable_needed (struct varpool_node *, tree);
649enum availability cgraph_variable_initializer_availability (struct varpool_node *);
715a4e08 650void cgraph_make_decl_local (tree);
a550d677
MJ
651void cgraph_make_node_local (struct cgraph_node *);
652bool cgraph_node_can_be_local_p (struct cgraph_node *);
8a4a83ed 653
2942c502 654
051f8cc6 655struct varpool_node * varpool_get_node (const_tree decl);
2942c502 656void varpool_remove_node (struct varpool_node *node);
7fece979 657void varpool_finalize_named_section_flags (struct varpool_node *node);
8a4a83ed
JH
658bool varpool_assemble_pending_decls (void);
659bool varpool_assemble_decl (struct varpool_node *node);
660bool varpool_analyze_pending_decls (void);
8a4a83ed 661void varpool_remove_unreferenced_decls (void);
7386e3ee 662void varpool_empty_needed_queue (void);
051f8cc6 663struct varpool_node * varpool_extra_name_alias (tree, tree);
cd35bcf7 664struct varpool_node * varpool_create_variable_alias (tree, tree);
a8289259 665const char * varpool_node_name (struct varpool_node *node);
b34fd25c 666void varpool_reset_queue (void);
64e0f5ff 667bool const_value_known_p (tree);
cd35bcf7
JH
668bool varpool_for_node_and_aliases (struct varpool_node *,
669 bool (*) (struct varpool_node *, void *),
670 void *, bool);
8a4a83ed 671
68e56cc4
JH
672/* Walk all reachable static variables. */
673#define FOR_EACH_STATIC_VARIABLE(node) \
674 for ((node) = varpool_nodes_queue; (node); (node) = (node)->next_needed)
675
676/* Return first reachable static variable with initializer. */
677static inline struct varpool_node *
678varpool_first_static_initializer (void)
679{
680 struct varpool_node *node;
681 for (node = varpool_nodes_queue; node; node = node->next_needed)
682 {
06795261 683 gcc_checking_assert (TREE_CODE (node->decl) == VAR_DECL);
68e56cc4
JH
684 if (DECL_INITIAL (node->decl))
685 return node;
686 }
687 return NULL;
688}
689
690/* Return next reachable static variable with initializer after NODE. */
691static inline struct varpool_node *
692varpool_next_static_initializer (struct varpool_node *node)
693{
694 for (node = node->next_needed; node; node = node->next_needed)
695 {
06795261 696 gcc_checking_assert (TREE_CODE (node->decl) == VAR_DECL);
68e56cc4
JH
697 if (DECL_INITIAL (node->decl))
698 return node;
699 }
700 return NULL;
701}
702
703/* Walk all static variables with initializer set. */
704#define FOR_EACH_STATIC_INITIALIZER(node) \
705 for ((node) = varpool_first_static_initializer (); (node); \
706 (node) = varpool_next_static_initializer (node))
707
c47d0034
JH
708/* Return first function with body defined. */
709static inline struct cgraph_node *
710cgraph_first_defined_function (void)
711{
712 struct cgraph_node *node;
713 for (node = cgraph_nodes; node; node = node->next)
714 {
715 if (node->analyzed)
716 return node;
717 }
718 return NULL;
719}
720
721/* Return next reachable static variable with initializer after NODE. */
722static inline struct cgraph_node *
723cgraph_next_defined_function (struct cgraph_node *node)
724{
725 for (node = node->next; node; node = node->next)
726 {
727 if (node->analyzed)
728 return node;
729 }
730 return NULL;
731}
732
733/* Walk all functions with body defined. */
734#define FOR_EACH_DEFINED_FUNCTION(node) \
735 for ((node) = cgraph_first_defined_function (); (node); \
736 (node) = cgraph_next_defined_function (node))
737
738
739/* Return true when NODE is a function with Gimple body defined
740 in current unit. Functions can also be define externally or they
741 can be thunks with no Gimple representation.
742
743 Note that at WPA stage, the function body may not be present in memory. */
744
745static inline bool
746cgraph_function_with_gimple_body_p (struct cgraph_node *node)
747{
39e2db00 748 return node->analyzed && !node->thunk.thunk_p && !node->alias;
c47d0034
JH
749}
750
751/* Return first function with body defined. */
752static inline struct cgraph_node *
753cgraph_first_function_with_gimple_body (void)
754{
755 struct cgraph_node *node;
756 for (node = cgraph_nodes; node; node = node->next)
757 {
758 if (cgraph_function_with_gimple_body_p (node))
759 return node;
760 }
761 return NULL;
762}
763
764/* Return next reachable static variable with initializer after NODE. */
765static inline struct cgraph_node *
766cgraph_next_function_with_gimple_body (struct cgraph_node *node)
767{
768 for (node = node->next; node; node = node->next)
769 {
770 if (cgraph_function_with_gimple_body_p (node))
771 return node;
772 }
773 return NULL;
774}
775
776/* Walk all functions with body defined. */
777#define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
778 for ((node) = cgraph_first_function_with_gimple_body (); (node); \
779 (node) = cgraph_next_function_with_gimple_body (node))
780
43d861a5
RL
781/* Create a new static variable of type TYPE. */
782tree add_new_static_var (tree type);
783
fed5ae11
DK
784/* Return true if iterator CSI points to nothing. */
785static inline bool
786csi_end_p (cgraph_node_set_iterator csi)
787{
788 return csi.index >= VEC_length (cgraph_node_ptr, csi.set->nodes);
789}
790
791/* Advance iterator CSI. */
792static inline void
793csi_next (cgraph_node_set_iterator *csi)
794{
795 csi->index++;
796}
797
798/* Return the node pointed to by CSI. */
799static inline struct cgraph_node *
800csi_node (cgraph_node_set_iterator csi)
801{
802 return VEC_index (cgraph_node_ptr, csi.set->nodes, csi.index);
803}
804
805/* Return an iterator to the first node in SET. */
806static inline cgraph_node_set_iterator
807csi_start (cgraph_node_set set)
808{
809 cgraph_node_set_iterator csi;
810
811 csi.set = set;
812 csi.index = 0;
813 return csi;
814}
815
816/* Return true if SET contains NODE. */
817static inline bool
818cgraph_node_in_set_p (struct cgraph_node *node, cgraph_node_set set)
819{
820 cgraph_node_set_iterator csi;
821 csi = cgraph_node_set_find (set, node);
822 return !csi_end_p (csi);
823}
824
825/* Return number of nodes in SET. */
826static inline size_t
827cgraph_node_set_size (cgraph_node_set set)
828{
1cb1a99f 829 return VEC_length (cgraph_node_ptr, set->nodes);
fed5ae11
DK
830}
831
2942c502
JH
832/* Return true if iterator VSI points to nothing. */
833static inline bool
834vsi_end_p (varpool_node_set_iterator vsi)
835{
836 return vsi.index >= VEC_length (varpool_node_ptr, vsi.set->nodes);
837}
838
839/* Advance iterator VSI. */
840static inline void
841vsi_next (varpool_node_set_iterator *vsi)
842{
843 vsi->index++;
844}
845
846/* Return the node pointed to by VSI. */
847static inline struct varpool_node *
848vsi_node (varpool_node_set_iterator vsi)
849{
850 return VEC_index (varpool_node_ptr, vsi.set->nodes, vsi.index);
851}
852
853/* Return an iterator to the first node in SET. */
854static inline varpool_node_set_iterator
855vsi_start (varpool_node_set set)
856{
857 varpool_node_set_iterator vsi;
858
859 vsi.set = set;
860 vsi.index = 0;
861 return vsi;
862}
863
864/* Return true if SET contains NODE. */
865static inline bool
866varpool_node_in_set_p (struct varpool_node *node, varpool_node_set set)
867{
868 varpool_node_set_iterator vsi;
869 vsi = varpool_node_set_find (set, node);
870 return !vsi_end_p (vsi);
871}
872
873/* Return number of nodes in SET. */
874static inline size_t
875varpool_node_set_size (varpool_node_set set)
876{
1cb1a99f 877 return VEC_length (varpool_node_ptr, set->nodes);
2942c502
JH
878}
879
d48e9cea
OR
880/* Uniquize all constants that appear in memory.
881 Each constant in memory thus far output is recorded
882 in `const_desc_table'. */
883
884struct GTY(()) constant_descriptor_tree {
885 /* A MEM for the constant. */
886 rtx rtl;
b8698a0f 887
d48e9cea
OR
888 /* The value of the constant. */
889 tree value;
890
891 /* Hash of value. Computing the hash from value each time
892 hashfn is called can't work properly, as that means recursive
893 use of the hash table during hash table expansion. */
894 hashval_t hash;
895};
896
ace72c88
JH
897/* Return true if set is nonempty. */
898static inline bool
899cgraph_node_set_nonempty_p (cgraph_node_set set)
900{
9eec9488 901 return !VEC_empty (cgraph_node_ptr, set->nodes);
ace72c88
JH
902}
903
904/* Return true if set is nonempty. */
905static inline bool
906varpool_node_set_nonempty_p (varpool_node_set set)
907{
9eec9488 908 return !VEC_empty (varpool_node_ptr, set->nodes);
ace72c88
JH
909}
910
be330ed4 911/* Return true when function NODE is only called directly or it has alias.
b20996ff
JH
912 i.e. it is not externally visible, address was not taken and
913 it is not used in any other non-standard way. */
914
915static inline bool
be330ed4 916cgraph_only_called_directly_or_aliased_p (struct cgraph_node *node)
b20996ff 917{
530f3a1b 918 gcc_assert (!node->global.inlined_to);
508e4757
JH
919 return (!node->needed && !node->address_taken
920 && !node->reachable_from_other_partition
921 && !DECL_STATIC_CONSTRUCTOR (node->decl)
922 && !DECL_STATIC_DESTRUCTOR (node->decl)
923 && !node->local.externally_visible);
b20996ff
JH
924}
925
df7705b1
JH
926/* Return true when function NODE can be removed from callgraph
927 if all direct calls are eliminated. */
928
929static inline bool
930varpool_can_remove_if_no_refs (struct varpool_node *node)
931{
932 return (!node->force_output && !node->used_from_other_partition
933 && (flag_toplevel_reorder || DECL_COMDAT (node->decl)
934 || DECL_ARTIFICIAL (node->decl))
935 && (DECL_COMDAT (node->decl) || !node->externally_visible));
936}
937
4a444e58
JH
938/* Return true when all references to VNODE must be visible in ipa_ref_list.
939 i.e. if the variable is not externally visible or not used in some magic
940 way (asm statement or such).
61502ca8 941 The magic uses are all summarized in force_output flag. */
4a444e58
JH
942
943static inline bool
944varpool_all_refs_explicit_p (struct varpool_node *vnode)
945{
e8fdf1cd
RG
946 return (vnode->analyzed
947 && !vnode->externally_visible
4a444e58
JH
948 && !vnode->used_from_other_partition
949 && !vnode->force_output);
950}
951
d48e9cea
OR
952/* Constant pool accessor function. */
953htab_t constant_pool_htab (void);
fed5ae11 954
be330ed4
JH
955/* FIXME: inappropriate dependency of cgraph on IPA. */
956#include "ipa-ref-inline.h"
957
39e2db00
JH
958/* Return node that alias N is aliasing. */
959
960static inline struct cgraph_node *
961cgraph_alias_aliased_node (struct cgraph_node *n)
962{
963 struct ipa_ref *ref;
964
965 ipa_ref_list_reference_iterate (&n->ref_list, 0, ref);
966 gcc_checking_assert (ref->use == IPA_REF_ALIAS);
967 if (ref->refered_type == IPA_REF_CGRAPH)
968 return ipa_ref_node (ref);
969 return NULL;
970}
971
cd35bcf7
JH
972/* Return node that alias N is aliasing. */
973
974static inline struct varpool_node *
975varpool_alias_aliased_node (struct varpool_node *n)
976{
977 struct ipa_ref *ref;
978
979 ipa_ref_list_reference_iterate (&n->ref_list, 0, ref);
980 gcc_checking_assert (ref->use == IPA_REF_ALIAS);
9c7c9f10 981 if (ref->refered_type == IPA_REF_VARPOOL)
cd35bcf7
JH
982 return ipa_ref_varpool_node (ref);
983 return NULL;
984}
985
be330ed4
JH
986/* Given NODE, walk the alias chain to return the function NODE is alias of.
987 Walk through thunk, too.
988 When AVAILABILITY is non-NULL, get minimal availablity in the chain. */
989
990static inline struct cgraph_node *
991cgraph_function_node (struct cgraph_node *node, enum availability *availability)
992{
993 if (availability)
994 *availability = cgraph_function_body_availability (node);
995 while (node)
996 {
39e2db00
JH
997 if (node->alias && node->analyzed)
998 node = cgraph_alias_aliased_node (node);
999 else if (node->thunk.thunk_p)
be330ed4
JH
1000 node = node->callees->callee;
1001 else
1002 return node;
39e2db00 1003 if (node && availability)
be330ed4
JH
1004 {
1005 enum availability a;
1006 a = cgraph_function_body_availability (node);
1007 if (a < *availability)
1008 *availability = a;
1009 }
1010 }
9c7c9f10 1011 if (availability)
39e2db00 1012 *availability = AVAIL_NOT_AVAILABLE;
be330ed4
JH
1013 return NULL;
1014}
1015
1016/* Given NODE, walk the alias chain to return the function NODE is alias of.
1017 Do not walk through thunks.
1018 When AVAILABILITY is non-NULL, get minimal availablity in the chain. */
1019
1020static inline struct cgraph_node *
1021cgraph_function_or_thunk_node (struct cgraph_node *node, enum availability *availability)
1022{
1023 if (availability)
1024 *availability = cgraph_function_body_availability (node);
39e2db00
JH
1025 while (node)
1026 {
1027 if (node->alias && node->analyzed)
1028 node = cgraph_alias_aliased_node (node);
1029 else
1030 return node;
1031 if (node && availability)
1032 {
1033 enum availability a;
1034 a = cgraph_function_body_availability (node);
1035 if (a < *availability)
1036 *availability = a;
1037 }
1038 }
9c7c9f10 1039 if (availability)
39e2db00 1040 *availability = AVAIL_NOT_AVAILABLE;
be330ed4
JH
1041 return NULL;
1042}
1043
cd35bcf7
JH
1044/* Given NODE, walk the alias chain to return the function NODE is alias of.
1045 Do not walk through thunks.
1046 When AVAILABILITY is non-NULL, get minimal availablity in the chain. */
1047
1048static inline struct varpool_node *
1049varpool_variable_node (struct varpool_node *node, enum availability *availability)
1050{
1051 if (availability)
1052 *availability = cgraph_variable_initializer_availability (node);
1053 while (node)
1054 {
1055 if (node->alias && node->analyzed)
1056 node = varpool_alias_aliased_node (node);
1057 else
1058 return node;
1059 if (node && availability)
1060 {
1061 enum availability a;
1062 a = cgraph_variable_initializer_availability (node);
1063 if (a < *availability)
1064 *availability = a;
1065 }
1066 }
9c7c9f10 1067 if (availability)
cd35bcf7
JH
1068 *availability = AVAIL_NOT_AVAILABLE;
1069 return NULL;
1070}
1071
d7d1d041
RG
1072/* Return true when the edge E represents a direct recursion. */
1073static inline bool
1074cgraph_edge_recursive_p (struct cgraph_edge *e)
1075{
be330ed4 1076 struct cgraph_node *callee = cgraph_function_or_thunk_node (e->callee, NULL);
d7d1d041 1077 if (e->caller->global.inlined_to)
be330ed4 1078 return e->caller->global.inlined_to->decl == callee->decl;
d7d1d041 1079 else
be330ed4 1080 return e->caller->decl == callee->decl;
d7d1d041 1081}
1c4a429a 1082#endif /* GCC_CGRAPH_H */