46 identifier==
"stdin" ||
47 identifier==
"stdout" ||
48 identifier==
"stderr" ||
49 identifier==
"sys_nerr" ||
53 const size_t pos=identifier.find(
"[]");
55 if(
pos!=std::string::npos)
58 identifier.erase(
pos);
73 catch(
const std::string &exception)
98 visitor.
visit_cfg(value_sets, model, no_dependencies, duplicate_body,
101 std::vector<std::size_t> subgraph_index;
105 for(std::map<event_idt, event_idt>::const_iterator
110 const std::size_t sg=subgraph_index[it->second];
118 unsigned interesting_sccs=0;
124 << interesting_sccs <<
" interesting SCCs" 135 std::size_t instr_counter=0;
136 for(goto_functionst::function_mapt::const_iterator
140 instr_counter+=it->second.body.instructions.size();
150 bool no_dependencies,
153 std::set<instrumentert::cfg_visitort::nodet> &ending_vertex)
157 instrumenter.message.debug() <<
"visit function " 167 instrumenter.goto_functions.function_map[
function]);
172 instrumenter.goto_functions.function_map[
function].body)
179 max_thread=max_thread+1;
180 coming_from=current_thread;
181 current_thread=max_thread;
184 current_thread=coming_from;
185 thread=current_thread;
187 instrumenter.message.debug() <<
"visit instruction "<<instruction.
type 200 #elif defined ATOMIC_FENCE 201 visit_cfg_fence(i_it);
204 visit_cfg_propagate(i_it);
220 else if(
is_fence(instruction, instrumenter.ns))
222 instrumenter.message.debug() <<
"Constructing a fence" <<
messaget::eom;
223 visit_cfg_fence(i_it);
225 else if(model!=
TSO &&
is_lwfence(instruction, instrumenter.ns))
227 visit_cfg_lwfence(i_it);
229 else if(model==
TSO &&
is_lwfence(instruction, instrumenter.ns))
232 visit_cfg_skip(i_it);
237 visit_cfg_asm_fence(i_it);
241 visit_cfg_function_call(value_sets, i_it, model,
242 no_dependencies, replicate_body);
246 visit_cfg_goto(i_it, replicate_body, value_sets
252 #ifdef CONTEXT_INSENSITIVE 255 visit_cfg_propagate(i_it);
256 add_all_pos(it, out_nodes[
function], in_pos[i_it]);
262 visit_cfg_propagate(i_it);
266 std::pair<unsigned, data_dpt> new_dp(thread, data_dp);
268 data_dp.print(instrumenter.message);
270 if(instrumenter.goto_functions.function_map[
function]
271 .body.instructions.empty())
277 goto_programt::instructionst::iterator it=instrumenter
278 .goto_functions.function_map[
function].body.instructions.end();
280 ending_vertex=in_pos[it];
285 goto_programt::instructionst::iterator i_it)
289 in_pos[i_it].
clear();
291 if(in_pos.find(in)!=in_pos.end())
292 for(
const auto &node : in_pos[in])
293 in_pos[i_it].insert(node);
309 if(instrumenter.map_function_graph.find(
id_function)!=
310 instrumenter.map_function_graph.end())
324 goto_programt::instructionst::iterator i_it=body.end();
328 goto_programt::instructionst::iterator targ=body.begin();
330 std::set<event_idt> in_nodes;
331 std::set<event_idt> out_nodes;
334 if(in_pos.find(targ)!=in_pos.end())
337 if(updated.find(targ)!=updated.end())
340 for(std::set<nodet>::const_iterator to=in_pos[targ].begin();
341 to!=in_pos[targ].end(); ++to)
342 in_nodes.insert(to->first);
343 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
344 from!=in_pos[i_it].end(); ++from)
345 out_nodes.insert(from->first);
349 instrumenter.message.debug() <<
"else case" <<
messaget::eom;
351 for(goto_programt::instructionst::iterator cur=i_it;
355 for(
const auto &in : cur->incoming_edges)
358 if(in_pos.find(in)!=in_pos.end() &&
359 updated.find(in)!=updated.end())
364 else if(in_pos.find(in)!=in_pos.end())
373 if(out_pos.find(targ)!=out_pos.end())
375 for(std::set<nodet>::const_iterator to=out_pos[targ].begin();
376 to!=out_pos[targ].end(); ++to)
377 in_nodes.insert(to->first);
378 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
379 from!=in_pos[i_it].end(); ++from)
380 out_nodes.insert(from->first);
386 std::make_pair(in_nodes, out_nodes);
407 instrumenter.message.debug() <<
"contains_shared_array called for " 408 << targ->source_location.get_line() <<
" and " 412 instrumenter.message.debug() <<
"Do we have an array at line " 419 instrumenter.message.debug() <<
"Writes: "<<rw_set.
w_entries.size()
424 const irep_idt var=r_it->second.object;
425 instrumenter.message.debug() <<
"Is "<<var<<
" an array?" 427 if(
id2string(var).find(
"[]")!=std::string::npos
428 && !instrumenter.local(var))
434 const irep_idt var=w_it->second.object;
435 instrumenter.message.debug()<<
"Is "<<var<<
" an array?"<<
messaget::eom;
436 if(
id2string(var).find(
"[]")!=std::string::npos
437 && !instrumenter.local(var))
457 for(
const auto &target : i_it->targets)
460 if(in_pos.find(target)!=in_pos.end())
462 if(in_pos[i_it].empty())
465 bool duplicate_this=
false;
467 switch(replicate_body)
470 duplicate_this=contains_shared_array(target, i_it, value_sets
480 duplicate_this=
false;
485 visit_cfg_duplicate(target, i_it);
487 visit_cfg_backedge(target, i_it);
496 instrumenter.message.status() <<
"Duplication..." <<
messaget::eom;
498 instrumenter.goto_functions.function_map[i_it->function];
500 bool found_pos=
false;
503 if(in_pos[targ].empty())
506 for(; new_targ!=fun.body.instructions.end();
509 if(in_pos.find(new_targ)!=in_pos.end() && !in_pos[new_targ].empty())
517 || new_targ->source_location.get_function()
518 !=targ->source_location.get_function()
519 || new_targ->source_location.get_file()
520 !=targ->source_location.get_file())
525 const std::set<nodet> &up_set=in_pos[(found_pos ? new_targ : targ)];
526 const std::set<nodet> &down_set=in_pos[i_it];
528 for(std::set<nodet>::const_iterator begin_it=up_set.begin();
529 begin_it!=up_set.end(); ++begin_it)
530 instrumenter.message.debug() <<
"Up " << begin_it->first <<
messaget::eom;
532 for(std::set<nodet>::const_iterator begin_it=down_set.begin();
533 begin_it!=down_set.end(); ++begin_it)
534 instrumenter.message.debug() <<
"Down " << begin_it->first <<
messaget::eom;
536 for(std::set<nodet>::const_iterator begin_it=up_set.begin();
537 begin_it!=up_set.end(); ++begin_it)
539 for(std::set<nodet>::const_iterator end_it=down_set.begin();
540 end_it!=down_set.end(); ++end_it)
561 if(updated.find(targ)!=updated.end())
564 for(std::set<nodet>::const_iterator to=in_pos[targ].begin();
565 to!=in_pos[targ].end(); ++to)
566 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
567 from!=in_pos[i_it].end(); ++from)
568 if(from->first!=to->first)
570 if(
egraph[from->first].thread!=
egraph[to->first].thread)
572 instrumenter.message.debug() << from->first <<
"-po->" 580 instrumenter.message.debug() <<
"else case" <<
messaget::eom;
586 for(
const auto &in : cur->incoming_edges)
588 if(in_pos.find(in)!=in_pos.end()
589 && updated.find(in)!=updated.end())
594 else if(in_pos.find(in)!=in_pos.end())
603 if(out_pos.find(targ)!=out_pos.end())
605 for(std::set<nodet>::const_iterator to=out_pos[targ].begin();
606 to!=out_pos[targ].end(); ++to)
607 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
608 from!=in_pos[i_it].end(); ++from)
609 if(from->first!=to->first)
611 if(
egraph[from->first].thread!=
egraph[to->first].thread)
613 instrumenter.message.debug() << from->first<<
"-po->" 623 goto_programt::instructionst::iterator i_it,
634 visit_cfg_propagate(i_it);
642 instrumenter.message.debug() <<
"backward goto" <<
messaget::eom;
643 visit_cfg_body(i_it, replicate_body, value_sets
653 goto_programt::instructionst::iterator i_it,
655 bool no_dependencies,
665 enter_function(fun_id);
666 #ifdef CONTEXT_INSENSITIVE 667 stack_fun.push(cur_fun);
672 if(!inline_function_cond(fun_id))
676 if(instrumenter.map_function_graph.find(fun_id)!=
677 instrumenter.map_function_graph.end())
686 visit_cfg_function(value_sets, model, no_dependencies, fun_id,
688 updated.insert(i_it);
695 visit_cfg_function(value_sets, model, no_dependencies, replicate_body,
696 fun_id, in_pos[i_it]);
697 updated.insert(i_it);
700 leave_function(fun_id);
701 #ifdef CONTEXT_INSENSITIVE 702 cur_fun=stack_fun.pop();
705 catch(
const std::string &s)
707 instrumenter.message.warning() <<
"sorry, doesn't handle recursion " 708 <<
"(function " << fun_id <<
"; .cpp) " 714 goto_programt::instructionst::iterator i_it)
718 thread,
"f", instrumenter.unique_id++, instruction.
source_location,
false);
720 egraph[new_fence_node](new_fence_event);
723 instrumenter.map_vertex_gnode.insert(
724 std::make_pair(new_fence_node, new_fence_gnode));
727 if(in_pos.find(in)!=in_pos.end())
729 for(
const auto &node : in_pos[in])
731 if(
egraph[node.first].thread!=thread)
733 instrumenter.message.debug() << node.first<<
"-po->"<<new_fence_node
740 in_pos[i_it].clear();
741 in_pos[i_it].insert(
nodet(new_fence_node, new_fence_gnode));
742 updated.insert(i_it);
746 goto_programt::instructionst::iterator i_it)
758 false, WRfence, WWfence, RRfence, RWfence, WWcumul, RWcumul, RRcumul);
760 egraph[new_fence_node](new_fence_event);
763 instrumenter.map_vertex_gnode.insert(
764 std::make_pair(new_fence_node, new_fence_gnode));
767 if(in_pos.find(in)!=in_pos.end())
769 for(
const auto &node : in_pos[in])
771 if(
egraph[node.first].thread!=thread)
773 instrumenter.message.debug() << node.first<<
"-po->"<<new_fence_node
780 in_pos[i_it].clear();
781 in_pos[i_it].insert(
nodet(new_fence_node, new_fence_gnode));
782 updated.insert(i_it);
787 goto_programt::instructionst::iterator &i_it,
803 event_idt previous=std::numeric_limits<event_idt>::max();
804 event_idt previous_gnode=std::numeric_limits<event_idt>::max();
811 if(!instruction.
labels.empty() && instruction.
labels.front()==
"ASSERT")
821 const irep_idt &read=r_it->second.object;
833 thread,
id2string(read), instrumenter.unique_id++,
837 egraph[new_read_node]=new_read_event;
838 instrumenter.message.debug() <<
"new Read"<<read<<
" @thread" 840 <<(
local(read)?
"local":
"shared")<<
") #"<<new_read_node
844 unknown_read_nodes.insert(new_read_node);
848 instrumenter.map_vertex_gnode.insert(
849 std::make_pair(new_read_node, new_read_gnode));
854 if(in_pos.find(in)!=in_pos.end())
856 for(
const auto &node : in_pos[in])
858 if(
egraph[node.first].thread!=thread)
860 instrumenter.message.debug() << node.first<<
"-po->" 869 previous=new_read_node;
870 previous_gnode=new_read_gnode;
873 const std::pair<id2nodet::iterator, id2nodet::iterator>
874 with_same_var=map_writes.equal_range(read);
875 for(id2nodet::iterator id_it=with_same_var.first;
876 id_it!=with_same_var.second; id_it++)
879 instrumenter.message.debug() << id_it->second<<
"<-com->" 881 std::map<event_idt, event_idt>::const_iterator entry=
882 instrumenter.map_vertex_gnode.find(id_it->second);
883 assert(entry!=instrumenter.map_vertex_gnode.end());
892 for(std::set<event_idt>::const_iterator id_it=
893 unknown_write_nodes.begin();
894 id_it!=unknown_write_nodes.end();
898 instrumenter.message.debug() << *id_it<<
"<-com->" 900 std::map<event_idt, event_idt>::const_iterator entry=
901 instrumenter.map_vertex_gnode.find(*id_it);
902 assert(entry!=instrumenter.map_vertex_gnode.end());
918 const irep_idt &write=w_it->second.object;
920 instrumenter.message.debug() <<
"WRITE: " << write <<
messaget::eom;
931 thread,
id2string(write), instrumenter.unique_id++,
935 egraph[new_write_node](new_write_event);
936 instrumenter.
message.
debug() <<
"new Write "<<write<<
" @thread"<<(thread)
938 << (
local(write)?
"local":
"shared")<<
") #"<<new_write_node
941 if(write==ID_unknown)
942 unknown_read_nodes.insert(new_write_node);
946 instrumenter.map_vertex_gnode.insert(
947 std::pair<event_idt, event_idt>(new_write_node, new_write_gnode));
950 if(previous!=std::numeric_limits<event_idt>::max())
952 instrumenter.message.debug() << previous<<
"-po->"<<new_write_node
961 if(in_pos.find(in)!=in_pos.end())
963 for(
const auto &node : in_pos[in])
965 if(
egraph[node.first].thread!=thread)
967 instrumenter.message.debug() << node.first<<
"-po->" 977 const std::pair<id2nodet::iterator, id2nodet::iterator>
978 r_with_same_var=map_reads.equal_range(write);
979 for(id2nodet::iterator idr_it=r_with_same_var.first;
980 idr_it!=r_with_same_var.second; idr_it++)
981 if(
egraph[idr_it->second].thread!=new_write_event.
thread)
983 instrumenter.message.debug() <<idr_it->second<<
"<-com->" 985 std::map<event_idt, event_idt>::const_iterator entry=
986 instrumenter.map_vertex_gnode.find(idr_it->second);
987 assert(entry!=instrumenter.map_vertex_gnode.end());
996 const std::pair<id2nodet::iterator, id2nodet::iterator>
997 w_with_same_var=map_writes.equal_range(write);
998 for(id2nodet::iterator idw_it=w_with_same_var.first;
999 idw_it!=w_with_same_var.second; idw_it++)
1000 if(
egraph[idw_it->second].thread!=new_write_event.
thread)
1002 instrumenter.message.debug() << idw_it->second<<
"<-com->" 1004 std::map<event_idt, event_idt>::const_iterator entry=
1005 instrumenter.map_vertex_gnode.find(idw_it->second);
1006 assert(entry!=instrumenter.map_vertex_gnode.end());
1015 for(std::set<event_idt>::const_iterator id_it=
1016 unknown_write_nodes.begin();
1017 id_it!=unknown_write_nodes.end();
1021 instrumenter.message.debug() << *id_it<<
"<-com->" 1023 std::map<event_idt, event_idt>::const_iterator entry=
1024 instrumenter.map_vertex_gnode.find(*id_it);
1025 assert(entry!=instrumenter.map_vertex_gnode.end());
1034 for(std::set<event_idt>::const_iterator id_it=
1035 unknown_read_nodes.begin();
1036 id_it!=unknown_read_nodes.end();
1040 instrumenter.message.debug() << *id_it<<
"<-com->" 1042 std::map<event_idt, event_idt>::const_iterator entry=
1043 instrumenter.map_vertex_gnode.find(*id_it);
1044 assert(entry!=instrumenter.map_vertex_gnode.end());
1054 previous=new_write_node;
1055 previous_gnode=new_write_gnode;
1058 if(previous!=std::numeric_limits<event_idt>::max())
1060 in_pos[i_it].clear();
1061 in_pos[i_it].insert(
nodet(previous, previous_gnode));
1062 updated.insert(i_it);
1067 visit_cfg_skip(i_it);
1071 if(!no_dependencies)
1076 const irep_idt &write=write_it->second.object;
1077 const irep_idt &read=read_it->second.object;
1078 instrumenter.message.debug() <<
"dp: Write:"<<write<<
"; Read:"<<read
1082 data_dp.dp_analysis(read_p,
local(read), write_p,
local(write));
1089 const irep_idt &read2=read2_it->second.object;
1090 const irep_idt &read=read_it->second.object;
1095 data_dp.dp_analysis(read_p,
local(read), read2_p,
local(read2));
1102 goto_programt::instructionst::iterator i_it)
1106 thread,
"F", instrumenter.unique_id++, instruction.
source_location,
false);
1108 egraph[new_fence_node](new_fence_event);
1111 instrumenter.map_vertex_gnode.insert(
1112 std::make_pair(new_fence_node, new_fence_gnode));
1115 if(in_pos.find(in)!=in_pos.end())
1117 for(
const auto &node : in_pos[in])
1119 instrumenter.message.debug() << node.first<<
"-po->"<<new_fence_node
1127 s.insert(
nodet(new_fence_node, new_fence_gnode));
1129 updated.insert(i_it);
1131 in_pos[i_it].clear();
1132 in_pos[i_it].insert(
nodet(new_fence_node, new_fence_gnode));
1133 updated.insert(i_it);
1137 goto_programt::instructionst::iterator i_it)
1139 visit_cfg_propagate(i_it);
1143 goto_programt::instructionst::iterator it,
1146 if(it->is_return() ||
1151 it->is_start_thread() ||
1152 it->is_end_thread())
1155 if(it->is_atomic_begin() ||
1156 it->is_atomic_end())
1162 if(it->is_function_call())
1171 current_instruction->swap(new_instruction);
1180 e_it!=cyc.
end() && ++e_it!=cyc.
end(); ++e_it)
1189 bool thread_found=
false;
1194 if(p_it->source_location==current_location)
1196 current_po=&f_it->second.body;
1210 bool exists_n=
false;
1212 for(wmm_grapht::edgest::const_iterator edge_it=pos_cur.begin();
1213 edge_it!=pos_cur.end(); edge_it++)
1215 if(pos_next.find(edge_it->first)!=pos_next.end())
1223 if((++e_it)!=cyc.
end() || !exists_n)
1229 if(i_it->source_location==current_location)
1232 for(goto_programt::instructionst::iterator same_loc=i_it;
1234 && same_loc->source_location==i_it->source_location;
1248 bool in_cycle=
false;
1251 if(it->source_location==current_location)
1256 if(it->source_location==next_location)
1268 if(int_it->is_goto())
1270 for(
const auto &t : int_it->targets)
1272 bool target_in_cycle=
false;
1277 target_in_cycle=
true;
1281 if(!target_in_cycle)
1293 map.insert(std::make_pair(
1295 std::move(one_interleaving)));
1303 bmct bmc(no_option, symbol_table, no_message);
1305 bool is_spurious=bmc.
run(this_interleaving);
1319 for(std::set<event_grapht::critical_cyclet>::iterator
1325 std::set<event_grapht::critical_cyclet>::iterator next=it;
1340 for(std::set<event_grapht::critical_cyclet>::iterator it=
1346 std::set<event_grapht::critical_cyclet>::iterator next=it;
1363 const std::set<event_grapht::critical_cyclet> &
set,
1366 std::ofstream &output,
1368 std::ofstream &table,
1370 bool hide_internals)
1373 std::map<unsigned, std::set<event_idt> > same_po;
1374 unsigned max_thread=0;
1378 std::map<irep_idt, std::set<event_idt> > same_file;
1381 std::map<std::string, std::string> map_id2var;
1382 std::map<std::string, std::string> map_var2id;
1384 for(std::set<event_grapht::critical_cyclet>::const_iterator it =
1385 set.begin(); it!=
set.end(); it++)
1387 #ifdef PRINT_UNSAFES 1390 it->print_dot(
dot, colour++, model);
1391 ref << it->print_name(model, hide_internals) <<
'\n';
1392 output << it->print_output() <<
'\n';
1393 all << it->print_all(model, map_id2var, map_var2id, hide_internals)
1397 for(std::list<event_idt>::const_iterator it_e=it->begin();
1398 it_e!=it->end(); it_e++)
1403 same_po[ev.
thread].insert(*it_e);
1414 dot << ev.
id <<
"[label=\"\\\\lb {" << ev.
id <<
"}";
1416 dot << ev.
thread <<
"\",color=red,shape=box];\n";
1424 for(
unsigned i=0; i<=max_thread; i++)
1425 if(!same_po[i].empty())
1427 dot <<
"{rank=same; thread_" << i
1428 <<
"[shape=plaintext, label=\"thread " << i <<
"\"];";
1429 for(std::set<event_idt>::iterator it=same_po[i].begin();
1430 it!=same_po[i].end(); it++)
1439 for(std::map<
irep_idt, std::set<event_idt> >::const_iterator it=
1441 it!=same_file.end(); it++)
1444 dot <<
" label=\"" << it->first <<
"\";\n";
1445 for(std::set<event_idt>::const_iterator ev_it=it->second.begin();
1446 ev_it!=it->second.end(); ev_it++)
1448 dot <<
" " <<
egraph[*ev_it].id <<
";\n";
1455 table << std::string(80,
'-');
1456 for(std::map<std::string, std::string>::const_iterator
1457 m_it=map_id2var.begin();
1458 m_it!=map_id2var.end();
1461 table <<
"\n| " << m_it->first <<
" : " << m_it->second;
1464 table << std::string(80,
'-');
1472 std::ofstream output;
1474 std::ofstream table;
1476 dot.open(
"cycles.dot");
1477 ref.open(
"ref.txt");
1478 output.open(
"output.txt");
1479 all.open(
"all.txt");
1480 table.open(
"table.txt");
1482 dot <<
"digraph G {\n";
1483 dot <<
"nodesep=1; ranksep=1;\n";
1488 model, hide_internals);
1493 std::ofstream local_dot;
1495 local_dot.open(name.c_str());
1497 local_dot <<
"digraph G {\n";
1498 local_dot <<
"nodesep=1; ranksep=1;\n";
1500 table, model, hide_internals);
1504 dot << i <<
"[label=\"SCC " << i <<
"\",link=\"" <<
"scc_" << i;
1527 std::set<event_grapht::critical_cyclet>());
1528 for(std::vector<std::set<event_idt> >::const_iterator it=
egraph_SCCs.begin();
1534 class pthread_argumentt
1539 const std::set<event_idt> &filter;
1540 std::set<event_grapht::critical_cyclet> &cycles;
1544 const std::set<event_idt> &_filter,
1545 std::set<event_grapht::critical_cyclet> &_cycles)
1546 :instr(_instr), mem(_mem), filter(_filter), cycles(_cycles)
1552 void *collect_cycles_in_thread(
void *arg)
1555 pthread_argumentt *p_arg=
reinterpret_cast<pthread_argumentt*
>(arg);
1558 const std::set<event_idt> &filter=p_arg->filter;
1559 std::set<event_grapht::critical_cyclet> &cycles=p_arg->cycles;
1568 const unsigned number_of_sccs=
num_sccs;
1569 std::set<unsigned> interesting_SCCs;
1572 pthread_t *threads=
new pthread_t[
num_sccs+1];
1575 std::set<event_grapht::critical_cyclet>());
1577 for(std::vector<std::set<unsigned> >::const_iterator it=
egraph_SCCs.begin();
1581 interesting_SCCs.insert(scc);
1584 int rc=pthread_create(&threads[scc++], NULL,
1585 collect_cycles_in_thread, &arg);
1591 for(
unsigned i=0; i<number_of_sccs; i++)
1592 if(interesting_SCCs.find(i)!=interesting_SCCs.end())
1594 int rc=pthread_join(threads[i], NULL);
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...
const irep_idt & get_statement() const
#define add_all_pos(it, target, source)
void visit_cfg_duplicate(goto_programt::const_targett targ, goto_programt::const_targett i_it)
const std::string & id2string(const irep_idt &d)
std::map< event_idt, event_idt > map_vertex_gnode
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...
bool is_atomic_end() const
std::set< targett > incoming_edges
std::set< irep_idt > var_to_instr
goto_functionst & goto_functions
void visit_cfg_thread() const
goto_program_instruction_typet type
What kind of instruction?
bool is_function_call() const
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
void visit_cfg_lwfence(goto_programt::instructionst::iterator i_it)
void visit_cfg_assign(value_setst &value_sets, goto_programt::instructionst::iterator &i_it, bool no_dependencies)
const irep_idt & get_function() const
const irep_idt & get_identifier() const
#define forall_rw_set_w_entries(it, rw_set)
void visit_cfg_skip(goto_programt::instructionst::iterator i_it)
function_mapt function_map
void add_po_edge(event_idt a, event_idt b)
void copy_from(const goto_programt &src)
Copy a full goto program, preserving targets.
void print_outputs(memory_modelt model, bool hide_internals)
bool get_bool(const irep_namet &name) const
bool is_backwards_goto() const
Returns true if the instruction is a backwards branch.
void visit_cfg_reference_function(irep_idt id_function)
references the first and last edges of the function
bool is_atomic_begin() const
data_typet::const_iterator const_iterator
bool is_fence(const goto_programt::instructiont &instruction, const namespacet &ns)
This class represents an instruction in the GOTO intermediate representation.
bool is_end_thread() const
std::list< instructiont > instructionst
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 dot(const goto_modelt &src, std::ostream &out)
#define forall_rw_set_r_entries(it, rw_set)
const wmm_grapht::edgest & po_out(event_idt n) const
void visit_cfg_body(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
bool local(const irep_idt &id)
is local variable?
instructionst::iterator targett
bool local(const irep_idt &i)
void collect_cycles_by_SCCs(memory_modelt model)
Note: can be distributed (#define DISTRIBUTED)
#define INITIALIZE_FUNCTION
instructionst instructions
The list of instructions in the goto program.
std::multimap< irep_idt, source_locationt > id2loc
instructionst::const_iterator const_targett
::goto_functiont goto_functiont
dstring_hash irep_id_hash
event_idt alt_copy_segment(wmm_grapht &alt_egraph, event_idt begin, event_idt end)
bool has_prefix(const std::string &s, const std::string &prefix)
event_idt copy_segment(event_idt begin, event_idt end)
void visit_cfg_backedge(goto_programt::const_targett targ, goto_programt::const_targett i_it)
strategy: fwd/bwd alternation
A collection of goto functions.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
std::map< irep_idt, goto_functiont > function_mapt
void add_po_back_edge(event_idt a, event_idt b)
std::string get_operation() const
void visit_cfg(value_setst &value_sets, memory_modelt model, bool no_dependencies, loop_strategyt duplicate_body, const irep_idt &function)
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
wmm_grapht::node_indext event_idt
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)
The Boolean constant false.
A goto function, consisting of function type (see type), function body (see body), and parameter identifiers (see parameter_identifiers).
A generic container class for the GOTO intermediate representation of one function.
instrumentert & instrumenter
bool is_cfg_spurious(const event_grapht::critical_cyclet &cyc)
const irep_idt & get_file() const
bool contains_shared_array(goto_programt::const_targett targ, goto_programt::const_targett i_it, value_setst &value_sets) const
void visit_cfg_asm_fence(goto_programt::instructionst::iterator i_it)
static irep_idt entry_point()
Get the identifier of the entry point to a goto model.
mstreamt & status() const
source_locationt source_location
The location of the instruction in the source file.
Fences for instrumentation.
targett add_instruction()
Adds an instruction at the end.
void add_com_edge(event_idt a, event_idt b)
void collect_cycles(std::set< critical_cyclet > &set_of_cycles, memory_modelt model, const std::set< event_idt > &filter)
Base class for all expressions.
virtual resultt run(const goto_functionst &goto_functions)
void add_edge(node_indext a, node_indext b)
#define Forall_goto_functions(it, functions)
std::map< unsigned, data_dpt > map_data_dp
source_locationt source_location
void add_instr_to_interleaving(goto_programt::instructionst::iterator it, goto_programt &interleaving)
Bounded model checking or path exploration for goto-programs.
void clear(goto_program_instruction_typet _type)
Clear the node.
std::set< event_grapht::critical_cyclet > set_of_cycles
#define Forall_goto_program_instructions(it, program)
virtual void visit_cfg_function(value_setst &value_sets, memory_modelt model, bool no_dependencies, loop_strategyt duplicate_body, const irep_idt &function, std::set< nodet > &ending_vertex)
TODO: move the visitor outside, and inherit.
bool is_start_thread() const
void visit_cfg_propagate(goto_programt::instructionst::iterator i_it)
std::pair< irep_idt, event_idt > id2node_pairt
#define forall_goto_program_instructions(it, program)
mstreamt & statistics() const
void visit_cfg_fence(goto_programt::instructionst::iterator i_it)
std::vector< std::set< event_idt > > egraph_SCCs
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
const code_function_callt & to_code_function_call(const codet &code)
std::vector< std::set< event_grapht::critical_cyclet > > set_of_cycles_per_SCC
bool is_lwfence(const goto_programt::instructiont &instruction, const namespacet &ns)
Race Detection for Threaded Goto Programs.
void visit_cfg_goto(goto_programt::instructionst::iterator i_it, loop_strategyt replicate_body, value_setst &value_sets)