ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
goto_inline.h
Go to the documentation of this file.
1#ifndef CPROVER_GOTO_INLINE_H
2#define CPROVER_GOTO_INLINE_H
3
5#include <unordered_set>
7
8// do a full inlining
9void goto_inline(
10 goto_functionst &goto_functions,
11 optionst &options,
12 const namespacet &ns,
13 goto_programt &dest);
14
15void goto_inline(
16 goto_functionst &goto_functions,
17 optionst &options,
18 const namespacet &ns);
19
20// inline those functions marked as "inlined"
21// and functions with less than _smallfunc_limit instructions
23 goto_functionst &goto_functions,
24 optionst &options,
25 const namespacet &ns,
26 unsigned _smallfunc_limit = 0);
27
29{
30public:
32 goto_functionst &_goto_functions,
33 optionst &_options,
34 const namespacet &_ns)
35 : smallfunc_limit(0),
36 goto_functions(_goto_functions),
37 options(_options),
38 ns(_ns)
39 {
40 }
41
42 void goto_inline(goto_programt &dest);
43 void goto_inline_rec(goto_programt &dest, bool full);
44
45 // inline single instruction at 'target'
46 // returns true if any inlining was performed
47 // set 'full' to perform this recursively
49 goto_programt &dest,
50 bool full,
52
54
55protected:
58 const namespacet &ns;
59
61 goto_programt &dest,
63 const expr2tc &lhs,
64 const expr2tc &function,
65 const std::vector<expr2tc> &arguments,
66 bool recursive);
67
68 void replace_return(goto_programt &body, const expr2tc &lhs);
69
71 const locationt &location,
72 const code_type2t &code_type,
73 const std::vector<expr2tc> &arguments,
74 goto_programt &dest);
75
76 typedef std::unordered_set<irep_idt, irep_id_hash> recursion_sett;
78
79 typedef std::unordered_set<irep_idt, irep_id_hash> no_body_sett;
81
82public:
83 // Set of function names that have been inlined into the function we're
84 // dealing with right now. Fairly hacky, could be improved.
85 std::set<std::string> inlined_funcs;
86};
87
88#endif
Type of functions.
Definition irep2_type.h:333
Definition goto_functions.h:56
std::unordered_set< irep_idt, irep_id_hash > no_body_sett
Definition goto_inline.h:79
goto_functionst & goto_functions
Definition goto_inline.h:56
no_body_sett no_body_set
Definition goto_inline.h:80
std::unordered_set< irep_idt, irep_id_hash > recursion_sett
Definition goto_inline.h:76
recursion_sett recursion_set
Definition goto_inline.h:77
void parameter_assignments(const locationt &location, const code_type2t &code_type, const std::vector< expr2tc > &arguments, goto_programt &dest)
Definition goto_inline.cpp:29
void replace_return(goto_programt &body, const expr2tc &lhs)
Definition goto_inline.cpp:118
goto_inlinet(goto_functionst &_goto_functions, optionst &_options, const namespacet &_ns)
Definition goto_inline.h:31
bool inline_instruction(goto_programt &dest, bool full, goto_programt::targett &target)
Definition goto_inline.cpp:361
optionst & options
Definition goto_inline.h:57
void goto_inline_rec(goto_programt &dest, bool full)
Definition goto_inline.cpp:341
std::set< std::string > inlined_funcs
Definition goto_inline.h:85
void expand_function_call(goto_programt &dest, goto_programt::targett &target, const expr2tc &lhs, const expr2tc &function, const std::vector< expr2tc > &arguments, bool recursive)
Definition goto_inline.cpp:167
void goto_inline(goto_programt &dest)
Definition goto_inline.cpp:335
const namespacet & ns
Definition goto_inline.h:58
unsigned smallfunc_limit
Definition goto_inline.h:53
A generic container class for a control flow graph for one function, in the form of a goto-program.
Definition goto_program.h:63
instructionst::iterator targett
Definition goto_program.h:590
Definition location.h:7
Definition namespace.h:10
Definition options.h:11
@ full
Alpha-rename every symbol: the digest sees structure and types only.
Definition fingerprint.h:23
void goto_partial_inline(goto_functionst &goto_functions, optionst &options, const namespacet &ns, unsigned _smallfunc_limit=0)
Definition goto_inline.cpp:458
void goto_inline(goto_functionst &goto_functions, optionst &options, const namespacet &ns, goto_programt &dest)
Definition goto_inline.cpp:381
irep_container< expr2t > expr2tc
Definition irep2.h:431
Definition module.h:12