* varasm.c (assemble_start_function): Remove reset of in_section.
[official-gcc.git] / gcc / cgraph.h
blobe701e5625f13e45019bcc0cbe77cb2eaf519fe66
1 /* Callgraph handling code.
2 Copyright (C) 2003, 2004, 2005 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 2, 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 COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
22 #ifndef GCC_CGRAPH_H
23 #define GCC_CGRAPH_H
24 #include "tree.h"
26 /* Information about the function collected locally.
27 Available after function is analyzed. */
29 struct cgraph_local_info GTY(())
31 /* Size of the function before inlining. */
32 int self_insns;
34 /* Set when function function is visible in current compilation unit only
35 and its address is never taken. */
36 bool local;
38 /* Set once it has been finalized so we consider it to be output. */
39 bool finalized;
41 /* False when there something makes inlining impossible (such as va_arg). */
42 bool inlinable;
44 /* True when function should be inlined independently on its size. */
45 bool disregard_inline_limits;
47 /* True when the function has been originally extern inline, but it is
48 redefined now. */
49 bool redefined_extern_inline;
51 /* True if statics_read_for_function and
52 statics_written_for_function contain valid data. */
53 bool for_functions_valid;
56 /* Information about the function that needs to be computed globally
57 once compilation is finished. Available only with -funit-at-time. */
59 struct cgraph_global_info GTY(())
61 /* For inline clones this points to the function they will be inlined into. */
62 struct cgraph_node *inlined_to;
64 /* Estimated size of the function after inlining. */
65 int insns;
67 /* Set iff the function has been inlined at least once. */
68 bool inlined;
71 /* Information about the function that is propagated by the RTL backend.
72 Available only for functions that has been already assembled. */
74 struct cgraph_rtl_info GTY(())
76 int preferred_incoming_stack_boundary;
77 bool const_function;
78 bool pure_function;
81 /* The cgraph data structure.
82 Each function decl has assigned cgraph_node listing callees and callers. */
84 struct cgraph_node GTY((chain_next ("%h.next"), chain_prev ("%h.previous")))
86 tree decl;
87 struct cgraph_edge *callees;
88 struct cgraph_edge *callers;
89 struct cgraph_node *next;
90 struct cgraph_node *previous;
91 /* For nested functions points to function the node is nested in. */
92 struct cgraph_node *origin;
93 /* Points to first nested function, if any. */
94 struct cgraph_node *nested;
95 /* Pointer to the next function with same origin, if any. */
96 struct cgraph_node *next_nested;
97 /* Pointer to the next function in cgraph_nodes_queue. */
98 struct cgraph_node *next_needed;
99 /* Pointer to the next clone. */
100 struct cgraph_node *next_clone;
101 struct cgraph_node *prev_clone;
102 PTR GTY ((skip)) aux;
104 struct cgraph_local_info local;
105 struct cgraph_global_info global;
106 struct cgraph_rtl_info rtl;
108 /* Unique id of the node. */
109 int uid;
110 /* Set when function must be output - it is externally visible
111 or its address is taken. */
112 bool needed;
113 /* Set when function is reachable by call from other function
114 that is either reachable or needed. */
115 bool reachable;
116 /* Set once the function has been instantiated and its callee
117 lists created. */
118 bool analyzed;
119 /* Set when function is scheduled to be assembled. */
120 bool output;
121 /* Set for aliases once they got through assemble_alias. */
122 bool alias;
125 struct cgraph_edge GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller")))
127 struct cgraph_node *caller;
128 struct cgraph_node *callee;
129 struct cgraph_edge *prev_caller;
130 struct cgraph_edge *next_caller;
131 struct cgraph_edge *prev_callee;
132 struct cgraph_edge *next_callee;
133 tree call_expr;
134 PTR GTY ((skip (""))) aux;
135 /* When NULL, inline this call. When non-NULL, points to the explanation
136 why function was not inlined. */
137 const char *inline_failed;
140 /* The cgraph_varpool data structure.
141 Each static variable decl has assigned cgraph_varpool_node. */
143 struct cgraph_varpool_node GTY(())
145 tree decl;
146 /* Pointer to the next function in cgraph_varpool_nodes. */
147 struct cgraph_varpool_node *next;
148 /* Pointer to the next function in cgraph_varpool_nodes_queue. */
149 struct cgraph_varpool_node *next_needed;
151 /* Set when function must be output - it is externally visible
152 or its address is taken. */
153 bool needed;
154 /* Needed variables might become dead by optimization. This flag
155 forces the variable to be output even if it appears dead otherwise. */
156 bool force_output;
157 /* Set once the variable has been instantiated and its callee
158 lists created. */
159 bool analyzed;
160 /* Set once it has been finalized so we consider it to be output. */
161 bool finalized;
162 /* Set when function is scheduled to be assembled. */
163 bool output;
164 /* Set for aliases once they got through assemble_alias. */
165 bool alias;
168 extern GTY(()) struct cgraph_node *cgraph_nodes;
169 extern GTY(()) int cgraph_n_nodes;
170 extern GTY(()) int cgraph_max_uid;
171 extern bool cgraph_global_info_ready;
172 extern GTY(()) struct cgraph_node *cgraph_nodes_queue;
174 extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_first_unanalyzed_node;
175 extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
177 /* In cgraph.c */
178 void dump_cgraph (FILE *);
179 void dump_cgraph_node (FILE *, struct cgraph_node *);
180 void dump_varpool (FILE *);
181 void dump_cgraph_varpool_node (FILE *, struct cgraph_varpool_node *);
182 void cgraph_remove_edge (struct cgraph_edge *);
183 void cgraph_remove_node (struct cgraph_node *);
184 void cgraph_node_remove_callees (struct cgraph_node *node);
185 struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
186 struct cgraph_node *,
187 tree);
188 struct cgraph_node *cgraph_node (tree decl);
189 struct cgraph_node *cgraph_node_for_asm (tree asmname);
190 struct cgraph_edge *cgraph_edge (struct cgraph_node *, tree call_expr);
191 struct cgraph_local_info *cgraph_local_info (tree);
192 struct cgraph_global_info *cgraph_global_info (tree);
193 struct cgraph_rtl_info *cgraph_rtl_info (tree);
194 const char * cgraph_node_name (struct cgraph_node *);
195 struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *, struct cgraph_node *, tree);
196 struct cgraph_node * cgraph_clone_node (struct cgraph_node *);
198 struct cgraph_varpool_node *cgraph_varpool_node (tree decl);
199 struct cgraph_varpool_node *cgraph_varpool_node_for_asm (tree asmname);
200 void cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *);
201 void cgraph_varpool_finalize_decl (tree);
202 void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *);
204 bool cgraph_function_possibly_inlined_p (tree);
205 void cgraph_unnest_node (struct cgraph_node *node);
206 void cgraph_varpool_enqueue_needed_node (struct cgraph_varpool_node *);
207 void cgraph_varpool_reset_queue (void);
208 bool decide_is_variable_needed (struct cgraph_varpool_node *, tree);
210 /* In cgraphunit.c */
211 bool cgraph_assemble_pending_functions (void);
212 bool cgraph_varpool_assemble_pending_decls (void);
213 void cgraph_finalize_function (tree, bool);
214 void cgraph_finalize_compilation_unit (void);
215 void cgraph_create_edges (struct cgraph_node *, tree);
216 void cgraph_optimize (void);
217 void cgraph_mark_needed_node (struct cgraph_node *);
218 void cgraph_mark_reachable_node (struct cgraph_node *);
219 bool cgraph_inline_p (struct cgraph_edge *, const char **reason);
220 bool cgraph_preserve_function_body_p (tree);
221 void verify_cgraph (void);
222 void verify_cgraph_node (struct cgraph_node *);
223 void cgraph_mark_inline_edge (struct cgraph_edge *e);
224 void cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate);
225 void cgraph_build_static_cdtor (char which, tree body, int priority);
226 void cgraph_reset_static_var_maps (void);
227 void init_cgraph (void);
229 #endif /* GCC_CGRAPH_H */