bool Coverage::runOnModule(Module &module) { doInitialization(module); // iterate through functions in module for (Module::iterator f = module.begin(), fe = module.end(); f != fe; f++) { runOnFunction(module, *f); } return true; }
bool MeasureMetric::runOnModule(Module &M) { doInitialization(M); for(Module::iterator f = M.begin(), fe = M.end(); f != fe; f++) { if (!f->isDeclaration()) { runOnFunction(*f); } } doFinalization(); return false; }
bool BytesFlops::runOnModule(Module & module) { doInitialization(module); /** * for each function in the module, run a function pass on it. */ for ( auto fiter = module.begin(); fiter != module.end(); fiter++ ) { runOnFunction(*fiter); } doFinalization(module); return true; }
bool VeryBusyAnalysisPass::runOnModule(Module& M) { errs() << "\n#########################################\n"; errs() << "VERY BUSY ANALYSIS\n"; errs() << "#########################################\n"; this->module = &M; this->BB_VB_IN = new MapBBToRCS(); this->I_VB_IN = new MapInstToRCS(); for (Module::iterator i = M.begin(), e = M.end(); i != e; ++i) { Function* func = &(*i); runOnFunction(&(*func)); } return false; }
void NullDerefProtectionTransformer::Transform() { FunctionDecl* FD = getTransaction()->getWrapperFD(); if (!FD) return; NonNullDeclFinder Finder(m_Sema); std::string mangledName = Finder.getMangledName(FD); // Find the function in the module. llvm::Function* F = getTransaction()->getModule()->getFunction(mangledName); if (!F) return; llvm::IRBuilder<> TheBuilder(F->getContext()); Builder = &TheBuilder; runOnFunction(*F); // Find all the function decls with null attribute arguments. for (size_t Idx = 0, E = getTransaction()->size(); Idx < E; ++Idx) { Transaction::DelayCallInfo I = (*getTransaction())[Idx]; for (DeclGroupRef::const_iterator J = I.m_DGR.begin(), JE = I.m_DGR.end(); J != JE; ++J) if ((*J)->hasBody()) Finder.TraverseStmt((*J)->getBody()); } const llvm::SmallVector<std::string, 8>& FDeclNames = Finder.getDeclNames(); if (FDeclNames.empty()) return; llvm::Module* M = F->getParent(); for (llvm::SmallVector<std::string, 8>::const_iterator i = FDeclNames.begin(), e = FDeclNames.end(); i != e; ++i) { const nonnull_map_t& ArgIndexs = Finder.getArgIndexs(); nonnull_map_t::const_iterator it = ArgIndexs.find(*i); if (it != ArgIndexs.end()) { const std::bitset<32>& ArgNums = it->second; handleNonNullArgCall(*M, *i, ArgNums); } } }
void Resolve::runOnModule(Module *M) { K = M->getContext(); for (auto P : Externals::get(K)->getProtos()) if (!K->Map.add(P)) { auto ErrMsg = "prototype " + P->getName() + " attempting to overshadow previously bound symbol with same name"; DiagnosticPrinter(P->getSourceLocation()) << ErrMsg; exit(1); } for (auto &F : *M) if (!K->Map.add(F)) { DiagnosticPrinter(F->getSourceLocation()) << "function " + F->getName() + " attempting to overshadow " "previously bound symbol with same " "name"; exit(1); } for (auto &F : *M) runOnFunction(F); }