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();
151 bool no_dependencies,
156 const std::set<instrumentert::cfg_visitort::nodet> &initial_vertex,
158 std::set<instrumentert::cfg_visitort::nodet> &ending_vertex)
162 instrumenter.message.debug() <<
"visit function " 172 instrumenter.goto_functions.function_map[
function]);
177 instrumenter.goto_functions.function_map[
function].body)
184 max_thread=max_thread+1;
185 coming_from=current_thread;
186 current_thread=max_thread;
189 current_thread=coming_from;
190 thread=current_thread;
192 instrumenter.message.debug() <<
"visit instruction "<<instruction.
type 205 #elif defined ATOMIC_FENCE 206 visit_cfg_fence(i_it);
209 visit_cfg_propagate(i_it);
215 visit_cfg_assign(value_sets,
ns, i_it, no_dependencies
221 else if(
is_fence(instruction, instrumenter.ns))
223 instrumenter.message.debug() <<
"Constructing a fence" <<
messaget::eom;
224 visit_cfg_fence(i_it);
226 else if(model!=
TSO &&
is_lwfence(instruction, instrumenter.ns))
228 visit_cfg_lwfence(i_it);
230 else if(model==
TSO &&
is_lwfence(instruction, instrumenter.ns))
233 visit_cfg_skip(i_it);
238 visit_cfg_asm_fence(i_it);
242 visit_cfg_function_call(value_sets, i_it, model,
243 no_dependencies, replicate_body);
247 visit_cfg_goto(i_it, replicate_body, value_sets
253 #ifdef CONTEXT_INSENSITIVE 256 visit_cfg_propagate(i_it);
257 add_all_pos(it, out_nodes[
function], in_pos[i_it]);
263 visit_cfg_propagate(i_it);
267 std::pair<unsigned, data_dpt> new_dp(thread, data_dp);
269 data_dp.print(instrumenter.message);
271 if(instrumenter.goto_functions.function_map[
function]
272 .body.instructions.empty())
278 goto_programt::instructionst::iterator it=instrumenter
279 .goto_functions.function_map[
function].body.instructions.end();
281 ending_vertex=in_pos[it];
286 goto_programt::instructionst::iterator i_it)
290 in_pos[i_it].
clear();
292 if(in_pos.find(in)!=in_pos.end())
293 for(
const auto &node : in_pos[in])
294 in_pos[i_it].insert(node);
310 if(instrumenter.map_function_graph.find(
id_function)!=
311 instrumenter.map_function_graph.end())
325 goto_programt::instructionst::iterator i_it=body.end();
329 goto_programt::instructionst::iterator targ=body.begin();
331 std::set<event_idt> in_nodes;
332 std::set<event_idt> out_nodes;
335 if(in_pos.find(targ)!=in_pos.end())
338 if(updated.find(targ)!=updated.end())
341 for(std::set<nodet>::const_iterator to=in_pos[targ].begin();
342 to!=in_pos[targ].end(); ++to)
343 in_nodes.insert(to->first);
344 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
345 from!=in_pos[i_it].end(); ++from)
346 out_nodes.insert(from->first);
350 instrumenter.message.debug() <<
"else case" <<
messaget::eom;
352 for(goto_programt::instructionst::iterator cur=i_it;
356 for(
const auto &in : cur->incoming_edges)
359 if(in_pos.find(in)!=in_pos.end() &&
360 updated.find(in)!=updated.end())
365 else if(in_pos.find(in)!=in_pos.end())
374 if(out_pos.find(targ)!=out_pos.end())
376 for(std::set<nodet>::const_iterator to=out_pos[targ].begin();
377 to!=out_pos[targ].end(); ++to)
378 in_nodes.insert(to->first);
379 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
380 from!=in_pos[i_it].end(); ++from)
381 out_nodes.insert(from->first);
387 std::make_pair(in_nodes, out_nodes);
408 instrumenter.message.debug() <<
"contains_shared_array called for " 409 << targ->source_location.get_line() <<
" and " 413 instrumenter.
message.
debug() <<
"Do we have an array at line " 420 instrumenter.message.debug() <<
"Writes: "<<rw_set.
w_entries.size()
425 const irep_idt var=r_it->second.object;
426 instrumenter.message.debug() <<
"Is "<<var<<
" an array?" 428 if(
id2string(var).find(
"[]")!=std::string::npos
429 && !instrumenter.local(var))
435 const irep_idt var=w_it->second.object;
436 instrumenter.message.debug()<<
"Is "<<var<<
" an array?"<<
messaget::eom;
437 if(
id2string(var).find(
"[]")!=std::string::npos
438 && !instrumenter.local(var))
458 for(
const auto &target : i_it->targets)
461 if(in_pos.find(target)!=in_pos.end())
463 if(in_pos[i_it].empty())
466 bool duplicate_this=
false;
468 switch(replicate_body)
471 duplicate_this=contains_shared_array(target, i_it, value_sets
481 duplicate_this=
false;
486 visit_cfg_duplicate(target, i_it);
488 visit_cfg_backedge(target, i_it);
497 instrumenter.message.status() <<
"Duplication..." <<
messaget::eom;
499 instrumenter.goto_functions.function_map[i_it->function];
501 bool found_pos=
false;
504 if(in_pos[targ].empty())
507 for(; new_targ!=fun.body.instructions.end();
510 if(in_pos.find(new_targ)!=in_pos.end() && !in_pos[new_targ].empty())
518 || new_targ->source_location.get_function()
519 !=targ->source_location.get_function()
520 || new_targ->source_location.get_file()
521 !=targ->source_location.get_file())
526 const std::set<nodet> &up_set=in_pos[(found_pos ? new_targ : targ)];
527 const std::set<nodet> &down_set=in_pos[i_it];
529 for(std::set<nodet>::const_iterator begin_it=up_set.begin();
530 begin_it!=up_set.end(); ++begin_it)
533 for(std::set<nodet>::const_iterator begin_it=down_set.begin();
534 begin_it!=down_set.end(); ++begin_it)
537 for(std::set<nodet>::const_iterator begin_it=up_set.begin();
538 begin_it!=up_set.end(); ++begin_it)
540 for(std::set<nodet>::const_iterator end_it=down_set.begin();
541 end_it!=down_set.end(); ++end_it)
562 if(updated.find(targ)!=updated.end())
565 for(std::set<nodet>::const_iterator to=in_pos[targ].begin();
566 to!=in_pos[targ].end(); ++to)
567 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
568 from!=in_pos[i_it].end(); ++from)
569 if(from->first!=to->first)
571 if(
egraph[from->first].thread!=
egraph[to->first].thread)
573 instrumenter.message.debug() << from->first <<
"-po->" 581 instrumenter.message.debug() <<
"else case" <<
messaget::eom;
587 for(
const auto &in : cur->incoming_edges)
589 if(in_pos.find(in)!=in_pos.end()
590 && updated.find(in)!=updated.end())
595 else if(in_pos.find(in)!=in_pos.end())
604 if(out_pos.find(targ)!=out_pos.end())
606 for(std::set<nodet>::const_iterator to=out_pos[targ].begin();
607 to!=out_pos[targ].end(); ++to)
608 for(std::set<nodet>::const_iterator from=in_pos[i_it].begin();
609 from!=in_pos[i_it].end(); ++from)
610 if(from->first!=to->first)
612 if(
egraph[from->first].thread!=
egraph[to->first].thread)
614 instrumenter.message.debug() << from->first<<
"-po->" 624 goto_programt::instructionst::iterator i_it,
635 visit_cfg_propagate(i_it);
643 instrumenter.message.debug() <<
"backward goto" <<
messaget::eom;
644 visit_cfg_body(i_it, replicate_body, value_sets
654 goto_programt::instructionst::iterator i_it,
656 bool no_dependencies,
662 if(in_pos.find(in)!=in_pos.end())
663 for(
const auto &node : in_pos[in])
671 enter_function(fun_id);
672 #ifdef CONTEXT_INSENSITIVE 673 stack_fun.push(cur_fun);
678 if(!inline_function_cond(fun_id))
682 if(instrumenter.map_function_graph.find(fun_id)!=
683 instrumenter.map_function_graph.end())
692 visit_cfg_function(value_sets, model, no_dependencies, fun_id, s,
694 updated.insert(i_it);
701 visit_cfg_function(value_sets, model, no_dependencies, replicate_body,
702 fun_id, s, in_pos[i_it]);
703 updated.insert(i_it);
706 leave_function(fun_id);
707 #ifdef CONTEXT_INSENSITIVE 708 cur_fun=stack_fun.pop();
711 catch(
const std::string &s)
713 instrumenter.message.warning() <<
"sorry, doesn't handle recursion " 714 <<
"(function " << fun_id <<
"; .cpp) " 720 goto_programt::instructionst::iterator i_it)
724 thread,
"f", instrumenter.unique_id++, instruction.
source_location,
false);
726 egraph[new_fence_node](new_fence_event);
729 instrumenter.map_vertex_gnode.insert(
730 std::make_pair(new_fence_node, new_fence_gnode));
733 if(in_pos.find(in)!=in_pos.end())
735 for(
const auto &node : in_pos[in])
737 if(
egraph[node.first].thread!=thread)
739 instrumenter.message.debug() << node.first<<
"-po->"<<new_fence_node
746 in_pos[i_it].clear();
747 in_pos[i_it].insert(
nodet(new_fence_node, new_fence_gnode));
748 updated.insert(i_it);
752 goto_programt::instructionst::iterator i_it)
764 false, WRfence, WWfence, RRfence, RWfence, WWcumul, RWcumul, RRcumul);
766 egraph[new_fence_node](new_fence_event);
769 instrumenter.map_vertex_gnode.insert(
770 std::make_pair(new_fence_node, new_fence_gnode));
773 if(in_pos.find(in)!=in_pos.end())
775 for(
const auto &node : in_pos[in])
777 if(
egraph[node.first].thread!=thread)
779 instrumenter.message.debug() << node.first<<
"-po->"<<new_fence_node
786 in_pos[i_it].clear();
787 in_pos[i_it].insert(
nodet(new_fence_node, new_fence_gnode));
788 updated.insert(i_it);
794 goto_programt::instructionst::iterator &i_it,
810 event_idt previous=std::numeric_limits<event_idt>::max();
811 event_idt previous_gnode=std::numeric_limits<event_idt>::max();
818 if(!instruction.
labels.empty() && instruction.
labels.front()==
"ASSERT")
828 const irep_idt &read=r_it->second.object;
840 thread,
id2string(read), instrumenter.unique_id++,
844 egraph[new_read_node]=new_read_event;
845 instrumenter.message.debug() <<
"new Read"<<read<<
" @thread" 847 <<(
local(read)?
"local":
"shared")<<
") #"<<new_read_node
851 unknown_read_nodes.insert(new_read_node);
855 instrumenter.map_vertex_gnode.insert(
856 std::make_pair(new_read_node, new_read_gnode));
861 if(in_pos.find(in)!=in_pos.end())
863 for(
const auto &node : in_pos[in])
865 if(
egraph[node.first].thread!=thread)
867 instrumenter.message.debug() << node.first<<
"-po->" 876 previous=new_read_node;
877 previous_gnode=new_read_gnode;
880 const std::pair<id2nodet::iterator, id2nodet::iterator>
881 with_same_var=map_writes.equal_range(read);
882 for(id2nodet::iterator id_it=with_same_var.first;
883 id_it!=with_same_var.second; id_it++)
886 instrumenter.message.debug() << id_it->second<<
"<-com->" 888 std::map<event_idt, event_idt>::const_iterator entry=
889 instrumenter.map_vertex_gnode.find(id_it->second);
890 assert(entry!=instrumenter.map_vertex_gnode.end());
899 for(std::set<event_idt>::const_iterator id_it=
900 unknown_write_nodes.begin();
901 id_it!=unknown_write_nodes.end();
905 instrumenter.message.debug() << *id_it<<
"<-com->" 907 std::map<event_idt, event_idt>::const_iterator entry=
908 instrumenter.map_vertex_gnode.find(*id_it);
909 assert(entry!=instrumenter.map_vertex_gnode.end());
925 const irep_idt &write=w_it->second.object;
927 instrumenter.message.debug() <<
"WRITE: " << write <<
messaget::eom;
938 thread,
id2string(write), instrumenter.unique_id++,
942 egraph[new_write_node](new_write_event);
943 instrumenter.
message.
debug() <<
"new Write "<<write<<
" @thread"<<(thread)
945 << (
local(write)?
"local":
"shared")<<
") #"<<new_write_node
948 if(write==ID_unknown)
949 unknown_read_nodes.insert(new_write_node);
953 instrumenter.map_vertex_gnode.insert(
954 std::pair<event_idt, event_idt>(new_write_node, new_write_gnode));
957 if(previous!=std::numeric_limits<event_idt>::max())
959 instrumenter.message.debug() << previous<<
"-po->"<<new_write_node
968 if(in_pos.find(in)!=in_pos.end())
970 for(
const auto &node : in_pos[in])
972 if(
egraph[node.first].thread!=thread)
974 instrumenter.message.debug() << node.first<<
"-po->" 984 const std::pair<id2nodet::iterator, id2nodet::iterator>
985 r_with_same_var=map_reads.equal_range(write);
986 for(id2nodet::iterator idr_it=r_with_same_var.first;
987 idr_it!=r_with_same_var.second; idr_it++)
988 if(
egraph[idr_it->second].thread!=new_write_event.
thread)
990 instrumenter.message.debug() <<idr_it->second<<
"<-com->" 992 std::map<event_idt, event_idt>::const_iterator entry=
993 instrumenter.map_vertex_gnode.find(idr_it->second);
994 assert(entry!=instrumenter.map_vertex_gnode.end());
1003 const std::pair<id2nodet::iterator, id2nodet::iterator>
1004 w_with_same_var=map_writes.equal_range(write);
1005 for(id2nodet::iterator idw_it=w_with_same_var.first;
1006 idw_it!=w_with_same_var.second; idw_it++)
1007 if(
egraph[idw_it->second].thread!=new_write_event.
thread)
1009 instrumenter.message.debug() << idw_it->second<<
"<-com->" 1011 std::map<event_idt, event_idt>::const_iterator entry=
1012 instrumenter.map_vertex_gnode.find(idw_it->second);
1013 assert(entry!=instrumenter.map_vertex_gnode.end());
1022 for(std::set<event_idt>::const_iterator id_it=
1023 unknown_write_nodes.begin();
1024 id_it!=unknown_write_nodes.end();
1028 instrumenter.message.debug() << *id_it<<
"<-com->" 1030 std::map<event_idt, event_idt>::const_iterator entry=
1031 instrumenter.map_vertex_gnode.find(*id_it);
1032 assert(entry!=instrumenter.map_vertex_gnode.end());
1041 for(std::set<event_idt>::const_iterator id_it=
1042 unknown_read_nodes.begin();
1043 id_it!=unknown_read_nodes.end();
1047 instrumenter.message.debug() << *id_it<<
"<-com->" 1049 std::map<event_idt, event_idt>::const_iterator entry=
1050 instrumenter.map_vertex_gnode.find(*id_it);
1051 assert(entry!=instrumenter.map_vertex_gnode.end());
1061 previous=new_write_node;
1062 previous_gnode=new_write_gnode;
1065 if(previous!=std::numeric_limits<event_idt>::max())
1067 in_pos[i_it].clear();
1068 in_pos[i_it].insert(
nodet(previous, previous_gnode));
1069 updated.insert(i_it);
1074 visit_cfg_skip(i_it);
1078 if(!no_dependencies)
1083 const irep_idt &write=write_it->second.object;
1084 const irep_idt &read=read_it->second.object;
1085 instrumenter.message.debug() <<
"dp: Write:"<<write<<
"; Read:"<<read
1089 data_dp.dp_analysis(read_p,
local(read), write_p,
local(write));
1096 const irep_idt &read2=read2_it->second.object;
1097 const irep_idt &read=read_it->second.object;
1102 data_dp.dp_analysis(read_p,
local(read), read2_p,
local(read2));
1109 goto_programt::instructionst::iterator i_it)
1113 thread,
"F", instrumenter.unique_id++, instruction.
source_location,
false);
1115 egraph[new_fence_node](new_fence_event);
1118 instrumenter.map_vertex_gnode.insert(
1119 std::make_pair(new_fence_node, new_fence_gnode));
1122 if(in_pos.find(in)!=in_pos.end())
1124 for(
const auto &node : in_pos[in])
1126 instrumenter.message.debug() << node.first<<
"-po->"<<new_fence_node
1134 s.insert(
nodet(new_fence_node, new_fence_gnode));
1136 updated.insert(i_it);
1138 in_pos[i_it].clear();
1139 in_pos[i_it].insert(
nodet(new_fence_node, new_fence_gnode));
1140 updated.insert(i_it);
1144 goto_programt::instructionst::iterator i_it)
1146 visit_cfg_propagate(i_it);
1150 goto_programt::instructionst::iterator it,
1153 if(it->is_return() ||
1158 it->is_start_thread() ||
1159 it->is_end_thread())
1162 if(it->is_atomic_begin() ||
1163 it->is_atomic_end())
1169 if(it->is_function_call())
1178 current_instruction->swap(new_instruction);
1187 e_it!=cyc.
end() && ++e_it!=cyc.
end(); ++e_it)
1196 bool thread_found=
false;
1201 if(p_it->source_location==current_location)
1203 current_po=&f_it->second.body;
1217 bool exists_n=
false;
1219 for(wmm_grapht::edgest::const_iterator edge_it=pos_cur.begin();
1220 edge_it!=pos_cur.end(); edge_it++)
1222 if(pos_next.find(edge_it->first)!=pos_next.end())
1230 if((++e_it)!=cyc.
end() || !exists_n)
1236 if(i_it->source_location==current_location)
1239 for(goto_programt::instructionst::iterator same_loc=i_it;
1241 && same_loc->source_location==i_it->source_location;
1255 bool in_cycle=
false;
1258 if(it->source_location==current_location)
1263 if(it->source_location==next_location)
1275 if(int_it->is_goto())
1277 for(
const auto &t : int_it->targets)
1279 bool target_in_cycle=
false;
1284 target_in_cycle=
true;
1288 if(!target_in_cycle)
1300 map.insert(std::make_pair(
1302 std::move(one_interleaving)));
1310 bmct bmc(no_option, symbol_table, no_message);
1312 bool is_spurious=bmc.
run(this_interleaving);
1326 for(std::set<event_grapht::critical_cyclet>::iterator
1332 std::set<event_grapht::critical_cyclet>::iterator next=it;
1347 for(std::set<event_grapht::critical_cyclet>::iterator it=
1353 std::set<event_grapht::critical_cyclet>::iterator next=it;
1370 const std::set<event_grapht::critical_cyclet> &
set,
1373 std::ofstream &output,
1375 std::ofstream &table,
1377 bool hide_internals)
1380 std::map<unsigned, std::set<event_idt> > same_po;
1381 unsigned max_thread=0;
1385 std::map<irep_idt, std::set<event_idt> > same_file;
1388 std::map<std::string, std::string> map_id2var;
1389 std::map<std::string, std::string> map_var2id;
1391 for(std::set<event_grapht::critical_cyclet>::const_iterator it =
1392 set.begin(); it!=
set.end(); it++)
1394 #ifdef PRINT_UNSAFES 1397 it->print_dot(
dot, colour++, model);
1398 ref << it->print_name(model, hide_internals) <<
'\n';
1399 output << it->print_output() <<
'\n';
1400 all << it->print_all(model, map_id2var, map_var2id, hide_internals)
1404 for(std::list<event_idt>::const_iterator it_e=it->begin();
1405 it_e!=it->end(); it_e++)
1410 same_po[ev.
thread].insert(*it_e);
1421 dot << ev.
id <<
"[label=\"\\\\lb {" << ev.
id <<
"}";
1423 dot << ev.
thread <<
"\",color=red,shape=box];\n";
1431 for(
unsigned i=0; i<=max_thread; i++)
1432 if(!same_po[i].empty())
1434 dot <<
"{rank=same; thread_" << i
1435 <<
"[shape=plaintext, label=\"thread " << i <<
"\"];";
1436 for(std::set<event_idt>::iterator it=same_po[i].begin();
1437 it!=same_po[i].end(); it++)
1446 for(std::map<
irep_idt, std::set<event_idt> >::const_iterator it=
1448 it!=same_file.end(); it++)
1451 dot <<
" label=\"" << it->first <<
"\";\n";
1452 for(std::set<event_idt>::const_iterator ev_it=it->second.begin();
1453 ev_it!=it->second.end(); ev_it++)
1455 dot <<
" " <<
egraph[*ev_it].id <<
";\n";
1462 table << std::string(80,
'-');
1463 for(std::map<std::string, std::string>::const_iterator
1464 m_it=map_id2var.begin();
1465 m_it!=map_id2var.end();
1468 table <<
"\n| " << m_it->first <<
" : " << m_it->second;
1471 table << std::string(80,
'-');
1479 std::ofstream output;
1481 std::ofstream table;
1483 dot.open(
"cycles.dot");
1484 ref.open(
"ref.txt");
1485 output.open(
"output.txt");
1486 all.open(
"all.txt");
1487 table.open(
"table.txt");
1489 dot <<
"digraph G {\n";
1490 dot <<
"nodesep=1; ranksep=1;\n";
1495 model, hide_internals);
1500 std::ofstream local_dot;
1502 local_dot.open(name.c_str());
1504 local_dot <<
"digraph G {\n";
1505 local_dot <<
"nodesep=1; ranksep=1;\n";
1507 table, model, hide_internals);
1511 dot << i <<
"[label=\"SCC " << i <<
"\",link=\"" <<
"scc_" << i;
1534 std::set<event_grapht::critical_cyclet>());
1535 for(std::vector<std::set<event_idt> >::const_iterator it=
egraph_SCCs.begin();
1541 class pthread_argumentt
1546 const std::set<event_idt> &filter;
1547 std::set<event_grapht::critical_cyclet> &cycles;
1551 const std::set<event_idt> &_filter,
1552 std::set<event_grapht::critical_cyclet> &_cycles)
1553 :instr(_instr), mem(_mem), filter(_filter), cycles(_cycles)
1559 void *collect_cycles_in_thread(
void *arg)
1562 pthread_argumentt *p_arg=
reinterpret_cast<pthread_argumentt*
>(arg);
1565 const std::set<event_idt> &filter=p_arg->filter;
1566 std::set<event_grapht::critical_cyclet> &cycles=p_arg->cycles;
1575 const unsigned number_of_sccs=
num_sccs;
1576 std::set<unsigned> interesting_SCCs;
1579 pthread_t *threads=
new pthread_t[
num_sccs+1];
1582 std::set<event_grapht::critical_cyclet>());
1584 for(std::vector<std::set<unsigned> >::const_iterator it=
egraph_SCCs.begin();
1588 interesting_SCCs.insert(scc);
1591 int rc=pthread_create(&threads[scc++], NULL,
1592 collect_cycles_in_thread, &arg);
1598 for(
unsigned i=0; i<number_of_sccs; i++)
1599 if(interesting_SCCs.find(i)!=interesting_SCCs.end())
1601 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
void visit_cfg_lwfence(goto_programt::instructionst::iterator i_it)
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)
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
void copy_from(const goto_programt &src)
Copy a full goto program, preserving targets.
static mstreamt & eom(mstreamt &m)
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
virtual void visit_cfg_function(value_setst &value_sets, memory_modelt model, bool no_dependencies, loop_strategyt duplicate_body, const irep_idt &function, const std::set< nodet > &initial_vertex, std::set< nodet > &ending_vertex)
TODO: move the visitor outside, and inherit.
std::pair< event_idt, event_idt > nodet
bool local(const irep_idt &id)
is local variable?
const irep_idt & get_line() const
instructionst::iterator targett
bool local(const irep_idt &i)
source_locationt source_location
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
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast a generic 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)
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 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()
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)
std::string to_string(const string_constraintt &expr)
Used for debug printing.
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)
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 namespace_baset::lookup().
void visit_cfg_assign(value_setst &value_sets, namespacet &ns, goto_programt::instructionst::iterator &i_it, bool no_dependencies)
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)