* config/sh/sh.md (prologue, epilogue): Use braced strings.
[official-gcc.git] / gcc / cgraph.h
blobb8001a62bc78e0c2aca9c0b53ebef713ad7cb0cb
1 /* Callgraph handling code.
2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
3 2012 Free Software Foundation, Inc.
4 Contributed by Jan Hubicka
6 This file is part of GCC.
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.
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.
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/>. */
22 #ifndef GCC_CGRAPH_H
23 #define GCC_CGRAPH_H
25 #include "plugin-api.h"
26 #include "vec.h"
27 #include "tree.h"
28 #include "basic-block.h"
29 #include "function.h"
30 #include "ipa-ref.h"
32 /* Symbol table consists of functions and variables.
33 TODO: add labels, constant pool and aliases. */
34 enum symtab_type
36 SYMTAB_SYMBOL,
37 SYMTAB_FUNCTION,
38 SYMTAB_VARIABLE
41 /* Base of all entries in the symbol table.
42 The symtab_node is inherited by cgraph and varpol nodes. */
43 struct GTY(()) symtab_node_base
45 /* Type of the symbol. */
46 enum symtab_type type;
47 tree decl;
48 struct ipa_ref_list ref_list;
49 /* Circular list of nodes in the same comdat group if non-NULL. */
50 symtab_node same_comdat_group;
51 /* Ordering of all symtab entries. */
52 int order;
53 enum ld_plugin_symbol_resolution resolution;
54 /* File stream where this node is being written to. */
55 struct lto_file_decl_data * lto_file_data;
57 /* Linked list of symbol table entries starting with symtab_nodes. */
58 symtab_node next;
59 symtab_node previous;
60 /* Linked list of symbols with the same asm name. There may be multiple
61 entries for single symbol name in the case of LTO resolutions,
62 existence of inline clones, or duplicated declaration. The last case
63 is a long standing bug frontends and builtin handling. */
64 symtab_node next_sharing_asm_name;
65 symtab_node previous_sharing_asm_name;
67 PTR GTY ((skip)) aux;
69 /* Set when function has address taken.
70 In current implementation it imply needed flag. */
71 unsigned address_taken : 1;
72 /* Set when variable is used from other LTRANS partition. */
73 unsigned used_from_other_partition : 1;
74 /* Set when function is available in the other LTRANS partition.
75 During WPA output it is used to mark nodes that are present in
76 multiple partitions. */
77 unsigned in_other_partition : 1;
78 /* Set when function is visible by other units. */
79 unsigned externally_visible : 1;
80 /* Needed variables might become dead by optimization. This flag
81 forces the variable to be output even if it appears dead otherwise. */
82 unsigned force_output : 1;
85 enum availability
87 /* Not yet set by cgraph_function_body_availability. */
88 AVAIL_UNSET,
89 /* Function body/variable initializer is unknown. */
90 AVAIL_NOT_AVAILABLE,
91 /* Function body/variable initializer is known but might be replaced
92 by a different one from other compilation unit and thus needs to
93 be dealt with a care. Like AVAIL_NOT_AVAILABLE it can have
94 arbitrary side effects on escaping variables and functions, while
95 like AVAILABLE it might access static variables. */
96 AVAIL_OVERWRITABLE,
97 /* Function body/variable initializer is known and will be used in final
98 program. */
99 AVAIL_AVAILABLE,
100 /* Function body/variable initializer is known and all it's uses are explicitly
101 visible within current unit (ie it's address is never taken and it is not
102 exported to other units).
103 Currently used only for functions. */
104 AVAIL_LOCAL
107 /* This is the information that is put into the cgraph local structure
108 to recover a function. */
109 struct lto_file_decl_data;
111 extern const char * const cgraph_availability_names[];
112 extern const char * const ld_plugin_symbol_resolution_names[];
114 /* Information about thunk, used only for same body aliases. */
116 struct GTY(()) cgraph_thunk_info {
117 /* Information about the thunk. */
118 HOST_WIDE_INT fixed_offset;
119 HOST_WIDE_INT virtual_value;
120 tree alias;
121 bool this_adjusting;
122 bool virtual_offset_p;
123 /* Set to true when alias node is thunk. */
124 bool thunk_p;
127 /* Information about the function collected locally.
128 Available after function is analyzed. */
130 struct GTY(()) cgraph_local_info {
131 /* Set when function function is visible in current compilation unit only
132 and its address is never taken. */
133 unsigned local : 1;
135 /* Set once it has been finalized so we consider it to be output. */
136 unsigned finalized : 1;
138 /* False when there is something makes versioning impossible. */
139 unsigned versionable : 1;
141 /* False when function calling convention and signature can not be changed.
142 This is the case when __builtin_apply_args is used. */
143 unsigned can_change_signature : 1;
145 /* True when the function has been originally extern inline, but it is
146 redefined now. */
147 unsigned redefined_extern_inline : 1;
149 /* True if the function may enter serial irrevocable mode. */
150 unsigned tm_may_enter_irr : 1;
153 /* Information about the function that needs to be computed globally
154 once compilation is finished. Available only with -funit-at-a-time. */
156 struct GTY(()) cgraph_global_info {
157 /* For inline clones this points to the function they will be
158 inlined into. */
159 struct cgraph_node *inlined_to;
162 /* Information about the function that is propagated by the RTL backend.
163 Available only for functions that has been already assembled. */
165 struct GTY(()) cgraph_rtl_info {
166 unsigned int preferred_incoming_stack_boundary;
169 /* Represent which DECL tree (or reference to such tree)
170 will be replaced by another tree while versioning. */
171 struct GTY(()) ipa_replace_map
173 /* The tree that will be replaced. */
174 tree old_tree;
175 /* The new (replacing) tree. */
176 tree new_tree;
177 /* Parameter number to replace, when old_tree is NULL. */
178 int parm_num;
179 /* True when a substitution should be done, false otherwise. */
180 bool replace_p;
181 /* True when we replace a reference to old_tree. */
182 bool ref_p;
184 typedef struct ipa_replace_map *ipa_replace_map_p;
185 DEF_VEC_P(ipa_replace_map_p);
186 DEF_VEC_ALLOC_P(ipa_replace_map_p,gc);
188 struct GTY(()) cgraph_clone_info
190 VEC(ipa_replace_map_p,gc)* tree_map;
191 bitmap args_to_skip;
192 bitmap combined_args_to_skip;
196 /* The cgraph data structure.
197 Each function decl has assigned cgraph_node listing callees and callers. */
199 struct GTY(()) cgraph_node {
200 struct symtab_node_base symbol;
201 struct cgraph_edge *callees;
202 struct cgraph_edge *callers;
203 /* List of edges representing indirect calls with a yet undetermined
204 callee. */
205 struct cgraph_edge *indirect_calls;
206 /* For nested functions points to function the node is nested in. */
207 struct cgraph_node *
208 GTY ((nested_ptr (union symtab_node_def, "(struct cgraph_node *)(%h)", "(symtab_node)%h")))
209 origin;
210 /* Points to first nested function, if any. */
211 struct cgraph_node *
212 GTY ((nested_ptr (union symtab_node_def, "(struct cgraph_node *)(%h)", "(symtab_node)%h")))
213 nested;
214 /* Pointer to the next function with same origin, if any. */
215 struct cgraph_node *
216 GTY ((nested_ptr (union symtab_node_def, "(struct cgraph_node *)(%h)", "(symtab_node)%h")))
217 next_nested;
218 /* Pointer to the next clone. */
219 struct cgraph_node *next_sibling_clone;
220 struct cgraph_node *prev_sibling_clone;
221 struct cgraph_node *clones;
222 struct cgraph_node *clone_of;
223 /* For functions with many calls sites it holds map from call expression
224 to the edge to speed up cgraph_edge function. */
225 htab_t GTY((param_is (struct cgraph_edge))) call_site_hash;
226 /* Declaration node used to be clone of. */
227 tree former_clone_of;
229 /* Interprocedural passes scheduled to have their transform functions
230 applied next time we execute local pass on them. We maintain it
231 per-function in order to allow IPA passes to introduce new functions. */
232 VEC(ipa_opt_pass,heap) * GTY((skip)) ipa_transforms_to_apply;
234 struct cgraph_local_info local;
235 struct cgraph_global_info global;
236 struct cgraph_rtl_info rtl;
237 struct cgraph_clone_info clone;
238 struct cgraph_thunk_info thunk;
240 /* Expected number of executions: calculated in profile.c. */
241 gcov_type count;
242 /* How to scale counts at materialization time; used to merge
243 LTO units with different number of profile runs. */
244 int count_materialization_scale;
245 /* Unique id of the node. */
246 int uid;
248 /* Set when decl is an abstract function pointed to by the
249 ABSTRACT_DECL_ORIGIN of a reachable function. */
250 unsigned abstract_and_needed : 1;
251 /* Set once the function is lowered (i.e. its CFG is built). */
252 unsigned lowered : 1;
253 /* Set once the function has been instantiated and its callee
254 lists created. */
255 unsigned analyzed : 1;
256 /* Set when function is scheduled to be processed by local passes. */
257 unsigned process : 1;
258 /* Set for aliases once they got through assemble_alias. */
259 unsigned alias : 1;
260 /* Set for aliases created as C++ same body aliases. */
261 unsigned same_body_alias : 1;
262 /* How commonly executed the node is. Initialized during branch
263 probabilities pass. */
264 ENUM_BITFIELD (node_frequency) frequency : 2;
265 /* True when function can only be called at startup (from static ctor). */
266 unsigned only_called_at_startup : 1;
267 /* True when function can only be called at startup (from static dtor). */
268 unsigned only_called_at_exit : 1;
269 /* True when function is the transactional clone of a function which
270 is called only from inside transactions. */
271 /* ?? We should be able to remove this. We have enough bits in
272 cgraph to calculate it. */
273 unsigned tm_clone : 1;
276 DEF_VEC_P(symtab_node);
277 DEF_VEC_ALLOC_P(symtab_node,heap);
278 DEF_VEC_ALLOC_P(symtab_node,gc);
280 typedef struct cgraph_node *cgraph_node_ptr;
282 DEF_VEC_P(cgraph_node_ptr);
283 DEF_VEC_ALLOC_P(cgraph_node_ptr,heap);
284 DEF_VEC_ALLOC_P(cgraph_node_ptr,gc);
286 /* A cgraph node set is a collection of cgraph nodes. A cgraph node
287 can appear in multiple sets. */
288 struct cgraph_node_set_def
290 struct pointer_map_t *map;
291 VEC(cgraph_node_ptr, heap) *nodes;
294 typedef struct varpool_node *varpool_node_ptr;
296 DEF_VEC_P(varpool_node_ptr);
297 DEF_VEC_ALLOC_P(varpool_node_ptr,heap);
298 DEF_VEC_ALLOC_P(varpool_node_ptr,gc);
300 /* A varpool node set is a collection of varpool nodes. A varpool node
301 can appear in multiple sets. */
302 struct varpool_node_set_def
304 struct pointer_map_t * map;
305 VEC(varpool_node_ptr, heap) *nodes;
308 typedef struct cgraph_node_set_def *cgraph_node_set;
310 DEF_VEC_P(cgraph_node_set);
311 DEF_VEC_ALLOC_P(cgraph_node_set,gc);
312 DEF_VEC_ALLOC_P(cgraph_node_set,heap);
314 typedef struct varpool_node_set_def *varpool_node_set;
316 DEF_VEC_P(varpool_node_set);
317 DEF_VEC_ALLOC_P(varpool_node_set,gc);
318 DEF_VEC_ALLOC_P(varpool_node_set,heap);
320 /* Iterator structure for cgraph node sets. */
321 typedef struct
323 cgraph_node_set set;
324 unsigned index;
325 } cgraph_node_set_iterator;
327 /* Iterator structure for varpool node sets. */
328 typedef struct
330 varpool_node_set set;
331 unsigned index;
332 } varpool_node_set_iterator;
334 #define DEFCIFCODE(code, string) CIF_ ## code,
335 /* Reasons for inlining failures. */
336 typedef enum cgraph_inline_failed_enum {
337 #include "cif-code.def"
338 CIF_N_REASONS
339 } cgraph_inline_failed_t;
341 /* Structure containing additional information about an indirect call. */
343 struct GTY(()) cgraph_indirect_call_info
345 /* When polymorphic is set, this field contains offset where the object which
346 was actually used in the polymorphic resides within a larger structure.
347 If agg_contents is set, the field contains the offset within the aggregate
348 from which the address to call was loaded. */
349 HOST_WIDE_INT offset;
350 /* OBJ_TYPE_REF_TOKEN of a polymorphic call (if polymorphic is set). */
351 HOST_WIDE_INT otr_token;
352 /* Type of the object from OBJ_TYPE_REF_OBJECT. */
353 tree otr_type;
354 /* Index of the parameter that is called. */
355 int param_index;
356 /* ECF flags determined from the caller. */
357 int ecf_flags;
359 /* Set when the call is a virtual call with the parameter being the
360 associated object pointer rather than a simple direct call. */
361 unsigned polymorphic : 1;
362 /* Set when the call is a call of a pointer loaded from contents of an
363 aggregate at offset. */
364 unsigned agg_contents : 1;
365 /* When the previous bit is set, this one determines whether the destination
366 is loaded from a parameter passed by reference. */
367 unsigned by_ref : 1;
370 struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"))) cgraph_edge {
371 /* Expected number of executions: calculated in profile.c. */
372 gcov_type count;
373 struct cgraph_node *caller;
374 struct cgraph_node *callee;
375 struct cgraph_edge *prev_caller;
376 struct cgraph_edge *next_caller;
377 struct cgraph_edge *prev_callee;
378 struct cgraph_edge *next_callee;
379 gimple call_stmt;
380 /* Additional information about an indirect call. Not cleared when an edge
381 becomes direct. */
382 struct cgraph_indirect_call_info *indirect_info;
383 PTR GTY ((skip (""))) aux;
384 /* When equal to CIF_OK, inline this call. Otherwise, points to the
385 explanation why function was not inlined. */
386 cgraph_inline_failed_t inline_failed;
387 /* The stmt_uid of call_stmt. This is used by LTO to recover the call_stmt
388 when the function is serialized in. */
389 unsigned int lto_stmt_uid;
390 /* Expected frequency of executions within the function.
391 When set to CGRAPH_FREQ_BASE, the edge is expected to be called once
392 per function call. The range is 0 to CGRAPH_FREQ_MAX. */
393 int frequency;
394 /* Unique id of the edge. */
395 int uid;
396 /* Whether this edge was made direct by indirect inlining. */
397 unsigned int indirect_inlining_edge : 1;
398 /* Whether this edge describes an indirect call with an undetermined
399 callee. */
400 unsigned int indirect_unknown_callee : 1;
401 /* Whether this edge is still a dangling */
402 /* True if the corresponding CALL stmt cannot be inlined. */
403 unsigned int call_stmt_cannot_inline_p : 1;
404 /* Can this call throw externally? */
405 unsigned int can_throw_external : 1;
408 #define CGRAPH_FREQ_BASE 1000
409 #define CGRAPH_FREQ_MAX 100000
411 typedef struct cgraph_edge *cgraph_edge_p;
413 DEF_VEC_P(cgraph_edge_p);
414 DEF_VEC_ALLOC_P(cgraph_edge_p,heap);
416 /* The varpool data structure.
417 Each static variable decl has assigned varpool_node. */
419 struct GTY(()) varpool_node {
420 struct symtab_node_base symbol;
421 /* For aliases points to declaration DECL is alias of. */
422 tree alias_of;
424 /* Set once the variable has been instantiated and its callee
425 lists created. */
426 unsigned analyzed : 1;
427 /* Set once it has been finalized so we consider it to be output. */
428 unsigned finalized : 1;
429 /* Set when variable is scheduled to be assembled. */
430 unsigned output : 1;
431 /* Set for aliases once they got through assemble_alias. Also set for
432 extra name aliases in varpool_extra_name_alias. */
433 unsigned alias : 1;
434 unsigned extra_name_alias : 1;
437 /* Every top level asm statement is put into a asm_node. */
439 struct GTY(()) asm_node {
440 /* Next asm node. */
441 struct asm_node *next;
442 /* String for this asm node. */
443 tree asm_str;
444 /* Ordering of all cgraph nodes. */
445 int order;
448 /* Symbol table entry. */
449 union GTY((desc ("%h.symbol.type"), chain_next ("%h.symbol.next"),
450 chain_prev ("%h.symbol.previous"))) symtab_node_def {
451 struct symtab_node_base GTY ((tag ("SYMTAB_SYMBOL"))) symbol;
452 /* Use cgraph (symbol) accessor to get cgraph_node. */
453 struct cgraph_node GTY ((tag ("SYMTAB_FUNCTION"))) x_function;
454 /* Use varpool (symbol) accessor to get varpool_node. */
455 struct varpool_node GTY ((tag ("SYMTAB_VARIABLE"))) x_variable;
458 extern GTY(()) symtab_node symtab_nodes;
459 extern GTY(()) int cgraph_n_nodes;
460 extern GTY(()) int cgraph_max_uid;
461 extern GTY(()) int cgraph_edge_max_uid;
462 extern bool cgraph_global_info_ready;
463 enum cgraph_state
465 /* Frontend is parsing and finalizing functions. */
466 CGRAPH_STATE_PARSING,
467 /* Callgraph is being constructed. It is safe to add new functions. */
468 CGRAPH_STATE_CONSTRUCTION,
469 /* Callgraph is built and IPA passes are being run. */
470 CGRAPH_STATE_IPA,
471 /* Callgraph is built and all functions are transformed to SSA form. */
472 CGRAPH_STATE_IPA_SSA,
473 /* Functions are now ordered and being passed to RTL expanders. */
474 CGRAPH_STATE_EXPANSION,
475 /* All cgraph expansion is done. */
476 CGRAPH_STATE_FINISHED
478 extern enum cgraph_state cgraph_state;
479 extern bool cgraph_function_flags_ready;
480 extern cgraph_node_set cgraph_new_nodes;
482 extern GTY(()) struct asm_node *asm_nodes;
483 extern GTY(()) int symtab_order;
484 extern bool same_body_aliases_done;
486 /* In symtab.c */
487 void symtab_register_node (symtab_node);
488 void symtab_unregister_node (symtab_node);
489 void symtab_remove_node (symtab_node);
490 symtab_node symtab_get_node (const_tree);
491 symtab_node symtab_node_for_asm (const_tree asmname);
492 const char * symtab_node_asm_name (symtab_node);
493 const char * symtab_node_name (symtab_node);
494 void symtab_insert_node_to_hashtable (symtab_node);
495 void symtab_add_to_same_comdat_group (symtab_node, symtab_node);
496 void symtab_dissolve_same_comdat_group_list (symtab_node node);
497 void dump_symtab (FILE *);
498 void debug_symtab (void);
499 void dump_symtab_node (FILE *, symtab_node);
500 void debug_symtab_node (symtab_node);
501 void dump_symtab_base (FILE *, symtab_node);
502 void verify_symtab (void);
503 void verify_symtab_node (symtab_node);
504 bool verify_symtab_base (symtab_node);
505 bool symtab_used_from_object_file_p (symtab_node);
506 void symtab_make_decl_local (tree);
508 /* In cgraph.c */
509 void dump_cgraph (FILE *);
510 void debug_cgraph (void);
511 void dump_cgraph_node (FILE *, struct cgraph_node *);
512 void debug_cgraph_node (struct cgraph_node *);
513 void cgraph_remove_edge (struct cgraph_edge *);
514 void cgraph_remove_node (struct cgraph_node *);
515 void cgraph_release_function_body (struct cgraph_node *);
516 void cgraph_node_remove_callees (struct cgraph_node *node);
517 struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
518 struct cgraph_node *,
519 gimple, gcov_type, int);
520 struct cgraph_edge *cgraph_create_indirect_edge (struct cgraph_node *, gimple,
521 int, gcov_type, int);
522 struct cgraph_indirect_call_info *cgraph_allocate_init_indirect_info (void);
523 struct cgraph_node * cgraph_create_node (tree);
524 struct cgraph_node * cgraph_create_empty_node (void);
525 struct cgraph_node * cgraph_get_create_node (tree);
526 struct cgraph_node * cgraph_same_body_alias (struct cgraph_node *, tree, tree);
527 struct cgraph_node * cgraph_add_thunk (struct cgraph_node *, tree, tree, bool, HOST_WIDE_INT,
528 HOST_WIDE_INT, tree, tree);
529 struct cgraph_node *cgraph_node_for_asm (tree);
530 struct cgraph_edge *cgraph_edge (struct cgraph_node *, gimple);
531 void cgraph_set_call_stmt (struct cgraph_edge *, gimple);
532 void cgraph_update_edges_for_call_stmt (gimple, tree, gimple);
533 struct cgraph_local_info *cgraph_local_info (tree);
534 struct cgraph_global_info *cgraph_global_info (tree);
535 struct cgraph_rtl_info *cgraph_rtl_info (tree);
536 struct cgraph_node *cgraph_create_function_alias (tree, tree);
537 void cgraph_call_node_duplication_hooks (struct cgraph_node *,
538 struct cgraph_node *);
539 void cgraph_call_edge_duplication_hooks (struct cgraph_edge *,
540 struct cgraph_edge *);
542 void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *);
543 void cgraph_make_edge_direct (struct cgraph_edge *, struct cgraph_node *);
544 bool cgraph_only_called_directly_p (struct cgraph_node *);
546 bool cgraph_function_possibly_inlined_p (tree);
547 void cgraph_unnest_node (struct cgraph_node *);
549 enum availability cgraph_function_body_availability (struct cgraph_node *);
550 void cgraph_add_new_function (tree, bool);
551 const char* cgraph_inline_failed_string (cgraph_inline_failed_t);
553 void cgraph_set_nothrow_flag (struct cgraph_node *, bool);
554 void cgraph_set_const_flag (struct cgraph_node *, bool, bool);
555 void cgraph_set_pure_flag (struct cgraph_node *, bool, bool);
556 bool cgraph_node_cannot_return (struct cgraph_node *);
557 bool cgraph_edge_cannot_lead_to_return (struct cgraph_edge *);
558 bool cgraph_will_be_removed_from_program_if_no_direct_calls
559 (struct cgraph_node *node);
560 bool cgraph_can_remove_if_no_direct_calls_and_refs_p
561 (struct cgraph_node *node);
562 bool cgraph_can_remove_if_no_direct_calls_p (struct cgraph_node *node);
563 bool resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution);
564 bool cgraph_for_node_thunks_and_aliases (struct cgraph_node *,
565 bool (*) (struct cgraph_node *, void *),
566 void *,
567 bool);
568 bool cgraph_for_node_and_aliases (struct cgraph_node *,
569 bool (*) (struct cgraph_node *, void *),
570 void *, bool);
571 VEC (cgraph_edge_p, heap) * collect_callers_of_node (struct cgraph_node *node);
572 void verify_cgraph (void);
573 void verify_cgraph_node (struct cgraph_node *);
574 void cgraph_mark_address_taken_node (struct cgraph_node *);
576 typedef void (*cgraph_edge_hook)(struct cgraph_edge *, void *);
577 typedef void (*cgraph_node_hook)(struct cgraph_node *, void *);
578 typedef void (*cgraph_2edge_hook)(struct cgraph_edge *, struct cgraph_edge *,
579 void *);
580 typedef void (*cgraph_2node_hook)(struct cgraph_node *, struct cgraph_node *,
581 void *);
582 struct cgraph_edge_hook_list;
583 struct cgraph_node_hook_list;
584 struct cgraph_2edge_hook_list;
585 struct cgraph_2node_hook_list;
586 struct cgraph_edge_hook_list *cgraph_add_edge_removal_hook (cgraph_edge_hook, void *);
587 void cgraph_remove_edge_removal_hook (struct cgraph_edge_hook_list *);
588 struct cgraph_node_hook_list *cgraph_add_node_removal_hook (cgraph_node_hook,
589 void *);
590 void cgraph_remove_node_removal_hook (struct cgraph_node_hook_list *);
591 struct cgraph_node_hook_list *cgraph_add_function_insertion_hook (cgraph_node_hook,
592 void *);
593 void cgraph_remove_function_insertion_hook (struct cgraph_node_hook_list *);
594 void cgraph_call_function_insertion_hooks (struct cgraph_node *node);
595 struct cgraph_2edge_hook_list *cgraph_add_edge_duplication_hook (cgraph_2edge_hook, void *);
596 void cgraph_remove_edge_duplication_hook (struct cgraph_2edge_hook_list *);
597 struct cgraph_2node_hook_list *cgraph_add_node_duplication_hook (cgraph_2node_hook, void *);
598 void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *);
599 gimple cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *);
600 bool cgraph_propagate_frequency (struct cgraph_node *node);
602 /* In cgraphunit.c */
603 struct asm_node *add_asm_node (tree);
604 extern FILE *cgraph_dump_file;
605 void cgraph_finalize_function (tree, bool);
606 void finalize_compilation_unit (void);
607 void compile (void);
608 void init_cgraph (void);
609 bool cgraph_process_new_functions (void);
610 void cgraph_process_same_body_aliases (void);
611 void fixup_same_cpp_alias_visibility (symtab_node node, symtab_node target, tree alias);
613 /* In cgraphclones.c */
615 struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *,
616 struct cgraph_node *, gimple,
617 unsigned, gcov_type, int, bool);
618 struct cgraph_node * cgraph_clone_node (struct cgraph_node *, tree, gcov_type,
619 int, bool, VEC(cgraph_edge_p,heap) *,
620 bool);
621 tree clone_function_name (tree decl, const char *);
622 struct cgraph_node * cgraph_create_virtual_clone (struct cgraph_node *old_node,
623 VEC(cgraph_edge_p,heap)*,
624 VEC(ipa_replace_map_p,gc)* tree_map,
625 bitmap args_to_skip,
626 const char *clone_name);
627 struct cgraph_node *cgraph_find_replacement_node (struct cgraph_node *);
628 bool cgraph_remove_node_and_inline_clones (struct cgraph_node *, struct cgraph_node *);
629 void cgraph_set_call_stmt_including_clones (struct cgraph_node *, gimple, gimple);
630 void cgraph_create_edge_including_clones (struct cgraph_node *,
631 struct cgraph_node *,
632 gimple, gimple, gcov_type, int,
633 cgraph_inline_failed_t);
634 void cgraph_materialize_all_clones (void);
635 struct cgraph_node * cgraph_copy_node_for_versioning (struct cgraph_node *,
636 tree, VEC(cgraph_edge_p,heap)*, bitmap);
637 struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
638 VEC(cgraph_edge_p,heap)*,
639 VEC(ipa_replace_map_p,gc)*,
640 bitmap, bool, bitmap,
641 basic_block, const char *);
642 void tree_function_versioning (tree, tree, VEC (ipa_replace_map_p,gc)*,
643 bool, bitmap, bool, bitmap, basic_block);
645 /* In cgraphbuild.c */
646 unsigned int rebuild_cgraph_edges (void);
647 void cgraph_rebuild_references (void);
648 int compute_call_stmt_bb_frequency (tree, basic_block bb);
649 void record_references_in_initializer (tree, bool);
651 /* In ipa.c */
652 bool symtab_remove_unreachable_nodes (bool, FILE *);
653 cgraph_node_set cgraph_node_set_new (void);
654 cgraph_node_set_iterator cgraph_node_set_find (cgraph_node_set,
655 struct cgraph_node *);
656 void cgraph_node_set_add (cgraph_node_set, struct cgraph_node *);
657 void cgraph_node_set_remove (cgraph_node_set, struct cgraph_node *);
658 void dump_cgraph_node_set (FILE *, cgraph_node_set);
659 void debug_cgraph_node_set (cgraph_node_set);
660 void free_cgraph_node_set (cgraph_node_set);
661 void cgraph_build_static_cdtor (char which, tree body, int priority);
663 varpool_node_set varpool_node_set_new (void);
664 varpool_node_set_iterator varpool_node_set_find (varpool_node_set,
665 struct varpool_node *);
666 void varpool_node_set_add (varpool_node_set, struct varpool_node *);
667 void varpool_node_set_remove (varpool_node_set, struct varpool_node *);
668 void dump_varpool_node_set (FILE *, varpool_node_set);
669 void debug_varpool_node_set (varpool_node_set);
670 void free_varpool_node_set (varpool_node_set);
671 void ipa_discover_readonly_nonaddressable_vars (void);
672 bool cgraph_comdat_can_be_unshared_p (struct cgraph_node *);
673 bool varpool_externally_visible_p (struct varpool_node *, bool);
675 /* In predict.c */
676 bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e);
677 bool cgraph_optimize_for_size_p (struct cgraph_node *);
679 /* In varpool.c */
680 struct varpool_node *varpool_node (tree);
681 struct varpool_node *varpool_node_for_asm (tree asmname);
682 void varpool_mark_needed_node (struct varpool_node *);
683 void debug_varpool (void);
684 void dump_varpool (FILE *);
685 void dump_varpool_node (FILE *, struct varpool_node *);
687 void varpool_finalize_decl (tree);
688 bool decide_is_variable_needed (struct varpool_node *, tree);
689 enum availability cgraph_variable_initializer_availability (struct varpool_node *);
690 void cgraph_make_node_local (struct cgraph_node *);
691 bool cgraph_node_can_be_local_p (struct cgraph_node *);
694 void varpool_remove_node (struct varpool_node *node);
695 void varpool_finalize_named_section_flags (struct varpool_node *node);
696 bool varpool_output_variables (void);
697 bool varpool_assemble_decl (struct varpool_node *node);
698 void varpool_analyze_node (struct varpool_node *);
699 struct varpool_node * varpool_extra_name_alias (tree, tree);
700 struct varpool_node * varpool_create_variable_alias (tree, tree);
701 void varpool_reset_queue (void);
702 bool const_value_known_p (tree);
703 bool varpool_for_node_and_aliases (struct varpool_node *,
704 bool (*) (struct varpool_node *, void *),
705 void *, bool);
706 void varpool_add_new_variable (tree);
707 void symtab_initialize_asm_name_hash (void);
708 void symtab_prevail_in_asm_name_hash (symtab_node node);
710 /* Return true when NODE is function. */
711 static inline bool
712 symtab_function_p (symtab_node node)
714 return node->symbol.type == SYMTAB_FUNCTION;
717 /* Return true when NODE is variable. */
718 static inline bool
719 symtab_variable_p (symtab_node node)
721 return node->symbol.type == SYMTAB_VARIABLE;
724 /* Return callgraph node for given symbol and check it is a function. */
725 static inline struct cgraph_node *
726 cgraph (symtab_node node)
728 gcc_checking_assert (!node || node->symbol.type == SYMTAB_FUNCTION);
729 return (struct cgraph_node *)node;
732 /* Return varpool node for given symbol and check it is a variable. */
733 static inline struct varpool_node *
734 varpool (symtab_node node)
736 gcc_checking_assert (!node || node->symbol.type == SYMTAB_VARIABLE);
737 return (struct varpool_node *)node;
740 /* Return callgraph node for given symbol and check it is a function. */
741 static inline struct cgraph_node *
742 cgraph_get_node (const_tree decl)
744 gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL);
745 return cgraph (symtab_get_node (decl));
748 /* Return varpool node for given symbol and check it is a function. */
749 static inline struct varpool_node *
750 varpool_get_node (const_tree decl)
752 gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
753 return varpool (symtab_get_node (decl));
756 /* Return asm name of cgraph node. */
757 static inline const char *
758 cgraph_node_asm_name(struct cgraph_node *node)
760 return symtab_node_asm_name ((symtab_node)node);
763 /* Return asm name of varpool node. */
764 static inline const char *
765 varpool_node_asm_name(struct varpool_node *node)
767 return symtab_node_asm_name ((symtab_node)node);
770 /* Return name of cgraph node. */
771 static inline const char *
772 cgraph_node_name(struct cgraph_node *node)
774 return symtab_node_name ((symtab_node)node);
777 /* Return name of varpool node. */
778 static inline const char *
779 varpool_node_name(struct varpool_node *node)
781 return symtab_node_name ((symtab_node)node);
784 /* Walk all symbols. */
785 #define FOR_EACH_SYMBOL(node) \
786 for ((node) = symtab_nodes; (node); (node) = (node)->symbol.next)
789 /* Return first variable. */
790 static inline struct varpool_node *
791 varpool_first_variable (void)
793 symtab_node node;
794 for (node = symtab_nodes; node; node = node->symbol.next)
796 if (symtab_variable_p (node))
797 return varpool (node);
799 return NULL;
802 /* Return next variable after NODE. */
803 static inline struct varpool_node *
804 varpool_next_variable (struct varpool_node *node)
806 symtab_node node1 = (symtab_node) node->symbol.next;
807 for (; node1; node1 = node1->symbol.next)
809 if (symtab_variable_p (node1))
810 return varpool (node1);
812 return NULL;
814 /* Walk all variables. */
815 #define FOR_EACH_VARIABLE(node) \
816 for ((node) = varpool_first_variable (); \
817 (node); \
818 (node) = varpool_next_variable ((node)))
820 /* Return first reachable static variable with initializer. */
821 static inline struct varpool_node *
822 varpool_first_static_initializer (void)
824 symtab_node node;
825 for (node = symtab_nodes; node; node = node->symbol.next)
827 if (symtab_variable_p (node)
828 && DECL_INITIAL (node->symbol.decl))
829 return varpool (node);
831 return NULL;
834 /* Return next reachable static variable with initializer after NODE. */
835 static inline struct varpool_node *
836 varpool_next_static_initializer (struct varpool_node *node)
838 symtab_node node1 = (symtab_node) node->symbol.next;
839 for (; node1; node1 = node1->symbol.next)
841 if (symtab_variable_p (node1)
842 && DECL_INITIAL (node1->symbol.decl))
843 return varpool (node1);
845 return NULL;
848 /* Walk all static variables with initializer set. */
849 #define FOR_EACH_STATIC_INITIALIZER(node) \
850 for ((node) = varpool_first_static_initializer (); (node); \
851 (node) = varpool_next_static_initializer (node))
853 /* Return first reachable static variable with initializer. */
854 static inline struct varpool_node *
855 varpool_first_defined_variable (void)
857 symtab_node node;
858 for (node = symtab_nodes; node; node = node->symbol.next)
860 if (symtab_variable_p (node) && varpool (node)->analyzed)
861 return varpool (node);
863 return NULL;
866 /* Return next reachable static variable with initializer after NODE. */
867 static inline struct varpool_node *
868 varpool_next_defined_variable (struct varpool_node *node)
870 symtab_node node1 = (symtab_node) node->symbol.next;
871 for (; node1; node1 = node1->symbol.next)
873 if (symtab_variable_p (node1) && varpool (node1)->analyzed)
874 return varpool (node1);
876 return NULL;
878 /* Walk all variables with definitions in current unit. */
879 #define FOR_EACH_DEFINED_VARIABLE(node) \
880 for ((node) = varpool_first_defined_variable (); (node); \
881 (node) = varpool_next_defined_variable (node))
883 /* Return first function with body defined. */
884 static inline struct cgraph_node *
885 cgraph_first_defined_function (void)
887 symtab_node node;
888 for (node = symtab_nodes; node; node = node->symbol.next)
890 if (symtab_function_p (node) && cgraph (node)->analyzed)
891 return cgraph (node);
893 return NULL;
896 /* Return next function with body defined after NODE. */
897 static inline struct cgraph_node *
898 cgraph_next_defined_function (struct cgraph_node *node)
900 symtab_node node1 = (symtab_node) node->symbol.next;
901 for (; node1; node1 = node1->symbol.next)
903 if (symtab_function_p (node1) && cgraph (node1)->analyzed)
904 return cgraph (node1);
906 return NULL;
909 /* Walk all functions with body defined. */
910 #define FOR_EACH_DEFINED_FUNCTION(node) \
911 for ((node) = cgraph_first_defined_function (); (node); \
912 (node) = cgraph_next_defined_function ((node)))
914 /* Return first function. */
915 static inline struct cgraph_node *
916 cgraph_first_function (void)
918 symtab_node node;
919 for (node = symtab_nodes; node; node = node->symbol.next)
921 if (symtab_function_p (node))
922 return cgraph (node);
924 return NULL;
927 /* Return next function. */
928 static inline struct cgraph_node *
929 cgraph_next_function (struct cgraph_node *node)
931 symtab_node node1 = (symtab_node) node->symbol.next;
932 for (; node1; node1 = node1->symbol.next)
934 if (symtab_function_p (node1))
935 return cgraph (node1);
937 return NULL;
939 /* Walk all functions. */
940 #define FOR_EACH_FUNCTION(node) \
941 for ((node) = cgraph_first_function (); (node); \
942 (node) = cgraph_next_function ((node)))
944 /* Return true when NODE is a function with Gimple body defined
945 in current unit. Functions can also be define externally or they
946 can be thunks with no Gimple representation.
948 Note that at WPA stage, the function body may not be present in memory. */
950 static inline bool
951 cgraph_function_with_gimple_body_p (struct cgraph_node *node)
953 return node->analyzed && !node->thunk.thunk_p && !node->alias;
956 /* Return first function with body defined. */
957 static inline struct cgraph_node *
958 cgraph_first_function_with_gimple_body (void)
960 symtab_node node;
961 for (node = symtab_nodes; node; node = node->symbol.next)
963 if (symtab_function_p (node)
964 && cgraph_function_with_gimple_body_p (cgraph (node)))
965 return cgraph (node);
967 return NULL;
970 /* Return next reachable static variable with initializer after NODE. */
971 static inline struct cgraph_node *
972 cgraph_next_function_with_gimple_body (struct cgraph_node *node)
974 symtab_node node1 = node->symbol.next;
975 for (; node1; node1 = node1->symbol.next)
977 if (symtab_function_p (node1)
978 && cgraph_function_with_gimple_body_p (cgraph (node1)))
979 return cgraph (node1);
981 return NULL;
984 /* Walk all functions with body defined. */
985 #define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
986 for ((node) = cgraph_first_function_with_gimple_body (); (node); \
987 (node) = cgraph_next_function_with_gimple_body (node))
989 /* Create a new static variable of type TYPE. */
990 tree add_new_static_var (tree type);
992 /* Return true if iterator CSI points to nothing. */
993 static inline bool
994 csi_end_p (cgraph_node_set_iterator csi)
996 return csi.index >= VEC_length (cgraph_node_ptr, csi.set->nodes);
999 /* Advance iterator CSI. */
1000 static inline void
1001 csi_next (cgraph_node_set_iterator *csi)
1003 csi->index++;
1006 /* Return the node pointed to by CSI. */
1007 static inline struct cgraph_node *
1008 csi_node (cgraph_node_set_iterator csi)
1010 return VEC_index (cgraph_node_ptr, csi.set->nodes, csi.index);
1013 /* Return an iterator to the first node in SET. */
1014 static inline cgraph_node_set_iterator
1015 csi_start (cgraph_node_set set)
1017 cgraph_node_set_iterator csi;
1019 csi.set = set;
1020 csi.index = 0;
1021 return csi;
1024 /* Return true if SET contains NODE. */
1025 static inline bool
1026 cgraph_node_in_set_p (struct cgraph_node *node, cgraph_node_set set)
1028 cgraph_node_set_iterator csi;
1029 csi = cgraph_node_set_find (set, node);
1030 return !csi_end_p (csi);
1033 /* Return number of nodes in SET. */
1034 static inline size_t
1035 cgraph_node_set_size (cgraph_node_set set)
1037 return VEC_length (cgraph_node_ptr, set->nodes);
1040 /* Return true if iterator VSI points to nothing. */
1041 static inline bool
1042 vsi_end_p (varpool_node_set_iterator vsi)
1044 return vsi.index >= VEC_length (varpool_node_ptr, vsi.set->nodes);
1047 /* Advance iterator VSI. */
1048 static inline void
1049 vsi_next (varpool_node_set_iterator *vsi)
1051 vsi->index++;
1054 /* Return the node pointed to by VSI. */
1055 static inline struct varpool_node *
1056 vsi_node (varpool_node_set_iterator vsi)
1058 return VEC_index (varpool_node_ptr, vsi.set->nodes, vsi.index);
1061 /* Return an iterator to the first node in SET. */
1062 static inline varpool_node_set_iterator
1063 vsi_start (varpool_node_set set)
1065 varpool_node_set_iterator vsi;
1067 vsi.set = set;
1068 vsi.index = 0;
1069 return vsi;
1072 /* Return true if SET contains NODE. */
1073 static inline bool
1074 varpool_node_in_set_p (struct varpool_node *node, varpool_node_set set)
1076 varpool_node_set_iterator vsi;
1077 vsi = varpool_node_set_find (set, node);
1078 return !vsi_end_p (vsi);
1081 /* Return number of nodes in SET. */
1082 static inline size_t
1083 varpool_node_set_size (varpool_node_set set)
1085 return VEC_length (varpool_node_ptr, set->nodes);
1088 /* Uniquize all constants that appear in memory.
1089 Each constant in memory thus far output is recorded
1090 in `const_desc_table'. */
1092 struct GTY(()) constant_descriptor_tree {
1093 /* A MEM for the constant. */
1094 rtx rtl;
1096 /* The value of the constant. */
1097 tree value;
1099 /* Hash of value. Computing the hash from value each time
1100 hashfn is called can't work properly, as that means recursive
1101 use of the hash table during hash table expansion. */
1102 hashval_t hash;
1105 /* Return true if set is nonempty. */
1106 static inline bool
1107 cgraph_node_set_nonempty_p (cgraph_node_set set)
1109 return !VEC_empty (cgraph_node_ptr, set->nodes);
1112 /* Return true if set is nonempty. */
1113 static inline bool
1114 varpool_node_set_nonempty_p (varpool_node_set set)
1116 return !VEC_empty (varpool_node_ptr, set->nodes);
1119 /* Return true when function NODE is only called directly or it has alias.
1120 i.e. it is not externally visible, address was not taken and
1121 it is not used in any other non-standard way. */
1123 static inline bool
1124 cgraph_only_called_directly_or_aliased_p (struct cgraph_node *node)
1126 gcc_assert (!node->global.inlined_to);
1127 return (!node->symbol.force_output && !node->symbol.address_taken
1128 && !node->symbol.used_from_other_partition
1129 && !DECL_STATIC_CONSTRUCTOR (node->symbol.decl)
1130 && !DECL_STATIC_DESTRUCTOR (node->symbol.decl)
1131 && !node->symbol.externally_visible);
1134 /* Return true when function NODE can be removed from callgraph
1135 if all direct calls are eliminated. */
1137 static inline bool
1138 varpool_can_remove_if_no_refs (struct varpool_node *node)
1140 if (DECL_EXTERNAL (node->symbol.decl))
1141 return true;
1142 return (!node->symbol.force_output && !node->symbol.used_from_other_partition
1143 && ((DECL_COMDAT (node->symbol.decl)
1144 && !symtab_used_from_object_file_p ((symtab_node) node))
1145 || !node->symbol.externally_visible
1146 || DECL_HAS_VALUE_EXPR_P (node->symbol.decl)));
1149 /* Return true when all references to VNODE must be visible in ipa_ref_list.
1150 i.e. if the variable is not externally visible or not used in some magic
1151 way (asm statement or such).
1152 The magic uses are all summarized in force_output flag. */
1154 static inline bool
1155 varpool_all_refs_explicit_p (struct varpool_node *vnode)
1157 return (vnode->analyzed
1158 && !vnode->symbol.externally_visible
1159 && !vnode->symbol.used_from_other_partition
1160 && !vnode->symbol.force_output);
1163 /* Constant pool accessor function. */
1164 htab_t constant_pool_htab (void);
1166 /* FIXME: inappropriate dependency of cgraph on IPA. */
1167 #include "ipa-ref-inline.h"
1169 /* Return node that alias N is aliasing. */
1171 static inline struct cgraph_node *
1172 cgraph_alias_aliased_node (struct cgraph_node *n)
1174 struct ipa_ref *ref;
1176 ipa_ref_list_reference_iterate (&n->symbol.ref_list, 0, ref);
1177 gcc_checking_assert (ref->use == IPA_REF_ALIAS);
1178 if (symtab_function_p (ref->referred))
1179 return ipa_ref_node (ref);
1180 return NULL;
1183 /* Return node that alias N is aliasing. */
1185 static inline struct varpool_node *
1186 varpool_alias_aliased_node (struct varpool_node *n)
1188 struct ipa_ref *ref;
1190 ipa_ref_list_reference_iterate (&n->symbol.ref_list, 0, ref);
1191 gcc_checking_assert (ref->use == IPA_REF_ALIAS);
1192 if (symtab_variable_p (ref->referred))
1193 return ipa_ref_varpool_node (ref);
1194 return NULL;
1197 /* Given NODE, walk the alias chain to return the function NODE is alias of.
1198 Walk through thunk, too.
1199 When AVAILABILITY is non-NULL, get minimal availability in the chain. */
1201 static inline struct cgraph_node *
1202 cgraph_function_node (struct cgraph_node *node, enum availability *availability)
1204 if (availability)
1205 *availability = cgraph_function_body_availability (node);
1206 while (node)
1208 if (node->alias && node->analyzed)
1209 node = cgraph_alias_aliased_node (node);
1210 else if (node->thunk.thunk_p)
1211 node = node->callees->callee;
1212 else
1213 return node;
1214 if (node && availability)
1216 enum availability a;
1217 a = cgraph_function_body_availability (node);
1218 if (a < *availability)
1219 *availability = a;
1222 if (availability)
1223 *availability = AVAIL_NOT_AVAILABLE;
1224 return NULL;
1227 /* Given NODE, walk the alias chain to return the function NODE is alias of.
1228 Do not walk through thunks.
1229 When AVAILABILITY is non-NULL, get minimal availability in the chain. */
1231 static inline struct cgraph_node *
1232 cgraph_function_or_thunk_node (struct cgraph_node *node, enum availability *availability)
1234 if (availability)
1235 *availability = cgraph_function_body_availability (node);
1236 while (node)
1238 if (node->alias && node->analyzed)
1239 node = cgraph_alias_aliased_node (node);
1240 else
1241 return node;
1242 if (node && availability)
1244 enum availability a;
1245 a = cgraph_function_body_availability (node);
1246 if (a < *availability)
1247 *availability = a;
1250 if (availability)
1251 *availability = AVAIL_NOT_AVAILABLE;
1252 return NULL;
1255 /* Given NODE, walk the alias chain to return the function NODE is alias of.
1256 Do not walk through thunks.
1257 When AVAILABILITY is non-NULL, get minimal availability in the chain. */
1259 static inline struct varpool_node *
1260 varpool_variable_node (struct varpool_node *node, enum availability *availability)
1262 if (availability)
1263 *availability = cgraph_variable_initializer_availability (node);
1264 while (node)
1266 if (node->alias && node->analyzed)
1267 node = varpool_alias_aliased_node (node);
1268 else
1269 return node;
1270 if (node && availability)
1272 enum availability a;
1273 a = cgraph_variable_initializer_availability (node);
1274 if (a < *availability)
1275 *availability = a;
1278 if (availability)
1279 *availability = AVAIL_NOT_AVAILABLE;
1280 return NULL;
1283 /* Return true when the edge E represents a direct recursion. */
1284 static inline bool
1285 cgraph_edge_recursive_p (struct cgraph_edge *e)
1287 struct cgraph_node *callee = cgraph_function_or_thunk_node (e->callee, NULL);
1288 if (e->caller->global.inlined_to)
1289 return e->caller->global.inlined_to->symbol.decl == callee->symbol.decl;
1290 else
1291 return e->caller->symbol.decl == callee->symbol.decl;
1294 /* Return true if the TM_CLONE bit is set for a given FNDECL. */
1295 static inline bool
1296 decl_is_tm_clone (const_tree fndecl)
1298 struct cgraph_node *n = cgraph_get_node (fndecl);
1299 if (n)
1300 return n->tm_clone;
1301 return false;
1304 /* Likewise indicate that a node is needed, i.e. reachable via some
1305 external means. */
1307 static inline void
1308 cgraph_mark_force_output_node (struct cgraph_node *node)
1310 node->symbol.force_output = 1;
1311 gcc_checking_assert (!node->global.inlined_to);
1314 /* Return true when the symbol is real symbol, i.e. it is not inline clone
1315 or extern function kept around just for inlining. */
1317 static inline bool
1318 symtab_real_symbol_p (symtab_node node)
1320 struct cgraph_node *cnode;
1321 struct ipa_ref *ref;
1323 if (!symtab_function_p (node))
1324 return true;
1325 cnode = cgraph (node);
1326 if (cnode->global.inlined_to)
1327 return false;
1328 if (cnode->abstract_and_needed)
1329 return false;
1330 /* We keep virtual clones in symtab. */
1331 if (!cnode->analyzed
1332 || DECL_EXTERNAL (cnode->symbol.decl))
1333 return (cnode->callers
1334 || ipa_ref_list_referring_iterate (&cnode->symbol.ref_list, 0, ref));
1335 return true;
1337 #endif /* GCC_CGRAPH_H */