#include "mlir/Target/LLVM/ModuleToObject.h"
#include "mlir/ExecutionEngine/OptUtils.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/Target/LLVMIR/Dialect/LLVMIR/LLVMToLLVMIRTranslation.h"
#include "mlir/Target/LLVMIR/Export.h"
#include "mlir/Target/LLVMIR/ModuleTranslation.h"
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/Linker/Linker.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Transforms/IPO/Internalize.h"
usingnamespacemlir;
usingnamespacemlir::LLVM;
ModuleToObject::ModuleToObject(Operation &module, StringRef triple,
StringRef chip, StringRef features, int optLevel)
: … { … }
ModuleToObject::~ModuleToObject() = default;
Operation &ModuleToObject::getOperation() { … }
std::optional<llvm::TargetMachine *>
ModuleToObject::getOrCreateTargetMachine() { … }
std::unique_ptr<llvm::Module>
ModuleToObject::loadBitcodeFile(llvm::LLVMContext &context, StringRef path) { … }
LogicalResult ModuleToObject::loadBitcodeFilesFromList(
llvm::LLVMContext &context, ArrayRef<std::string> fileList,
SmallVector<std::unique_ptr<llvm::Module>> &llvmModules,
bool failureOnError) { … }
std::unique_ptr<llvm::Module>
ModuleToObject::translateToLLVMIR(llvm::LLVMContext &llvmContext) { … }
LogicalResult
ModuleToObject::linkFiles(llvm::Module &module,
SmallVector<std::unique_ptr<llvm::Module>> &&libs) { … }
LogicalResult ModuleToObject::optimizeModule(llvm::Module &module,
int optLevel) { … }
std::optional<std::string>
ModuleToObject::translateToISA(llvm::Module &llvmModule,
llvm::TargetMachine &targetMachine) { … }
void ModuleToObject::setDataLayoutAndTriple(llvm::Module &module) { … }
std::optional<SmallVector<char, 0>>
ModuleToObject::moduleToObject(llvm::Module &llvmModule) { … }
std::optional<SmallVector<char, 0>> ModuleToObject::run() { … }