MCPcopy Create free account
hub / github.com/csmith-project/csmith / shortcut_analysis

Method shortcut_analysis

src/Statement.cpp:564–585  ·  view source on GitHub ↗

return code: * 0 means we successfully take a shortcut * 1 means the shortcut fails due to effect conflict * 2 means there is no shortcut */

Source from the content-addressed store, hash-verified

562 * 2 means there is no shortcut
563 */
564int
565Statement::shortcut_analysis(vector<const Fact*>& inputs, CGContext& cg_context) const
566{
567 FactMgr* fm = get_fact_mgr_for_func(func);
568 // the output facts of control statement (break/continue/goto) has removed local facts
569 // thus can not take this shortcut. (The facts we get should represent all variables
570 // visible in subsequent statement)
571 if (same_facts(inputs, fm->map_facts_in[this]) && !is_ctrl_stmt() && !contains_unfixed_goto())
572 {
573 //cg_context.get_effect_context().Output(cout);
574 //print_facts(inputs);
575 //fm->map_stm_effect[this].Output(cout);
576 if (cg_context.in_conflict(fm->map_stm_effect[this])) {
577 return 1;
578 }
579 inputs = fm->map_facts_out[this];
580 cg_context.add_effect(fm->map_stm_effect[this]);
581 fm->map_accum_effect[this] = *(cg_context.get_effect_accum());
582 return 0;
583 }
584 return 2;
585}
586
587/***************************************************************************************
588 * for a given input env, abstract a given statement, generate an output env, and

Callers

nothing calls this directly

Calls 5

get_fact_mgr_for_funcFunction · 0.85
same_factsFunction · 0.85
in_conflictMethod · 0.80
get_effect_accumMethod · 0.80
add_effectMethod · 0.45

Tested by

no test coverage detected