LLVM: lib/LTO/ThinLTOCodeGenerator.cpp File Reference (original) (raw)

Go to the source code of this file.

Namespaces
namespace llvm
This is an optimization pass for GlobalISel generic memory operations.
Macros
#define DEBUG_TYPE "thinlto"
Functions
static void saveTempBitcode (const Module &TheModule, StringRef TempDir, unsigned count, StringRef Suffix)
static const GlobalValueSummary * getFirstDefinitionForLinker (ArrayRef< std::unique_ptr< GlobalValueSummary > > GVSummaryList)
static void computePrevailingCopies (const ModuleSummaryIndex &Index, DenseMap< GlobalValue::GUID, const GlobalValueSummary * > &PrevailingCopy)
static StringMap< lto::InputFile * > generateModuleMap (std::vector< std::unique_ptr< lto::InputFile > > &Modules)
static void promoteModule (Module &TheModule, const ModuleSummaryIndex &Index, bool ClearDSOLocalOnDeclarations)
static void verifyLoadedModule (Module &TheModule)
Verify the module and strip broken debug info.
static std::unique_ptr< Module > loadModuleFromInput (lto::InputFile *Input, LLVMContext &Context, bool Lazy, bool IsImporting)
static void crossImportIntoModule (Module &TheModule, const ModuleSummaryIndex &Index, StringMap< lto::InputFile * > &ModuleMap, const FunctionImporter::ImportMapTy &ImportList, bool ClearDSOLocalOnDeclarations)
static void optimizeModule (Module &TheModule, TargetMachine &TM, unsigned OptLevel, bool Freestanding, bool DebugPassManager, ModuleSummaryIndex *Index)
static void addUsedSymbolToPreservedGUID (const lto::InputFile &File, DenseSet< GlobalValue::GUID > &PreservedGUID)
static void computeGUIDPreservedSymbols (const lto::InputFile &File, const StringSet<> &PreservedSymbols, const Triple &TheTriple, DenseSet< GlobalValue::GUID > &GUIDs)
static DenseSet< GlobalValue::GUID > computeGUIDPreservedSymbols (const lto::InputFile &File, const StringSet<> &PreservedSymbols, const Triple &TheTriple)
static std::unique_ptr< MemoryBuffer > codegenModule (Module &TheModule, TargetMachine &TM)
static std::unique_ptr< MemoryBuffer > ProcessThinLTOModule (Module &TheModule, ModuleSummaryIndex &Index, StringMap< lto::InputFile * > &ModuleMap, TargetMachine &TM, const FunctionImporter::ImportMapTy &ImportList, const FunctionImporter::ExportSetTy &ExportList, const DenseSet< GlobalValue::GUID > &GUIDPreservedSymbols, const GVSummaryMapTy &DefinedGlobals, const ThinLTOCodeGenerator::CachingOptions &CacheOptions, bool DisableCodeGen, StringRef SaveTempsDir, bool Freestanding, unsigned OptLevel, unsigned count, bool DebugPassManager)
static void resolvePrevailingInIndex (ModuleSummaryIndex &Index, StringMap< std::map< GlobalValue::GUID, GlobalValue::LinkageTypes > > &ResolvedODR, const DenseSet< GlobalValue::GUID > &GUIDPreservedSymbols, const DenseMap< GlobalValue::GUID, const GlobalValueSummary * > &PrevailingCopy)
Resolve prevailing symbols.
static void initTMBuilder (TargetMachineBuilder &TMBuilder, const Triple &TheTriple)
static void computeDeadSymbolsInIndex (ModuleSummaryIndex &Index, const DenseSet< GlobalValue::GUID > &GUIDPreservedSymbols)
Variables
static cl::opt< int > ThreadCount ("threads", cl::init(0))

DEBUG_TYPE

#define DEBUG_TYPE "thinlto"

addUsedSymbolToPreservedGUID()

codegenModule()

computeDeadSymbolsInIndex()

computeGUIDPreservedSymbols() [1/2]

computeGUIDPreservedSymbols() [2/2]

Definition at line 301 of file ThinLTOCodeGenerator.cpp.

