47 identifier==
"stdin" ||
48 identifier==
"stdout" ||
49 identifier==
"stderr" ||
50 identifier==
"sys_nerr" ||
54 const size_t pos=identifier.find(
"[]");
56 if(
pos!=std::string::npos)
59 identifier.erase(
pos);
74 catch(
const std::string &exception)
99 visitor.
visit_cfg(value_sets, model, no_dependencies, duplicate_body,
102 std::vector<std::size_t> subgraph_index;
106 for(std::map<event_idt, event_idt>::const_iterator
111 const std::size_t sg=subgraph_index[it->second];
119 unsigned interesting_sccs=0;
125 << interesting_sccs <<
" interesting SCCs"
136 std::size_t instr_counter=0;
137 for(goto_functionst::function_mapt::const_iterator
141 instr_counter+=it->second.body.instructions.size();
151 bool no_dependencies,
154 std::set<instrumentert::cfg_visitort::nodet> &ending_vertex)
158 instrumenter.message.debug()
168 instrumenter.goto_functions.function_map[function_id]);
173 instrumenter.goto_functions.function_map[function_id].body;
181 max_thread=max_thread+1;
182 coming_from=current_thread;
183 current_thread=max_thread;
186 current_thread=coming_from;
187 thread=current_thread;
189 instrumenter.message.debug()
202 #elif defined ATOMIC_FENCE
203 visit_cfg_fence(i_it, function_id);
206 visit_cfg_propagate(i_it);
223 else if(
is_fence(instruction, instrumenter.ns))
225 instrumenter.message.debug() <<
"Constructing a fence" <<
messaget::eom;
226 visit_cfg_fence(i_it, function_id);
228 else if(model!=
TSO &&
is_lwfence(instruction, instrumenter.ns))
230 visit_cfg_lwfence(i_it, function_id);
232 else if(model==
TSO &&
is_lwfence(instruction, instrumenter.ns))
235 visit_cfg_skip(i_it);
240 visit_cfg_asm_fence(i_it, function_id);
244 visit_cfg_function_call(value_sets, i_it, model,
245 no_dependencies, replicate_body);
261 #ifdef CONTEXT_INSENSITIVE
264 visit_cfg_propagate(i_it);
265 add_all_pos(it, out_nodes[function_id], in_pos[i_it]);
271 visit_cfg_propagate(i_it);
275 std::pair<unsigned, data_dpt> new_dp(thread, data_dp);
277 data_dp.print(instrumenter.message);
279 if(instrumenter.goto_functions.function_map[function_id]
280 .body.instructions.empty())
286 goto_programt::instructionst::iterator it =
287 instrumenter.goto_functions.function_map[function_id]
288 .body.instructions.end();
290 ending_vertex=in_pos[it];
295 goto_programt::instructionst::iterator i_it)
299 in_pos[i_it].
clear();
301 if(in_pos.find(in)!=in_pos.end())
302 for(
const auto &node : in_pos[in])
303 in_pos[i_it].insert(node);
319 if(instrumenter.map_function_graph.find(id_function)!=
320 instrumenter.map_function_graph.end())
325 .function_map[id_function].body.instructions;
334 goto_programt::instructionst::iterator i_it=body.end();
338 goto_programt::instructionst::iterator targ=body.begin();
340 std::set<event_idt> in_nodes;
341 std::set<event_idt> out_nodes;
344 if(in_pos.find(targ)!=in_pos.end())
347 if(updated.find(targ)!=updated.end())
350 for(std::set<nodet>::const_iterator to=in_pos[targ].begin();
351 to!=in_pos[targ].end(); ++to)
352 in_nodes.insert(to->first);
353 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
354 from!=in_pos[i_it].end(); ++from)
355 out_nodes.insert(from->first);
359 instrumenter.message.debug() <<
"else case" <<
messaget::eom;
361 for(goto_programt::instructionst::iterator cur=i_it;
365 for(
const auto &in : cur->incoming_edges)
368 if(in_pos.find(in)!=in_pos.end() &&
369 updated.find(in)!=updated.end())
374 else if(in_pos.find(in)!=in_pos.end())
383 if(out_pos.find(targ)!=out_pos.end())
385 for(std::set<nodet>::const_iterator to=out_pos[targ].begin();
386 to!=out_pos[targ].end(); ++to)
387 in_nodes.insert(to->first);
388 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
389 from!=in_pos[i_it].end(); ++from)
390 out_nodes.insert(from->first);
395 instrumenter.map_function_graph[id_function]=
396 std::make_pair(in_nodes, out_nodes);
419 instrumenter.message.debug()
420 <<
"contains_shared_array called for " << targ->source_location().get_line()
421 <<
" and " << i_it->source_location().get_line() <<
messaget::eom;
424 instrumenter.message.debug()
425 <<
"Do we have an array at line " << cur->source_location().get_line()
435 instrumenter.message.get_message_handler());
436 instrumenter.message.debug() <<
"Writes: "<<rw_set.
w_entries.size()
439 for(
const auto &r_entry : rw_set.
r_entries)
441 const irep_idt var = r_entry.second.object;
442 instrumenter.message.debug() <<
"Is "<<var<<
" an array?"
444 if(
id2string(var).find(
"[]")!=std::string::npos
445 && !instrumenter.local(var))
449 for(
const auto &w_entry : rw_set.
w_entries)
451 const irep_idt var = w_entry.second.object;
452 instrumenter.message.debug()<<
"Is "<<var<<
" an array?"<<
messaget::eom;
453 if(
id2string(var).find(
"[]")!=std::string::npos
454 && !instrumenter.local(var))
477 for(
const auto &target : i_it->targets)
480 if(in_pos.find(target)!=in_pos.end())
482 if(in_pos[i_it].empty())
485 bool duplicate_this=
false;
487 switch(replicate_body)
490 duplicate_this = contains_shared_array(
505 duplicate_this=
false;
510 visit_cfg_duplicate(goto_program, target, i_it);
512 visit_cfg_backedge(target, i_it);
522 instrumenter.message.status() <<
"Duplication..." <<
messaget::eom;
524 bool found_pos=
false;
527 if(in_pos[targ].empty())
530 for(; new_targ != goto_program.
instructions.end(); ++new_targ)
532 if(in_pos.find(new_targ)!=in_pos.end() && !in_pos[new_targ].empty())
544 new_targ->source_location().get_function() !=
545 targ->source_location().get_function() ||
546 new_targ->source_location().get_file() !=
547 targ->source_location().get_file())
552 const std::set<nodet> &up_set=in_pos[(found_pos ? new_targ : targ)];
553 const std::set<nodet> &down_set=in_pos[i_it];
555 for(std::set<nodet>::const_iterator begin_it=up_set.begin();
556 begin_it!=up_set.end(); ++begin_it)
557 instrumenter.message.debug() <<
"Up " << begin_it->first <<
messaget::eom;
559 for(std::set<nodet>::const_iterator begin_it=down_set.begin();
560 begin_it!=down_set.end(); ++begin_it)
561 instrumenter.message.debug() <<
"Down " << begin_it->first <<
messaget::eom;
563 for(std::set<nodet>::const_iterator begin_it=up_set.begin();
564 begin_it!=up_set.end(); ++begin_it)
566 for(std::set<nodet>::const_iterator end_it=down_set.begin();
567 end_it!=down_set.end(); ++end_it)
588 if(updated.find(targ)!=updated.end())
591 for(std::set<nodet>::const_iterator to=in_pos[targ].begin();
592 to!=in_pos[targ].end(); ++to)
593 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
594 from!=in_pos[i_it].end(); ++from)
595 if(from->first!=to->first)
597 if(
egraph[from->first].thread!=
egraph[to->first].thread)
599 instrumenter.message.debug() << from->first <<
"-po->"
607 instrumenter.message.debug() <<
"else case" <<
messaget::eom;
613 for(
const auto &in : cur->incoming_edges)
615 if(in_pos.find(in)!=in_pos.end()
616 && updated.find(in)!=updated.end())
621 else if(in_pos.find(in)!=in_pos.end())
630 if(out_pos.find(targ)!=out_pos.end())
632 for(std::set<nodet>::const_iterator to=out_pos[targ].begin();
633 to!=out_pos[targ].end(); ++to)
634 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
635 from!=in_pos[i_it].end(); ++from)
636 if(from->first!=to->first)
638 if(
egraph[from->first].thread!=
egraph[to->first].thread)
640 instrumenter.message.debug() << from->first<<
"-po->"
652 goto_programt::instructionst::iterator i_it,
664 visit_cfg_propagate(i_it);
672 instrumenter.message.debug() <<
"backward goto" <<
messaget::eom;
689 goto_programt::instructionst::iterator i_it,
691 bool no_dependencies,
701 enter_function(fun_id);
702 #ifdef CONTEXT_INSENSITIVE
703 stack_fun.push(cur_fun);
708 if(!inline_function_cond(fun_id))
712 if(instrumenter.map_function_graph.find(fun_id)!=
713 instrumenter.map_function_graph.end())
722 visit_cfg_function(value_sets, model, no_dependencies, fun_id,
724 updated.insert(i_it);
731 visit_cfg_function(value_sets, model, no_dependencies, replicate_body,
732 fun_id, in_pos[i_it]);
733 updated.insert(i_it);
736 leave_function(fun_id);
737 #ifdef CONTEXT_INSENSITIVE
738 cur_fun=stack_fun.pop();
741 catch(
const std::string &s)
743 instrumenter.message.warning() <<
"sorry, doesn't handle recursion "
744 <<
"(function " << fun_id <<
"; .cpp) "
750 goto_programt::instructionst::iterator i_it,
758 instrumenter.unique_id++,
763 egraph[new_fence_node](new_fence_event);
766 instrumenter.map_vertex_gnode.insert(
767 std::make_pair(new_fence_node, new_fence_gnode));
770 if(in_pos.find(in)!=in_pos.end())
772 for(
const auto &node : in_pos[in])
774 if(
egraph[node.first].thread!=thread)
776 instrumenter.message.debug() << node.first<<
"-po->"<<new_fence_node
783 in_pos[i_it].clear();
784 in_pos[i_it].insert(
nodet(new_fence_node, new_fence_gnode));
785 updated.insert(i_it);
789 goto_programt::instructionst::iterator i_it,
804 instrumenter.unique_id++,
816 egraph[new_fence_node](new_fence_event);
819 instrumenter.map_vertex_gnode.insert(
820 std::make_pair(new_fence_node, new_fence_gnode));
823 if(in_pos.find(in)!=in_pos.end())
825 for(
const auto &node : in_pos[in])
827 if(
egraph[node.first].thread!=thread)
829 instrumenter.message.debug() << node.first<<
"-po->"<<new_fence_node
836 in_pos[i_it].clear();
837 in_pos[i_it].insert(
nodet(new_fence_node, new_fence_gnode));
838 updated.insert(i_it);
844 goto_programt::instructionst::iterator &i_it,
863 instrumenter.message.get_message_handler());
865 event_idt previous=std::numeric_limits<event_idt>::max();
866 event_idt previous_gnode=std::numeric_limits<event_idt>::max();
873 if(!instruction.
labels.empty() && instruction.
labels.front()==
"ASSERT")
877 for(
const auto &r_entry : rw_set.
r_entries)
898 instrumenter.unique_id++,
904 egraph[new_read_node]=new_read_event;
905 instrumenter.message.debug() <<
"new Read" <<
read <<
" @thread" << (thread)
907 << (
local(
read) ?
"local" :
"shared") <<
") #"
911 unknown_read_nodes.insert(new_read_node);
915 instrumenter.map_vertex_gnode.insert(
916 std::make_pair(new_read_node, new_read_gnode));
921 if(in_pos.find(in)!=in_pos.end())
923 for(
const auto &node : in_pos[in])
925 if(
egraph[node.first].thread!=thread)
927 instrumenter.message.debug() << node.first<<
"-po->"
936 previous=new_read_node;
937 previous_gnode=new_read_gnode;
940 const std::pair<id2nodet::iterator, id2nodet::iterator>
941 with_same_var=map_writes.equal_range(
read);
942 for(id2nodet::iterator id_it=with_same_var.first;
943 id_it!=with_same_var.second; id_it++)
946 instrumenter.message.debug() << id_it->second<<
"<-com->"
948 std::map<event_idt, event_idt>::const_iterator entry=
949 instrumenter.map_vertex_gnode.find(id_it->second);
950 CHECK_RETURN(entry != instrumenter.map_vertex_gnode.end());
959 for(std::set<event_idt>::const_iterator id_it=
960 unknown_write_nodes.begin();
961 id_it!=unknown_write_nodes.end();
965 instrumenter.message.debug() << *id_it<<
"<-com->"
967 std::map<event_idt, event_idt>::const_iterator entry=
968 instrumenter.map_vertex_gnode.find(*id_it);
969 CHECK_RETURN(entry != instrumenter.map_vertex_gnode.end());
979 for(
const auto &w_entry : rw_set.
w_entries)
1001 instrumenter.unique_id++,
1007 egraph[new_write_node](new_write_event);
1009 <<
"new Write " <<
write <<
" @thread" << (thread) <<
"("
1011 << (
local(
write) ?
"local" :
"shared") <<
") #" << new_write_node
1014 if(
write==ID_unknown)
1015 unknown_read_nodes.insert(new_write_node);
1019 instrumenter.map_vertex_gnode.insert(
1020 std::pair<event_idt, event_idt>(new_write_node, new_write_gnode));
1023 if(previous!=std::numeric_limits<event_idt>::max())
1025 instrumenter.message.debug() << previous<<
"-po->"<<new_write_node
1034 if(in_pos.find(in)!=in_pos.end())
1036 for(
const auto &node : in_pos[in])
1038 if(
egraph[node.first].thread!=thread)
1040 instrumenter.message.debug() << node.first<<
"-po->"
1050 const std::pair<id2nodet::iterator, id2nodet::iterator>
1051 r_with_same_var=map_reads.equal_range(
write);
1052 for(id2nodet::iterator idr_it=r_with_same_var.first;
1053 idr_it!=r_with_same_var.second; idr_it++)
1054 if(
egraph[idr_it->second].thread!=new_write_event.
thread)
1056 instrumenter.message.debug() <<idr_it->second<<
"<-com->"
1058 std::map<event_idt, event_idt>::const_iterator entry=
1059 instrumenter.map_vertex_gnode.find(idr_it->second);
1060 CHECK_RETURN(entry != instrumenter.map_vertex_gnode.end());
1069 const std::pair<id2nodet::iterator, id2nodet::iterator>
1070 w_with_same_var=map_writes.equal_range(
write);
1071 for(id2nodet::iterator idw_it=w_with_same_var.first;
1072 idw_it!=w_with_same_var.second; idw_it++)
1073 if(
egraph[idw_it->second].thread!=new_write_event.
thread)
1075 instrumenter.message.debug() << idw_it->second<<
"<-com->"
1077 std::map<event_idt, event_idt>::const_iterator entry=
1078 instrumenter.map_vertex_gnode.find(idw_it->second);
1079 CHECK_RETURN(entry != instrumenter.map_vertex_gnode.end());
1088 for(std::set<event_idt>::const_iterator id_it=
1089 unknown_write_nodes.begin();
1090 id_it!=unknown_write_nodes.end();
1094 instrumenter.message.debug() << *id_it<<
"<-com->"
1096 std::map<event_idt, event_idt>::const_iterator entry=
1097 instrumenter.map_vertex_gnode.find(*id_it);
1098 CHECK_RETURN(entry != instrumenter.map_vertex_gnode.end());
1107 for(std::set<event_idt>::const_iterator id_it=
1108 unknown_read_nodes.begin();
1109 id_it!=unknown_read_nodes.end();
1113 instrumenter.message.debug() << *id_it<<
"<-com->"
1115 std::map<event_idt, event_idt>::const_iterator entry=
1116 instrumenter.map_vertex_gnode.find(*id_it);
1117 CHECK_RETURN(entry != instrumenter.map_vertex_gnode.end());
1127 previous=new_write_node;
1128 previous_gnode=new_write_gnode;
1131 if(previous!=std::numeric_limits<event_idt>::max())
1133 in_pos[i_it].clear();
1134 in_pos[i_it].insert(
nodet(previous, previous_gnode));
1135 updated.insert(i_it);
1140 visit_cfg_skip(i_it);
1144 if(!no_dependencies)
1146 for(
const auto &w_entry : rw_set.
w_entries)
1148 for(
const auto &r_entry : rw_set.
r_entries)
1152 instrumenter.message.debug() <<
"dp: Write:"<<
write<<
"; Read:"<<
read
1161 for(
const auto &r_entry : rw_set.
r_entries)
1163 for(
const auto &r_entry2 : rw_set.
r_entries)
1165 const irep_idt &read2 = r_entry2.second.object;
1179 goto_programt::instructionst::iterator i_it,
1187 instrumenter.unique_id++,
1192 egraph[new_fence_node](new_fence_event);
1195 instrumenter.map_vertex_gnode.insert(
1196 std::make_pair(new_fence_node, new_fence_gnode));
1199 if(in_pos.find(in)!=in_pos.end())
1201 for(
const auto &node : in_pos[in])
1203 instrumenter.message.debug() << node.first<<
"-po->"<<new_fence_node
1211 s.insert(
nodet(new_fence_node, new_fence_gnode));
1213 updated.insert(i_it);
1215 in_pos[i_it].clear();
1216 in_pos[i_it].insert(
nodet(new_fence_node, new_fence_gnode));
1217 updated.insert(i_it);
1221 goto_programt::instructionst::iterator i_it)
1223 visit_cfg_propagate(i_it);
1227 goto_programt::instructionst::iterator it,
1231 it->is_set_return_value() || it->is_throw() || it->is_catch() ||
1232 it->is_skip() || it->is_dead() || it->is_start_thread() ||
1233 it->is_end_thread())
1236 if(it->is_atomic_begin() ||
1237 it->is_atomic_end())
1243 if(it->is_function_call())
1259 e_it!=cyc.
end() && ++e_it!=cyc.
end(); ++e_it)
1268 bool thread_found=
false;
1272 for(
const auto &instruction : gf_entry.second.body.instructions)
1274 if(instruction.source_location() == current_location)
1276 current_po = &gf_entry.second.body;
1291 bool exists_n=
false;
1293 for(wmm_grapht::edgest::const_iterator edge_it=pos_cur.begin();
1294 edge_it!=pos_cur.end(); edge_it++)
1296 if(pos_next.find(edge_it->first)!=pos_next.end())
1304 if((++e_it)!=cyc.
end() || !exists_n)
1310 if(i_it->source_location() == current_location)
1313 for(goto_programt::instructionst::iterator same_loc = i_it;
1315 same_loc->source_location() == i_it->source_location();
1329 bool in_cycle=
false;
1332 if(it->source_location() == current_location)
1337 if(it->source_location() == next_location)
1350 if(instruction.is_goto())
1352 for(
const auto &t : instruction.targets)
1354 bool target_in_cycle=
false;
1360 target_in_cycle=
true;
1365 if(!target_in_cycle)
1379 map.insert(std::make_pair(
1381 std::move(one_interleaving)));
1388 bmct bmc(no_option, symbol_table, no_message);
1390 bool is_spurious=bmc.run(this_interleaving);
1404 for(std::set<event_grapht::critical_cyclet>::iterator
1410 std::set<event_grapht::critical_cyclet>::iterator next=it;
1425 for(std::set<event_grapht::critical_cyclet>::iterator it=
1431 std::set<event_grapht::critical_cyclet>::iterator next=it;
1448 const std::set<event_grapht::critical_cyclet> &set,
1451 std::ofstream &output,
1453 std::ofstream &table,
1455 bool hide_internals)
1458 std::map<unsigned, std::set<event_idt> > same_po;
1459 unsigned max_thread=0;
1463 std::map<irep_idt, std::set<event_idt> > same_file;
1466 std::map<std::string, std::string> map_id2var;
1467 std::map<std::string, std::string> map_var2id;
1469 for(std::set<event_grapht::critical_cyclet>::const_iterator it =
1470 set.begin(); it!=set.end(); it++)
1472 #ifdef PRINT_UNSAFES
1475 it->print_dot(
dot, colour++, model);
1476 ref << it->print_name(model, hide_internals) <<
'\n';
1477 output << it->print_output() <<
'\n';
1478 all << it->print_all(model, map_id2var, map_var2id, hide_internals)
1482 for(std::list<event_idt>::const_iterator it_e=it->begin();
1483 it_e!=it->end(); it_e++)
1488 same_po[ev.
thread].insert(*it_e);
1499 dot << ev.
id <<
"[label=\"\\\\lb {" << ev.
id <<
"}";
1501 dot << ev.
thread <<
"\",color=red,shape=box];\n";
1509 for(
unsigned i=0; i<=max_thread; i++)
1510 if(!same_po[i].empty())
1512 dot <<
"{rank=same; thread_" << i
1513 <<
"[shape=plaintext, label=\"thread " << i <<
"\"];";
1514 for(std::set<event_idt>::iterator it=same_po[i].begin();
1515 it!=same_po[i].end(); it++)
1524 for(std::map<
irep_idt, std::set<event_idt> >::const_iterator it=
1526 it!=same_file.end(); it++)
1529 dot <<
" label=\"" << it->first <<
"\";\n";
1530 for(std::set<event_idt>::const_iterator ev_it=it->second.begin();
1531 ev_it!=it->second.end(); ev_it++)
1533 dot <<
" " <<
egraph[*ev_it].id <<
";\n";
1540 table << std::string(80,
'-');
1541 for(std::map<std::string, std::string>::const_iterator
1542 m_it=map_id2var.begin();
1543 m_it!=map_id2var.end();
1546 table <<
"\n| " << m_it->first <<
" : " << m_it->second;
1549 table << std::string(80,
'-');
1557 std::ofstream output;
1559 std::ofstream table;
1561 dot.open(
"cycles.dot");
1562 ref.open(
"ref.txt");
1563 output.open(
"output.txt");
1564 all.open(
"all.txt");
1565 table.open(
"table.txt");
1567 dot <<
"digraph G {\n";
1568 dot <<
"nodesep=1; ranksep=1;\n";
1573 model, hide_internals);
1578 std::ofstream local_dot;
1580 local_dot.open(name.c_str());
1582 local_dot <<
"digraph G {\n";
1583 local_dot <<
"nodesep=1; ranksep=1;\n";
1585 table, model, hide_internals);
1589 dot << i <<
"[label=\"SCC " << i <<
"\",link=\"" <<
"scc_" << i;
1612 std::set<event_grapht::critical_cyclet>());
1613 for(std::vector<std::set<event_idt> >::const_iterator it=
egraph_SCCs.begin();
1619 class pthread_argumentt
1624 const std::set<event_idt> &filter;
1625 std::set<event_grapht::critical_cyclet> &cycles;
1629 const std::set<event_idt> &_filter,
1630 std::set<event_grapht::critical_cyclet> &_cycles)
1631 :instr(_instr), mem(_mem), filter(_filter), cycles(_cycles)
1637 void *collect_cycles_in_thread(
void *arg)
1640 pthread_argumentt *p_arg=
reinterpret_cast<pthread_argumentt*
>(arg);
1643 const std::set<event_idt> &filter=p_arg->filter;
1644 std::set<event_grapht::critical_cyclet> &cycles=p_arg->cycles;
1653 const unsigned number_of_sccs=
num_sccs;
1654 std::set<unsigned> interesting_SCCs;
1657 pthread_t *threads=
new pthread_t[
num_sccs+1];
1660 std::set<event_grapht::critical_cyclet>());
1662 for(std::vector<std::set<unsigned> >::const_iterator it=
egraph_SCCs.begin();
1666 interesting_SCCs.insert(scc);
1670 collect_cycles_in_thread, &arg);
1676 for(
unsigned i=0; i<number_of_sccs; i++)
1677 if(interesting_SCCs.find(i)!=interesting_SCCs.end())
std::string get_operation() const
source_locationt source_location
const irep_idt & get_statement() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
std::string::const_iterator begin() const
data_typet::const_iterator const_iterator
event_idt copy_segment(event_idt begin, event_idt end)
const wmm_grapht::edgest & po_out(event_idt n) const
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
void add_com_edge(event_idt a, event_idt b)
void add_po_edge(event_idt a, event_idt b)
void add_po_back_edge(event_idt a, event_idt b)
Base class for all expressions.
const source_locationt & source_location() const
The Boolean constant false.
A collection of goto functions.
std::map< irep_idt, goto_functiont > function_mapt
function_mapt function_map
static irep_idt entry_point()
Get the identifier of the entry point to a goto model.
A goto function, consisting of function body (see body) and parameter identifiers (see parameter_iden...
This class represents an instruction in the GOTO intermediate representation.
bool is_set_return_value() const
const exprt & call_function() const
Get the function that is called for FUNCTION_CALL.
bool is_end_thread() const
const goto_instruction_codet & code() const
Get the code represented by this instruction.
bool is_start_thread() const
bool is_atomic_end() const
bool is_backwards_goto() const
Returns true if the instruction is a backwards branch.
bool is_atomic_begin() const
std::set< targett, target_less_than > incoming_edges
void clear(goto_program_instruction_typet __type)
Clear the node.
const source_locationt & source_location() const
bool is_function_call() const
goto_program_instruction_typet type() const
What kind of instruction?
A generic container class for the GOTO intermediate representation of one function.
instructionst instructions
The list of instructions in the goto program.
void copy_from(const goto_programt &src)
Copy a full goto program, preserving targets.
instructionst::const_iterator const_targett
std::list< instructiont > instructionst
targett add(instructiont &&instruction)
Adds a given instruction at the end.
static instructiont make_assertion(const exprt &g, const source_locationt &l=source_locationt::nil())
std::size_t SCCs(std::vector< node_indext > &subgraph_nr) const
Computes strongly-connected components of a graph and yields a vector expressing a mapping from nodes...
node_indext add_node(arguments &&... values)
void add_edge(node_indext a, node_indext b)
void visit_cfg_backedge(goto_programt::const_targett targ, goto_programt::const_targett i_it)
strategy: fwd/bwd alternation
void visit_cfg_reference_function(irep_idt id_function)
references the first and last edges of the function
bool contains_shared_array(const irep_idt &function_id, goto_programt::const_targett targ, goto_programt::const_targett i_it, value_setst &value_sets) const
instrumentert & instrumenter
virtual void visit_cfg_function(value_setst &value_sets, memory_modelt model, bool no_dependencies, loop_strategyt duplicate_body, const irep_idt &function_id, std::set< nodet > &ending_vertex)
TODO: move the visitor outside, and inherit.
std::pair< irep_idt, event_idt > id2node_pairt
bool local(const irep_idt &i)
void visit_cfg_fence(goto_programt::instructionst::iterator i_it, const irep_idt &function_id)
void visit_cfg_goto(const irep_idt &function_id, const goto_programt &goto_program, goto_programt::instructionst::iterator i_it, loop_strategyt replicate_body, value_setst &value_sets)
void visit_cfg_function_call(value_setst &value_sets, goto_programt::instructionst::iterator i_it, memory_modelt model, bool no_dependenciess, loop_strategyt duplicate_body)
void visit_cfg_lwfence(goto_programt::instructionst::iterator i_it, const irep_idt &function_id)
void visit_cfg_propagate(goto_programt::instructionst::iterator i_it)
void visit_cfg_assign(value_setst &value_sets, const irep_idt &function_id, goto_programt::instructionst::iterator &i_it, bool no_dependencies)
void visit_cfg(value_setst &value_sets, memory_modelt model, bool no_dependencies, loop_strategyt duplicate_body, const irep_idt &function_id)
void visit_cfg_duplicate(const goto_programt &goto_program, goto_programt::const_targett targ, goto_programt::const_targett i_it)
void visit_cfg_body(const irep_idt &function_id, const goto_programt &goto_program, goto_programt::const_targett i_it, loop_strategyt replicate_body, value_setst &value_sets)
strategy: fwd/bwd alternation
std::pair< event_idt, event_idt > nodet
void visit_cfg_thread() const
void visit_cfg_skip(goto_programt::instructionst::iterator i_it)
void visit_cfg_asm_fence(goto_programt::instructionst::iterator i_it, const irep_idt &function_id)
void print_outputs(memory_modelt model, bool hide_internals)
void collect_cycles_by_SCCs(memory_modelt model)
Note: can be distributed (#define DISTRIBUTED)
std::set< event_grapht::critical_cyclet > set_of_cycles
std::set< irep_idt > var_to_instr
std::vector< std::set< event_idt > > egraph_SCCs
std::multimap< irep_idt, source_locationt > id2loc
bool is_cfg_spurious(const event_grapht::critical_cyclet &cyc)
goto_functionst & goto_functions
std::map< event_idt, event_idt > map_vertex_gnode
std::vector< std::set< event_grapht::critical_cyclet > > set_of_cycles_per_SCC
void add_instr_to_interleaving(goto_programt::instructionst::iterator it, goto_programt &interleaving)
bool local(const irep_idt &id)
is local variable?
unsigned goto2graph_cfg(value_setst &value_sets, memory_modelt model, bool no_dependencies, loop_strategyt duplicate_body)
goes through CFG and build a static abstract event graph overapproximating the read/write relations f...
void print_outputs_local(const std::set< event_grapht::critical_cyclet > &set, std::ofstream &dot, std::ofstream &ref, std::ofstream &output, std::ofstream &all, std::ofstream &table, memory_modelt model, bool hide_internals)
bool get_bool(const irep_idt &name) const
mstreamt & statistics() const
mstreamt & status() const
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
const irep_idt & get_file() const
const irep_idt & get_identifier() const
bool has_prefix(const std::string &s, const std::string &prefix)
void dot(const goto_modelt &src, std::ostream &out)
wmm_grapht::node_indext event_idt
bool is_fence(const goto_programt::instructiont &instruction, const namespacet &ns)
bool is_lwfence(const goto_programt::instructiont &instruction, const namespacet &ns)
Fences for instrumentation.
event_idt alt_copy_segment(wmm_grapht &alt_egraph, event_idt begin, event_idt end)
#define add_all_pos(it, target, source)
#define forall_goto_program_instructions(it, program)
#define Forall_goto_program_instructions(it, program)
dstring_hash irep_id_hash
const std::string & id2string(const irep_idt &d)
int __CPROVER_ID java::java io InputStream read
int pthread_join(pthread_t thread, void **value_ptr)
int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
Race Detection for Threaded Goto Programs.
#define CHECK_RETURN(CONDITION)
#define INITIALIZE_FUNCTION
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
ssize_t write(int fildes, const void *buf, size_t nbyte)