@@ -123,10 +123,20 @@ void goto_inline(
123
123
Function: goto_partial_inline
124
124
125
125
Inputs:
126
+ goto_model:
127
+ Source of the symbol table and function map to use.
128
+ message_handler:
129
+ Message handler used by goto_inlinet.
130
+ smallfunc_limit:
131
+ The maximum number of instructions in functions to be inlined.
132
+ adjust_function:
133
+ Tell goto_inlinet to adjust function.
126
134
127
135
Outputs:
128
136
129
137
Purpose:
138
+ Inline all function calls to functions either marked as "inlined" or
139
+ smaller than smallfunc_limit (by instruction count).
130
140
131
141
\*******************************************************************/
132
142
@@ -150,10 +160,23 @@ void goto_partial_inline(
150
160
Function: goto_partial_inline
151
161
152
162
Inputs:
163
+ goto_functions:
164
+ The function map to use to find functions containing calls and function
165
+ bodies.
166
+ ns:
167
+ Namespace used by goto_inlinet.
168
+ message_handler:
169
+ Message handler used by goto_inlinet.
170
+ smallfunc_limit:
171
+ The maximum number of instructions in functions to be inlined.
172
+ adjust_function:
173
+ Tell goto_inlinet to adjust function.
153
174
154
175
Outputs:
155
176
156
177
Purpose:
178
+ Inline all function calls to functions either marked as "inlined" or
179
+ smaller than smallfunc_limit (by instruction count).
157
180
158
181
\*******************************************************************/
159
182
@@ -182,6 +205,10 @@ void goto_partial_inline(
182
205
if (!goto_function.body_available ())
183
206
continue ;
184
207
208
+ if (f_it->first ==goto_functions.entry_point ())
209
+ // Don't inline any function calls made from the _start function.
210
+ continue ;
211
+
185
212
goto_programt &goto_program=goto_function.body ;
186
213
187
214
goto_inlinet::call_listt &call_list=inline_map[f_it->first ];
@@ -195,10 +222,10 @@ void goto_partial_inline(
195
222
exprt function_expr;
196
223
exprt::operandst arguments;
197
224
exprt constrain;
198
-
199
225
goto_inlinet::get_call (i_it, lhs, function_expr, arguments, constrain);
200
226
201
227
if (function_expr.id ()!=ID_symbol)
228
+ // Can't handle pointers to functions
202
229
continue ;
203
230
204
231
const symbol_exprt &symbol_expr=to_symbol_expr (function_expr);
@@ -208,17 +235,14 @@ void goto_partial_inline(
208
235
goto_functions.function_map .find (id);
209
236
210
237
if (f_it==goto_functions.function_map .end ())
238
+ // Function not loaded, can't check size
211
239
continue ;
212
240
213
241
// called function
214
242
const goto_functiont &goto_function=f_it->second ;
215
243
216
- // We can't take functions without bodies to find functions
217
- // inside them to be inlined.
218
- // We also don't allow for the _start function to have any of its
219
- // function calls to be inlined
220
- if (!goto_function.body_available () ||
221
- f_it->first ==goto_functions.entry_point ())
244
+ if (!goto_function.body_available ())
245
+ // The bodies of functions that don't have bodies can't be inlined.
222
246
continue ;
223
247
224
248
const goto_programt &goto_program=goto_function.body ;
@@ -240,36 +264,52 @@ void goto_partial_inline(
240
264
Function: goto_function_inline
241
265
242
266
Inputs:
267
+ goto_model: Source of the symbol table and function map to use.
268
+ function: The function whose calls to inline.
269
+ message_handler: Message handler used by goto_inlinet.
270
+ adjust_function: Tell goto_inlinet to adjust function.
271
+ caching: Tell goto_inlinet to cache.
243
272
244
273
Outputs:
245
274
246
275
Purpose:
276
+ Inline all function calls made from a particular function
247
277
248
278
\*******************************************************************/
249
279
250
280
void goto_function_inline (
251
281
goto_modelt &goto_model,
252
282
const irep_idt function,
253
283
message_handlert &message_handler,
254
- bool adjust_function)
284
+ bool adjust_function,
285
+ bool caching)
255
286
{
256
287
const namespacet ns (goto_model.symbol_table );
257
288
goto_function_inline (
258
289
goto_model.goto_functions ,
259
290
function,
260
291
ns,
261
- message_handler);
292
+ message_handler,
293
+ adjust_function,
294
+ caching);
262
295
}
263
296
264
297
/* ******************************************************************\
265
298
266
299
Function: goto_function_inline
267
300
268
301
Inputs:
302
+ goto_functions: The function map to use to find function bodies.
303
+ function: The function whose calls to inline.
304
+ ns: Namespace used by goto_inlinet.
305
+ message_handler: Message handler used by goto_inlinet.
306
+ adjust_function: Tell goto_inlinet to adjust function.
307
+ caching: Tell goto_inlinet to cache.
269
308
270
309
Outputs:
271
310
272
311
Purpose:
312
+ Inline all function calls made from a particular function
273
313
274
314
\*******************************************************************/
275
315
0 commit comments