#include "llvm/LTO/legacy/LTOModule.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Mangler.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCParser/MCAsmParser.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Object/IRObjectFile.h"
#include "llvm/Object/MachO.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/TargetParser/Host.h"
#include "llvm/TargetParser/SubtargetFeature.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Transforms/Utils/GlobalStatus.h"
#include <system_error>
usingnamespacellvm;
usingnamespacellvm::object;
LTOModule::LTOModule(std::unique_ptr<Module> M, MemoryBufferRef MBRef,
llvm::TargetMachine *TM)
: … { … }
LTOModule::~LTOModule() = default;
bool LTOModule::isBitcodeFile(const void *Mem, size_t Length) { … }
bool LTOModule::isBitcodeFile(StringRef Path) { … }
bool LTOModule::isThinLTO() { … }
bool LTOModule::isBitcodeForTarget(MemoryBuffer *Buffer,
StringRef TriplePrefix) { … }
std::string LTOModule::getProducerString(MemoryBuffer *Buffer) { … }
ErrorOr<std::unique_ptr<LTOModule>>
LTOModule::createFromFile(LLVMContext &Context, StringRef path,
const TargetOptions &options) { … }
ErrorOr<std::unique_ptr<LTOModule>>
LTOModule::createFromOpenFile(LLVMContext &Context, int fd, StringRef path,
size_t size, const TargetOptions &options) { … }
ErrorOr<std::unique_ptr<LTOModule>>
LTOModule::createFromOpenFileSlice(LLVMContext &Context, int fd, StringRef path,
size_t map_size, off_t offset,
const TargetOptions &options) { … }
ErrorOr<std::unique_ptr<LTOModule>>
LTOModule::createFromBuffer(LLVMContext &Context, const void *mem,
size_t length, const TargetOptions &options,
StringRef path) { … }
ErrorOr<std::unique_ptr<LTOModule>>
LTOModule::createInLocalContext(std::unique_ptr<LLVMContext> Context,
const void *mem, size_t length,
const TargetOptions &options, StringRef path) { … }
static ErrorOr<std::unique_ptr<Module>>
parseBitcodeFileImpl(MemoryBufferRef Buffer, LLVMContext &Context,
bool ShouldBeLazy) { … }
ErrorOr<std::unique_ptr<LTOModule>>
LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options,
LLVMContext &Context, bool ShouldBeLazy) { … }
std::unique_ptr<MemoryBuffer>
LTOModule::makeBuffer(const void *mem, size_t length, StringRef name) { … }
bool
LTOModule::objcClassNameFromExpression(const Constant *c, std::string &name) { … }
void LTOModule::addObjCClass(const GlobalVariable *clgv) { … }
void LTOModule::addObjCCategory(const GlobalVariable *clgv) { … }
void LTOModule::addObjCClassRef(const GlobalVariable *clgv) { … }
void LTOModule::addDefinedDataSymbol(ModuleSymbolTable::Symbol Sym) { … }
void LTOModule::addDefinedDataSymbol(StringRef Name, const GlobalValue *v) { … }
void LTOModule::addDefinedFunctionSymbol(ModuleSymbolTable::Symbol Sym) { … }
void LTOModule::addDefinedFunctionSymbol(StringRef Name, const Function *F) { … }
void LTOModule::addDefinedSymbol(StringRef Name, const GlobalValue *def,
bool isFunction) { … }
void LTOModule::addAsmGlobalSymbol(StringRef name,
lto_symbol_attributes scope) { … }
void LTOModule::addAsmGlobalSymbolUndef(StringRef name) { … }
void LTOModule::addPotentialUndefinedSymbol(ModuleSymbolTable::Symbol Sym,
bool isFunc) { … }
void LTOModule::parseSymbols() { … }
void LTOModule::parseMetadata() { … }
lto::InputFile *LTOModule::createInputFile(const void *buffer,
size_t buffer_size, const char *path,
std::string &outErr) { … }
size_t LTOModule::getDependentLibraryCount(lto::InputFile *input) { … }
const char *LTOModule::getDependentLibrary(lto::InputFile *input, size_t index,
size_t *size) { … }
Expected<uint32_t> LTOModule::getMachOCPUType() const { … }
Expected<uint32_t> LTOModule::getMachOCPUSubType() const { … }
bool LTOModule::hasCtorDtor() const { … }