]>
Commit | Line | Data |
---|---|---|
1c4a429a JH |
1 | /* Callgraph handling code. |
2 | Copyright (C) 2003 Free Software Foundation, Inc. | |
3 | Contributed by Jan Hubicka | |
4 | ||
5 | This file is part of GCC. | |
6 | ||
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. | |
11 | ||
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. | |
16 | ||
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. */ | |
21 | ||
22 | #ifndef GCC_CGRAPH_H | |
23 | #define GCC_CGRAPH_H | |
24 | ||
dafc5b82 JH |
25 | /* Information about the function collected locally. |
26 | Available after function is lowered */ | |
27 | ||
ed2df68b | 28 | struct cgraph_local_info GTY(()) |
dafc5b82 JH |
29 | { |
30 | /* Set when function function is visiable in current compilation unit only | |
31 | and it's address is never taken. */ | |
32 | bool local; | |
18d13f34 | 33 | /* Set when function is small enought to be inlinable many times. */ |
dafc5b82 | 34 | bool inline_many; |
18d13f34 JH |
35 | /* Set when function can be inlined once (false only for functions calling |
36 | alloca, using varargs and so on). */ | |
37 | bool can_inline_once; | |
dafc5b82 JH |
38 | }; |
39 | ||
40 | /* Information about the function that needs to be computed globally | |
41 | once compilation is finished. Available only with -funit-at-time. */ | |
42 | ||
ed2df68b | 43 | struct cgraph_global_info GTY(()) |
dafc5b82 | 44 | { |
18d13f34 JH |
45 | /* Set when the function will be inlined exactly once. */ |
46 | bool inline_once; | |
dafc5b82 JH |
47 | }; |
48 | ||
b255a036 JH |
49 | /* Information about the function that is propagated by the RTL backend. |
50 | Available only for functions that has been already assembled. */ | |
51 | ||
ed2df68b | 52 | struct cgraph_rtl_info GTY(()) |
b255a036 | 53 | { |
ed2df68b JH |
54 | bool const_function; |
55 | bool pure_function; | |
b255a036 JH |
56 | int preferred_incoming_stack_boundary; |
57 | }; | |
58 | ||
dafc5b82 | 59 | |
1c4a429a JH |
60 | /* The cgraph data strutcture. |
61 | Each function decl has assigned cgraph_node listing calees and callers. */ | |
62 | ||
ed2df68b | 63 | struct cgraph_node GTY(()) |
1c4a429a JH |
64 | { |
65 | tree decl; | |
66 | struct cgraph_edge *callees; | |
67 | struct cgraph_edge *callers; | |
ed2df68b JH |
68 | struct cgraph_node *next; |
69 | struct cgraph_node *previous; | |
1c4a429a JH |
70 | /* For nested functions points to function the node is nested in. */ |
71 | struct cgraph_node *origin; | |
72 | /* Points to first nested function, if any. */ | |
73 | struct cgraph_node *nested; | |
74 | /* Pointer to the next function with same origin, if any. */ | |
75 | struct cgraph_node *next_nested; | |
ed2df68b | 76 | PTR GTY ((skip (""))) aux; |
1c4a429a JH |
77 | |
78 | /* Set when function must be output - it is externally visible | |
79 | or it's address is taken. */ | |
80 | bool needed; | |
81 | /* Set when function is reachable by call from other function | |
82 | that is eighter reachable or needed. */ | |
83 | bool reachable; | |
84 | /* Set when the frontend has been asked to lower representation of this | |
85 | function into trees. Callees lists are not available when lowered | |
86 | is not set. */ | |
87 | bool lowered; | |
88 | /* Set when function is scheduled to be assembled. */ | |
89 | bool output; | |
dafc5b82 JH |
90 | struct cgraph_local_info local; |
91 | struct cgraph_global_info global; | |
b255a036 | 92 | struct cgraph_rtl_info rtl; |
1c4a429a JH |
93 | }; |
94 | ||
ed2df68b | 95 | struct cgraph_edge GTY(()) |
1c4a429a | 96 | { |
ed2df68b JH |
97 | struct cgraph_node *caller; |
98 | struct cgraph_node *callee; | |
1c4a429a JH |
99 | struct cgraph_edge *next_caller; |
100 | struct cgraph_edge *next_callee; | |
101 | }; | |
102 | ||
e69529cd JH |
103 | /* The cgraph_varpool data strutcture. |
104 | Each static variable decl has assigned cgraph_varpool_node. */ | |
105 | ||
ed2df68b | 106 | struct cgraph_varpool_node GTY(()) |
e69529cd JH |
107 | { |
108 | tree decl; | |
ed2df68b | 109 | PTR GTY ((skip (""))) aux; |
e69529cd JH |
110 | |
111 | /* Set when function must be output - it is externally visible | |
112 | or it's address is taken. */ | |
113 | bool needed; | |
114 | /* Set once it has been finalized so we consider it to be output. */ | |
115 | bool finalized; | |
116 | /* Set when function is scheduled to be assembled. */ | |
117 | bool output; | |
118 | }; | |
119 | ||
ed2df68b JH |
120 | extern GTY(()) struct cgraph_node *cgraph_nodes; |
121 | extern GTY(()) int cgraph_n_nodes; | |
dafc5b82 | 122 | extern bool cgraph_global_info_ready; |
ed2df68b | 123 | extern GTY(()) struct cgraph_node *cgraph_nodes_queue; |
1c4a429a | 124 | |
ed2df68b JH |
125 | extern GTY(()) int cgraph_varpool_n_nodes; |
126 | extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue; | |
e69529cd JH |
127 | |
128 | ||
1c4a429a JH |
129 | /* In cgraph.c */ |
130 | void dump_cgraph PARAMS ((FILE *)); | |
131 | void cgraph_remove_call PARAMS ((tree, tree)); | |
18d13f34 | 132 | void cgraph_remove_node PARAMS ((struct cgraph_node *)); |
1c4a429a JH |
133 | struct cgraph_edge *cgraph_record_call PARAMS ((tree, tree)); |
134 | struct cgraph_node *cgraph_node PARAMS ((tree decl)); | |
1668aabc | 135 | struct cgraph_node *cgraph_node_for_identifier PARAMS ((tree id)); |
1c4a429a | 136 | bool cgraph_calls_p PARAMS ((tree, tree)); |
dafc5b82 JH |
137 | struct cgraph_local_info *cgraph_local_info PARAMS ((tree)); |
138 | struct cgraph_global_info *cgraph_global_info PARAMS ((tree)); | |
b255a036 | 139 | struct cgraph_rtl_info *cgraph_rtl_info PARAMS ((tree)); |
1c4a429a | 140 | |
e69529cd JH |
141 | struct cgraph_varpool_node *cgraph_varpool_node (tree decl); |
142 | struct cgraph_varpool_node *cgraph_varpool_node_for_identifier (tree id); | |
143 | void cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *); | |
144 | void cgraph_varpool_finalize_decl (tree); | |
145 | bool cgraph_varpool_assemble_pending_decls (void); | |
146 | ||
1c4a429a JH |
147 | /* In cgraphunit.c */ |
148 | void cgraph_finalize_function PARAMS ((tree, tree)); | |
149 | void cgraph_finalize_compilation_unit PARAMS ((void)); | |
150 | void cgraph_create_edges PARAMS ((tree, tree)); | |
151 | void cgraph_optimize PARAMS ((void)); | |
152 | void cgraph_mark_needed_node PARAMS ((struct cgraph_node *, int)); | |
153 | ||
154 | #endif /* GCC_CGRAPH_H */ |