Fix DealII type problems.
[official-gcc/Ramakrishna.git] / gcc / cgraph.h
bloba683c5bc97092ec2f37fe91b085e69a988a28a14
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
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
24 #include "tree.h"
25 #include "basic-block.h"
27 enum availability
29 /* Not yet set by cgraph_function_body_availability. */
30 AVAIL_UNSET,
31 /* Function body/variable initializer is unknown. */
32 AVAIL_NOT_AVAILABLE,
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. */
38 AVAIL_OVERWRITABLE,
39 /* Function body/variable initializer is known and will be used in final
40 program. */
41 AVAIL_AVAILABLE,
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. */
46 AVAIL_LOCAL
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. */
63 int self_size;
64 /* How many instructions are likely going to disappear after inlining. */
65 int size_inlining_benefit;
66 /* Estimated time spent executing the function body. */
67 int self_time;
68 /* How much time is going to be saved by inlining. */
69 int time_inlining_benefit;
72 /* Information about the function collected locally.
73 Available after function is analyzed. */
75 struct GTY(()) cgraph_local_info {
76 /* File stream where this node is being written to. */
77 struct lto_file_decl_data * GTY ((skip)) lto_file_data;
79 struct inline_summary inline_summary;
81 /* Set when function function is visible in current compilation unit only
82 and its address is never taken. */
83 unsigned local : 1;
85 /* Set when function is visible by other units. */
86 unsigned externally_visible : 1;
88 /* Set once it has been finalized so we consider it to be output. */
89 unsigned finalized : 1;
91 /* False when there something makes inlining impossible (such as va_arg). */
92 unsigned inlinable : 1;
94 /* True when function should be inlined independently on its size. */
95 unsigned disregard_inline_limits : 1;
97 /* True when the function has been originally extern inline, but it is
98 redefined now. */
99 unsigned redefined_extern_inline : 1;
101 /* True if statics_read_for_function and
102 statics_written_for_function contain valid data. */
103 unsigned for_functions_valid : 1;
105 /* True if the function is going to be emitted in some other translation
106 unit, referenced from vtable. */
107 unsigned vtable_method : 1;
110 /* Information about the function that needs to be computed globally
111 once compilation is finished. Available only with -funit-at-a-time. */
113 struct GTY(()) cgraph_global_info {
114 /* Estimated stack frame consumption by the function. */
115 HOST_WIDE_INT estimated_stack_size;
116 /* Expected offset of the stack frame of inlined function. */
117 HOST_WIDE_INT stack_frame_offset;
119 /* For inline clones this points to the function they will be
120 inlined into. */
121 struct cgraph_node *inlined_to;
123 /* Estimated size of the function after inlining. */
124 int time;
125 int size;
127 /* Estimated growth after inlining. INT_MIN if not computed. */
128 int estimated_growth;
130 /* Set iff the function has been inlined at least once. */
131 bool inlined;
134 /* Information about the function that is propagated by the RTL backend.
135 Available only for functions that has been already assembled. */
137 struct GTY(()) cgraph_rtl_info {
138 unsigned int preferred_incoming_stack_boundary;
141 /* Represent which DECL tree (or reference to such tree)
142 will be replaced by another tree while versioning. */
143 struct GTY(()) ipa_replace_map
145 /* The tree that will be replaced. */
146 tree old_tree;
147 /* The new (replacing) tree. */
148 tree new_tree;
149 /* True when a substitution should be done, false otherwise. */
150 bool replace_p;
151 /* True when we replace a reference to old_tree. */
152 bool ref_p;
154 typedef struct ipa_replace_map *ipa_replace_map_p;
155 DEF_VEC_P(ipa_replace_map_p);
156 DEF_VEC_ALLOC_P(ipa_replace_map_p,gc);
158 struct GTY(()) cgraph_clone_info
160 VEC(ipa_replace_map_p,gc)* tree_map;
161 bitmap args_to_skip;
162 bitmap combined_args_to_skip;
165 /* The cgraph data structure.
166 Each function decl has assigned cgraph_node listing callees and callers. */
168 struct GTY((chain_next ("%h.next"), chain_prev ("%h.previous"))) cgraph_node {
169 tree decl;
170 struct cgraph_edge *callees;
171 struct cgraph_edge *callers;
172 struct cgraph_node *next;
173 struct cgraph_node *previous;
174 /* For nested functions points to function the node is nested in. */
175 struct cgraph_node *origin;
176 /* Points to first nested function, if any. */
177 struct cgraph_node *nested;
178 /* Pointer to the next function with same origin, if any. */
179 struct cgraph_node *next_nested;
180 /* Pointer to the next function in cgraph_nodes_queue. */
181 struct cgraph_node *next_needed;
182 /* Pointer to the next clone. */
183 struct cgraph_node *next_sibling_clone;
184 struct cgraph_node *prev_sibling_clone;
185 struct cgraph_node *clones;
186 struct cgraph_node *clone_of;
187 /* For normal nodes pointer to the list of alias nodes, in alias
188 nodes pointer to the normal node. */
189 struct cgraph_node *same_body;
190 /* For functions with many calls sites it holds map from call expression
191 to the edge to speed up cgraph_edge function. */
192 htab_t GTY((param_is (struct cgraph_edge))) call_site_hash;
194 PTR GTY ((skip)) aux;
196 /* Interprocedural passes scheduled to have their transform functions
197 applied next time we execute local pass on them. We maintain it
198 per-function in order to allow IPA passes to introduce new functions. */
199 VEC(ipa_opt_pass,heap) * GTY((skip)) ipa_transforms_to_apply;
201 struct cgraph_local_info local;
202 struct cgraph_global_info global;
203 struct cgraph_rtl_info rtl;
204 struct cgraph_clone_info clone;
206 /* Expected number of executions: calculated in profile.c. */
207 gcov_type count;
208 /* Unique id of the node. */
209 int uid;
210 /* Ordering of all cgraph nodes. */
211 int order;
213 /* unique id for profiling. pid is not suitable because of different
214 number of cfg nodes with -fprofile-generate and -fprofile-use */
215 int pid;
217 /* Set when function must be output for some reason. The primary
218 use of this flag is to mark functions needed to be output for
219 non-standard reason. Functions that are externally visible
220 or reachable from functions needed to be output are marked
221 by specialized flags. */
222 unsigned needed : 1;
223 /* Set when function has address taken.
224 In current implementation it imply needed flag. */
225 unsigned address_taken : 1;
226 /* Set when decl is an abstract function pointed to by the
227 ABSTRACT_DECL_ORIGIN of a reachable function. */
228 unsigned abstract_and_needed : 1;
229 /* Set when function is reachable by call from other function
230 that is either reachable or needed.
231 This flag is computed at original cgraph construction and then
232 updated in cgraph_remove_unreachable_nodes. Note that after
233 cgraph_remove_unreachable_nodes cgraph still can contain unreachable
234 nodes when they are needed for virtual clone instantiation. */
235 unsigned reachable : 1;
236 /* Set once the function is lowered (i.e. its CFG is built). */
237 unsigned lowered : 1;
238 /* Set once the function has been instantiated and its callee
239 lists created. */
240 unsigned analyzed : 1;
241 /* Set when function is scheduled to be processed by local passes. */
242 unsigned process : 1;
243 /* Set for aliases once they got through assemble_alias. */
244 unsigned alias : 1;
245 /* Set for nodes that was constructed and finalized by frontend. */
246 unsigned finalized_by_frontend : 1;
247 /* Set for alias nodes, same_body points to the node they are alias of
248 and they are linked through the next/previous pointers. */
249 unsigned same_body_alias : 1;
252 typedef struct cgraph_node *cgraph_node_ptr;
254 DEF_VEC_P(cgraph_node_ptr);
255 DEF_VEC_ALLOC_P(cgraph_node_ptr,heap);
256 DEF_VEC_ALLOC_P(cgraph_node_ptr,gc);
258 /* A cgraph node set is a collection of cgraph nodes. A cgraph node
259 can appear in multiple sets. */
260 struct GTY(()) cgraph_node_set_def
262 htab_t GTY((param_is (struct cgraph_node_set_element_def))) hashtab;
263 VEC(cgraph_node_ptr, gc) *nodes;
264 PTR GTY ((skip)) aux;
267 typedef struct cgraph_node_set_def *cgraph_node_set;
269 DEF_VEC_P(cgraph_node_set);
270 DEF_VEC_ALLOC_P(cgraph_node_set,gc);
271 DEF_VEC_ALLOC_P(cgraph_node_set,heap);
273 /* A cgraph node set element contains an index in the vector of nodes in
274 the set. */
275 struct GTY(()) cgraph_node_set_element_def
277 struct cgraph_node *node;
278 HOST_WIDE_INT index;
281 typedef struct cgraph_node_set_element_def *cgraph_node_set_element;
282 typedef const struct cgraph_node_set_element_def *const_cgraph_node_set_element;
284 /* Iterator structure for cgraph node sets. */
285 typedef struct
287 cgraph_node_set set;
288 unsigned index;
289 } cgraph_node_set_iterator;
291 #define DEFCIFCODE(code, string) CIF_ ## code,
292 /* Reasons for inlining failures. */
293 typedef enum {
294 #include "cif-code.def"
295 CIF_N_REASONS
296 } cgraph_inline_failed_t;
298 struct GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller"))) cgraph_edge {
299 struct cgraph_node *caller;
300 struct cgraph_node *callee;
301 struct cgraph_edge *prev_caller;
302 struct cgraph_edge *next_caller;
303 struct cgraph_edge *prev_callee;
304 struct cgraph_edge *next_callee;
305 gimple call_stmt;
306 /* The stmt_uid of this call stmt. This is used by LTO to recover
307 the call_stmt when the function is serialized in. */
308 unsigned int lto_stmt_uid;
309 PTR GTY ((skip (""))) aux;
310 /* When equal to CIF_OK, inline this call. Otherwise, points to the
311 explanation why function was not inlined. */
312 cgraph_inline_failed_t inline_failed;
313 /* Expected number of executions: calculated in profile.c. */
314 gcov_type count;
315 /* Expected frequency of executions within the function.
316 When set to CGRAPH_FREQ_BASE, the edge is expected to be called once
317 per function call. The range is 0 to CGRAPH_FREQ_MAX. */
318 int frequency;
319 /* Depth of loop nest, 1 means no loop nest. */
320 unsigned int loop_nest : 30;
321 /* Whether this edge describes a call that was originally indirect. */
322 unsigned int indirect_call : 1;
323 /* True if the corresponding CALL stmt cannot be inlined. */
324 unsigned int call_stmt_cannot_inline_p : 1;
325 /* Can this call throw externally? */
326 unsigned int can_throw_external : 1;
327 /* Unique id of the edge. */
328 int uid;
331 #define CGRAPH_FREQ_BASE 1000
332 #define CGRAPH_FREQ_MAX 100000
334 typedef struct cgraph_edge *cgraph_edge_p;
336 DEF_VEC_P(cgraph_edge_p);
337 DEF_VEC_ALLOC_P(cgraph_edge_p,heap);
339 /* The varpool data structure.
340 Each static variable decl has assigned varpool_node. */
342 struct GTY((chain_next ("%h.next"))) varpool_node {
343 tree decl;
344 /* Pointer to the next function in varpool_nodes. */
345 struct varpool_node *next;
346 /* Pointer to the next function in varpool_nodes_queue. */
347 struct varpool_node *next_needed;
348 /* Ordering of all cgraph nodes. */
349 int order;
351 /* Set when function must be output - it is externally visible
352 or its address is taken. */
353 unsigned needed : 1;
354 /* Needed variables might become dead by optimization. This flag
355 forces the variable to be output even if it appears dead otherwise. */
356 unsigned force_output : 1;
357 /* Set once the variable has been instantiated and its callee
358 lists created. */
359 unsigned analyzed : 1;
360 /* Set once it has been finalized so we consider it to be output. */
361 unsigned finalized : 1;
362 /* Set when variable is scheduled to be assembled. */
363 unsigned output : 1;
364 /* Set when function is visible by other units. */
365 unsigned externally_visible : 1;
366 /* Set for aliases once they got through assemble_alias. */
367 unsigned alias : 1;
370 /* Every top level asm statement is put into a cgraph_asm_node. */
372 struct GTY(()) cgraph_asm_node {
373 /* Next asm node. */
374 struct cgraph_asm_node *next;
375 /* String for this asm node. */
376 tree asm_str;
377 /* Ordering of all cgraph nodes. */
378 int order;
381 extern GTY(()) struct cgraph_node *cgraph_nodes;
382 extern GTY(()) int cgraph_n_nodes;
383 extern GTY(()) int cgraph_max_uid;
384 extern GTY(()) int cgraph_edge_max_uid;
385 extern GTY(()) int cgraph_max_pid;
386 extern bool cgraph_global_info_ready;
387 enum cgraph_state
389 /* Callgraph is being constructed. It is safe to add new functions. */
390 CGRAPH_STATE_CONSTRUCTION,
391 /* Callgraph is built and IPA passes are being run. */
392 CGRAPH_STATE_IPA,
393 /* Callgraph is built and all functions are transformed to SSA form. */
394 CGRAPH_STATE_IPA_SSA,
395 /* Functions are now ordered and being passed to RTL expanders. */
396 CGRAPH_STATE_EXPANSION,
397 /* All cgraph expansion is done. */
398 CGRAPH_STATE_FINISHED
400 extern enum cgraph_state cgraph_state;
401 extern bool cgraph_function_flags_ready;
402 extern GTY(()) struct cgraph_node *cgraph_nodes_queue;
403 extern GTY(()) struct cgraph_node *cgraph_new_nodes;
405 extern GTY(()) struct cgraph_asm_node *cgraph_asm_nodes;
406 extern GTY(()) int cgraph_order;
408 /* In cgraph.c */
409 void dump_cgraph (FILE *);
410 void debug_cgraph (void);
411 void dump_cgraph_node (FILE *, struct cgraph_node *);
412 void debug_cgraph_node (struct cgraph_node *);
413 void cgraph_insert_node_to_hashtable (struct cgraph_node *node);
414 void cgraph_remove_edge (struct cgraph_edge *);
415 void cgraph_remove_node (struct cgraph_node *);
416 void cgraph_remove_node_and_inline_clones (struct cgraph_node *);
417 void cgraph_release_function_body (struct cgraph_node *);
418 void cgraph_node_remove_callees (struct cgraph_node *node);
419 struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
420 struct cgraph_node *,
421 gimple, gcov_type, int, int);
423 struct cgraph_node * cgraph_get_node (tree);
424 struct cgraph_node *cgraph_node (tree);
425 bool cgraph_same_body_alias (tree, tree);
426 void cgraph_remove_same_body_alias (struct cgraph_node *);
427 struct cgraph_node *cgraph_node_for_asm (tree);
428 struct cgraph_edge *cgraph_edge (struct cgraph_node *, gimple);
429 void cgraph_set_call_stmt (struct cgraph_edge *, gimple);
430 void cgraph_set_call_stmt_including_clones (struct cgraph_node *, gimple, gimple);
431 void cgraph_create_edge_including_clones (struct cgraph_node *,
432 struct cgraph_node *,
433 gimple, gcov_type, int, int,
434 cgraph_inline_failed_t);
435 void cgraph_update_edges_for_call_stmt (gimple, tree, gimple);
436 struct cgraph_local_info *cgraph_local_info (tree);
437 struct cgraph_global_info *cgraph_global_info (tree);
438 struct cgraph_rtl_info *cgraph_rtl_info (tree);
439 const char * cgraph_node_name (struct cgraph_node *);
440 struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *,
441 struct cgraph_node *, gimple,
442 unsigned, gcov_type, int, int, bool);
443 struct cgraph_node * cgraph_clone_node (struct cgraph_node *, gcov_type, int,
444 int, bool, VEC(cgraph_edge_p,heap) *);
446 void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *);
448 struct cgraph_asm_node *cgraph_add_asm_node (tree);
450 bool cgraph_function_possibly_inlined_p (tree);
451 void cgraph_unnest_node (struct cgraph_node *);
453 enum availability cgraph_function_body_availability (struct cgraph_node *);
454 void cgraph_add_new_function (tree, bool);
455 const char* cgraph_inline_failed_string (cgraph_inline_failed_t);
456 struct cgraph_node * cgraph_create_virtual_clone (struct cgraph_node *old_node,
457 VEC(cgraph_edge_p,heap)*,
458 VEC(ipa_replace_map_p,gc)* tree_map,
459 bitmap args_to_skip);
461 /* In cgraphunit.c */
462 void cgraph_finalize_function (tree, bool);
463 void cgraph_mark_if_needed (tree);
464 void cgraph_finalize_compilation_unit (void);
465 void cgraph_optimize (void);
466 void cgraph_mark_needed_node (struct cgraph_node *);
467 void cgraph_mark_address_taken_node (struct cgraph_node *);
468 void cgraph_mark_reachable_node (struct cgraph_node *);
469 bool cgraph_inline_p (struct cgraph_edge *, cgraph_inline_failed_t *reason);
470 bool cgraph_preserve_function_body_p (tree);
471 void verify_cgraph (void);
472 void verify_cgraph_node (struct cgraph_node *);
473 void cgraph_build_static_cdtor (char which, tree body, int priority);
474 void cgraph_reset_static_var_maps (void);
475 void init_cgraph (void);
476 struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
477 VEC(cgraph_edge_p,heap)*,
478 VEC(ipa_replace_map_p,gc)*,
479 bitmap);
480 void tree_function_versioning (tree, tree, VEC (ipa_replace_map_p,gc)*, bool, bitmap);
481 struct cgraph_node *save_inline_function_body (struct cgraph_node *);
482 void record_references_in_initializer (tree, bool);
483 bool cgraph_process_new_functions (void);
485 bool cgraph_decide_is_function_needed (struct cgraph_node *, tree);
487 typedef void (*cgraph_edge_hook)(struct cgraph_edge *, void *);
488 typedef void (*cgraph_node_hook)(struct cgraph_node *, void *);
489 typedef void (*cgraph_2edge_hook)(struct cgraph_edge *, struct cgraph_edge *,
490 void *);
491 typedef void (*cgraph_2node_hook)(struct cgraph_node *, struct cgraph_node *,
492 void *);
493 struct cgraph_edge_hook_list;
494 struct cgraph_node_hook_list;
495 struct cgraph_2edge_hook_list;
496 struct cgraph_2node_hook_list;
497 struct cgraph_edge_hook_list *cgraph_add_edge_removal_hook (cgraph_edge_hook, void *);
498 void cgraph_remove_edge_removal_hook (struct cgraph_edge_hook_list *);
499 struct cgraph_node_hook_list *cgraph_add_node_removal_hook (cgraph_node_hook,
500 void *);
501 void cgraph_remove_node_removal_hook (struct cgraph_node_hook_list *);
502 struct cgraph_node_hook_list *cgraph_add_function_insertion_hook (cgraph_node_hook,
503 void *);
504 void cgraph_remove_function_insertion_hook (struct cgraph_node_hook_list *);
505 void cgraph_call_function_insertion_hooks (struct cgraph_node *node);
506 struct cgraph_2edge_hook_list *cgraph_add_edge_duplication_hook (cgraph_2edge_hook, void *);
507 void cgraph_remove_edge_duplication_hook (struct cgraph_2edge_hook_list *);
508 struct cgraph_2node_hook_list *cgraph_add_node_duplication_hook (cgraph_2node_hook, void *);
509 void cgraph_remove_node_duplication_hook (struct cgraph_2node_hook_list *);
510 void cgraph_materialize_all_clones (void);
512 /* In cgraphbuild.c */
513 unsigned int rebuild_cgraph_edges (void);
514 void reset_inline_failed (struct cgraph_node *);
515 int compute_call_stmt_bb_frequency (tree, basic_block bb);
517 /* In ipa.c */
518 bool cgraph_remove_unreachable_nodes (bool, FILE *);
519 int cgraph_postorder (struct cgraph_node **);
520 cgraph_node_set cgraph_node_set_new (void);
521 cgraph_node_set_iterator cgraph_node_set_find (cgraph_node_set,
522 struct cgraph_node *);
523 void cgraph_node_set_add (cgraph_node_set, struct cgraph_node *);
524 void cgraph_node_set_remove (cgraph_node_set, struct cgraph_node *);
525 void dump_cgraph_node_set (FILE *, cgraph_node_set);
526 void debug_cgraph_node_set (cgraph_node_set);
529 /* In predict.c */
530 bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e);
532 /* In varpool.c */
533 extern GTY(()) struct varpool_node *varpool_nodes_queue;
534 extern GTY(()) struct varpool_node *varpool_nodes;
536 struct varpool_node *varpool_node (tree);
537 struct varpool_node *varpool_node_for_asm (tree asmname);
538 void varpool_mark_needed_node (struct varpool_node *);
539 void debug_varpool (void);
540 void dump_varpool (FILE *);
541 void dump_varpool_node (FILE *, struct varpool_node *);
543 void varpool_finalize_decl (tree);
544 bool decide_is_variable_needed (struct varpool_node *, tree);
545 enum availability cgraph_variable_initializer_availability (struct varpool_node *);
546 void cgraph_make_node_local (struct cgraph_node *);
547 bool cgraph_node_can_be_local_p (struct cgraph_node *);
549 bool varpool_assemble_pending_decls (void);
550 bool varpool_assemble_decl (struct varpool_node *node);
551 bool varpool_analyze_pending_decls (void);
552 void varpool_remove_unreferenced_decls (void);
553 void varpool_empty_needed_queue (void);
554 const char * varpool_node_name (struct varpool_node *node);
556 /* Walk all reachable static variables. */
557 #define FOR_EACH_STATIC_VARIABLE(node) \
558 for ((node) = varpool_nodes_queue; (node); (node) = (node)->next_needed)
560 /* Return first reachable static variable with initializer. */
561 static inline struct varpool_node *
562 varpool_first_static_initializer (void)
564 struct varpool_node *node;
565 for (node = varpool_nodes_queue; node; node = node->next_needed)
567 gcc_assert (TREE_CODE (node->decl) == VAR_DECL);
568 if (DECL_INITIAL (node->decl))
569 return node;
571 return NULL;
574 /* Return next reachable static variable with initializer after NODE. */
575 static inline struct varpool_node *
576 varpool_next_static_initializer (struct varpool_node *node)
578 for (node = node->next_needed; node; node = node->next_needed)
580 gcc_assert (TREE_CODE (node->decl) == VAR_DECL);
581 if (DECL_INITIAL (node->decl))
582 return node;
584 return NULL;
587 /* Walk all static variables with initializer set. */
588 #define FOR_EACH_STATIC_INITIALIZER(node) \
589 for ((node) = varpool_first_static_initializer (); (node); \
590 (node) = varpool_next_static_initializer (node))
592 /* In ipa-inline.c */
593 void cgraph_clone_inlined_nodes (struct cgraph_edge *, bool, bool);
594 unsigned int compute_inline_parameters (struct cgraph_node *);
597 /* Create a new static variable of type TYPE. */
598 tree add_new_static_var (tree type);
600 /* lto-cgraph.c */
602 enum LTO_cgraph_tags
604 /* Must leave 0 for the stopper. */
605 LTO_cgraph_avail_node = 1,
606 LTO_cgraph_overwritable_node,
607 LTO_cgraph_unavail_node,
608 LTO_cgraph_edge,
609 LTO_cgraph_last_tag
612 extern const char * LTO_cgraph_tag_names[LTO_cgraph_last_tag];
614 #define LCC_NOT_FOUND (-1)
617 /* Return true if iterator CSI points to nothing. */
618 static inline bool
619 csi_end_p (cgraph_node_set_iterator csi)
621 return csi.index >= VEC_length (cgraph_node_ptr, csi.set->nodes);
624 /* Advance iterator CSI. */
625 static inline void
626 csi_next (cgraph_node_set_iterator *csi)
628 csi->index++;
631 /* Return the node pointed to by CSI. */
632 static inline struct cgraph_node *
633 csi_node (cgraph_node_set_iterator csi)
635 return VEC_index (cgraph_node_ptr, csi.set->nodes, csi.index);
638 /* Return an iterator to the first node in SET. */
639 static inline cgraph_node_set_iterator
640 csi_start (cgraph_node_set set)
642 cgraph_node_set_iterator csi;
644 csi.set = set;
645 csi.index = 0;
646 return csi;
649 /* Return true if SET contains NODE. */
650 static inline bool
651 cgraph_node_in_set_p (struct cgraph_node *node, cgraph_node_set set)
653 cgraph_node_set_iterator csi;
654 csi = cgraph_node_set_find (set, node);
655 return !csi_end_p (csi);
658 /* Return number of nodes in SET. */
659 static inline size_t
660 cgraph_node_set_size (cgraph_node_set set)
662 return htab_elements (set->hashtab);
665 /* Uniquize all constants that appear in memory.
666 Each constant in memory thus far output is recorded
667 in `const_desc_table'. */
669 struct GTY(()) constant_descriptor_tree {
670 /* A MEM for the constant. */
671 rtx rtl;
673 /* The value of the constant. */
674 tree value;
676 /* Hash of value. Computing the hash from value each time
677 hashfn is called can't work properly, as that means recursive
678 use of the hash table during hash table expansion. */
679 hashval_t hash;
682 /* Return true when function NODE is only called directly.
683 i.e. it is not externally visible, address was not taken and
684 it is not used in any other non-standard way. */
686 static inline bool
687 cgraph_only_called_directly_p (struct cgraph_node *node)
689 return !node->needed && !node->local.externally_visible;
692 /* Return true when function NODE can be removed from callgraph
693 if all direct calls are eliminated. */
695 static inline bool
696 cgraph_can_remove_if_no_direct_calls_p (struct cgraph_node *node)
698 return (!node->needed
699 && (DECL_COMDAT (node->decl) || !node->local.externally_visible));
702 /* Constant pool accessor function. */
703 htab_t constant_pool_htab (void);
705 #endif /* GCC_CGRAPH_H */