liberty/lib/SLAMP/SLAMP.cpp
/// Find target function and loop baed on the options passed in
Find target function and loop baed on the options passed in
Find target function and loop baed on the options passed in
bool SLAMP::findTarget(Module &m) {
  auto &mloops = getAnalysis<ModuleLoops>();
  bool found = false;
  for (auto & fi : m) {
    Function *f = &fi;
    if (f->getName().str() == TargetFcn) {
      BasicBlock *header = nullptr;
      for (auto & bi : *f) {
        if (bi.getName().str() == TargetLoop) {
          header = &bi;
          break;
        }
      }
      if (header == nullptr)
        break;
      LoopInfo &loopinfo = mloops.getAnalysis_LoopInfo(f);
      this->target_loop = loopinfo.getLoopFor(header);
      if (!this->target_loop)
        break;
      this->target_fn = f;
      found = true;
    }
  }
  return found;
}
bool SLAMP :: findTarget ( Module & m ) { auto & mloops = getAnalysis < ModuleLoops > ( ) ; bool found = false ; for ( auto & fi : m ) { Function * f = & fi ; if ( f -> getName ( ) . str ( ) == TargetFcn ) { BasicBlock * header = nullptr ; for ( auto & bi : * f ) { if ( bi . getName ( ) . str ( ) == TargetLoop ) { header = & bi ; break ; } } if ( header == nullptr ) break ; LoopInfo & loopinfo = mloops . getAnalysis_LoopInfo ( f ) ; this -> target_loop = loopinfo . getLoopFor ( header ) ; if ( ! this -> target_loop ) break ; this -> target_fn = f ; found = true ; } } return found ; }
Find target function and loop baed on the options passed in
Find target function and loop baed on the options passed in