#include "MCJIT.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/ExecutionEngine/JITEventListener.h"
#include "llvm/ExecutionEngine/MCJIT.h"
#include "llvm/ExecutionEngine/ObjectCache.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Mangler.h"
#include "llvm/IR/Module.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SmallVectorMemoryBuffer.h"
#include <mutex>
usingnamespacellvm;
namespace {
static struct RegisterJIT { … } JITRegistrator;
}
extern "C" void LLVMLinkInMCJIT() { … }
ExecutionEngine *
MCJIT::createJIT(std::unique_ptr<Module> M, std::string *ErrorStr,
std::shared_ptr<MCJITMemoryManager> MemMgr,
std::shared_ptr<LegacyJITSymbolResolver> Resolver,
std::unique_ptr<TargetMachine> TM) { … }
MCJIT::MCJIT(std::unique_ptr<Module> M, std::unique_ptr<TargetMachine> TM,
std::shared_ptr<MCJITMemoryManager> MemMgr,
std::shared_ptr<LegacyJITSymbolResolver> Resolver)
: … { … }
MCJIT::~MCJIT() { … }
void MCJIT::addModule(std::unique_ptr<Module> M) { … }
bool MCJIT::removeModule(Module *M) { … }
void MCJIT::addObjectFile(std::unique_ptr<object::ObjectFile> Obj) { … }
void MCJIT::addObjectFile(object::OwningBinary<object::ObjectFile> Obj) { … }
void MCJIT::addArchive(object::OwningBinary<object::Archive> A) { … }
void MCJIT::setObjectCache(ObjectCache* NewCache) { … }
std::unique_ptr<MemoryBuffer> MCJIT::emitObject(Module *M) { … }
void MCJIT::generateCodeForModule(Module *M) { … }
void MCJIT::finalizeLoadedModules() { … }
void MCJIT::finalizeObject() { … }
void MCJIT::finalizeModule(Module *M) { … }
JITSymbol MCJIT::findExistingSymbol(const std::string &Name) { … }
Module *MCJIT::findModuleForSymbol(const std::string &Name,
bool CheckFunctionsOnly) { … }
uint64_t MCJIT::getSymbolAddress(const std::string &Name,
bool CheckFunctionsOnly) { … }
JITSymbol MCJIT::findSymbol(const std::string &Name,
bool CheckFunctionsOnly) { … }
uint64_t MCJIT::getGlobalValueAddress(const std::string &Name) { … }
uint64_t MCJIT::getFunctionAddress(const std::string &Name) { … }
void *MCJIT::getPointerToFunction(Function *F) { … }
void MCJIT::runStaticConstructorsDestructorsInModulePtrSet(
bool isDtors, ModulePtrSet::iterator I, ModulePtrSet::iterator E) { … }
void MCJIT::runStaticConstructorsDestructors(bool isDtors) { … }
Function *MCJIT::FindFunctionNamedInModulePtrSet(StringRef FnName,
ModulePtrSet::iterator I,
ModulePtrSet::iterator E) { … }
GlobalVariable *MCJIT::FindGlobalVariableNamedInModulePtrSet(StringRef Name,
bool AllowInternal,
ModulePtrSet::iterator I,
ModulePtrSet::iterator E) { … }
Function *MCJIT::FindFunctionNamed(StringRef FnName) { … }
GlobalVariable *MCJIT::FindGlobalVariableNamed(StringRef Name, bool AllowInternal) { … }
GenericValue MCJIT::runFunction(Function *F, ArrayRef<GenericValue> ArgValues) { … }
void *MCJIT::getPointerToNamedFunction(StringRef Name, bool AbortOnFailure) { … }
void MCJIT::RegisterJITEventListener(JITEventListener *L) { … }
void MCJIT::UnregisterJITEventListener(JITEventListener *L) { … }
void MCJIT::notifyObjectLoaded(const object::ObjectFile &Obj,
const RuntimeDyld::LoadedObjectInfo &L) { … }
void MCJIT::notifyFreeingObject(const object::ObjectFile &Obj) { … }
JITSymbol
LinkingSymbolResolver::findSymbol(const std::string &Name) { … }
void LinkingSymbolResolver::anchor() { … }