References llvm::StringMap< ValueTy, AllocatorTy >::count(), llvm::GlobalValue::ExternalLinkage, llvm::GlobalValue::getGlobalIdentifier(), llvm::GlobalValue::getGUIDAssumingExternalLinkage(), and llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::insert().

Referenced by computeGUIDPreservedSymbols(), llvm::ThinLTOCodeGenerator::crossModuleImport(), llvm::ThinLTOCodeGenerator::emitImports(), llvm::ThinLTOCodeGenerator::gatherImportedSummariesForModule(), llvm::ThinLTOCodeGenerator::internalize(), llvm::ThinLTOCodeGenerator::promote(), and llvm::ThinLTOCodeGenerator::run().

computePrevailingCopies()

crossImportIntoModule()

generateModuleMap()

getFirstDefinitionForLinker()

initTMBuilder()

loadModuleFromInput()

optimizeModule()

Definition at line 234 of file ThinLTOCodeGenerator.cpp.

References llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::addPass(), CGAM, FAM, llvm::Module::getContext(), llvm::TargetMachine::getTargetTriple(), LAM, llvm_unreachable, llvm::PipelineTuningOptions::LoopVectorization, MAM, llvm::OptimizationLevel::O0, llvm::OptimizationLevel::O1, llvm::OptimizationLevel::O2, llvm::OptimizationLevel::O3, PB(), PIC, llvm::PassManager< IRUnitT, AnalysisManagerT, ExtraArgTs >::run(), and llvm::PipelineTuningOptions::SLPVectorization.

Referenced by llvm::ThinLTOCodeGenerator::optimize(), and ProcessThinLTOModule().

ProcessThinLTOModule()

std::unique_ptr< MemoryBuffer > ProcessThinLTOModule ( Module & TheModule, ModuleSummaryIndex & Index, StringMap< lto::InputFile * > & ModuleMap, TargetMachine & TM, const FunctionImporter::ImportMapTy & ImportList, const FunctionImporter::ExportSetTy & ExportList, const DenseSet< GlobalValue::GUID > & GUIDPreservedSymbols, const GVSummaryMapTy & DefinedGlobals, const ThinLTOCodeGenerator::CachingOptions & CacheOptions, bool DisableCodeGen, StringRef SaveTempsDir, bool Freestanding, unsigned OptLevel, unsigned count, bool DebugPassManager ) static

Definition at line 427 of file ThinLTOCodeGenerator.cpp.

References llvm::buildModuleSummaryIndex(), codegenModule(), llvm::count(), crossImportIntoModule(), llvm::PIELevel::Default, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty(), llvm::Module::getPIELevel(), llvm::TargetMachine::getRelocationModel(), llvm::TargetMachine::getTargetTriple(), llvm::Triple::isOSBinFormatELF(), optimizeModule(), promoteModule(), saveTempBitcode(), llvm::StringMapImpl::size(), llvm::Reloc::Static, llvm::thinLTOFinalizeInModule(), llvm::thinLTOInternalizeModule(), llvm::updatePublicTypeTestCalls(), and llvm::WriteBitcodeToFile().

Referenced by llvm::ThinLTOCodeGenerator::run().

promoteModule()

resolvePrevailingInIndex()

Resolve prevailing symbols.

Record resolutions in the ResolvedODR map for caching, and in the Index for application during the ThinLTO backends. This is needed for correctness for exported symbols (ensure at least one copy kept) and a compile-time optimization (to drop duplicate copies when possible).

Definition at line 506 of file ThinLTOCodeGenerator.cpp.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find(), and llvm::thinLTOResolvePrevailingInIndex().

Referenced by llvm::ThinLTOCodeGenerator::internalize(), llvm::ThinLTOCodeGenerator::promote(), and llvm::ThinLTOCodeGenerator::run().

saveTempBitcode()

verifyLoadedModule()

void verifyLoadedModule ( Module & TheModule) static

ThreadCount

cl::opt< int > ThreadCount("threads", cl::init(0)) ( "threads" , cl::init(0) ) static