return code: * 0 means we successfully take a shortcut * 1 means the shortcut fails due to effect conflict * 2 means there is no shortcut */
| 562 | * 2 means there is no shortcut |
| 563 | */ |
| 564 | int |
| 565 | Statement::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 |
nothing calls this directly
no test coverage detected