]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/cgraph.h
invoke.texi (SPARC options): Document that -mapp-regs is turned off by default on...
[thirdparty/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"
1c4a429a 25
dafc5b82 26/* Information about the function collected locally.
25c84396 27 Available after function is analyzed. */
dafc5b82 28
ed2df68b 29struct cgraph_local_info GTY(())
dafc5b82 30{
95c755e9
JH
31 /* Size of the function before inlining. */
32 int self_insns;
6674a6ce 33
e0bb17a8 34 /* Set when function function is visible in current compilation unit only
e2209b03 35 and its address is never taken. */
dafc5b82 36 bool local;
6674a6ce 37
f6981e16
JH
38 /* Set once it has been finalized so we consider it to be output. */
39 bool finalized;
b58b1157 40
b3c3af2f 41 /* False when there something makes inlining impossible (such as va_arg). */
b58b1157 42 bool inlinable;
6674a6ce 43
e2209b03 44 /* True when function should be inlined independently on its size. */
b3c3af2f 45 bool disregard_inline_limits;
6674a6ce 46
95c755e9
JH
47 /* True when the function has been originally extern inline, but it is
48 redefined now. */
49 bool redefined_extern_inline;
6674a6ce
KZ
50
51 /* True if statics_read_for_function and
52 statics_written_for_function contain valid data. */
53 bool for_functions_valid;
dafc5b82
JH
54};
55
56/* Information about the function that needs to be computed globally
57 once compilation is finished. Available only with -funit-at-time. */
58
ed2df68b 59struct cgraph_global_info GTY(())
dafc5b82 60{
18c6ada9
JH
61 /* For inline clones this points to the function they will be inlined into. */
62 struct cgraph_node *inlined_to;
63
b58b1157
JH
64 /* Estimated size of the function after inlining. */
65 int insns;
66
18c6ada9 67 /* Set iff the function has been inlined at least once. */
1bb17c21 68 bool inlined;
dafc5b82
JH
69};
70
b255a036
JH
71/* Information about the function that is propagated by the RTL backend.
72 Available only for functions that has been already assembled. */
73
ed2df68b 74struct cgraph_rtl_info GTY(())
b255a036 75{
6de9cd9a 76 int preferred_incoming_stack_boundary;
ed2df68b
JH
77 bool const_function;
78 bool pure_function;
b255a036
JH
79};
80
ba228239 81/* The cgraph data structure.
e0bb17a8 82 Each function decl has assigned cgraph_node listing callees and callers. */
1c4a429a 83
d1bd0ded 84struct cgraph_node GTY((chain_next ("%h.next"), chain_prev ("%h.previous")))
1c4a429a
JH
85{
86 tree decl;
87 struct cgraph_edge *callees;
88 struct cgraph_edge *callers;
ed2df68b
JH
89 struct cgraph_node *next;
90 struct cgraph_node *previous;
1c4a429a
JH
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;
8bd87c4e
JH
97 /* Pointer to the next function in cgraph_nodes_queue. */
98 struct cgraph_node *next_needed;
18c6ada9
JH
99 /* Pointer to the next clone. */
100 struct cgraph_node *next_clone;
1655dc9d 101 struct cgraph_node *prev_clone;
1431042e 102 PTR GTY ((skip)) aux;
1c4a429a 103
95c755e9
JH
104 struct cgraph_local_info local;
105 struct cgraph_global_info global;
106 struct cgraph_rtl_info rtl;
6674a6ce 107
95c755e9
JH
108 /* Unique id of the node. */
109 int uid;
1c4a429a 110 /* Set when function must be output - it is externally visible
e2209b03 111 or its address is taken. */
1c4a429a
JH
112 bool needed;
113 /* Set when function is reachable by call from other function
e0bb17a8 114 that is either reachable or needed. */
1c4a429a 115 bool reachable;
25c84396
RH
116 /* Set once the function has been instantiated and its callee
117 lists created. */
118 bool analyzed;
1c4a429a
JH
119 /* Set when function is scheduled to be assembled. */
120 bool output;
12527dce
RH
121 /* Set for aliases once they got through assemble_alias. */
122 bool alias;
1c4a429a
JH
123};
124
2563c224 125struct cgraph_edge GTY((chain_next ("%h.next_caller"), chain_prev ("%h.prev_caller")))
1c4a429a 126{
ed2df68b
JH
127 struct cgraph_node *caller;
128 struct cgraph_node *callee;
2563c224 129 struct cgraph_edge *prev_caller;
1c4a429a 130 struct cgraph_edge *next_caller;
2563c224 131 struct cgraph_edge *prev_callee;
1c4a429a 132 struct cgraph_edge *next_callee;
18c6ada9
JH
133 tree call_expr;
134 PTR GTY ((skip (""))) aux;
dc0bfe6a
JH
135 /* When NULL, inline this call. When non-NULL, points to the explanation
136 why function was not inlined. */
137 const char *inline_failed;
1c4a429a
JH
138};
139
ba228239 140/* The cgraph_varpool data structure.
e69529cd
JH
141 Each static variable decl has assigned cgraph_varpool_node. */
142
ed2df68b 143struct cgraph_varpool_node GTY(())
e69529cd
JH
144{
145 tree decl;
bedb9fc0
RH
146 /* Pointer to the next function in cgraph_varpool_nodes. */
147 struct cgraph_varpool_node *next;
8bd87c4e
JH
148 /* Pointer to the next function in cgraph_varpool_nodes_queue. */
149 struct cgraph_varpool_node *next_needed;
e69529cd
JH
150
151 /* Set when function must be output - it is externally visible
e2209b03 152 or its address is taken. */
e69529cd 153 bool needed;
cd9c7bd2
JH
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;
e69529cd
JH
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;
1a612e0a
JJ
164 /* Set for aliases once they got through assemble_alias. */
165 bool alias;
e69529cd
JH
166};
167
ed2df68b
JH
168extern GTY(()) struct cgraph_node *cgraph_nodes;
169extern GTY(()) int cgraph_n_nodes;
b58b1157 170extern GTY(()) int cgraph_max_uid;
dafc5b82 171extern bool cgraph_global_info_ready;
ed2df68b 172extern GTY(()) struct cgraph_node *cgraph_nodes_queue;
1c4a429a 173
cd9c7bd2 174extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_first_unanalyzed_node;
ed2df68b 175extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
e69529cd 176
1c4a429a 177/* In cgraph.c */
439f7bc3 178void dump_cgraph (FILE *);
18c6ada9 179void dump_cgraph_node (FILE *, struct cgraph_node *);
cd9c7bd2
JH
180void dump_varpool (FILE *);
181void dump_cgraph_varpool_node (FILE *, struct cgraph_varpool_node *);
18c6ada9 182void cgraph_remove_edge (struct cgraph_edge *);
439f7bc3 183void cgraph_remove_node (struct cgraph_node *);
2563c224 184void cgraph_node_remove_callees (struct cgraph_node *node);
18c6ada9
JH
185struct cgraph_edge *cgraph_create_edge (struct cgraph_node *,
186 struct cgraph_node *,
187 tree);
439f7bc3 188struct cgraph_node *cgraph_node (tree decl);
bedb9fc0 189struct cgraph_node *cgraph_node_for_asm (tree asmname);
18c6ada9 190struct cgraph_edge *cgraph_edge (struct cgraph_node *, tree call_expr);
439f7bc3
AJ
191struct cgraph_local_info *cgraph_local_info (tree);
192struct cgraph_global_info *cgraph_global_info (tree);
193struct cgraph_rtl_info *cgraph_rtl_info (tree);
194const char * cgraph_node_name (struct cgraph_node *);
18c6ada9
JH
195struct cgraph_edge * cgraph_clone_edge (struct cgraph_edge *, struct cgraph_node *, tree);
196struct cgraph_node * cgraph_clone_node (struct cgraph_node *);
1c4a429a 197
e69529cd 198struct cgraph_varpool_node *cgraph_varpool_node (tree decl);
bedb9fc0 199struct cgraph_varpool_node *cgraph_varpool_node_for_asm (tree asmname);
e69529cd
JH
200void cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *);
201void cgraph_varpool_finalize_decl (tree);
18c6ada9 202void cgraph_redirect_edge_callee (struct cgraph_edge *, struct cgraph_node *);
e69529cd 203
1bb17c21 204bool cgraph_function_possibly_inlined_p (tree);
8f235343 205void cgraph_unnest_node (struct cgraph_node *node);
cd9c7bd2
JH
206void cgraph_varpool_enqueue_needed_node (struct cgraph_varpool_node *);
207void cgraph_varpool_reset_queue (void);
208bool decide_is_variable_needed (struct cgraph_varpool_node *, tree);
1bb17c21 209
1c4a429a 210/* In cgraphunit.c */
f6d1b84a 211bool cgraph_assemble_pending_functions (void);
cd9c7bd2 212bool cgraph_varpool_assemble_pending_decls (void);
6b00c969 213void cgraph_finalize_function (tree, bool);
439f7bc3 214void cgraph_finalize_compilation_unit (void);
18c6ada9 215void cgraph_create_edges (struct cgraph_node *, tree);
439f7bc3 216void cgraph_optimize (void);
8dafba3c
RH
217void cgraph_mark_needed_node (struct cgraph_node *);
218void cgraph_mark_reachable_node (struct cgraph_node *);
18c6ada9
JH
219bool cgraph_inline_p (struct cgraph_edge *, const char **reason);
220bool cgraph_preserve_function_body_p (tree);
221void verify_cgraph (void);
222void verify_cgraph_node (struct cgraph_node *);
223void cgraph_mark_inline_edge (struct cgraph_edge *e);
224void cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate);
35b6fdcf 225void cgraph_build_static_cdtor (char which, tree body, int priority);
6674a6ce 226void cgraph_reset_static_var_maps (void);
9b3e897d 227void init_cgraph (void);
1c4a429a
JH
228
229#endif /* GCC_CGRAPH_H */