2013-05-30 Ed Smith-Rowland <3dw4rd@verizon.net>
[official-gcc.git] / gcc / cgraph.h
blob276e568230e07d5acf307d03dcad94e426d4d891
1 /* Callgraph handling code.
2 Copyright (C) 2003-2013 Free Software Foundation, Inc.
3 Contributed by Jan Hubicka
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef GCC_CGRAPH_H
22 #define GCC_CGRAPH_H
24 #include "is-a.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 and CONST_DECLs. */
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_BITFIELD (symtab_type) type : 8;
48 /* The symbols resolution. */
49 ENUM_BITFIELD (ld_plugin_symbol_resolution) resolution : 8;
51 /*** Flags representing the symbol type. ***/
53 /* True when symbol corresponds to a definition in current unit.
54 set via cgraph_finalize_function or varpool_finalize_decl */
55 unsigned definition : 1;
56 /* True when symbol is an alias.
57 Set by assemble_alias. */
58 unsigned alias : 1;
59 /* C++ frontend produce same body aliases and extra name aliases for
60 virutal functions and vtables that are obviously equivalent.
61 Those aliases are bit special, especially because C++ frontend
62 visibility code is so ugly it can not get them right at first time
63 and their visibility needs to be copied from their "masters" at
64 the end of parsing. */
65 unsigned cpp_implicit_alias : 1;
66 /* Set once the definition was analyzed. The list of references and
67 other properties are built during analysis. */
68 unsigned analyzed : 1;
71 /*** Visibility and linkage flags. ***/
73 /* Set when function is visible by other units. */
74 unsigned externally_visible : 1;
75 /* Needed variables might become dead by optimization. This flag
76 forces the variable to be output even if it appears dead otherwise. */
77 unsigned force_output : 1;
78 /* True when the name is known to be unique and thus it does not need mangling. */
79 unsigned unique_name : 1;
82 /*** WHOPR Partitioning flags.
83 These flags are used at ltrans stage when only part of the callgraph is
84 available. ***/
86 /* Set when variable is used from other LTRANS partition. */
87 unsigned used_from_other_partition : 1;
88 /* Set when function is available in the other LTRANS partition.
89 During WPA output it is used to mark nodes that are present in
90 multiple partitions. */
91 unsigned in_other_partition : 1;
95 /*** other flags. ***/
97 /* Set when symbol has address taken. */
98 unsigned address_taken : 1;
101 /* Ordering of all symtab entries. */
102 int order;
104 /* Declaration representing the symbol. */
105 tree decl;
107 /* Linked list of symbol table entries starting with symtab_nodes. */
108 symtab_node next;
109 symtab_node previous;
111 /* Linked list of symbols with the same asm name. There may be multiple
112 entries for single symbol name during LTO, because symbols are renamed
113 only after partitioning.
115 Because inline clones are kept in the assembler name has, they also produce
116 duplicate entries.
118 There are also several long standing bugs where frontends and builtin
119 code produce duplicated decls. */
120 symtab_node next_sharing_asm_name;
121 symtab_node previous_sharing_asm_name;
123 /* Circular list of nodes in the same comdat group if non-NULL. */
124 symtab_node same_comdat_group;
126 /* Vectors of referring and referenced entities. */
127 struct ipa_ref_list ref_list;
129 /* Alias target. May be either DECL pointer or ASSEMBLER_NAME pointer
130 depending to what was known to frontend on the creation time.
131 Once alias is resolved, this pointer become NULL. */
132 tree alias_target;
134 /* File stream where this node is being written to. */
135 struct lto_file_decl_data * lto_file_data;
137 PTR GTY ((skip)) aux;
140 enum availability
142 /* Not yet set by cgraph_function_body_availability. */
143 AVAIL_UNSET,
144 /* Function body/variable initializer is unknown. */
145 AVAIL_NOT_AVAILABLE,
146 /* Function body/variable initializer is known but might be replaced
147 by a different one from other compilation unit and thus needs to
148 be dealt with a care. Like AVAIL_NOT_AVAILABLE it can have
149 arbitrary side effects on escaping variables and functions, while
150 like AVAILABLE it might access static variables. */
151 AVAIL_OVERWRITABLE,
152 /* Function body/variable initializer is known and will be used in final
153 program. */
154 AVAIL_AVAILABLE,
155 /* Function body/variable initializer is known and all it's uses are explicitly
156 visible within current unit (ie it's address is never taken and it is not
157 exported to other units).
158 Currently used only for functions. */
159 AVAIL_LOCAL
162 /* This is the information that is put into the cgraph local structure
163 to recover a function. */
164 struct lto_file_decl_data;
166 extern const char * const cgraph_availability_names[];
167 extern const char * const ld_plugin_symbol_resolution_names[];
169 /* Information about thunk, used only for same body aliases. */
171 struct GTY(()) cgraph_thunk_info {
172 /* Information about the thunk. */
173 HOST_WIDE_INT fixed_offset;
174 HOST_WIDE_INT virtual_value;
175 tree alias;
176 bool this_adjusting;
177 bool virtual_offset_p;
178 /* Set to true when alias node is thunk. */
179 bool thunk_p;
182 /* Information about the function collected locally.
183 Available after function is analyzed. */
185 struct GTY(()) cgraph_local_info {
186 /* Set when function function is visible in current compilation unit only
187 and its address is never taken. */
188 unsigned local : 1;
190 /* False when there is something makes versioning impossible. */
191 unsigned versionable : 1;
193 /* False when function calling convention and signature can not be changed.
194 This is the case when __builtin_apply_args is used. */
195 unsigned can_change_signature : 1;
197 /* True when the function has been originally extern inline, but it is
198 redefined now. */
199 unsigned redefined_extern_inline : 1;
201 /* True if the function may enter serial irrevocable mode. */
202 unsigned tm_may_enter_irr : 1;
205 /* Information about the function that needs to be computed globally
206 once compilation is finished. Available only with -funit-at-a-time. */
208 struct GTY(()) cgraph_global_info {
209 /* For inline clones this points to the function they will be
210 inlined into. */
211 struct cgraph_node *inlined_to;
214 /* Information about the function that is propagated by the RTL backend.
215 Available only for functions that has been already assembled. */
217 struct GTY(()) cgraph_rtl_info {
218 unsigned int preferred_incoming_stack_boundary;
221 /* Represent which DECL tree (or reference to such tree)
222 will be replaced by another tree while versioning. */
223 struct GTY(()) ipa_replace_map
225 /* The tree that will be replaced. */
226 tree old_tree;
227 /* The new (replacing) tree. */
228 tree new_tree;
229 /* Parameter number to replace, when old_tree is NULL. */
230 int parm_num;
231 /* True when a substitution should be done, false otherwise. */
232 bool replace_p;
233 /* True when we replace a reference to old_tree. */
234 bool ref_p;
236 typedef struct ipa_replace_map *ipa_replace_map_p;
238 struct GTY(()) cgraph_clone_info
240 vec<ipa_replace_map_p, va_gc> *tree_map;
241 bitmap args_to_skip;
242 bitmap combined_args_to_skip;
246 /* The cgraph data structure.
247 Each function decl has assigned cgraph_node listing callees and callers. */
249 struct GTY(()) cgraph_node {
250 struct symtab_node_base symbol;
251 struct cgraph_edge *callees;
252 struct cgraph_edge *callers;
253 /* List of edges representing indirect calls with a yet undetermined
254 callee. */
255 struct cgraph_edge *indirect_calls;
256 /* For nested functions points to function the node is nested in. */
257 struct cgraph_node *
258 GTY ((nested_ptr (union symtab_node_def, "(struct cgraph_node *)(%h)", "(symtab_node)%h")))
259 origin;
260 /* Points to first nested function, if any. */
261 struct cgraph_node *
262 GTY ((nested_ptr (union symtab_node_def, "(struct cgraph_node *)(%h)", "(symtab_node)%h")))
263 nested;
264 /* Pointer to the next function with same origin, if any. */
265 struct cgraph_node *
266 GTY ((nested_ptr (union symtab_node_def, "(struct cgraph_node *)(%h)", "(symtab_node)%h")))
267 next_nested;
268 /* Pointer to the next clone. */
269 struct cgraph_node *next_sibling_clone;
270 struct cgraph_node *prev_sibling_clone;
271 struct cgraph_node *clones;
272 struct cgraph_node *clone_of;
273 /* For functions with many calls sites it holds map from call expression
274 to the edge to speed up cgraph_edge function. */
275 htab_t GTY((param_is (struct cgraph_edge))) call_site_hash;
276 /* Declaration node used to be clone of. */
277 tree former_clone_of;
279 /* Interprocedural passes scheduled to have their transform functions
280 applied next time we execute local pass on them. We maintain it
281 per-function in order to allow IPA passes to introduce new functions. */
282 vec<ipa_opt_pass> GTY((skip)) ipa_transforms_to_apply;
284 struct cgraph_local_info local;
285 struct cgraph_global_info global;
286 struct cgraph_rtl_info rtl;
287 struct cgraph_clone_info clone;
288 struct cgraph_thunk_info thunk;
290 /* Expected number of executions: calculated in profile.c. */
291 gcov_type count;
292 /* How to scale counts at materialization time; used to merge
293 LTO units with different number of profile runs. */
294 int count_materialization_scale;
295 /* Unique id of the node. */
296 int uid;
298 /* Set when decl is an abstract function pointed to by the
299 ABSTRACT_DECL_ORIGIN of a reachable function. */
300 unsigned abstract_and_needed : 1;
301 /* Set once the function is lowered (i.e. its CFG is built). */
302 unsigned lowered : 1;
303 /* Set once the function has been instantiated and its callee
304 lists created. */
305 unsigned process : 1;
306 /* How commonly executed the node is. Initialized during branch
307 probabilities pass. */
308 ENUM_BITFIELD (node_frequency) frequency : 2;
309 /* True when function can only be called at startup (from static ctor). */
310 unsigned only_called_at_startup : 1;
311 /* True when function can only be called at startup (from static dtor). */
312 unsigned only_called_at_exit : 1;
313 /* True when function is the transactional clone of a function which
314 is called only from inside transactions. */
315 /* ?? We should be able to remove this. We have enough bits in
316 cgraph to calculate it. */
317 unsigned tm_clone : 1;
318 /* True if this decl is a dispatcher for function versions. */
319 unsigned dispatcher_function : 1;
323 typedef struct cgraph_node *cgraph_node_ptr;
326 /* Function Multiversioning info. */
327 struct GTY(()) cgraph_function_version_info {
328 /* The cgraph_node for which the function version info is stored. */
329 struct cgraph_node *this_node;
330 /* Chains all the semantically identical function versions. The
331 first function in this chain is the version_info node of the
332 default function. */
333 struct cgraph_function_version_info *prev;
334 /* If this version node corresponds to a dispatcher for function
335 versions, this points to the version info node of the default
336 function, the first node in the chain. */
337 struct cgraph_function_version_info *next;
338 /* If this node corresponds to a function version, this points
339 to the dispatcher function decl, which is the function that must
340 be called to execute the right function version at run-time.
342 If this cgraph node is a dispatcher (if dispatcher_function is
343 true, in the cgraph_node struct) for function versions, this
344 points to resolver function, which holds the function body of the
345 dispatcher. The dispatcher decl is an alias to the resolver
346 function decl. */
347 tree dispatcher_resolver;
350 /* Get the cgraph_function_version_info node corresponding to node. */
351 struct cgraph_function_version_info *
352 get_cgraph_node_version (struct cgraph_node *node);
354 /* Insert a new cgraph_function_version_info node into cgraph_fnver_htab
355 corresponding to cgraph_node NODE. */
356 struct cgraph_function_version_info *
357 insert_new_cgraph_node_version (struct cgraph_node *node);
359 /* Record that DECL1 and DECL2 are semantically identical function
360 versions. */
361 void record_function_versions (tree decl1, tree decl2);
363 /* Remove the cgraph_function_version_info and cgraph_node for DECL. This
364 DECL is a duplicate declaration. */
365 void delete_function_version (tree decl);
367 /* A cgraph node set is a collection of cgraph nodes. A cgraph node
368 can appear in multiple sets. */
369 struct cgraph_node_set_def
371 struct pointer_map_t *map;
372 vec<cgraph_node_ptr> nodes;
375 typedef struct varpool_node *varpool_node_ptr;
378 /* A varpool node set is a collection of varpool nodes. A varpool node
379 can appear in multiple sets. */
380 struct varpool_node_set_def
382 struct pointer_map_t * map;
383 vec<varpool_node_ptr> nodes;
386 typedef struct cgraph_node_set_def *cgraph_node_set;
389 typedef struct varpool_node_set_def *varpool_node_set;
392 /* Iterator structure for cgraph node sets. */
393 typedef struct
395 cgraph_node_set set;
396 unsigned index;
397 } cgraph_node_set_iterator;
399 /* Iterator structure for varpool node sets. */
400 typedef struct
402 varpool_node_set set;
403 unsigned index;
404 } varpool_node_set_iterator;
406 #define DEFCIFCODE(code, string) CIF_ ## code,
407 /* Reasons for inlining failures. */
408 typedef enum cgraph_inline_failed_enum {
409 #include "cif-code.def"
410 CIF_N_REASONS
411 } cgraph_inline_failed_t;
413 /* Structure containing additional information about an indirect call. */
415 struct GTY(()) cgraph_indirect_call_info
417 /* When polymorphic is set, this field contains offset where the object which
418 was actually used in the polymorphic resides within a larger structure.
419 If agg_contents is set, the field contains the offset within the aggregate
420 from which the address to call was loaded. */
421 HOST_WIDE_INT offset;
422 /* OBJ_TYPE_REF_TOKEN of a polymorphic call (if polymorphic is set). */
423 HOST_WIDE_INT otr_token;
424 /* Type of the object from OBJ_TYPE_REF_OBJECT. */
425 tree otr_type;
426 /* Index of the parameter that is called. */
427 int param_index;
428 /* ECF flags determined from the caller. */
429 int ecf_flags;
431 /* Set when the call is a virtual call with the parameter being the
432 associated object pointer rather than a simple direct call. */
433 unsigned polymorphic : 1;
434 /* Set when the call is a call of a pointer loaded from contents of an
435 aggregate at offset. */
436 unsigned agg_contents : 1;
437 /* When the previous bit is set, this one determines whether the destination
438 is loaded from a parameter passed by reference. */
439 unsigned by_ref : 1;
442 struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"))) cgraph_edge {
443 /* Expected number of executions: calculated in profile.c. */
444 gcov_type count;
445 struct cgraph_node *caller;
446 struct cgraph_node *callee;
447 struct cgraph_edge *prev_caller;
448 struct cgraph_edge *next_caller;
449 struct cgraph_edge *prev_callee;
450 struct cgraph_edge *next_callee;
451 gimple call_stmt;
452 /* Additional information about an indirect call. Not cleared when an edge
453 becomes direct. */
454 struct cgraph_indirect_call_info *indirect_info;
455 PTR GTY ((skip (""))) aux;
456 /* When equal to CIF_OK, inline this call. Otherwise, points to the
457 explanation why function was not inlined. */
458 cgraph_inline_failed_t inline_failed;
459 /* The stmt_uid of call_stmt. This is used by LTO to recover the call_stmt
460 when the function is serialized in. */
461 unsigned int lto_stmt_uid;
462 /* Expected frequency of executions within the function.
463 When set to CGRAPH_FREQ_BASE, the edge is expected to be called once
464 per function call. The range is 0 to CGRAPH_FREQ_MAX. */
465 int frequency;
466 /* Unique id of the edge. */
467 int uid;
468 /* Whether this edge was made direct by indirect inlining. */
469 unsigned int indirect_inlining_edge : 1;
470 /* Whether this edge describes an indirect call with an undetermined
471 callee. */
472 unsigned int indirect_unknown_callee : 1;
473 /* Whether this edge is still a dangling */
474 /* True if the corresponding CALL stmt cannot be inlined. */
475 unsigned int call_stmt_cannot_inline_p : 1;
476 /* Can this call throw externally? */
477 unsigned int can_throw_external : 1;
480 #define CGRAPH_FREQ_BASE 1000
481 #define CGRAPH_FREQ_MAX 100000
483 typedef struct cgraph_edge *cgraph_edge_p;
486 /* The varpool data structure.
487 Each static variable decl has assigned varpool_node. */
489 struct GTY(()) varpool_node {
490 struct symtab_node_base symbol;
492 /* Set when variable is scheduled to be assembled. */
493 unsigned output : 1;
496 /* Every top level asm statement is put into a asm_node. */
498 struct GTY(()) asm_node {
499 /* Next asm node. */
500 struct asm_node *next;
501 /* String for this asm node. */
502 tree asm_str;
503 /* Ordering of all cgraph nodes. */
504 int order;
507 /* Symbol table entry. */
508 union GTY((desc ("%h.symbol.type"), chain_next ("%h.symbol.next"),
509 chain_prev ("%h.symbol.previous"))) symtab_node_def {
510 struct symtab_node_base GTY ((tag ("SYMTAB_SYMBOL"))) symbol;
511 /* To access the following fields,
512 use the use dyn_cast or as_a to obtain the concrete type. */
513 struct cgraph_node GTY ((tag ("SYMTAB_FUNCTION"))) x_function;
514 struct varpool_node GTY ((tag ("SYMTAB_VARIABLE"))) x_variable;
517 /* Report whether or not THIS symtab node is a function, aka cgraph_node. */
519 template <>
520 template <>
521 inline bool
522 is_a_helper <cgraph_node>::test (symtab_node_def *p)
524 return p->symbol.type == SYMTAB_FUNCTION;
527 /* Report whether or not THIS symtab node is a vriable, aka varpool_node. */
529 template <>
530 template <>
531 inline bool
532 is_a_helper <varpool_node>::test (symtab_node_def *p)
534 return p->symbol.type == SYMTAB_VARIABLE;
537 extern GTY(()) symtab_node symtab_nodes;
538 extern GTY(()) int cgraph_n_nodes;
539 extern GTY(()) int cgraph_max_uid;
540 extern GTY(()) int cgraph_edge_max_uid;
541 extern bool cgraph_global_info_ready;
542 enum cgraph_state
544 /* Frontend is parsing and finalizing functions. */
545 CGRAPH_STATE_PARSING,
546 /* Callgraph is being constructed. It is safe to add new functions. */
547 CGRAPH_STATE_CONSTRUCTION,
548 /* Callgraph is built and IPA passes are being run. */
549 CGRAPH_STATE_IPA,
550 /* Callgraph is built and all functions are transformed to SSA form. */
551 CGRAPH_STATE_IPA_SSA,
552 /* Functions are now ordered and being passed to RTL expanders. */
553 CGRAPH_STATE_EXPANSION,
554 /* All cgraph expansion is done. */
555 CGRAPH_STATE_FINISHED
557 extern enum cgraph_state cgraph_state;
558 extern bool cgraph_function_flags_ready;
559 extern cgraph_node_set cgraph_new_nodes;
561 extern GTY(()) struct asm_node *asm_nodes;
562 extern GTY(()) int symtab_order;
563 extern bool cpp_implicit_aliases_done;
565 /* In symtab.c */
566 void symtab_register_node (symtab_node);
567 void symtab_unregister_node (symtab_node);
568 void symtab_remove_node (symtab_node);
569 symtab_node symtab_get_node (const_tree);
570 symtab_node symtab_node_for_asm (const_tree asmname);
571 const char * symtab_node_asm_name (symtab_node);
572 const char * symtab_node_name (symtab_node);
573 void symtab_insert_node_to_hashtable (symtab_node);
574 void symtab_add_to_same_comdat_group (symtab_node, symtab_node);
575 void symtab_dissolve_same_comdat_group_list (symtab_node node);
576 void dump_symtab (FILE *);
577 void debug_symtab (void);
578 void dump_symtab_node (FILE *, symtab_node);
579 void debug_symtab_node (symtab_node);
580 void dump_symtab_base (FILE *, symtab_node);
581 void verify_symtab (void);
582 void verify_symtab_node (symtab_node);
583 bool verify_symtab_base (symtab_node);
584 bool symtab_used_from_object_file_p (symtab_node);
585 void symtab_make_decl_local (tree);
586 symtab_node symtab_alias_ultimate_target (symtab_node,
587 enum availability *avail = NULL);
588 bool symtab_resolve_alias (symtab_node node, symtab_node target);
589 void fixup_same_cpp_alias_visibility (symtab_node node, symtab_node target);
591 /* In cgraph.c */
592 void dump_cgraph (FILE *);
593 void debug_cgraph (void);
594 void dump_cgraph_node (FILE *, struct cgraph_node *);
595 void debug_cgraph_node (struct cgraph_node *);
596 void cgraph_remove_edge (struct cgraph_edge *);
597 void cgraph_remove_node (struct cgraph_node *);
598 void cgraph_release_function_body (struct cgraph_node *);
599 void cgraph_node_remove_callees (struct cgraph_node *node);
600 struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
601 struct cgraph_node *,
602 gimple, gcov_type, int);
603 struct cgraph_edge *cgraph_create_indirect_edge (struct cgraph_node *, gimple,
604 int, gcov_type, int);
605 struct cgraph_indirect_call_info *cgraph_allocate_init_indirect_info (void);
606 struct cgraph_node * cgraph_create_node (tree);
607 struct cgraph_node * cgraph_create_empty_node (void);
608 struct cgraph_node * cgraph_get_create_node (tree);
609 struct cgraph_node * cgraph_get_create_real_symbol_node (tree);
610 struct cgraph_node * cgraph_same_body_alias (struct cgraph_node *, tree, tree);
611 struct cgraph_node * cgraph_add_thunk (struct cgraph_node *, tree, tree, bool, HOST_WIDE_INT,
612 HOST_WIDE_INT, tree, tree);
613 struct cgraph_node *cgraph_node_for_asm (tree);
614 struct cgraph_edge *cgraph_edge (struct cgraph_node *, gimple);
615 void cgraph_set_call_stmt (struct cgraph_edge *, gimple);
616 void cgraph_update_edges_for_call_stmt (gimple, tree, gimple);
617 struct cgraph_local_info *cgraph_local_info (tree);
618 struct cgraph_global_info *cgraph_global_info (tree);
619 struct cgraph_rtl_info *cgraph_rtl_info (tree);
620 struct cgraph_node *cgraph_create_function_alias (tree, tree);
621 void cgraph_call_node_duplication_hooks (struct cgraph_node *,
622 struct cgraph_node *);
623 void cgraph_call_edge_duplication_hooks (struct cgraph_edge *,
624 struct cgraph_edge *);
626 void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *);
627 void cgraph_make_edge_direct (struct cgraph_edge *, struct cgraph_node *);
628 bool cgraph_only_called_directly_p (struct cgraph_node *);
630 bool cgraph_function_possibly_inlined_p (tree);
631 void cgraph_unnest_node (struct cgraph_node *);
633 enum availability cgraph_function_body_availability (struct cgraph_node *);
634 void cgraph_add_new_function (tree, bool);
635 const char* cgraph_inline_failed_string (cgraph_inline_failed_t);
637 void cgraph_set_nothrow_flag (struct cgraph_node *, bool);
638 void cgraph_set_const_flag (struct cgraph_node *, bool, bool);
639 void cgraph_set_pure_flag (struct cgraph_node *, bool, bool);
640 bool cgraph_node_cannot_return (struct cgraph_node *);
641 bool cgraph_edge_cannot_lead_to_return (struct cgraph_edge *);
642 bool cgraph_will_be_removed_from_program_if_no_direct_calls
643 (struct cgraph_node *node);
644 bool cgraph_can_remove_if_no_direct_calls_and_refs_p
645 (struct cgraph_node *node);
646 bool cgraph_can_remove_if_no_direct_calls_p (struct cgraph_node *node);
647 bool resolution_used_from_other_file_p (enum ld_plugin_symbol_resolution);
648 bool cgraph_for_node_thunks_and_aliases (struct cgraph_node *,
649 bool (*) (struct cgraph_node *, void *),
650 void *,
651 bool);
652 bool cgraph_for_node_and_aliases (struct cgraph_node *,
653 bool (*) (struct cgraph_node *, void *),
654 void *, bool);
655 vec<cgraph_edge_p> collect_callers_of_node (struct cgraph_node *node);
656 void verify_cgraph (void);
657 void verify_cgraph_node (struct cgraph_node *);
658 void cgraph_mark_address_taken_node (struct cgraph_node *);
660 typedef void (*cgraph_edge_hook)(struct cgraph_edge *, void *);
661 typedef void (*cgraph_node_hook)(struct cgraph_node *, void *);
662 typedef void (*cgraph_2edge_hook)(struct cgraph_edge *, struct cgraph_edge *,
663 void *);
664 typedef void (*cgraph_2node_hook)(struct cgraph_node *, struct cgraph_node *,
665 void *);
666 struct cgraph_edge_hook_list;
667 struct cgraph_node_hook_list;
668 struct cgraph_2edge_hook_list;
669 struct cgraph_2node_hook_list;
670 struct cgraph_edge_hook_list *cgraph_add_edge_removal_hook (cgraph_edge_hook, void *);
671 void cgraph_remove_edge_removal_hook (struct cgraph_edge_hook_list *);
672 struct cgraph_node_hook_list *cgraph_add_node_removal_hook (cgraph_node_hook,
673 void *);
674 void cgraph_remove_node_removal_hook (struct cgraph_node_hook_list *);
675 struct cgraph_node_hook_list *cgraph_add_function_insertion_hook (cgraph_node_hook,
676 void *);
677 void cgraph_remove_function_insertion_hook (struct cgraph_node_hook_list *);
678 void cgraph_call_function_insertion_hooks (struct cgraph_node *node);
679 struct cgraph_2edge_hook_list *cgraph_add_edge_duplication_hook (cgraph_2edge_hook, void *);
680 void cgraph_remove_edge_duplication_hook (struct cgraph_2edge_hook_list *);
681 struct cgraph_2node_hook_list *cgraph_add_node_duplication_hook (cgraph_2node_hook, void *);
682 void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *);
683 gimple cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *);
684 bool cgraph_propagate_frequency (struct cgraph_node *node);
685 struct cgraph_node * cgraph_function_node (struct cgraph_node *,
686 enum availability *avail = NULL);
688 /* In cgraphunit.c */
689 struct asm_node *add_asm_node (tree);
690 extern FILE *cgraph_dump_file;
691 void cgraph_finalize_function (tree, bool);
692 void finalize_compilation_unit (void);
693 void compile (void);
694 void init_cgraph (void);
695 bool cgraph_process_new_functions (void);
696 void cgraph_process_same_body_aliases (void);
697 void fixup_same_cpp_alias_visibility (symtab_node, symtab_node target, tree);
698 /* Initialize datastructures so DECL is a function in lowered gimple form.
699 IN_SSA is true if the gimple is in SSA. */
700 basic_block init_lowered_empty_function (tree, bool);
701 void cgraph_reset_node (struct cgraph_node *);
703 /* In cgraphclones.c */
705 struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *,
706 struct cgraph_node *, gimple,
707 unsigned, gcov_type, int, bool);
708 struct cgraph_node * cgraph_clone_node (struct cgraph_node *, tree, gcov_type,
709 int, bool, vec<cgraph_edge_p>,
710 bool);
711 tree clone_function_name (tree decl, const char *);
712 struct cgraph_node * cgraph_create_virtual_clone (struct cgraph_node *old_node,
713 vec<cgraph_edge_p>,
714 vec<ipa_replace_map_p, va_gc> *tree_map,
715 bitmap args_to_skip,
716 const char *clone_name);
717 struct cgraph_node *cgraph_find_replacement_node (struct cgraph_node *);
718 bool cgraph_remove_node_and_inline_clones (struct cgraph_node *, struct cgraph_node *);
719 void cgraph_set_call_stmt_including_clones (struct cgraph_node *, gimple, gimple);
720 void cgraph_create_edge_including_clones (struct cgraph_node *,
721 struct cgraph_node *,
722 gimple, gimple, gcov_type, int,
723 cgraph_inline_failed_t);
724 void cgraph_materialize_all_clones (void);
725 struct cgraph_node * cgraph_copy_node_for_versioning (struct cgraph_node *,
726 tree, vec<cgraph_edge_p>, bitmap);
727 struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
728 vec<cgraph_edge_p>,
729 vec<ipa_replace_map_p, va_gc> *,
730 bitmap, bool, bitmap,
731 basic_block, const char *);
732 void tree_function_versioning (tree, tree, vec<ipa_replace_map_p, va_gc> *,
733 bool, bitmap, bool, bitmap, basic_block);
735 /* In cgraphbuild.c */
736 unsigned int rebuild_cgraph_edges (void);
737 void cgraph_rebuild_references (void);
738 int compute_call_stmt_bb_frequency (tree, basic_block bb);
739 void record_references_in_initializer (tree, bool);
740 void ipa_record_stmt_references (struct cgraph_node *, gimple);
742 /* In ipa.c */
743 bool symtab_remove_unreachable_nodes (bool, FILE *);
744 cgraph_node_set cgraph_node_set_new (void);
745 cgraph_node_set_iterator cgraph_node_set_find (cgraph_node_set,
746 struct cgraph_node *);
747 void cgraph_node_set_add (cgraph_node_set, struct cgraph_node *);
748 void cgraph_node_set_remove (cgraph_node_set, struct cgraph_node *);
749 void dump_cgraph_node_set (FILE *, cgraph_node_set);
750 void debug_cgraph_node_set (cgraph_node_set);
751 void free_cgraph_node_set (cgraph_node_set);
752 void cgraph_build_static_cdtor (char which, tree body, int priority);
754 varpool_node_set varpool_node_set_new (void);
755 varpool_node_set_iterator varpool_node_set_find (varpool_node_set,
756 struct varpool_node *);
757 void varpool_node_set_add (varpool_node_set, struct varpool_node *);
758 void varpool_node_set_remove (varpool_node_set, struct varpool_node *);
759 void dump_varpool_node_set (FILE *, varpool_node_set);
760 void debug_varpool_node_set (varpool_node_set);
761 void free_varpool_node_set (varpool_node_set);
762 void ipa_discover_readonly_nonaddressable_vars (void);
763 bool varpool_externally_visible_p (struct varpool_node *);
765 /* In predict.c */
766 bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e);
767 bool cgraph_optimize_for_size_p (struct cgraph_node *);
769 /* In varpool.c */
770 struct varpool_node *varpool_node_for_decl (tree);
771 struct varpool_node *varpool_node_for_asm (tree asmname);
772 void varpool_mark_needed_node (struct varpool_node *);
773 void debug_varpool (void);
774 void dump_varpool (FILE *);
775 void dump_varpool_node (FILE *, struct varpool_node *);
777 void varpool_finalize_decl (tree);
778 bool decide_is_variable_needed (struct varpool_node *, tree);
779 enum availability cgraph_variable_initializer_availability (struct varpool_node *);
780 void cgraph_make_node_local (struct cgraph_node *);
781 bool cgraph_node_can_be_local_p (struct cgraph_node *);
784 void varpool_remove_node (struct varpool_node *node);
785 void varpool_finalize_named_section_flags (struct varpool_node *node);
786 bool varpool_output_variables (void);
787 bool varpool_assemble_decl (struct varpool_node *node);
788 void varpool_analyze_node (struct varpool_node *);
789 struct varpool_node * varpool_extra_name_alias (tree, tree);
790 struct varpool_node * varpool_create_variable_alias (tree, tree);
791 void varpool_reset_queue (void);
792 bool const_value_known_p (tree);
793 bool varpool_for_node_and_aliases (struct varpool_node *,
794 bool (*) (struct varpool_node *, void *),
795 void *, bool);
796 void varpool_add_new_variable (tree);
797 void symtab_initialize_asm_name_hash (void);
798 void symtab_prevail_in_asm_name_hash (symtab_node node);
799 void varpool_remove_initializer (struct varpool_node *);
802 /* Return callgraph node for given symbol and check it is a function. */
803 static inline struct cgraph_node *
804 cgraph (symtab_node node)
806 gcc_checking_assert (!node || node->symbol.type == SYMTAB_FUNCTION);
807 return (struct cgraph_node *)node;
810 /* Return varpool node for given symbol and check it is a variable. */
811 static inline struct varpool_node *
812 varpool (symtab_node node)
814 gcc_checking_assert (!node || node->symbol.type == SYMTAB_VARIABLE);
815 return (struct varpool_node *)node;
818 /* Return callgraph node for given symbol and check it is a function. */
819 static inline struct cgraph_node *
820 cgraph_get_node (const_tree decl)
822 gcc_checking_assert (TREE_CODE (decl) == FUNCTION_DECL);
823 return cgraph (symtab_get_node (decl));
826 /* Return varpool node for given symbol and check it is a function. */
827 static inline struct varpool_node *
828 varpool_get_node (const_tree decl)
830 gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
831 return varpool (symtab_get_node (decl));
834 /* Return asm name of cgraph node. */
835 static inline const char *
836 cgraph_node_asm_name (struct cgraph_node *node)
838 return symtab_node_asm_name ((symtab_node)node);
841 /* Return asm name of varpool node. */
842 static inline const char *
843 varpool_node_asm_name(struct varpool_node *node)
845 return symtab_node_asm_name ((symtab_node)node);
848 /* Return name of cgraph node. */
849 static inline const char *
850 cgraph_node_name(struct cgraph_node *node)
852 return symtab_node_name ((symtab_node)node);
855 /* Return name of varpool node. */
856 static inline const char *
857 varpool_node_name(struct varpool_node *node)
859 return symtab_node_name ((symtab_node)node);
862 /* Walk all symbols. */
863 #define FOR_EACH_SYMBOL(node) \
864 for ((node) = symtab_nodes; (node); (node) = (node)->symbol.next)
867 /* Return first variable. */
868 static inline struct varpool_node *
869 varpool_first_variable (void)
871 symtab_node node;
872 for (node = symtab_nodes; node; node = node->symbol.next)
873 if (varpool_node *vnode = dyn_cast <varpool_node> (node))
874 return vnode;
875 return NULL;
878 /* Return next variable after NODE. */
879 static inline struct varpool_node *
880 varpool_next_variable (struct varpool_node *node)
882 symtab_node node1 = (symtab_node) node->symbol.next;
883 for (; node1; node1 = node1->symbol.next)
884 if (varpool_node *vnode1 = dyn_cast <varpool_node> (node1))
885 return vnode1;
886 return NULL;
888 /* Walk all variables. */
889 #define FOR_EACH_VARIABLE(node) \
890 for ((node) = varpool_first_variable (); \
891 (node); \
892 (node) = varpool_next_variable ((node)))
894 /* Return first reachable static variable with initializer. */
895 static inline struct varpool_node *
896 varpool_first_static_initializer (void)
898 symtab_node node;
899 for (node = symtab_nodes; node; node = node->symbol.next)
901 varpool_node *vnode = dyn_cast <varpool_node> (node);
902 if (vnode && DECL_INITIAL (node->symbol.decl))
903 return vnode;
905 return NULL;
908 /* Return next reachable static variable with initializer after NODE. */
909 static inline struct varpool_node *
910 varpool_next_static_initializer (struct varpool_node *node)
912 symtab_node node1 = (symtab_node) node->symbol.next;
913 for (; node1; node1 = node1->symbol.next)
915 varpool_node *vnode1 = dyn_cast <varpool_node> (node1);
916 if (vnode1 && DECL_INITIAL (node1->symbol.decl))
917 return vnode1;
919 return NULL;
922 /* Walk all static variables with initializer set. */
923 #define FOR_EACH_STATIC_INITIALIZER(node) \
924 for ((node) = varpool_first_static_initializer (); (node); \
925 (node) = varpool_next_static_initializer (node))
927 /* Return first reachable static variable with initializer. */
928 static inline struct varpool_node *
929 varpool_first_defined_variable (void)
931 symtab_node node;
932 for (node = symtab_nodes; node; node = node->symbol.next)
934 varpool_node *vnode = dyn_cast <varpool_node> (node);
935 if (vnode && vnode->symbol.definition)
936 return vnode;
938 return NULL;
941 /* Return next reachable static variable with initializer after NODE. */
942 static inline struct varpool_node *
943 varpool_next_defined_variable (struct varpool_node *node)
945 symtab_node node1 = (symtab_node) node->symbol.next;
946 for (; node1; node1 = node1->symbol.next)
948 varpool_node *vnode1 = dyn_cast <varpool_node> (node1);
949 if (vnode1 && vnode1->symbol.definition)
950 return vnode1;
952 return NULL;
954 /* Walk all variables with definitions in current unit. */
955 #define FOR_EACH_DEFINED_VARIABLE(node) \
956 for ((node) = varpool_first_defined_variable (); (node); \
957 (node) = varpool_next_defined_variable (node))
959 /* Return first function with body defined. */
960 static inline struct cgraph_node *
961 cgraph_first_defined_function (void)
963 symtab_node node;
964 for (node = symtab_nodes; node; node = node->symbol.next)
966 cgraph_node *cn = dyn_cast <cgraph_node> (node);
967 if (cn && cn->symbol.definition)
968 return cn;
970 return NULL;
973 /* Return next function with body defined after NODE. */
974 static inline struct cgraph_node *
975 cgraph_next_defined_function (struct cgraph_node *node)
977 symtab_node node1 = (symtab_node) node->symbol.next;
978 for (; node1; node1 = node1->symbol.next)
980 cgraph_node *cn1 = dyn_cast <cgraph_node> (node1);
981 if (cn1 && cn1->symbol.definition)
982 return cn1;
984 return NULL;
987 /* Walk all functions with body defined. */
988 #define FOR_EACH_DEFINED_FUNCTION(node) \
989 for ((node) = cgraph_first_defined_function (); (node); \
990 (node) = cgraph_next_defined_function ((node)))
992 /* Return first function. */
993 static inline struct cgraph_node *
994 cgraph_first_function (void)
996 symtab_node node;
997 for (node = symtab_nodes; node; node = node->symbol.next)
998 if (cgraph_node *cn = dyn_cast <cgraph_node> (node))
999 return cn;
1000 return NULL;
1003 /* Return next function. */
1004 static inline struct cgraph_node *
1005 cgraph_next_function (struct cgraph_node *node)
1007 symtab_node node1 = (symtab_node) node->symbol.next;
1008 for (; node1; node1 = node1->symbol.next)
1009 if (cgraph_node *cn1 = dyn_cast <cgraph_node> (node1))
1010 return cn1;
1011 return NULL;
1013 /* Walk all functions. */
1014 #define FOR_EACH_FUNCTION(node) \
1015 for ((node) = cgraph_first_function (); (node); \
1016 (node) = cgraph_next_function ((node)))
1018 /* Return true when NODE is a function with Gimple body defined
1019 in current unit. Functions can also be define externally or they
1020 can be thunks with no Gimple representation.
1022 Note that at WPA stage, the function body may not be present in memory. */
1024 static inline bool
1025 cgraph_function_with_gimple_body_p (struct cgraph_node *node)
1027 return node->symbol.definition && !node->thunk.thunk_p && !node->symbol.alias;
1030 /* Return first function with body defined. */
1031 static inline struct cgraph_node *
1032 cgraph_first_function_with_gimple_body (void)
1034 symtab_node node;
1035 for (node = symtab_nodes; node; node = node->symbol.next)
1037 cgraph_node *cn = dyn_cast <cgraph_node> (node);
1038 if (cn && cgraph_function_with_gimple_body_p (cn))
1039 return cn;
1041 return NULL;
1044 /* Return next reachable static variable with initializer after NODE. */
1045 static inline struct cgraph_node *
1046 cgraph_next_function_with_gimple_body (struct cgraph_node *node)
1048 symtab_node node1 = node->symbol.next;
1049 for (; node1; node1 = node1->symbol.next)
1051 cgraph_node *cn1 = dyn_cast <cgraph_node> (node1);
1052 if (cn1 && cgraph_function_with_gimple_body_p (cn1))
1053 return cn1;
1055 return NULL;
1058 /* Walk all functions with body defined. */
1059 #define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \
1060 for ((node) = cgraph_first_function_with_gimple_body (); (node); \
1061 (node) = cgraph_next_function_with_gimple_body (node))
1063 /* Create a new static variable of type TYPE. */
1064 tree add_new_static_var (tree type);
1066 /* Return true if iterator CSI points to nothing. */
1067 static inline bool
1068 csi_end_p (cgraph_node_set_iterator csi)
1070 return csi.index >= csi.set->nodes.length ();
1073 /* Advance iterator CSI. */
1074 static inline void
1075 csi_next (cgraph_node_set_iterator *csi)
1077 csi->index++;
1080 /* Return the node pointed to by CSI. */
1081 static inline struct cgraph_node *
1082 csi_node (cgraph_node_set_iterator csi)
1084 return csi.set->nodes[csi.index];
1087 /* Return an iterator to the first node in SET. */
1088 static inline cgraph_node_set_iterator
1089 csi_start (cgraph_node_set set)
1091 cgraph_node_set_iterator csi;
1093 csi.set = set;
1094 csi.index = 0;
1095 return csi;
1098 /* Return true if SET contains NODE. */
1099 static inline bool
1100 cgraph_node_in_set_p (struct cgraph_node *node, cgraph_node_set set)
1102 cgraph_node_set_iterator csi;
1103 csi = cgraph_node_set_find (set, node);
1104 return !csi_end_p (csi);
1107 /* Return number of nodes in SET. */
1108 static inline size_t
1109 cgraph_node_set_size (cgraph_node_set set)
1111 return set->nodes.length ();
1114 /* Return true if iterator VSI points to nothing. */
1115 static inline bool
1116 vsi_end_p (varpool_node_set_iterator vsi)
1118 return vsi.index >= vsi.set->nodes.length ();
1121 /* Advance iterator VSI. */
1122 static inline void
1123 vsi_next (varpool_node_set_iterator *vsi)
1125 vsi->index++;
1128 /* Return the node pointed to by VSI. */
1129 static inline struct varpool_node *
1130 vsi_node (varpool_node_set_iterator vsi)
1132 return vsi.set->nodes[vsi.index];
1135 /* Return an iterator to the first node in SET. */
1136 static inline varpool_node_set_iterator
1137 vsi_start (varpool_node_set set)
1139 varpool_node_set_iterator vsi;
1141 vsi.set = set;
1142 vsi.index = 0;
1143 return vsi;
1146 /* Return true if SET contains NODE. */
1147 static inline bool
1148 varpool_node_in_set_p (struct varpool_node *node, varpool_node_set set)
1150 varpool_node_set_iterator vsi;
1151 vsi = varpool_node_set_find (set, node);
1152 return !vsi_end_p (vsi);
1155 /* Return number of nodes in SET. */
1156 static inline size_t
1157 varpool_node_set_size (varpool_node_set set)
1159 return set->nodes.length ();
1162 /* Uniquize all constants that appear in memory.
1163 Each constant in memory thus far output is recorded
1164 in `const_desc_table'. */
1166 struct GTY(()) constant_descriptor_tree {
1167 /* A MEM for the constant. */
1168 rtx rtl;
1170 /* The value of the constant. */
1171 tree value;
1173 /* Hash of value. Computing the hash from value each time
1174 hashfn is called can't work properly, as that means recursive
1175 use of the hash table during hash table expansion. */
1176 hashval_t hash;
1179 /* Return true if set is nonempty. */
1180 static inline bool
1181 cgraph_node_set_nonempty_p (cgraph_node_set set)
1183 return !set->nodes.is_empty ();
1186 /* Return true if set is nonempty. */
1187 static inline bool
1188 varpool_node_set_nonempty_p (varpool_node_set set)
1190 return !set->nodes.is_empty ();
1193 /* Return true when function NODE is only called directly or it has alias.
1194 i.e. it is not externally visible, address was not taken and
1195 it is not used in any other non-standard way. */
1197 static inline bool
1198 cgraph_only_called_directly_or_aliased_p (struct cgraph_node *node)
1200 gcc_assert (!node->global.inlined_to);
1201 return (!node->symbol.force_output && !node->symbol.address_taken
1202 && !node->symbol.used_from_other_partition
1203 && !DECL_VIRTUAL_P (node->symbol.decl)
1204 && !DECL_STATIC_CONSTRUCTOR (node->symbol.decl)
1205 && !DECL_STATIC_DESTRUCTOR (node->symbol.decl)
1206 && !node->symbol.externally_visible);
1209 /* Return true when function NODE can be removed from callgraph
1210 if all direct calls are eliminated. */
1212 static inline bool
1213 varpool_can_remove_if_no_refs (struct varpool_node *node)
1215 if (DECL_EXTERNAL (node->symbol.decl))
1216 return true;
1217 return (!node->symbol.force_output && !node->symbol.used_from_other_partition
1218 && ((DECL_COMDAT (node->symbol.decl)
1219 && !symtab_used_from_object_file_p ((symtab_node) node))
1220 || !node->symbol.externally_visible
1221 || DECL_HAS_VALUE_EXPR_P (node->symbol.decl)));
1224 /* Return true when all references to VNODE must be visible in ipa_ref_list.
1225 i.e. if the variable is not externally visible or not used in some magic
1226 way (asm statement or such).
1227 The magic uses are all summarized in force_output flag. */
1229 static inline bool
1230 varpool_all_refs_explicit_p (struct varpool_node *vnode)
1232 return (vnode->symbol.definition
1233 && !vnode->symbol.externally_visible
1234 && !vnode->symbol.used_from_other_partition
1235 && !vnode->symbol.force_output);
1238 /* Constant pool accessor function. */
1239 htab_t constant_pool_htab (void);
1241 /* FIXME: inappropriate dependency of cgraph on IPA. */
1242 #include "ipa-ref-inline.h"
1244 /* Return node that alias N is aliasing. */
1246 static inline symtab_node
1247 symtab_alias_target (symtab_node n)
1249 struct ipa_ref *ref;
1250 ipa_ref_list_reference_iterate (&n->symbol.ref_list, 0, ref);
1251 gcc_checking_assert (ref->use == IPA_REF_ALIAS);
1252 return ref->referred;
1255 static inline struct cgraph_node *
1256 cgraph_alias_target (struct cgraph_node *n)
1258 return dyn_cast <cgraph_node> (symtab_alias_target ((symtab_node) n));
1261 static inline struct varpool_node *
1262 varpool_alias_target (struct varpool_node *n)
1264 return dyn_cast <varpool_node> (symtab_alias_target ((symtab_node) n));
1267 /* Given NODE, walk the alias chain to return the function NODE is alias of.
1268 Do not walk through thunks.
1269 When AVAILABILITY is non-NULL, get minimal availability in the chain. */
1271 static inline struct cgraph_node *
1272 cgraph_function_or_thunk_node (struct cgraph_node *node,
1273 enum availability *availability = NULL)
1275 struct cgraph_node *n;
1277 n = dyn_cast <cgraph_node> (symtab_alias_ultimate_target ((symtab_node)node,
1278 availability));
1279 if (!n && availability)
1280 *availability = AVAIL_NOT_AVAILABLE;
1281 return n;
1283 /* Given NODE, walk the alias chain to return the function NODE is alias of.
1284 Do not walk through thunks.
1285 When AVAILABILITY is non-NULL, get minimal availability in the chain. */
1287 static inline struct varpool_node *
1288 varpool_variable_node (struct varpool_node *node,
1289 enum availability *availability = NULL)
1291 struct varpool_node *n;
1293 n = dyn_cast <varpool_node> (symtab_alias_ultimate_target ((symtab_node)node,
1294 availability));
1295 if (!n && availability)
1296 *availability = AVAIL_NOT_AVAILABLE;
1297 return n;
1300 /* Return true when the edge E represents a direct recursion. */
1301 static inline bool
1302 cgraph_edge_recursive_p (struct cgraph_edge *e)
1304 struct cgraph_node *callee = cgraph_function_or_thunk_node (e->callee, NULL);
1305 if (e->caller->global.inlined_to)
1306 return e->caller->global.inlined_to->symbol.decl == callee->symbol.decl;
1307 else
1308 return e->caller->symbol.decl == callee->symbol.decl;
1311 /* Return true if the TM_CLONE bit is set for a given FNDECL. */
1312 static inline bool
1313 decl_is_tm_clone (const_tree fndecl)
1315 struct cgraph_node *n = cgraph_get_node (fndecl);
1316 if (n)
1317 return n->tm_clone;
1318 return false;
1321 /* Likewise indicate that a node is needed, i.e. reachable via some
1322 external means. */
1324 static inline void
1325 cgraph_mark_force_output_node (struct cgraph_node *node)
1327 node->symbol.force_output = 1;
1328 gcc_checking_assert (!node->global.inlined_to);
1331 /* Return true when the symbol is real symbol, i.e. it is not inline clone
1332 or abstract function kept for debug info purposes only. */
1334 static inline bool
1335 symtab_real_symbol_p (symtab_node node)
1337 struct cgraph_node *cnode;
1339 if (!is_a <cgraph_node> (node))
1340 return true;
1341 cnode = cgraph (node);
1342 if (cnode->global.inlined_to)
1343 return false;
1344 if (cnode->abstract_and_needed)
1345 return false;
1346 return true;
1348 #endif /* GCC_CGRAPH_H */