Author: meiye Date: 2011-08-22 21:18:38 -0400 (Mon, 22 Aug 2011) New Revision: 3725
Modified: trunk/osprey/be/opt/opt_proactive.cxx Log: Rework on identifying single entry single exit SC_BLOCKs for take unstructured branches into consideration. CR: Min Zhao Modified: trunk/osprey/be/opt/opt_proactive.cxx =================================================================== --- trunk/osprey/be/opt/opt_proactive.cxx 2011-08-22 10:02:49 UTC (rev 3724) +++ trunk/osprey/be/opt/opt_proactive.cxx 2011-08-23 01:18:38 UTC (rev 3725) @@ -716,7 +716,7 @@ if (sc_then->Contains(tmp)) return tmp; } - return NULL; + return NULL; } // Obtain the last block of a else-path. @@ -846,20 +846,72 @@ BB_LIST_ITER bb_list_iter; BB_NODE * bb_tmp; BB_NODE * bb_first; + BB_NODE * bb_last; switch (type) { case SC_BLOCK: ret_val = TRUE; bb_first = First_bb(); + bb_last = Last_bb(); - FOR_ALL_ELEM(bb_tmp, bb_list_iter, Init(this->Get_bbs())) { - if ((bb_tmp != bb_first) - && (!bb_first->Dominates(bb_tmp) || !bb_tmp->Postdominates(bb_first) - || !bb_tmp->Pred() - || (bb_tmp->Pred()->Len() != 1))) { - ret_val = FALSE; + FOR_ALL_ELEM(bb_tmp, bb_list_iter, Init(Get_bbs())) { + BB_LIST_ITER iter; + BB_NODE * tmp; + + if (bb_tmp != bb_last) { + // Do not allow exits except for the last block. + if (bb_tmp->Succ()) { + FOR_ALL_ELEM(tmp, iter, Init(bb_tmp->Succ())) { + if (!Contains(tmp)) { + ret_val = FALSE; + break; + } + } + } + } + if (!ret_val) break; + + if (bb_tmp != bb_first) { + if (!bb_first->Dominates(bb_tmp) || !bb_tmp->Postdominates(bb_first)) { + ret_val = FALSE; + break; + } + else if (bb_tmp->Pred()) { + // Do not allow entrances except for the first block. + FOR_ALL_ELEM(tmp, iter, Init(bb_tmp->Pred())) { + if (!Contains(tmp)) { + ret_val = FALSE; + break; + } + } + } } + else { + // For the first block, do not allow more than 1 entrances from outside + // unless it is a merge block of a SC_IF. + BB_LIST * pred = bb_tmp->Pred(); + if (pred && (pred->Len() > 1)) { + int count = 0; + FOR_ALL_ELEM(tmp, iter, Init(pred)) { + if (!Contains(tmp)) + count++; + } + if (count > 1) { + // Check whether bb_tmp is a SC_IF's merge block. + SC_NODE * sc_tmp = Prev_sibling(); + if (!sc_tmp || (sc_tmp->Type() != SC_IF) + || (sc_tmp->Merge() != bb_tmp) + || (count != 2)) { + ret_val = FALSE; + break; + } + } + } + } + + if (!ret_val) + break; } break; ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 _______________________________________________ Open64-devel mailing list Open64-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/open64-devel