cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
aggressive_slicer.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Aggressive Slicer
4
5
Author: Elizabeth Polgreen, polgreen@amazon.com
6
7
\*******************************************************************/
8
13
14
#ifndef CPROVER_GOTO_INSTRUMENT_AGGRESSIVE_SLICER_H
15
#define CPROVER_GOTO_INSTRUMENT_AGGRESSIVE_SLICER_H
16
17
#include <list>
18
#include <string>
19
20
#include <
util/irep.h
>
21
22
#include <
analyses/call_graph.h
>
23
24
#include <
goto-programs/goto_model.h
>
25
26
class
message_handlert
;
27
34
class
aggressive_slicert
35
{
36
public
:
37
aggressive_slicert
(
goto_modelt
&_goto_model,
message_handlert
&_msg)
38
:
call_depth
(0),
39
preserve_all_direct_paths
(false),
40
start_function
(_goto_model.goto_functions.entry_point()),
41
goto_model
(_goto_model),
42
message_handler
(_msg)
43
{
44
call_grapht
undirected_call_graph =
45
call_grapht::create_from_root_function
(
goto_model
,
start_function
,
false
);
46
call_graph
= undirected_call_graph.
get_directed_graph
();
47
}
48
53
void
doit
();
54
59
void
preserve_functions
(
const
std::list<std::string> &function_list)
60
{
61
for
(
const
auto
&f : function_list)
62
functions_to_keep
.insert(f);
63
};
64
65
std::list<std::string>
user_specified_properties
;
66
std::size_t
call_depth
;
67
std::list<std::string>
name_snippets
;
68
bool
preserve_all_direct_paths
;
69
70
private
:
71
const
irep_idt
start_function
;
72
goto_modelt
&
goto_model
;
73
message_handlert
&
message_handler
;
74
std::set<irep_idt>
functions_to_keep
;
75
call_grapht::directed_grapht
call_graph
;
76
80
void
find_functions_that_contain_name_snippet
();
81
88
void
note_functions_to_keep
(
const
irep_idt
&destination_function);
89
95
void
get_all_functions_containing_properties
();
96
};
97
98
// clang-format off
99
#define OPT_AGGRESSIVE_SLICER \
100
"(aggressive-slice)" \
101
"(aggressive-slice-call-depth):" \
102
"(aggressive-slice-preserve-function):" \
103
"(aggressive-slice-preserve-functions-containing):" \
104
"(aggressive-slice-preserve-all-direct-paths)"
105
106
// clang-format on
107
108
#endif
// CPROVER_GOTO_INSTRUMENT_AGGRESSIVE_SLICER_H
call_graph.h
Function Call Graphs.
aggressive_slicert::goto_model
goto_modelt & goto_model
Definition
aggressive_slicer.h:72
aggressive_slicert::message_handler
message_handlert & message_handler
Definition
aggressive_slicer.h:73
aggressive_slicert::user_specified_properties
std::list< std::string > user_specified_properties
Definition
aggressive_slicer.h:65
aggressive_slicert::call_graph
call_grapht::directed_grapht call_graph
Definition
aggressive_slicer.h:75
aggressive_slicert::doit
void doit()
Removes the body of all functions except those on the shortest path or functions that are reachable f...
Definition
aggressive_slicer.cpp:76
aggressive_slicert::name_snippets
std::list< std::string > name_snippets
Definition
aggressive_slicer.h:67
aggressive_slicert::aggressive_slicert
aggressive_slicert(goto_modelt &_goto_model, message_handlert &_msg)
Definition
aggressive_slicer.h:37
aggressive_slicert::get_all_functions_containing_properties
void get_all_functions_containing_properties()
Finds all functions that contain a property, and adds them to the list of functions to keep.
Definition
aggressive_slicer.cpp:46
aggressive_slicert::preserve_functions
void preserve_functions(const std::list< std::string > &function_list)
Adds a list of functions to the set of functions for the aggressive slicer to preserve.
Definition
aggressive_slicer.h:59
aggressive_slicert::preserve_all_direct_paths
bool preserve_all_direct_paths
Definition
aggressive_slicer.h:68
aggressive_slicert::note_functions_to_keep
void note_functions_to_keep(const irep_idt &destination_function)
notes functions to keep in the slice based on the program start function and the given destination fu...
Definition
aggressive_slicer.cpp:25
aggressive_slicert::start_function
const irep_idt start_function
Definition
aggressive_slicer.h:71
aggressive_slicert::call_depth
std::size_t call_depth
Definition
aggressive_slicer.h:66
aggressive_slicert::functions_to_keep
std::set< irep_idt > functions_to_keep
Definition
aggressive_slicer.h:74
aggressive_slicert::find_functions_that_contain_name_snippet
void find_functions_that_contain_name_snippet()
Finds all functions whose name contains a name snippet and adds them to the std::unordered_set of ire...
Definition
aggressive_slicer.cpp:64
call_grapht::directed_grapht
Directed graph representation of this call graph.
Definition
call_graph.h:140
call_grapht
A call graph (https://en.wikipedia.org/wiki/Call_graph) for a GOTO model or GOTO functions collection...
Definition
call_graph.h:44
call_grapht::get_directed_graph
directed_grapht get_directed_graph() const
Returns a grapht representation of this call graph, suitable for use with generic grapht algorithms.
Definition
call_graph.cpp:209
call_grapht::create_from_root_function
static call_grapht create_from_root_function(const goto_modelt &model, const irep_idt &root, bool collect_callsites)
Definition
call_graph.h:53
goto_modelt
Definition
goto_model.h:27
message_handlert
Definition
message.h:27
goto_model.h
Symbol Table + CFG.
irep.h
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
goto-instrument
aggressive_slicer.h
Generated by
1.17.0