X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FIR%2FFunctionInfo.h;h=eba088a61bc0ea4acae9d23347c1236c069ad7d4;hb=2b762697564ca1e12e0e974e93ceeb4c3420505c;hp=e265ad3709637b5a8bd2d1b964cf3bd1153e1060;hpb=5aa157fab605b41262b7e32fad59110432b319fb;p=oota-llvm.git diff --git a/include/llvm/IR/FunctionInfo.h b/include/llvm/IR/FunctionInfo.h index e265ad37096..eba088a61bc 100644 --- a/include/llvm/IR/FunctionInfo.h +++ b/include/llvm/IR/FunctionInfo.h @@ -165,19 +165,8 @@ private: /// Holds strings for combined index, mapping to the corresponding module ID. ModulePathStringTableTy ModulePathStringTable; - /// The main module being compiled, that we are importing into, if applicable. - /// Used to check if any of its functions are in the index and therefore - /// potentially exported. - const Module *ExportingModule; - - /// Flag indicating whether the exporting module has any functions in the - /// index and therefore potentially exported (imported into another module). - bool HasExportedFunctions; - public: - FunctionInfoIndex(const Module *M = nullptr) - : ExportingModule(M), HasExportedFunctions(false){}; - ~FunctionInfoIndex() = default; + FunctionInfoIndex() = default; // Disable the copy constructor and assignment operators, so // no unexpected copying/moving occurs. @@ -194,14 +183,13 @@ public: return FunctionMap[FuncName]; } + /// Get the list of function info objects for a given function. + const const_funcinfo_iterator findFunctionInfoList(StringRef FuncName) const { + return FunctionMap.find(FuncName); + } + /// Add a function info for a function of the given name. void addFunctionInfo(StringRef FuncName, std::unique_ptr Info) { - if (ExportingModule) { - assert(Info->functionSummary()); - if (ExportingModule->getModuleIdentifier() == - Info->functionSummary()->modulePath()) - HasExportedFunctions = true; - } FunctionMap[FuncName].push_back(std::move(Info)); } @@ -241,11 +229,10 @@ public: } /// Check if the given Module has any functions available for exporting - /// in the index. - bool hasExportedFunctions(const Module *M) { - assert(M == ExportingModule && - "Checking for exported functions on unexpected module"); - return HasExportedFunctions; + /// in the index. We consider any module present in the ModulePathStringTable + /// to have exported functions. + bool hasExportedFunctions(const Module &M) const { + return ModulePathStringTable.count(M.getModuleIdentifier()); } };