diff options
author | Teresa Johnson <tejohnson@google.com> | 2016-03-14 21:05:56 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2016-03-14 21:05:56 +0000 |
commit | 892920b358665ee87a654f06c08af0aeaaeff70f (patch) | |
tree | 0e8d1646ba1e1f22428d9dfcdf119ab04cc7d81c /llvm/lib/Transforms/IPO/FunctionImport.cpp | |
parent | 71b5a81e7724b8ff06da9272906a056c55193b9f (diff) | |
download | bcm5719-llvm-892920b358665ee87a654f06c08af0aeaaeff70f.tar.gz bcm5719-llvm-892920b358665ee87a654f06c08af0aeaaeff70f.zip |
[ThinLTO] Renaming of function index to module summary index (NFC)
With the changes in r263275, there are now more than just functions in
the summary. Completed the renaming of data structures (started in
r263275) to reflect the wider scope. In particular, changed the
FunctionIndex* data structures to ModuleIndex*, and renamed related
variables and comments. Also renamed the files to reflect the changes.
A companion clang patch will immediately succeed this patch to reflect
this renaming.
llvm-svn: 263490
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionImport.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionImport.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index 8aa97535170..90b36aab363 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -20,7 +20,7 @@ #include "llvm/IR/Module.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Linker/Linker.h" -#include "llvm/Object/FunctionIndexObjectFile.h" +#include "llvm/Object/ModuleSummaryIndexObjectFile.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/SourceMgr.h" @@ -111,7 +111,7 @@ Module &ModuleLazyLoaderCache::operator()(StringRef Identifier) { /// calls not already in the \p VisitedFunctions map. If any are /// found they are added to the \p Worklist for importing. static void findExternalCalls( - const Module &DestModule, Function &F, const FunctionInfoIndex &Index, + const Module &DestModule, Function &F, const ModuleSummaryIndex &Index, VisitedFunctionTrackerTy &VisitedFunctions, unsigned Threshold, SmallVectorImpl<std::pair<StringRef, unsigned>> &Worklist) { // We need to suffix internal function calls imported from other modules, @@ -141,7 +141,7 @@ static void findExternalCalls( if (CalledFunction->hasInternalLinkage()) { ImportedName = Renamed; } - // Compute the global identifier used in the function index. + // Compute the global identifier used in the summary index. auto CalledFunctionGlobalID = Function::getGlobalIdentifier( CalledFunction->getName(), CalledFunction->getLinkage(), CalledFunction->getParent()->getSourceFileName()); @@ -192,9 +192,9 @@ static void GetImportList(Module &DestModule, SmallVectorImpl<std::pair<StringRef, unsigned>> &Worklist, VisitedFunctionTrackerTy &VisitedFunctions, - std::map<StringRef, DenseSet<const GlobalValue *>> & - ModuleToFunctionsToImportMap, - const FunctionInfoIndex &Index, + std::map<StringRef, DenseSet<const GlobalValue *>> + &ModuleToFunctionsToImportMap, + const ModuleSummaryIndex &Index, ModuleLazyLoaderCache &ModuleLoaderCache) { while (!Worklist.empty()) { StringRef CalledFunctionName; @@ -374,11 +374,11 @@ static void diagnosticHandler(const DiagnosticInfo &DI) { OS << '\n'; } -/// Parse the function index out of an IR file and return the function +/// Parse the summary index out of an IR file and return the summary /// index object if found, or nullptr if not. -static std::unique_ptr<FunctionInfoIndex> -getFunctionIndexForFile(StringRef Path, std::string &Error, - DiagnosticHandlerFunction DiagnosticHandler) { +static std::unique_ptr<ModuleSummaryIndex> +getModuleSummaryIndexForFile(StringRef Path, std::string &Error, + DiagnosticHandlerFunction DiagnosticHandler) { std::unique_ptr<MemoryBuffer> Buffer; ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr = MemoryBuffer::getFile(Path); @@ -387,9 +387,9 @@ getFunctionIndexForFile(StringRef Path, std::string &Error, return nullptr; } Buffer = std::move(BufferOrErr.get()); - ErrorOr<std::unique_ptr<object::FunctionIndexObjectFile>> ObjOrErr = - object::FunctionIndexObjectFile::create(Buffer->getMemBufferRef(), - DiagnosticHandler); + ErrorOr<std::unique_ptr<object::ModuleSummaryIndexObjectFile>> ObjOrErr = + object::ModuleSummaryIndexObjectFile::create(Buffer->getMemBufferRef(), + DiagnosticHandler); if (std::error_code EC = ObjOrErr.getError()) { Error = EC.message(); return nullptr; @@ -400,9 +400,9 @@ getFunctionIndexForFile(StringRef Path, std::string &Error, namespace { /// Pass that performs cross-module function import provided a summary file. class FunctionImportPass : public ModulePass { - /// Optional function summary index to use for importing, otherwise + /// Optional module summary index to use for importing, otherwise /// the summary-file option must be specified. - const FunctionInfoIndex *Index; + const ModuleSummaryIndex *Index; public: /// Pass identification, replacement for typeid @@ -413,19 +413,20 @@ public: return "Function Importing"; } - explicit FunctionImportPass(const FunctionInfoIndex *Index = nullptr) + explicit FunctionImportPass(const ModuleSummaryIndex *Index = nullptr) : ModulePass(ID), Index(Index) {} bool runOnModule(Module &M) override { if (SummaryFile.empty() && !Index) report_fatal_error("error: -function-import requires -summary-file or " "file from frontend\n"); - std::unique_ptr<FunctionInfoIndex> IndexPtr; + std::unique_ptr<ModuleSummaryIndex> IndexPtr; if (!SummaryFile.empty()) { if (Index) report_fatal_error("error: -summary-file and index from frontend\n"); std::string Error; - IndexPtr = getFunctionIndexForFile(SummaryFile, Error, diagnosticHandler); + IndexPtr = + getModuleSummaryIndexForFile(SummaryFile, Error, diagnosticHandler); if (!IndexPtr) { errs() << "Error loading file '" << SummaryFile << "': " << Error << "\n"; @@ -458,7 +459,7 @@ INITIALIZE_PASS_END(FunctionImportPass, "function-import", "Summary Based Function Import", false, false) namespace llvm { -Pass *createFunctionImportPass(const FunctionInfoIndex *Index = nullptr) { +Pass *createFunctionImportPass(const ModuleSummaryIndex *Index = nullptr) { return new FunctionImportPass(Index); } } |