OSDN Git Service

* config/xtensa/xtensa.c (xtensa_multibss_section_type_flags): Add
[pf3gnuchains/gcc-fork.git] / gcc / cgraph.h
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
25 /* Information about the function collected locally.
26    Available after function is analyzed.  */
27
28 struct cgraph_local_info GTY(())
29 {
30   /* Set when function function is visible in current compilation unit only
31      and it's address is never taken.  */
32   bool local;
33   /* Set once it has been finalized so we consider it to be output.  */
34   bool finalized;
35
36   /* False when there something makes inlining impossible (such as va_arg).  */
37   bool inlinable;
38   /* True when function should be inlined independently on it's size.  */
39   bool disregard_inline_limits;
40   /* Size of the function before inlining.  */
41   int self_insns;
42 };
43
44 /* Information about the function that needs to be computed globally
45    once compilation is finished.  Available only with -funit-at-time.  */
46
47 struct cgraph_global_info GTY(())
48 {
49   /* Set when the function will be inlined exactly once.  */
50   bool inline_once;
51
52   /* Estimated size of the function after inlining.  */
53   int insns;
54
55   /* Number of times given function will be cloned during output.  */
56   int cloned_times;
57
58   /* Set to true for all reachable functions before inlining is decided.
59      Once we inline all calls to the function and the function is local,
60      it is set to false.  */
61   bool will_be_output;
62 };
63
64 /* Information about the function that is propagated by the RTL backend.
65    Available only for functions that has been already assembled.  */
66
67 struct cgraph_rtl_info GTY(())
68 {
69    bool const_function;
70    bool pure_function;
71    int preferred_incoming_stack_boundary;
72 };
73
74
75 /* The cgraph data strutcture.
76    Each function decl has assigned cgraph_node listing callees and callers.  */
77
78 struct cgraph_node GTY((chain_next ("%h.next"), chain_prev ("%h.previous")))
79 {
80   tree decl;
81   struct cgraph_edge *callees;
82   struct cgraph_edge *callers;
83   struct cgraph_node *next;
84   struct cgraph_node *previous;
85   /* For nested functions points to function the node is nested in.  */
86   struct cgraph_node *origin;
87   /* Points to first nested function, if any.  */
88   struct cgraph_node *nested;
89   /* Pointer to the next function with same origin, if any.  */
90   struct cgraph_node *next_nested;
91   /* Pointer to the next function in cgraph_nodes_queue.  */
92   struct cgraph_node *next_needed;
93   /* Unique id of the node.  */
94   int uid;
95   PTR GTY ((skip (""))) aux;
96
97   /* Set when function must be output - it is externally visible
98      or it's address is taken.  */
99   bool needed;
100   /* Set when function is reachable by call from other function
101      that is either reachable or needed.  */
102   bool reachable;
103   /* Set once the function has been instantiated and its callee
104      lists created.  */
105   bool analyzed;
106   /* Set when function is scheduled to be assembled.  */
107   bool output;
108   struct cgraph_local_info local;
109   struct cgraph_global_info global;
110   struct cgraph_rtl_info rtl;
111 };
112
113 struct cgraph_edge GTY(())
114 {
115   struct cgraph_node *caller;
116   struct cgraph_node *callee;
117   struct cgraph_edge *next_caller;
118   struct cgraph_edge *next_callee;
119   bool inline_call;
120 };
121
122 /* The cgraph_varpool data strutcture.
123    Each static variable decl has assigned cgraph_varpool_node.  */
124
125 struct cgraph_varpool_node GTY(())
126 {
127   tree decl;
128   /* Pointer to the next function in cgraph_varpool_nodes_queue.  */
129   struct cgraph_varpool_node *next_needed;
130
131   /* Set when function must be output - it is externally visible
132      or it's address is taken.  */
133   bool needed;
134   /* Set once it has been finalized so we consider it to be output.  */
135   bool finalized;
136   /* Set when function is scheduled to be assembled.  */
137   bool output;
138 };
139
140 extern GTY(()) struct cgraph_node *cgraph_nodes;
141 extern GTY(()) int cgraph_n_nodes;
142 extern GTY(()) int cgraph_max_uid;
143 extern bool cgraph_global_info_ready;
144 extern GTY(()) struct cgraph_node *cgraph_nodes_queue;
145 extern FILE *cgraph_dump_file;
146
147 extern GTY(()) int cgraph_varpool_n_nodes;
148 extern GTY(()) struct cgraph_varpool_node *cgraph_varpool_nodes_queue;
149
150
151 /* In cgraph.c  */
152 void dump_cgraph (FILE *);
153 void cgraph_remove_call (tree, tree);
154 void cgraph_remove_node (struct cgraph_node *);
155 struct cgraph_edge *cgraph_record_call (tree, tree);
156 struct cgraph_node *cgraph_node (tree decl);
157 struct cgraph_node *cgraph_node_for_identifier (tree id);
158 bool cgraph_calls_p (tree, tree);
159 struct cgraph_local_info *cgraph_local_info (tree);
160 struct cgraph_global_info *cgraph_global_info (tree);
161 struct cgraph_rtl_info *cgraph_rtl_info (tree);
162 const char * cgraph_node_name (struct cgraph_node *);
163
164 struct cgraph_varpool_node *cgraph_varpool_node (tree decl);
165 struct cgraph_varpool_node *cgraph_varpool_node_for_identifier (tree id);
166 void cgraph_varpool_mark_needed_node (struct cgraph_varpool_node *);
167 void cgraph_varpool_finalize_decl (tree);
168 bool cgraph_varpool_assemble_pending_decls (void);
169
170 /* In cgraphunit.c  */
171 bool cgraph_assemble_pending_functions (void);
172 void cgraph_finalize_function (tree, bool);
173 void cgraph_finalize_compilation_unit (void);
174 void cgraph_create_edges (tree, tree);
175 void cgraph_optimize (void);
176 void cgraph_mark_needed_node (struct cgraph_node *);
177 void cgraph_mark_reachable_node (struct cgraph_node *);
178 bool cgraph_inline_p (tree, tree);
179
180 #endif  /* GCC_CGRAPH_H  */