comparison gcc/ipa-fnsummary.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* IPA function body analysis. 1 /* IPA function body analysis.
2 Copyright (C) 2003-2017 Free Software Foundation, Inc. 2 Copyright (C) 2003-2018 Free Software Foundation, Inc.
3 Contributed by Jan Hubicka 3 Contributed by Jan Hubicka
4 4
5 This file is part of GCC. 5 This file is part of GCC.
6 6
7 GCC is free software; you can redistribute it and/or modify it under 7 GCC is free software; you can redistribute it and/or modify it under
85 }; 85 };
86 86
87 /* Function inlining information. */ 87 /* Function inlining information. */
88 struct GTY(()) ipa_fn_summary 88 struct GTY(()) ipa_fn_summary
89 { 89 {
90 /* Keep all field empty so summary dumping works during its computation.
91 This is useful for debugging. */
92 ipa_fn_summary ()
93 : estimated_self_stack_size (0), self_size (0), min_size (0),
94 inlinable (false), single_caller (false),
95 fp_expressions (false), estimated_stack_size (false),
96 stack_frame_offset (false), time (0), size (0), conds (NULL),
97 size_time_table (NULL), loop_iterations (NULL), loop_stride (NULL),
98 array_index (NULL), growth (0), scc_no (0)
99 {
100 }
101
102 /* Copy constructor. */
103 ipa_fn_summary (const ipa_fn_summary &s)
104 : estimated_self_stack_size (s.estimated_self_stack_size),
105 self_size (s.self_size), min_size (s.min_size),
106 inlinable (s.inlinable), single_caller (s.single_caller),
107 fp_expressions (s.fp_expressions),
108 estimated_stack_size (s.estimated_stack_size),
109 stack_frame_offset (s.stack_frame_offset), time (s.time), size (s.size),
110 conds (s.conds), size_time_table (s.size_time_table),
111 loop_iterations (s.loop_iterations), loop_stride (s.loop_stride),
112 array_index (s.array_index), growth (s.growth), scc_no (s.scc_no)
113 {}
114
115 /* Default constructor. */
116 ~ipa_fn_summary ();
117
90 /* Information about the function body itself. */ 118 /* Information about the function body itself. */
91 119
92 /* Estimated stack frame consumption by the function. */ 120 /* Estimated stack frame consumption by the function. */
93 HOST_WIDE_INT estimated_self_stack_size; 121 HOST_WIDE_INT estimated_self_stack_size;
94 /* Size of the function body. */ 122 /* Size of the function body. */
96 /* Minimal size increase after inlining. */ 124 /* Minimal size increase after inlining. */
97 int min_size; 125 int min_size;
98 126
99 /* False when there something makes inlining impossible (such as va_arg). */ 127 /* False when there something makes inlining impossible (such as va_arg). */
100 unsigned inlinable : 1; 128 unsigned inlinable : 1;
101 /* True when function contains cilk spawn (and thus we can not inline
102 into it). */
103 unsigned contains_cilk_spawn : 1;
104 /* True wen there is only one caller of the function before small function 129 /* True wen there is only one caller of the function before small function
105 inlining. */ 130 inlining. */
106 unsigned int single_caller : 1; 131 unsigned int single_caller : 1;
107 /* True if function contains any floating point expressions. */ 132 /* True if function contains any floating point expressions. */
108 unsigned int fp_expressions : 1; 133 unsigned int fp_expressions : 1;
139 expenses. */ 164 expenses. */
140 int growth; 165 int growth;
141 /* Number of SCC on the beginning of inlining process. */ 166 /* Number of SCC on the beginning of inlining process. */
142 int scc_no; 167 int scc_no;
143 168
144 /* Keep all field empty so summary dumping works during its computation.
145 This is useful for debugging. */
146 ipa_fn_summary ()
147 : estimated_self_stack_size (0), self_size (0), min_size (0),
148 inlinable (false), contains_cilk_spawn (false), single_caller (false),
149 fp_expressions (false), estimated_stack_size (false),
150 stack_frame_offset (false), time (0), size (0), conds (NULL),
151 size_time_table (NULL), loop_iterations (NULL), loop_stride (NULL),
152 array_index (NULL), growth (0), scc_no (0)
153 {
154 }
155
156 /* Record time and size under given predicates. */ 169 /* Record time and size under given predicates. */
157 void account_size_time (int, sreal, const predicate &, const predicate &); 170 void account_size_time (int, sreal, const predicate &, const predicate &);
158
159 /* Reset summary to empty state. */
160 void reset (struct cgraph_node *node);
161 171
162 /* We keep values scaled up, so fractional sizes can be accounted. */ 172 /* We keep values scaled up, so fractional sizes can be accounted. */
163 static const int size_scale = 2; 173 static const int size_scale = 2;
164 }; 174 };
165 175
175 ipa_fn_summary_t(symtab, true); 185 ipa_fn_summary_t(symtab, true);
176 summary->disable_insertion_hook (); 186 summary->disable_insertion_hook ();
177 return summary; 187 return summary;
178 } 188 }
179 189
190 /* Remove ipa_fn_summary for all callees of NODE. */
191 void remove_callees (cgraph_node *node);
180 192
181 virtual void insert (cgraph_node *, ipa_fn_summary *); 193 virtual void insert (cgraph_node *, ipa_fn_summary *);
182 virtual void remove (cgraph_node *node, ipa_fn_summary *); 194 virtual void remove (cgraph_node *node, ipa_fn_summary *)
195 {
196 remove_callees (node);
197 }
198
183 virtual void duplicate (cgraph_node *src, cgraph_node *dst, 199 virtual void duplicate (cgraph_node *src, cgraph_node *dst,
184 ipa_fn_summary *src_data, ipa_fn_summary *dst_data); 200 ipa_fn_summary *src_data, ipa_fn_summary *dst_data);
185 }; 201 };
186 202
187 extern GTY(()) function_summary <ipa_fn_summary *> *ipa_fn_summaries; 203 extern GTY(()) function_summary <ipa_fn_summary *> *ipa_fn_summaries;
188 204
189 /* Information kept about callgraph edges. */ 205 /* Information kept about callgraph edges. */
190 struct ipa_call_summary 206 struct ipa_call_summary
191 { 207 {
208 /* Keep all field empty so summary dumping works during its computation.
209 This is useful for debugging. */
210 ipa_call_summary ()
211 : predicate (NULL), param (vNULL), call_stmt_size (0), call_stmt_time (0),
212 loop_depth (0), is_return_callee_uncaptured (false)
213 {
214 }
215
216 /* Copy constructor. */
217 ipa_call_summary (const ipa_call_summary &s):
218 predicate (s.predicate), param (s.param), call_stmt_size (s.call_stmt_size),
219 call_stmt_time (s.call_stmt_time), loop_depth (s.loop_depth),
220 is_return_callee_uncaptured (s.is_return_callee_uncaptured)
221 {
222 }
223
224 /* Default destructor. */
225 ~ipa_call_summary ();
226
192 class predicate *predicate; 227 class predicate *predicate;
193 /* Vector indexed by parameters. */ 228 /* Vector indexed by parameters. */
194 vec<inline_param_summary> param; 229 vec<inline_param_summary> param;
195 /* Estimated size and time of the call statement. */ 230 /* Estimated size and time of the call statement. */
196 int call_stmt_size; 231 int call_stmt_size;
197 int call_stmt_time; 232 int call_stmt_time;
198 /* Depth of loop nest, 0 means no nesting. */ 233 /* Depth of loop nest, 0 means no nesting. */
199 unsigned int loop_depth; 234 unsigned int loop_depth;
200 235 /* Indicates whether the caller returns the value of it's callee. */
201 /* Keep all field empty so summary dumping works during its computation. 236 bool is_return_callee_uncaptured;
202 This is useful for debugging. */
203 ipa_call_summary ()
204 : predicate (NULL), param (vNULL), call_stmt_size (0), call_stmt_time (0),
205 loop_depth (0)
206 {
207 }
208
209 /* Reset inline summary to empty state. */
210 void reset ();
211 }; 237 };
212 238
213 class ipa_call_summary_t: public call_summary <ipa_call_summary *> 239 class ipa_call_summary_t: public call_summary <ipa_call_summary *>
214 { 240 {
215 public: 241 public:
216 ipa_call_summary_t (symbol_table *symtab, bool ggc): 242 ipa_call_summary_t (symbol_table *symtab, bool ggc):
217 call_summary <ipa_call_summary *> (symtab, ggc) {} 243 call_summary <ipa_call_summary *> (symtab, ggc) {}
218 244
219 /* Hook that is called by summary when an edge is duplicated. */
220 virtual void remove (cgraph_edge *cs, ipa_call_summary *);
221 /* Hook that is called by summary when an edge is duplicated. */ 245 /* Hook that is called by summary when an edge is duplicated. */
222 virtual void duplicate (cgraph_edge *src, cgraph_edge *dst, 246 virtual void duplicate (cgraph_edge *src, cgraph_edge *dst,
223 ipa_call_summary *src_data, 247 ipa_call_summary *src_data,
224 ipa_call_summary *dst_data); 248 ipa_call_summary *dst_data);
225 }; 249 };
262 sreal *ret_nonspecialized_time, 286 sreal *ret_nonspecialized_time,
263 ipa_hints *ret_hints, 287 ipa_hints *ret_hints,
264 vec<inline_param_summary> 288 vec<inline_param_summary>
265 inline_param_summary); 289 inline_param_summary);
266 290
291 void ipa_fnsummary_c_finalize (void);
292
267 #endif /* GCC_IPA_FNSUMMARY_H */ 293 #endif /* GCC_IPA_FNSUMMARY_H */