1 /* Callgraph handling code.
2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
3 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
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
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/>. */
25 #include "basic-block.h"
29 /* Not yet set by cgraph_function_body_availability. */
31 /* Function body/variable initializer is unknown. */
33 /* Function body/variable initializer is known but might be replaced
34 by a different one from other compilation unit and thus needs to
35 be dealt with a care. Like AVAIL_NOT_AVAILABLE it can have
36 arbitrary side effects on escaping variables and functions, while
37 like AVAILABLE it might access static variables. */
39 /* Function body/variable initializer is known and will be used in final
42 /* Function body/variable initializer is known and all it's uses are explicitly
43 visible within current unit (ie it's address is never taken and it is not
44 exported to other units).
45 Currently used only for functions. */
49 /* This is the information that is put into the cgraph local structure
50 to recover a function. */
51 struct lto_file_decl_data
;
53 extern const char * const cgraph_availability_names
[];
55 /* Function inlining information. */
57 struct GTY(()) inline_summary
59 /* Estimated stack frame consumption by the function. */
60 HOST_WIDE_INT estimated_self_stack_size
;
62 /* Size of the function body. */
64 /* How many instructions are likely going to disappear after inlining. */
65 int size_inlining_benefit
;
66 /* Estimated time spent executing the function body. */
68 /* How much time is going to be saved by inlining. */
69 int time_inlining_benefit
;
72 /* Information about thunk, used only for same body aliases. */
74 struct GTY(()) cgraph_thunk_info
{
75 /* Information about the thunk. */
76 HOST_WIDE_INT fixed_offset
;
77 HOST_WIDE_INT virtual_value
;
80 bool virtual_offset_p
;
81 /* Set to true when alias node is thunk. */
85 /* Information about the function collected locally.
86 Available after function is analyzed. */
88 struct GTY(()) cgraph_local_info
{
89 /* File stream where this node is being written to. */
90 struct lto_file_decl_data
* GTY ((skip
)) lto_file_data
;
92 struct inline_summary inline_summary
;
94 /* Set when function function is visible in current compilation unit only
95 and its address is never taken. */
98 /* Set when function is visible by other units. */
99 unsigned externally_visible
: 1;
101 /* Set once it has been finalized so we consider it to be output. */
102 unsigned finalized
: 1;
104 /* False when there something makes inlining impossible (such as va_arg). */
105 unsigned inlinable
: 1;
107 /* True when function should be inlined independently on its size. */
108 unsigned disregard_inline_limits
: 1;
110 /* True when the function has been originally extern inline, but it is
112 unsigned redefined_extern_inline
: 1;
114 /* True if statics_read_for_function and
115 statics_written_for_function contain valid data. */
116 unsigned for_functions_valid
: 1;
118 /* True if the function is going to be emitted in some other translation
119 unit, referenced from vtable. */
120 unsigned vtable_method
: 1;
123 /* Information about the function that needs to be computed globally
124 once compilation is finished. Available only with -funit-at-a-time. */
126 struct GTY(()) cgraph_global_info
{
127 /* Estimated stack frame consumption by the function. */
128 HOST_WIDE_INT estimated_stack_size
;
129 /* Expected offset of the stack frame of inlined function. */
130 HOST_WIDE_INT stack_frame_offset
;
132 /* For inline clones this points to the function they will be
134 struct cgraph_node
*inlined_to
;
136 /* Estimated size of the function after inlining. */
140 /* Estimated growth after inlining. INT_MIN if not computed. */
141 int estimated_growth
;
143 /* Set iff the function has been inlined at least once. */
147 /* Information about the function that is propagated by the RTL backend.
148 Available only for functions that has been already assembled. */
150 struct GTY(()) cgraph_rtl_info
{
151 unsigned int preferred_incoming_stack_boundary
;
154 /* Represent which DECL tree (or reference to such tree)
155 will be replaced by another tree while versioning. */
156 struct GTY(()) ipa_replace_map
158 /* The tree that will be replaced. */
160 /* The new (replacing) tree. */
162 /* True when a substitution should be done, false otherwise. */
164 /* True when we replace a reference to old_tree. */
167 typedef struct ipa_replace_map
*ipa_replace_map_p
;
168 DEF_VEC_P(ipa_replace_map_p
);
169 DEF_VEC_ALLOC_P(ipa_replace_map_p
,gc
);
171 struct GTY(()) cgraph_clone_info
173 VEC(ipa_replace_map_p
,gc
)* tree_map
;
175 bitmap combined_args_to_skip
;
178 /* The cgraph data structure.
179 Each function decl has assigned cgraph_node listing callees and callers. */
181 struct GTY((chain_next ("%h.next"), chain_prev ("%h.previous"))) cgraph_node
{
183 struct cgraph_edge
*callees
;
184 struct cgraph_edge
*callers
;
185 struct cgraph_node
*next
;
186 struct cgraph_node
*previous
;
187 /* For nested functions points to function the node is nested in. */
188 struct cgraph_node
*origin
;
189 /* Points to first nested function, if any. */
190 struct cgraph_node
*nested
;
191 /* Pointer to the next function with same origin, if any. */
192 struct cgraph_node
*next_nested
;
193 /* Pointer to the next function in cgraph_nodes_queue. */
194 struct cgraph_node
*next_needed
;
195 /* Pointer to the next clone. */
196 struct cgraph_node
*next_sibling_clone
;
197 struct cgraph_node
*prev_sibling_clone
;
198 struct cgraph_node
*clones
;
199 struct cgraph_node
*clone_of
;
200 /* For normal nodes pointer to the list of alias and thunk nodes,
201 in alias/thunk nodes pointer to the normal node. */
202 struct cgraph_node
*same_body
;
203 /* Circular list of nodes in the same comdat group if non-NULL. */
204 struct cgraph_node
*same_comdat_group
;
205 /* For functions with many calls sites it holds map from call expression
206 to the edge to speed up cgraph_edge function. */
207 htab_t
GTY((param_is (struct cgraph_edge
))) call_site_hash
;
209 PTR
GTY ((skip
)) aux
;
211 /* Interprocedural passes scheduled to have their transform functions
212 applied next time we execute local pass on them. We maintain it
213 per-function in order to allow IPA passes to introduce new functions. */
214 VEC(ipa_opt_pass
,heap
) * GTY((skip
)) ipa_transforms_to_apply
;
216 struct cgraph_local_info local
;
217 struct cgraph_global_info global
;
218 struct cgraph_rtl_info rtl
;
219 struct cgraph_clone_info clone
;
220 struct cgraph_thunk_info thunk
;
222 /* Expected number of executions: calculated in profile.c. */
224 /* Unique id of the node. */
226 /* Ordering of all cgraph nodes. */
229 /* unique id for profiling. pid is not suitable because of different
230 number of cfg nodes with -fprofile-generate and -fprofile-use */
233 /* Set when function must be output for some reason. The primary
234 use of this flag is to mark functions needed to be output for
235 non-standard reason. Functions that are externally visible
236 or reachable from functions needed to be output are marked
237 by specialized flags. */
239 /* Set when function has address taken.
240 In current implementation it imply needed flag. */
241 unsigned address_taken
: 1;
242 /* Set when decl is an abstract function pointed to by the
243 ABSTRACT_DECL_ORIGIN of a reachable function. */
244 unsigned abstract_and_needed
: 1;
245 /* Set when function is reachable by call from other function
246 that is either reachable or needed.
247 This flag is computed at original cgraph construction and then
248 updated in cgraph_remove_unreachable_nodes. Note that after
249 cgraph_remove_unreachable_nodes cgraph still can contain unreachable
250 nodes when they are needed for virtual clone instantiation. */
251 unsigned reachable
: 1;
252 /* Set once the function is lowered (i.e. its CFG is built). */
253 unsigned lowered
: 1;
254 /* Set once the function has been instantiated and its callee
256 unsigned analyzed
: 1;
257 /* Set when function is scheduled to be processed by local passes. */
258 unsigned process
: 1;
259 /* Set for aliases once they got through assemble_alias. */
261 /* Set for nodes that was constructed and finalized by frontend. */
262 unsigned finalized_by_frontend
: 1;
263 /* Set for alias and thunk nodes, same_body points to the node they are alias
264 of and they are linked through the next/previous pointers. */
265 unsigned same_body_alias
: 1;
268 typedef struct cgraph_node
*cgraph_node_ptr
;
270 DEF_VEC_P(cgraph_node_ptr
);
271 DEF_VEC_ALLOC_P(cgraph_node_ptr
,heap
);
272 DEF_VEC_ALLOC_P(cgraph_node_ptr
,gc
);
274 /* A cgraph node set is a collection of cgraph nodes. A cgraph node
275 can appear in multiple sets. */
276 struct GTY(()) cgraph_node_set_def
278 htab_t
GTY((param_is (struct cgraph_node_set_element_def
))) hashtab
;
279 VEC(cgraph_node_ptr
, gc
) *nodes
;
280 PTR
GTY ((skip
)) aux
;
283 typedef struct cgraph_node_set_def
*cgraph_node_set
;
285 DEF_VEC_P(cgraph_node_set
);
286 DEF_VEC_ALLOC_P(cgraph_node_set
,gc
);
287 DEF_VEC_ALLOC_P(cgraph_node_set
,heap
);
289 /* A cgraph node set element contains an index in the vector of nodes in
291 struct GTY(()) cgraph_node_set_element_def
293 struct cgraph_node
*node
;
297 typedef struct cgraph_node_set_element_def
*cgraph_node_set_element
;
298 typedef const struct cgraph_node_set_element_def
*const_cgraph_node_set_element
;
300 /* Iterator structure for cgraph node sets. */
305 } cgraph_node_set_iterator
;
307 #define DEFCIFCODE(code, string) CIF_ ## code,
308 /* Reasons for inlining failures. */
310 #include "cif-code.def"
312 } cgraph_inline_failed_t
;
314 struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"))) cgraph_edge
{
315 /* Expected number of executions: calculated in profile.c. */
317 struct cgraph_node
*caller
;
318 struct cgraph_node
*callee
;
319 struct cgraph_edge
*prev_caller
;
320 struct cgraph_edge
*next_caller
;
321 struct cgraph_edge
*prev_callee
;
322 struct cgraph_edge
*next_callee
;
324 PTR
GTY ((skip (""))) aux
;
325 /* When equal to CIF_OK, inline this call. Otherwise, points to the
326 explanation why function was not inlined. */
327 cgraph_inline_failed_t inline_failed
;
328 /* The stmt_uid of call_stmt. This is used by LTO to recover the call_stmt
329 when the function is serialized in. */
330 unsigned int lto_stmt_uid
;
331 /* Expected frequency of executions within the function.
332 When set to CGRAPH_FREQ_BASE, the edge is expected to be called once
333 per function call. The range is 0 to CGRAPH_FREQ_MAX. */
335 /* Unique id of the edge. */
337 /* Depth of loop nest, 1 means no loop nest. */
338 unsigned short int loop_nest
;
339 /* Whether this edge describes a call that was originally indirect. */
340 unsigned int indirect_call
: 1;
341 /* True if the corresponding CALL stmt cannot be inlined. */
342 unsigned int call_stmt_cannot_inline_p
: 1;
343 /* Can this call throw externally? */
344 unsigned int can_throw_external
: 1;
347 #define CGRAPH_FREQ_BASE 1000
348 #define CGRAPH_FREQ_MAX 100000
350 typedef struct cgraph_edge
*cgraph_edge_p
;
352 DEF_VEC_P(cgraph_edge_p
);
353 DEF_VEC_ALLOC_P(cgraph_edge_p
,heap
);
355 /* The varpool data structure.
356 Each static variable decl has assigned varpool_node. */
358 struct GTY((chain_next ("%h.next"))) varpool_node
{
360 /* Pointer to the next function in varpool_nodes. */
361 struct varpool_node
*next
;
362 /* Pointer to the next function in varpool_nodes_queue. */
363 struct varpool_node
*next_needed
;
364 /* Ordering of all cgraph nodes. */
367 /* Set when function must be output - it is externally visible
368 or its address is taken. */
370 /* Needed variables might become dead by optimization. This flag
371 forces the variable to be output even if it appears dead otherwise. */
372 unsigned force_output
: 1;
373 /* Set once the variable has been instantiated and its callee
375 unsigned analyzed
: 1;
376 /* Set once it has been finalized so we consider it to be output. */
377 unsigned finalized
: 1;
378 /* Set when variable is scheduled to be assembled. */
380 /* Set when function is visible by other units. */
381 unsigned externally_visible
: 1;
382 /* Set for aliases once they got through assemble_alias. */
386 /* Every top level asm statement is put into a cgraph_asm_node. */
388 struct GTY(()) cgraph_asm_node
{
390 struct cgraph_asm_node
*next
;
391 /* String for this asm node. */
393 /* Ordering of all cgraph nodes. */
397 extern GTY(()) struct cgraph_node
*cgraph_nodes
;
398 extern GTY(()) int cgraph_n_nodes
;
399 extern GTY(()) int cgraph_max_uid
;
400 extern GTY(()) int cgraph_edge_max_uid
;
401 extern GTY(()) int cgraph_max_pid
;
402 extern bool cgraph_global_info_ready
;
405 /* Callgraph is being constructed. It is safe to add new functions. */
406 CGRAPH_STATE_CONSTRUCTION
,
407 /* Callgraph is built and IPA passes are being run. */
409 /* Callgraph is built and all functions are transformed to SSA form. */
410 CGRAPH_STATE_IPA_SSA
,
411 /* Functions are now ordered and being passed to RTL expanders. */
412 CGRAPH_STATE_EXPANSION
,
413 /* All cgraph expansion is done. */
414 CGRAPH_STATE_FINISHED
416 extern enum cgraph_state cgraph_state
;
417 extern bool cgraph_function_flags_ready
;
418 extern GTY(()) struct cgraph_node
*cgraph_nodes_queue
;
419 extern GTY(()) struct cgraph_node
*cgraph_new_nodes
;
421 extern GTY(()) struct cgraph_asm_node
*cgraph_asm_nodes
;
422 extern GTY(()) int cgraph_order
;
425 void dump_cgraph (FILE *);
426 void debug_cgraph (void);
427 void dump_cgraph_node (FILE *, struct cgraph_node
*);
428 void debug_cgraph_node (struct cgraph_node
*);
429 void cgraph_insert_node_to_hashtable (struct cgraph_node
*node
);
430 void cgraph_remove_edge (struct cgraph_edge
*);
431 void cgraph_remove_node (struct cgraph_node
*);
432 void cgraph_remove_node_and_inline_clones (struct cgraph_node
*);
433 void cgraph_release_function_body (struct cgraph_node
*);
434 void cgraph_node_remove_callees (struct cgraph_node
*node
);
435 struct cgraph_edge
*cgraph_create_edge (struct cgraph_node
*,
436 struct cgraph_node
*,
437 gimple
, gcov_type
, int, int);
439 struct cgraph_node
* cgraph_get_node (tree
);
440 struct cgraph_node
*cgraph_node (tree
);
441 bool cgraph_same_body_alias (tree
, tree
);
442 void cgraph_add_thunk (tree
, tree
, bool, HOST_WIDE_INT
, HOST_WIDE_INT
, tree
, tree
);
443 void cgraph_remove_same_body_alias (struct cgraph_node
*);
444 struct cgraph_node
*cgraph_node_for_asm (tree
);
445 struct cgraph_edge
*cgraph_edge (struct cgraph_node
*, gimple
);
446 void cgraph_set_call_stmt (struct cgraph_edge
*, gimple
);
447 void cgraph_set_call_stmt_including_clones (struct cgraph_node
*, gimple
, gimple
);
448 void cgraph_create_edge_including_clones (struct cgraph_node
*,
449 struct cgraph_node
*,
450 gimple
, gimple
, gcov_type
, int, int,
451 cgraph_inline_failed_t
);
452 void cgraph_update_edges_for_call_stmt (gimple
, tree
, gimple
);
453 struct cgraph_local_info
*cgraph_local_info (tree
);
454 struct cgraph_global_info
*cgraph_global_info (tree
);
455 struct cgraph_rtl_info
*cgraph_rtl_info (tree
);
456 const char * cgraph_node_name (struct cgraph_node
*);
457 struct cgraph_edge
* cgraph_clone_edge (struct cgraph_edge
*,
458 struct cgraph_node
*, gimple
,
459 unsigned, gcov_type
, int, int, bool);
460 struct cgraph_node
* cgraph_clone_node (struct cgraph_node
*, gcov_type
, int,
461 int, bool, VEC(cgraph_edge_p
,heap
) *);
463 void cgraph_redirect_edge_callee (struct cgraph_edge
*, struct cgraph_node
*);
465 struct cgraph_asm_node
*cgraph_add_asm_node (tree
);
467 bool cgraph_function_possibly_inlined_p (tree
);
468 void cgraph_unnest_node (struct cgraph_node
*);
470 enum availability
cgraph_function_body_availability (struct cgraph_node
*);
471 void cgraph_add_new_function (tree
, bool);
472 const char* cgraph_inline_failed_string (cgraph_inline_failed_t
);
473 struct cgraph_node
* cgraph_create_virtual_clone (struct cgraph_node
*old_node
,
474 VEC(cgraph_edge_p
,heap
)*,
475 VEC(ipa_replace_map_p
,gc
)* tree_map
,
476 bitmap args_to_skip
);
478 void cgraph_set_nothrow_flag (struct cgraph_node
*, bool);
479 void cgraph_set_readonly_flag (struct cgraph_node
*, bool);
480 void cgraph_set_pure_flag (struct cgraph_node
*, bool);
481 void cgraph_set_looping_const_or_pure_flag (struct cgraph_node
*, bool);
483 /* In cgraphunit.c */
484 void cgraph_finalize_function (tree
, bool);
485 void cgraph_mark_if_needed (tree
);
486 void cgraph_finalize_compilation_unit (void);
487 void cgraph_optimize (void);
488 void cgraph_mark_needed_node (struct cgraph_node
*);
489 void cgraph_mark_address_taken_node (struct cgraph_node
*);
490 void cgraph_mark_reachable_node (struct cgraph_node
*);
491 bool cgraph_inline_p (struct cgraph_edge
*, cgraph_inline_failed_t
*reason
);
492 bool cgraph_preserve_function_body_p (tree
);
493 void verify_cgraph (void);
494 void verify_cgraph_node (struct cgraph_node
*);
495 void cgraph_build_static_cdtor (char which
, tree body
, int priority
);
496 void cgraph_reset_static_var_maps (void);
497 void init_cgraph (void);
498 struct cgraph_node
*cgraph_function_versioning (struct cgraph_node
*,
499 VEC(cgraph_edge_p
,heap
)*,
500 VEC(ipa_replace_map_p
,gc
)*,
502 void tree_function_versioning (tree
, tree
, VEC (ipa_replace_map_p
,gc
)*, bool, bitmap
);
503 struct cgraph_node
*save_inline_function_body (struct cgraph_node
*);
504 void record_references_in_initializer (tree
, bool);
505 bool cgraph_process_new_functions (void);
507 bool cgraph_decide_is_function_needed (struct cgraph_node
*, tree
);
509 typedef void (*cgraph_edge_hook
)(struct cgraph_edge
*, void *);
510 typedef void (*cgraph_node_hook
)(struct cgraph_node
*, void *);
511 typedef void (*cgraph_2edge_hook
)(struct cgraph_edge
*, struct cgraph_edge
*,
513 typedef void (*cgraph_2node_hook
)(struct cgraph_node
*, struct cgraph_node
*,
515 struct cgraph_edge_hook_list
;
516 struct cgraph_node_hook_list
;
517 struct cgraph_2edge_hook_list
;
518 struct cgraph_2node_hook_list
;
519 struct cgraph_edge_hook_list
*cgraph_add_edge_removal_hook (cgraph_edge_hook
, void *);
520 void cgraph_remove_edge_removal_hook (struct cgraph_edge_hook_list
*);
521 struct cgraph_node_hook_list
*cgraph_add_node_removal_hook (cgraph_node_hook
,
523 void cgraph_remove_node_removal_hook (struct cgraph_node_hook_list
*);
524 struct cgraph_node_hook_list
*cgraph_add_function_insertion_hook (cgraph_node_hook
,
526 void cgraph_remove_function_insertion_hook (struct cgraph_node_hook_list
*);
527 void cgraph_call_function_insertion_hooks (struct cgraph_node
*node
);
528 struct cgraph_2edge_hook_list
*cgraph_add_edge_duplication_hook (cgraph_2edge_hook
, void *);
529 void cgraph_remove_edge_duplication_hook (struct cgraph_2edge_hook_list
*);
530 struct cgraph_2node_hook_list
*cgraph_add_node_duplication_hook (cgraph_2node_hook
, void *);
531 void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list
*);
532 void cgraph_materialize_all_clones (void);
534 /* In cgraphbuild.c */
535 unsigned int rebuild_cgraph_edges (void);
536 void reset_inline_failed (struct cgraph_node
*);
537 int compute_call_stmt_bb_frequency (tree
, basic_block bb
);
540 bool cgraph_remove_unreachable_nodes (bool, FILE *);
541 int cgraph_postorder (struct cgraph_node
**);
542 cgraph_node_set
cgraph_node_set_new (void);
543 cgraph_node_set_iterator
cgraph_node_set_find (cgraph_node_set
,
544 struct cgraph_node
*);
545 void cgraph_node_set_add (cgraph_node_set
, struct cgraph_node
*);
546 void cgraph_node_set_remove (cgraph_node_set
, struct cgraph_node
*);
547 void dump_cgraph_node_set (FILE *, cgraph_node_set
);
548 void debug_cgraph_node_set (cgraph_node_set
);
552 bool cgraph_maybe_hot_edge_p (struct cgraph_edge
*e
);
555 extern GTY(()) struct varpool_node
*varpool_nodes_queue
;
556 extern GTY(()) struct varpool_node
*varpool_nodes
;
558 struct varpool_node
*varpool_node (tree
);
559 struct varpool_node
*varpool_node_for_asm (tree asmname
);
560 void varpool_mark_needed_node (struct varpool_node
*);
561 void debug_varpool (void);
562 void dump_varpool (FILE *);
563 void dump_varpool_node (FILE *, struct varpool_node
*);
565 void varpool_finalize_decl (tree
);
566 bool decide_is_variable_needed (struct varpool_node
*, tree
);
567 enum availability
cgraph_variable_initializer_availability (struct varpool_node
*);
568 void cgraph_make_decl_local (tree
);
569 void cgraph_make_node_local (struct cgraph_node
*);
570 bool cgraph_node_can_be_local_p (struct cgraph_node
*);
572 bool varpool_assemble_pending_decls (void);
573 bool varpool_assemble_decl (struct varpool_node
*node
);
574 bool varpool_analyze_pending_decls (void);
575 void varpool_remove_unreferenced_decls (void);
576 void varpool_empty_needed_queue (void);
577 const char * varpool_node_name (struct varpool_node
*node
);
579 /* Walk all reachable static variables. */
580 #define FOR_EACH_STATIC_VARIABLE(node) \
581 for ((node) = varpool_nodes_queue; (node); (node) = (node)->next_needed)
583 /* Return first reachable static variable with initializer. */
584 static inline struct varpool_node
*
585 varpool_first_static_initializer (void)
587 struct varpool_node
*node
;
588 for (node
= varpool_nodes_queue
; node
; node
= node
->next_needed
)
590 gcc_assert (TREE_CODE (node
->decl
) == VAR_DECL
);
591 if (DECL_INITIAL (node
->decl
))
597 /* Return next reachable static variable with initializer after NODE. */
598 static inline struct varpool_node
*
599 varpool_next_static_initializer (struct varpool_node
*node
)
601 for (node
= node
->next_needed
; node
; node
= node
->next_needed
)
603 gcc_assert (TREE_CODE (node
->decl
) == VAR_DECL
);
604 if (DECL_INITIAL (node
->decl
))
610 /* Walk all static variables with initializer set. */
611 #define FOR_EACH_STATIC_INITIALIZER(node) \
612 for ((node) = varpool_first_static_initializer (); (node); \
613 (node) = varpool_next_static_initializer (node))
615 /* In ipa-inline.c */
616 void cgraph_clone_inlined_nodes (struct cgraph_edge
*, bool, bool);
617 unsigned int compute_inline_parameters (struct cgraph_node
*);
620 /* Create a new static variable of type TYPE. */
621 tree
add_new_static_var (tree type
);
627 /* Must leave 0 for the stopper. */
628 LTO_cgraph_avail_node
= 1,
629 LTO_cgraph_overwritable_node
,
630 LTO_cgraph_unavail_node
,
635 extern const char * LTO_cgraph_tag_names
[LTO_cgraph_last_tag
];
637 #define LCC_NOT_FOUND (-1)
640 /* Return true if iterator CSI points to nothing. */
642 csi_end_p (cgraph_node_set_iterator csi
)
644 return csi
.index
>= VEC_length (cgraph_node_ptr
, csi
.set
->nodes
);
647 /* Advance iterator CSI. */
649 csi_next (cgraph_node_set_iterator
*csi
)
654 /* Return the node pointed to by CSI. */
655 static inline struct cgraph_node
*
656 csi_node (cgraph_node_set_iterator csi
)
658 return VEC_index (cgraph_node_ptr
, csi
.set
->nodes
, csi
.index
);
661 /* Return an iterator to the first node in SET. */
662 static inline cgraph_node_set_iterator
663 csi_start (cgraph_node_set set
)
665 cgraph_node_set_iterator csi
;
672 /* Return true if SET contains NODE. */
674 cgraph_node_in_set_p (struct cgraph_node
*node
, cgraph_node_set set
)
676 cgraph_node_set_iterator csi
;
677 csi
= cgraph_node_set_find (set
, node
);
678 return !csi_end_p (csi
);
681 /* Return number of nodes in SET. */
683 cgraph_node_set_size (cgraph_node_set set
)
685 return htab_elements (set
->hashtab
);
688 /* Uniquize all constants that appear in memory.
689 Each constant in memory thus far output is recorded
690 in `const_desc_table'. */
692 struct GTY(()) constant_descriptor_tree
{
693 /* A MEM for the constant. */
696 /* The value of the constant. */
699 /* Hash of value. Computing the hash from value each time
700 hashfn is called can't work properly, as that means recursive
701 use of the hash table during hash table expansion. */
705 /* Return true when function NODE is only called directly.
706 i.e. it is not externally visible, address was not taken and
707 it is not used in any other non-standard way. */
710 cgraph_only_called_directly_p (struct cgraph_node
*node
)
712 return !node
->needed
&& !node
->local
.externally_visible
;
715 /* Return true when function NODE can be removed from callgraph
716 if all direct calls are eliminated. */
719 cgraph_can_remove_if_no_direct_calls_p (struct cgraph_node
*node
)
721 return (!node
->needed
722 && (DECL_COMDAT (node
->decl
) || !node
->local
.externally_visible
));
725 /* Constant pool accessor function. */
726 htab_t
constant_pool_htab (void);
728 #endif /* GCC_CGRAPH_H */