16
16
// / get all functions whose address is taken
17
17
void compute_address_taken_functions (
18
18
const exprt &src,
19
- std::set <irep_idt> &address_taken)
19
+ std::unordered_set <irep_idt> &address_taken)
20
20
{
21
21
forall_operands (it, src)
22
22
compute_address_taken_functions (*it, address_taken);
@@ -35,7 +35,7 @@ void compute_address_taken_functions(
35
35
// / get all functions in the expression
36
36
void compute_functions (
37
37
const exprt &src,
38
- std::set <irep_idt> &address_taken)
38
+ std::unordered_set <irep_idt> &address_taken)
39
39
{
40
40
forall_operands (it, src)
41
41
compute_functions (*it, address_taken);
@@ -48,7 +48,7 @@ void compute_functions(
48
48
// / get all functions whose address is taken
49
49
void compute_address_taken_functions (
50
50
const goto_programt &goto_program,
51
- std::set <irep_idt> &address_taken)
51
+ std::unordered_set <irep_idt> &address_taken)
52
52
{
53
53
forall_goto_program_instructions (it, goto_program)
54
54
{
@@ -60,28 +60,27 @@ void compute_address_taken_functions(
60
60
// / get all functions whose address is taken
61
61
void compute_address_taken_functions (
62
62
const goto_functionst &goto_functions,
63
- std::set <irep_idt> &address_taken)
63
+ std::unordered_set <irep_idt> &address_taken)
64
64
{
65
65
forall_goto_functions (it, goto_functions)
66
66
compute_address_taken_functions (it->second .body , address_taken);
67
67
}
68
68
69
69
// / get all functions whose address is taken
70
- std::set <irep_idt> compute_address_taken_functions (
71
- const goto_functionst &goto_functions)
70
+ std::unordered_set <irep_idt>
71
+ compute_address_taken_functions ( const goto_functionst &goto_functions)
72
72
{
73
- std::set <irep_idt> address_taken;
73
+ std::unordered_set <irep_idt> address_taken;
74
74
compute_address_taken_functions (goto_functions, address_taken);
75
75
return address_taken;
76
76
}
77
77
78
78
// / computes the functions that are (potentially) called
79
- std::set <irep_idt> compute_called_functions (
80
- const goto_functionst &goto_functions)
79
+ std::unordered_set <irep_idt>
80
+ compute_called_functions ( const goto_functionst &goto_functions)
81
81
{
82
- std::set<irep_idt> working_queue;
83
- std::set<irep_idt> done;
84
- std::set<irep_idt> functions;
82
+ std::unordered_set<irep_idt> working_queue;
83
+ std::unordered_set<irep_idt> functions;
85
84
86
85
// start from entry point
87
86
working_queue.insert (goto_functions.entry_point ());
@@ -91,12 +90,9 @@ std::set<irep_idt> compute_called_functions(
91
90
irep_idt id=*working_queue.begin ();
92
91
working_queue.erase (working_queue.begin ());
93
92
94
- if (done. find (id)!=done. end () )
93
+ if (!functions. insert (id). second )
95
94
continue ;
96
95
97
- functions.insert (id);
98
- done.insert (id);
99
-
100
96
const goto_functionst::function_mapt::const_iterator f_it=
101
97
goto_functions.function_map .find (id);
102
98
@@ -123,8 +119,8 @@ std::set<irep_idt> compute_called_functions(
123
119
}
124
120
125
121
// / computes the functions that are (potentially) called
126
- std::set <irep_idt> compute_called_functions (
127
- const goto_modelt &goto_model)
122
+ std::unordered_set <irep_idt>
123
+ compute_called_functions ( const goto_modelt &goto_model)
128
124
{
129
125
return compute_called_functions (goto_model.goto_functions );
130
126
}
0 commit comments