#include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/ModuleSummaryAnalysis.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/Analysis/TypeMetadataUtils.h"
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Object/ModuleSymbolTable.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/IPO/FunctionAttrs.h"
#include "llvm/Transforms/IPO/FunctionImport.h"
#include "llvm/Transforms/IPO/LowerTypeTests.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
usingnamespacellvm;
namespace {
static bool allowPromotionAlias(const std::string &Name) { … }
void promoteInternals(Module &ExportM, Module &ImportM, StringRef ModuleId,
SetVector<GlobalValue *> &PromoteExtra) { … }
void promoteTypeIds(Module &M, StringRef ModuleId) { … }
void simplifyExternals(Module &M) { … }
static void
filterModule(Module *M,
function_ref<bool(const GlobalValue *)> ShouldKeepDefinition) { … }
void forEachVirtualFunction(Constant *C, function_ref<void(Function *)> Fn) { … }
static void cloneUsedGlobalVariables(const Module &SrcM, Module &DestM,
bool CompilerUsed) { … }
#ifndef NDEBUG
static bool enableUnifiedLTO(Module &M) {
bool UnifiedLTO = false;
if (auto *MD =
mdconst::extract_or_null<ConstantInt>(M.getModuleFlag("UnifiedLTO")))
UnifiedLTO = MD->getZExtValue();
return UnifiedLTO;
}
#endif
void splitAndWriteThinLTOBitcode(
raw_ostream &OS, raw_ostream *ThinLinkOS,
function_ref<AAResults &(Function &)> AARGetter, Module &M) { … }
bool enableSplitLTOUnit(Module &M) { … }
bool hasTypeMetadata(Module &M) { … }
bool writeThinLTOBitcode(raw_ostream &OS, raw_ostream *ThinLinkOS,
function_ref<AAResults &(Function &)> AARGetter,
Module &M, const ModuleSummaryIndex *Index) { … }
}
extern bool WriteNewDbgInfoFormatToBitcode;
PreservedAnalyses
llvm::ThinLTOBitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) { … }