]> gcc.gnu.org Git - gcc.git/blame - gcc/cgraph.h
loop-doloop.c: Include "target.h".
[gcc.git] / gcc / cgraph.h
CommitLineData
1c4a429a 1/* Callgraph handling code.
ad616de1 2 Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
1c4a429a
JH
3 Contributed by Jan Hubicka
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA. */
21
22#ifndef GCC_CGRAPH_H
23#define GCC_CGRAPH_H
6674a6ce 24#include "tree.h"
e42922b1 25#include "basic-block.h"
1c4a429a 26
dafc5b82 27/* Information about the function collected locally.
25c84396 28 Available after function is analyzed. */
dafc5b82 29
ed2df68b 30struct cgraph_local_info GTY(())
dafc5b82 31{
95c755e9
JH
32 /* Size of the function before inlining. */
33 int self_insns;
6674a6ce 34
e0bb17a8 35 /* Set when function function is visible in current compilation unit only
e2209b03 36 and its address is never taken. */
dafc5b82 37 bool local;
6674a6ce 38
f6981e16
JH
39 /* Set once it has been finalized so we consider it to be output. */
40 bool finalized;
b58b1157 41
b3c3af2f 42 /* False when there something makes inlining impossible (such as va_arg). */
b58b1157 43 bool inlinable;
6674a6ce 44
e2209b03 45 /* True when function should be inlined independently on its size. */
b3c3af2f 46 bool disregard_inline_limits;
6674a6ce 47
95c755e9
JH
48 /* True when the function has been originally extern inline, but it is
49 redefined now. */
50 bool redefined_extern_inline;
6674a6ce
KZ
51
52 /* True if statics_read_for_function and
53 statics_written_for_function contain valid data. */
54 bool for_functions_valid;
8634c649
JJ
55
56 /* True if the function is going to be emitted in some other translation
57 unit, referenced from vtable. */
58 bool vtable_method;
dafc5b82
JH
59};
60
61/* Information about the function that needs to be computed globally
62 once compilation is finished. Available only with -funit-at-time. */
63
ed2df68b 64struct cgraph_global_info GTY(())
dafc5b82 65{
18c6ada9
JH
66 /* For inline clones this points to the function they will be inlined into. */
67 struct cgraph_node *inlined_to;
68
b58b1157
JH
69 /* Estimated size of the function after inlining. */
70 int insns;
71
18c6ada9 72 /* Set iff the function has been inlined at least once. */
1bb17c21 73 bool inlined;
dafc5b82
JH
74};
75
b255a036
JH
76/* Information about the function that is propagated by the RTL backend.
77 Available only for functions that has been already assembled. */
78
ed2df68b 79struct cgraph_rtl_info GTY(())
b255a036 80{
6de9cd9a 81 int preferred_incoming_stack_boundary;
ed2df68b
JH
82 bool const_function;
83 bool pure_function;
b255a036
JH
84};
85
ba228239 86/* The cgraph data structure.
e0bb17a8 87 Each function decl has assigned cgraph_node listing callees and callers. */
1c4a429a 88
d1bd0ded 89struct cgraph_node GTY((chain_next ("%h.next"), chain_prev ("%h.previous")))
1c4a429a
JH
90{
91 tree decl;
92 struct cgraph_edge *callees;
93 struct cgraph_edge *callers;
ed2df68b
JH
94 struct cgraph_node *next;
95 struct cgraph_node *previous;
1c4a429a
JH
96 /* For nested functions points to function the node is nested in. */
97 struct cgraph_node *origin;
98 /* Points to first nested function, if any. */
99 struct cgraph_node *nested;
100 /* Pointer to the next function with same origin, if any. */
101 struct cgraph_node *next_nested;
8bd87c4e
JH
102 /* Pointer to the next function in cgraph_nodes_queue. */
103 struct cgraph_node *next_needed;
18c6ada9
JH
104 /* Pointer to the next clone. */
105 struct cgraph_node *next_clone;
1655dc9d 106 struct cgraph_node *prev_clone;
1431042e 107 PTR GTY ((skip)) aux;
1c4a429a 108
95c755e9
JH
109 struct cgraph_local_info local;
110 struct cgraph_global_info global;
111 struct cgraph_rtl_info rtl;
6674a6ce 112
e42922b1
JH
113 /* Expected number of executions: calculated in profile.c. */
114 gcov_type count;
95c755e9
JH
115 /* Unique id of the node. */
116 int uid;
1c4a429a 117 /* Set when function must be output - it is externally visible
e2209b03 118 or its address is taken. */
1c4a429a
JH
119 bool needed;
120 /* Set when function is reachable by call from other function
e0bb17a8 121 that is either reachable or needed. */
1c4a429a 122 bool reachable;
e21aff8a
SB
123 /* Set once the function is lowered (ie it's CFG is built). */
124 bool lowered;
25c84396
RH
125 /* Set once the function has been instantiated and its callee
126 lists created. */
127 bool analyzed;
1c4a429a
JH
128 /* Set when function is scheduled to be assembled. */
129 bool output;
12527dce
RH
130 /* Set for aliases once they got through assemble_alias. */
131 bool alias;
1c4a429a
JH
132};
133
2563c224 134struct cgraph_edge GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller")))
1c4a429a 135{
ed2df68b
JH
136 struct cgraph_node *caller;
137 struct cgraph_node *callee;
2563c224 138 struct cgraph_edge *prev_caller;
1c4a429a 139 struct cgraph_edge *next_caller;
2563c224 140 struct cgraph_edge *prev_callee;
1c4a429a 141 struct cgraph_edge *next_callee;
18c6ada9
JH
142 tree call_expr;
143 PTR GTY ((skip (""))) aux;
dc0bfe6a
JH
144 /* When NULL, inline this call. When non-NULL, points to the explanation
145 why function was not inlined. */
146 const char *inline_failed;
e42922b1
JH
147 /* Expected number of executions: calculated in profile.c. */
148 gcov_type count;
149 /* Depth of loop nest, 1 means no loop nest. */
150 int loop_nest;
1c4a429a
JH
151};
152
ba228239 153/* The cgraph_varpool data structure.
e69529cd
JH
154 Each static variable decl has assigned cgraph_varpool_node. */
155
ed2df68b 156struct cgraph_varpool_node GTY(())
e69529cd
JH
157{
158 tree decl;
bedb9fc0
RH
159 /* Pointer to the next function in cgraph_varpool_nodes. */
160 struct cgraph_varpool_node *next;
8bd87c4e
JH
161 /* Pointer to the next function in cgraph_varpool_nodes_queue. */
162 struct cgraph_varpool_node *next_needed;
e69529cd
JH
163
164 /* Set when function must be output - it is externally visible
e2209b03 165 or its address is taken. */
e69529cd 166 bool needed;
cd9c7bd2
JH
167 /* Needed variables might become dead by optimization. This flag
168 forces the variable to be output even if it appears dead otherwise. */
169 bool force_output;
170 /* Set once the variable has been instantiated and its callee
171 lists created. */
172 bool analyzed;
e69529cd
JH
173 /* Set once it has been finalized so we consider it to be output. */
174 bool finalized;
175 /* Set when function is scheduled to be assembled. */
176 bool output;
1a612e0a
JJ
177 /* Set for aliases once they got through assemble_alias. */
178 bool alias;
e69529cd
JH
179};
180
ed2df68b
JH
181extern GTY(()) struct cgraph_node *cgraph_nodes;
182extern GTY(()) int cgraph_n_nodes;
b58b1157 183extern GTY(()) int cgraph_max_uid;
dafc5b82 184extern bool cgraph_global_info_ready;
ed2df68b 185extern GTY(()) struct cgraph_node *cgraph_nodes_queue;
1c4a429a 186
cd9c7bd2 187extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_first_unanalyzed_node;
ed2df68b 188extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
e69529cd 189
1c4a429a 190/* In cgraph.c */
439f7bc3 191void dump_cgraph (FILE *);
18c6ada9 192void dump_cgraph_node (FILE *, struct cgraph_node *);
cd9c7bd2
JH
193void dump_varpool (FILE *);
194void dump_cgraph_varpool_node (FILE *, struct cgraph_varpool_node *);
18c6ada9 195void cgraph_remove_edge (struct cgraph_edge *);
439f7bc3 196void cgraph_remove_node (struct cgraph_node *);
2563c224 197void cgraph_node_remove_callees (struct cgraph_node *node);
18c6ada9
JH
198struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
199 struct cgraph_node *,
e42922b1
JH
200 tree, gcov_type, int);
201struct cgraph_node *cgraph_node (tree);
bedb9fc0 202struct cgraph_node *cgraph_node_for_asm (tree asmname);
e42922b1 203struct cgraph_edge *cgraph_edge (struct cgraph_node *, tree);
439f7bc3
AJ
204struct cgraph_local_info *cgraph_local_info (tree);
205struct cgraph_global_info *cgraph_global_info (tree);
206struct cgraph_rtl_info *cgraph_rtl_info (tree);
207const char * cgraph_node_name (struct cgraph_node *);
e42922b1
JH
208struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *, struct cgraph_node *, tree, int, int);
209struct cgraph_node * cgraph_clone_node (struct cgraph_node *, gcov_type, int);
1c4a429a 210
e42922b1 211struct cgraph_varpool_node *cgraph_varpool_node (tree);
bedb9fc0 212struct cgraph_varpool_node *cgraph_varpool_node_for_asm (tree asmname);
e69529cd
JH
213void cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *);
214void cgraph_varpool_finalize_decl (tree);
18c6ada9 215void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *);
e69529cd 216
1bb17c21 217bool cgraph_function_possibly_inlined_p (tree);
e42922b1 218void cgraph_unnest_node (struct cgraph_node *);
cd9c7bd2
JH
219void cgraph_varpool_enqueue_needed_node (struct cgraph_varpool_node *);
220void cgraph_varpool_reset_queue (void);
221bool decide_is_variable_needed (struct cgraph_varpool_node *, tree);
1bb17c21 222
1c4a429a 223/* In cgraphunit.c */
f6d1b84a 224bool cgraph_assemble_pending_functions (void);
cd9c7bd2 225bool cgraph_varpool_assemble_pending_decls (void);
6b00c969 226void cgraph_finalize_function (tree, bool);
e21aff8a 227void cgraph_lower_function (struct cgraph_node *);
439f7bc3 228void cgraph_finalize_compilation_unit (void);
439f7bc3 229void cgraph_optimize (void);
8dafba3c
RH
230void cgraph_mark_needed_node (struct cgraph_node *);
231void cgraph_mark_reachable_node (struct cgraph_node *);
18c6ada9
JH
232bool cgraph_inline_p (struct cgraph_edge *, const char **reason);
233bool cgraph_preserve_function_body_p (tree);
234void verify_cgraph (void);
235void verify_cgraph_node (struct cgraph_node *);
236void cgraph_mark_inline_edge (struct cgraph_edge *e);
237void cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate);
35b6fdcf 238void cgraph_build_static_cdtor (char which, tree body, int priority);
6674a6ce 239void cgraph_reset_static_var_maps (void);
9b3e897d 240void init_cgraph (void);
1c4a429a 241
ca31b95f
JH
242/* In ipa.c */
243bool cgraph_remove_unreachable_nodes (bool, FILE *);
244int cgraph_postorder (struct cgraph_node **);
245
246/* In ipa-inline.c */
247void cgraph_decide_inlining_incrementally (struct cgraph_node *);
248void cgraph_clone_inlined_nodes (struct cgraph_edge *, bool);
249void cgraph_mark_inline_edge (struct cgraph_edge *);
250bool cgraph_default_inline_p (struct cgraph_node *);
1c4a429a 251#endif /* GCC_CGRAPH_H */
This page took 0.659333 seconds and 5 git commands to generate.