14 #ifndef CPROVER_GOTO_INSTRUMENT_WMM_EVENT_GRAPH_H
15 #define CPROVER_GOTO_INSTRUMENT_WMM_EVENT_GRAPH_H
49 std::map<std::string, std::string> &map_id2var,
50 std::map<std::string, std::string> &map_var2id)
const;
55 data_typet::const_iterator s_it,
59 data_typet::const_iterator it,
104 for(
auto it=cyc.
data.cbegin();
118 auto it=
data.cbegin();
121 for(; it!=
data.cend() && n_it!=
data.cend(); ++it, ++n_it)
201 std::string
print()
const;
215 INVARIANT(!reduced.
data.empty(),
"reduced must not be empty");
225 std::map<std::string, std::string> &map_id2var,
226 std::map<std::string, std::string> &map_var2id,
275 std::list<event_idt>* order)
296 unsigned _max_po_trans):
305 std::map<event_idt, bool>
mark;
312 event_idt source,
unsigned number_of_cycles);
314 bool backtrack(std::set<critical_cyclet> &set_of_cycles,
321 bool has_to_be_unsafe,
327 std::set<critical_cyclet> &set_of_cycles,
339 unsigned _max_po_trans,
const std::set<event_idt> &_filter)
351 static std::list<event_idt> new_order;
354 for(
const auto &evt : *order)
356 new_order.push_back(evt);
373 unsigned _max_po_trans)
403 std::set<std::pair<event_idt, event_idt> >
loops;
409 INVARIANT(po_no==com_no,
"node added with same id in both graphs");
456 PRECONDITION(
operator[](a).thread ==
operator[](b).thread);
465 PRECONDITION(
operator[](a).thread ==
operator[](b).thread);
469 loops.insert(std::pair<event_idt, event_idt>(a, b));
470 loops.insert(std::pair<event_idt, event_idt>(b, a));
510 std::set<std::pair<const abstract_eventt&, const abstract_eventt&>>
521 if(
operator[](a).thread!=
operator[](b).thread)
525 if(
loops.find(std::pair<event_idt, event_idt>(a, b))!=
loops.end() )
548 std::set<event_idt> &visited);
553 const std::set<event_idt> &filter)
568 unsigned _max_po_trans=0,
569 bool _ignore_arrays=
false)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
std::string print_events() const
const_iterator end() const
void hide_internals(critical_cyclet &reduced) const
data_typet::const_iterator const_iterator
std::string print_unsafes() const
const value_type & back() const
std::list< event_idt > data_typet
const value_type & front() const
bool is_unsafe(memory_modelt model, bool fast=false)
checks whether there is at least one pair which is unsafe (takes fences and dependencies into account...
bool is_unsafe_asm(memory_modelt model, bool fast=false)
same as is_unsafe, but with ASM fences
bool check_AC(data_typet::const_iterator s_it, const abstract_eventt &first, const abstract_eventt &second) const
bool is_not_uniproc() const
const_iterator cend() const
const_iterator cbegin() const
std::set< delayt > unsafe_pairs
bool is_not_weak_uniproc() const
bool is_not_uniproc(memory_modelt model) const
std::string print_name(const critical_cyclet &redyced, memory_modelt model) const
std::string print_name(memory_modelt model) const
std::string print_all(memory_modelt model, std::map< std::string, std::string > &map_id2var, std::map< std::string, std::string > &map_var2id, bool hide_internals) const
bool check_BC(data_typet::const_iterator it, const abstract_eventt &first, const abstract_eventt &second) const
void print_dot(std::ostream &str, unsigned colour, memory_modelt model) const
const_iterator begin() const
void operator()(const critical_cyclet &cyc)
std::string print_detail(const critical_cyclet &reduced, std::map< std::string, std::string > &map_id2var, std::map< std::string, std::string > &map_var2id) const
critical_cyclet(event_grapht &_egraph, unsigned _id)
std::string print_name(memory_modelt model, bool hide_internals) const
void compute_unsafe_pairs(memory_modelt model)
bool is_not_thin_air() const
std::string print_output() const
std::string print() const
bool has_user_defined_fence
bool operator<(const critical_cyclet &other) const
data_typet::value_type value_type
data_typet::iterator iterator
bool is_unsafe_fast(memory_modelt model)
const std::set< event_idt > & filter
bool filtering(event_idt u)
std::list< event_idt > * initial_filtering(std::list< event_idt > *order)
graph_conc_explorert(event_grapht &_egraph, unsigned _max_var, unsigned _max_po_trans, const std::set< event_idt > &_filter)
std::set< event_idt > thin_air_events
std::map< irep_idt, unsigned char > reads_per_variable
std::stack< event_idt > marked_stack
std::set< event_idt > skip_tracked
std::stack< event_idt > point_stack
std::map< irep_idt, unsigned char > writes_per_variable
virtual bool filtering(event_idt)
std::map< event_idt, bool > mark
graph_explorert(event_grapht &_egraph, unsigned _max_var, unsigned _max_po_trans)
critical_cyclet extract_cycle(event_idt vertex, event_idt source, unsigned number_of_cycles)
extracts a (whole, unreduced) cycle from the stack.
std::map< unsigned, unsigned char > events_per_thread
void collect_cycles(std::set< critical_cyclet > &set_of_cycles, memory_modelt model)
Tarjan 1972 adapted and modified for events.
bool backtrack(std::set< critical_cyclet > &set_of_cycles, event_idt source, event_idt vertex, bool unsafe_met, event_idt po_trans, bool same_var_pair, bool lwsync_met, bool has_to_be_unsafe, irep_idt var_to_avoid, memory_modelt model)
see event_grapht::collect_cycles
virtual std::list< event_idt > * order_filtering(std::list< event_idt > *order)
void filter_thin_air(std::set< critical_cyclet > &set_of_cycles)
after the collection, eliminates the executions forbidden by an indirect thin-air
virtual ~graph_explorert()
bool find_second_event(event_idt source)
std::set< event_idt > visited_nodes
graph_pensieve_explorert(event_grapht &_egraph, unsigned _max_var, unsigned _max_po_trans)
const wmm_grapht::edgest & com_in(event_idt n) const
grapht< abstract_eventt >::nodet & operator[](event_idt n)
void add_undirected_com_edge(event_idt a, event_idt b)
std::list< event_idt > poUrfe_order
void collect_cycles(std::set< critical_cyclet > &set_of_cycles, memory_modelt model)
std::set< std::pair< event_idt, event_idt > > loops
bool has_com_edge(event_idt i, event_idt j) const
std::list< event_idt > po_order
void explore_copy_segment(std::set< event_idt > &explored, event_idt begin, event_idt end) const
copies the segment
void remove_po_edge(event_idt a, event_idt b)
event_idt copy_segment(event_idt begin, event_idt end)
void collect_pairs_naive()
bool has_po_edge(event_idt i, event_idt j) const
const wmm_grapht::edgest & com_out(event_idt n) const
event_grapht(messaget &_message)
bool are_po_ordered(event_idt a, event_idt b)
const wmm_grapht::edgest & po_out(event_idt n) const
void remove_com_edge(event_idt a, event_idt b)
void set_parameters_collection(unsigned _max_var=0, unsigned _max_po_trans=0, bool _ignore_arrays=false)
bool is_local(event_idt a)
void collect_cycles(std::set< critical_cyclet > &set_of_cycles, memory_modelt model, const std::set< event_idt > &filter)
std::map< unsigned, data_dpt > map_data_dp
std::set< std::pair< const abstract_eventt &, const abstract_eventt & > > duplicated_bodies
void add_com_edge(event_idt a, event_idt b)
void add_po_edge(event_idt a, event_idt b)
void remove_edge(event_idt a, event_idt b)
const wmm_grapht::edgest & po_in(event_idt n) const
void print_rec_graph(std::ofstream &file, event_idt node_id, std::set< event_idt > &visited)
void add_po_back_edge(event_idt a, event_idt b)
const edgest & in(node_indext n) const
nodet::node_indext node_indext
bool has_edge(node_indext i, node_indext j) const
node_indext add_node(arguments &&... values)
void add_edge(node_indext a, node_indext b)
void remove_edge(node_indext a, node_indext b)
const edgest & out(node_indext n) const
Class that provides messages with a built-in verbosity 'level'.
wmm_grapht::node_indext event_idt
grapht< abstract_eventt > wmm_grapht
A Template Class for Graphs.
#define PRECONDITION(CONDITION)
delayt(event_idt _first, event_idt _second, bool _is_po)
delayt(event_idt _first, event_idt _second)
bool operator==(const delayt &other) const
bool operator<(const delayt &other) const