36 return pc->source_location().as_string() ==
37 other.
pc->source_location().as_string();
46 std::size_t ssa_index,
47 const exprt &ssa_expression,
56 if(!pre_existing.second)
76 const exprt &ssa_expression,
77 const std::vector<goto_programt::const_targett> &pcs)
93 const size_t cnf_clause_index,
99 for(
const auto &literal : bv)
107 std::cout << cnf_clause_index <<
": ";
108 for(
const auto &literal : cnf)
109 std::cout << literal.dimacs() <<
" ";
130 std::size_t ssa_set_bit_offset = 0;
131 const std::size_t one = 1;
133 ++ssa_set_bit_offset;
141 if(ssa_step_hardness.empty())
145 for(
const auto &key_value_pair : ssa_step_hardness)
147 auto const &ssa = key_value_pair.first;
148 auto const &hardness = key_value_pair.second;
150 hardness_stats_json[
"SSA_expr"] =
json_stringt{ssa.ssa_expression};
151 hardness_stats_json[
"GOTO"] =
158 hardness_stats_json[
"GOTO_ID"] =
160 hardness_stats_json[
"Source"] =
json(ssa.pc->source_location());
163 sat_hardness_json[
"Clauses"] =
165 sat_hardness_json[
"Literals"] =
167 sat_hardness_json[
"Variables"] =
171 for(
auto const &clause : hardness.clause_set)
176 sat_hardness_json[
"ClauseSet"] = sat_hardness_clause_set_json;
178 hardness_stats_json[
"SAT_hardness"] = sat_hardness_json;
180 json_stream_array.
push_back(hardness_stats_json);
188 assertion_stats_json[
"SSA_expr"] =
195 assertion_stats_pc_json[
"GOTO"] =
197 assertion_stats_pc_json[
"Source"] =
json(pc->source_location());
198 assertion_stats_pcs_json.push_back(assertion_stats_pc_json);
200 assertion_stats_json[
"Sources"] = assertion_stats_pcs_json;
203 assertion_hardness_json[
"Clauses"] =
205 assertion_hardness_json[
"Literals"] =
210 json_arrayt assertion_sat_hardness_clause_set_json;
213 assertion_sat_hardness_clause_set_json.
push_back(
216 assertion_hardness_json[
"ClauseSet"] =
217 assertion_sat_hardness_clause_set_json;
219 assertion_stats_json[
"SAT_hardness"] = assertion_hardness_json;
221 json_stream_array.
push_back(assertion_stats_json);
228 std::stringstream out;
229 auto instruction = *pc;
231 if(!instruction.labels.empty())
233 out <<
" // Labels:";
234 for(
const auto &label : instruction.labels)
238 if(instruction.is_target())
239 out << std::setw(6) << instruction.target_number <<
": ";
241 switch(instruction.type())
244 out <<
"NO INSTRUCTION TYPE SET";
249 if(!instruction.condition().is_true())
251 out <<
"IF " <<
format(instruction.condition()) <<
" THEN ";
256 if(instruction.is_incomplete_goto())
258 out <<
"(incomplete)";
262 for(
auto gt_it = instruction.targets.begin();
263 gt_it != instruction.targets.end();
266 if(gt_it != instruction.targets.begin())
268 out << (*gt_it)->target_number;
274 out <<
"SET RETURN VALUE" <<
format(instruction.return_value());
282 out <<
format(instruction.code());
287 if(instruction.is_assume())
292 out <<
format(instruction.condition());
300 out <<
"END_FUNCTION";
312 instruction.code().find(ID_exception_list).get_sub();
314 for(
const auto &ex : exception_list)
315 out <<
" " << ex.id();
318 if(instruction.code().operands().size() == 1)
319 out <<
": " <<
format(instruction.code().op0());
325 if(instruction.code().get_statement() == ID_exception_landingpad)
328 out <<
"EXCEPTION LANDING PAD (" <<
format(landingpad.catch_expr().type())
329 <<
' ' <<
format(landingpad.catch_expr()) <<
")";
331 else if(instruction.code().get_statement() == ID_push_catch)
333 out <<
"CATCH-PUSH ";
337 instruction.code().find(ID_exception_list).get_sub();
339 instruction.targets.size() == exception_list.size(),
340 "unexpected discrepancy between sizes of instruction"
341 "targets and exception list");
342 for(
auto gt_it = instruction.targets.begin();
343 gt_it != instruction.targets.end();
346 if(gt_it != instruction.targets.begin())
348 out << exception_list[i].id() <<
"->" << (*gt_it)->target_number;
351 else if(instruction.code().get_statement() == ID_pop_catch)
363 out <<
"ATOMIC_BEGIN";
371 out <<
"START THREAD " << instruction.get_target()->target_number;
384 std::stringstream ss;
Base class for all expressions.
instructionst::const_iterator const_targett
jsont & push_back(const jsont &json)
Provides methods for streaming JSON arrays.
std::vector< literalt > bvt
static void json(json_objectT &result, const irep_idt &property_id, const property_infot &property_info)
#define UNREACHABLE
This should be used to mark dead code.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
static code_landingpadt & to_code_landingpad(codet &code)
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
std::vector< goto_programt::const_targett > pcs
sat_hardnesst sat_hardness
std::string ssa_expression
goto_programt::const_targett pc
bool operator==(const hardness_ssa_keyt &other) const
std::string ssa_expression
sat_hardnesst & operator+=(const sat_hardnesst &other)
std::vector< size_t > clause_set
std::unordered_set< size_t > variables
sat_hardnesst current_hardness
static std::string expr2string(const exprt &expr)
assertion_statst assertion_stats
void set_outfile(const std::string &file_name)
void register_clause(const bvt &bv, const bvt &cnf, const size_t cnf_clause_index, bool register_cnf)
Called e.g.
hardness_ssa_keyt current_ssa_key
void register_ssa(std::size_t ssa_index, const exprt &ssa_expression, goto_programt::const_targett pc)
Called from the symtex_target_equationt::convert_*, this function associates an SSA step to all the s...
void register_assertion_ssas(const exprt &ssa_expression, const std::vector< goto_programt::const_targett > &pcs)
Called from the symtex_target_equationt::convert_assertions, this function associates the disjunction...
std::vector< std::unordered_map< hardness_ssa_keyt, sat_hardnesst > > hardness_stats
std::size_t max_ssa_set_size
void produce_report()
Print the statistics to a JSON file (specified via command-line option).
static std::string goto_instruction2string(goto_programt::const_targett pc)
void register_ssa_size(std::size_t size)