static void lower_to_do_scalar_opt(REGION & ru, OPT_CTX & oc) { SIMP_CTX simp; if (g_is_lower_to_simplest) { simp.set_simp_cf(); simp.set_simp_array(); simp.set_simp_select(); simp.set_simp_local_or_and(); simp.set_simp_local_not(); simp.set_simp_to_pr_mode(); } else { simp.set_simp_to_lowest_heigh(); SIMP_array(&simp) = false; //Keep array operation unchanged. SIMP_array_to_pr_mode(&simp) = true; } if (g_do_ssa) { //Note if this flag enable, //AA may generate imprecise result. //TODO: use SSA info to improve the precision of AA. simp.set_simp_to_pr_mode(); simp.set_simp_select(); simp.set_simp_local_or_and(); simp.set_simp_local_not(); } //Simplify IR tree if it is needed. ru.simplify_bb_list(ru.get_bb_list(), &simp); if (SIMP_need_recon_bblist(&simp)) { //New BB boundary IR generated, rebuilding CFG. if (ru.reconstruct_ir_bb_list(oc)) { ru.get_cfg()->rebuild(oc); ru.get_cfg()->remove_empty_bb(oc); ru.get_cfg()->compute_entry_and_exit(true, true); } } if (SIMP_changed(&simp)) { //We perfer flow sensitive analysis as default. ru.get_aa()->set_flow_sensitive(true); ru.get_aa()->perform(oc); //The primary actions must do are computing IR reference //and reach def. UINT action = SOL_REACH_DEF|SOL_REF; if (g_do_ivr) { //IVR needs available reach def. action |= SOL_AVAIL_REACH_DEF; } //DU mananger may use the context info supplied by AA. ru.get_du_mgr()->perform(oc, action); //Compute the DU chain. ru.get_du_mgr()->compute_du_chain(oc); } }
void Region::lowerIRTreeToLowestHeight(OptCtx & oc) { SimpCtx simp; if (g_is_lower_to_pr_mode) { simp.set_simp_to_pr_mode(); } if (g_do_ssa) { //Note if this flag enable, //AA may generate imprecise result. //TODO: use SSA info to improve the precision of AA. simp.set_simp_land_lor(); simp.set_simp_lnot(); simp.set_simp_cf(); } //Simplify IR tree if it is needed. simplifyBBlist(get_bb_list(), &simp); if (SIMP_need_recon_bblist(&simp)) { //New BB boundary IR generated, rebuilding CFG. if (reconstructBBlist(oc)) { get_cfg()->rebuild(oc); get_cfg()->removeEmptyBB(oc); get_cfg()->computeExitList(); } } if (SIMP_changed(&simp)) { //We perfer flow sensitive analysis as default. get_aa()->set_flow_sensitive(true); get_aa()->perform(oc); //The primary actions must do are computing IR reference //and reach def. UINT action = SOL_REACH_DEF|SOL_REF; if (g_do_ivr) { //IVR needs available reach def. action |= SOL_AVAIL_REACH_DEF; } //DU mananger may use the context info supplied by AA. get_du_mgr()->perform(oc, action); //Compute the DU chain. get_du_mgr()->computeMDDUChain(oc); } }