コード例 #1
0
bool FunctionStaticSlicer::updateRCSC(
                PostDominanceFrontier::DomSetType::const_iterator start,
                PostDominanceFrontier::DomSetType::const_iterator end) {
  bool changed = false;
#ifdef DEBUG_RC
  errs() << __func__ << " ============ BEG\n";
#endif
  for (; start != end; start++) {
    const BasicBlock *BB = *start;
    const Instruction &i = BB->back();
    InsInfo *ii = getInsInfo(&i);
    /* SC = BC \cup ... */
#ifdef DEBUG_SLICING
    errs() << "XXXXXXXXXXXXXX " << BB->getName() << " ";
    i.print(errs());
    errs() << '\n';
#endif
    ii->deslice();
    /* RC = ... \cup \cup(b \in BC) RB */
    for (ValSet::const_iterator II = ii->REF_begin(), EE = ii->REF_end();
         II != EE; II++)
      if (ii->addRC(*II)) {
        changed = true;
#ifdef DEBUG_RC
        errs() << "  added " << (*II)->getName() << "\n";
#endif
      }
  }
#ifdef DEBUG_RC
  errs() << __func__ << " ============ END: changed=" << changed << "\n";
#endif
  return changed;
}
コード例 #2
0
/*
 * j is predecessor of i
 * SC(i)={i| REF(i) \cap RC(j) \neq \emptyset}
 * Statement i should be in slice if it uses a relevant variable
 */
void FwdFunctionStaticSlicer::computeSCi(const Instruction *i, const Instruction *j) {
  InsInfo *insInfoi = getInsInfo(i), *insInfoj = getInsInfo(j);
#ifdef DEBUG_SLICE
  errs() << "\n\ti ==>\t";
  i->print(errs());
  errs() << "\n\tj ==>\t";
  j->print(errs());
#endif

  bool isect_nonempty = false;
  for (ValSet::const_iterator I = insInfoi->REF_begin(),
       E = insInfoi->REF_end(); I != E && !isect_nonempty; I++) {
    const Pointee &REFi = *I;
    for (ValSet::const_iterator II = insInfoj->RC_begin(),
         EE = insInfoj->RC_end(); II != EE; II++) {

    	if(Helper::checkValid(REFi, *II)) {
#ifdef DEBUG_SLICE
        	errs() << "\n\t\t";
        	REFi.first->print(errs());
        	errs() << "\t\t";
    		II->first->print(errs());
#endif
    		if (AA->isMustAlias(REFi.first, II->first)) {
    			isect_nonempty = true;
    			break;
    		}
    	}
    }
  }

  if (isect_nonempty) {
    insInfoi->deslice();
#ifdef DEBUG_SLICING
    errs() << "\n\tXXXXXXXXXXXXXY ";
    i->print(errs());
    errs() << '\n';
#endif
  }
}