Module &M;
/// Function index passed in for function importing/exporting handling.
- const FunctionInfoIndex *ImportIndex;
+ const FunctionInfoIndex &ImportIndex;
/// Functions to import from this module, all other functions will be
/// imported as declarations instead of definitions.
public:
FunctionImportGlobalProcessing(
- Module &M, const FunctionInfoIndex *Index,
+ Module &M, const FunctionInfoIndex &Index,
DenseSet<const GlobalValue *> *FunctionsToImport = nullptr)
: M(M), ImportIndex(Index), FunctionsToImport(FunctionsToImport) {
// If we have a FunctionInfoIndex but no function to import,
// backend compilation, and we need to see if it has functions that
// may be exported to another backend compilation.
if (!FunctionsToImport)
- HasExportedFunctions = ImportIndex->hasExportedFunctions(M);
+ HasExportedFunctions = ImportIndex.hasExportedFunctions(M);
}
bool run();
/// Perform in-place global value handling on the given Module for
/// exported local functions renamed and promoted for ThinLTO.
-bool renameModuleForThinLTO(Module &M, const FunctionInfoIndex *Index);
+bool renameModuleForThinLTO(Module &M, const FunctionInfoIndex &Index);
} // End llvm namespace
return true;
if (ImportIndex) {
- FunctionImportGlobalProcessing ThinLTOProcessing(*SrcM, ImportIndex,
+ FunctionImportGlobalProcessing ThinLTOProcessing(*SrcM, *ImportIndex,
FunctionsToImport);
if (ThinLTOProcessing.run())
return true;
// First we need to promote to global scope and rename any local values that
// are potentially exported to other modules.
- if (renameModuleForThinLTO(M, Index)) {
+ if (renameModuleForThinLTO(M, *Index)) {
errs() << "Error renaming module\n";
return false;
}
(doPromoteLocalToGlobal(SGV) || isPerformingImport()))
return FunctionInfoIndex::getGlobalNameForLocal(
SGV->getName(),
- ImportIndex->getModuleId(SGV->getParent()->getModuleIdentifier()));
+ ImportIndex.getModuleId(SGV->getParent()->getModuleIdentifier()));
return SGV->getName();
}
return false;
}
-bool llvm::renameModuleForThinLTO(Module &M, const FunctionInfoIndex *Index) {
+bool llvm::renameModuleForThinLTO(Module &M, const FunctionInfoIndex &Index) {
FunctionImportGlobalProcessing ThinLTOProcessing(M, Index);
return ThinLTOProcessing.run();
}