18#include "llvm/ExecutionEngine/ExecutionEngine.h"
19#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
20#include "llvm/ExecutionEngine/Orc/Debugging/DebuggerSupport.h"
21#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
22#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
23#include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h"
24#include "llvm/ExecutionEngine/Orc/LLJIT.h"
25#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
26#include "llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h"
27#include "llvm/ExecutionEngine/SectionMemoryManager.h"
28#include "llvm/IR/Module.h"
29#include "llvm/Support/ManagedStatic.h"
30#include "llvm/Support/TargetSelect.h"
34 llvm::errs() << (
void *)&llvm_orc_registerJITLoaderGDBWrapper
35 << (
void *)&llvm_orc_registerJITLoaderGDBAllocAction;
44 llvm::orc::JITTargetMachineBuilder JTMB) {
45 auto JITBuilder = std::make_unique<llvm::orc::LLJITBuilder>();
46 JITBuilder->setJITTargetMachineBuilder(std::move(JTMB));
47 JITBuilder->setPrePlatformSetup([](llvm::orc::LLJIT &J) {
50 consumeError(llvm::orc::enableDebuggerSupport(J));
51 return llvm::Error::success();
53 return std::move(JITBuilder);
57 llvm::orc::LLJITBuilder &JITBuilder,
61 llvm::ErrorAsOutParameter EAO(&Err);
63 if (
auto JitOrErr = JITBuilder.create())
64 Jit = std::move(*JitOrErr);
66 Err = JitOrErr.takeError();
74 llvm::orc::ResourceTrackerSP RT =
75 Jit->getMainJITDylib().createResourceTracker();
76 ResourceTrackers[&PTU] = RT;
78 return Jit->addIRModule(RT, {std::move(PTU.
TheModule), TSCtx});
83 llvm::orc::ResourceTrackerSP RT = std::move(ResourceTrackers[&PTU]);
85 return llvm::Error::success();
87 ResourceTrackers.erase(&PTU);
88 if (llvm::Error Err = RT->remove())
90 return llvm::Error::success();
96 return Jit->deinitialize(Jit->getMainJITDylib());
100 return Jit->initialize(Jit->getMainJITDylib());
107 auto SO = makeJITDylibSearchOrder({&Jit->getMainJITDylib(),
108 Jit->getPlatformJITDylib().get(),
109 Jit->getProcessSymbolsJITDylib().get()});
111 ExecutionSession &ES = Jit->getExecutionSession();
114 ES.lookup(SO, (NameKind ==
LinkerName) ? ES.intern(Name)
115 : Jit->mangleAndIntern(Name));
116 if (
auto Err = SymOrErr.takeError())
117 return std::move(Err);
118 return SymOrErr->getAddress();
LLVM_ATTRIBUTE_USED void linkComponents()
Defines the clang::TargetOptions class.
virtual llvm::Error runCtors() const
virtual llvm::Error addModule(PartialTranslationUnit &PTU)
virtual ~IncrementalExecutor()
llvm::Expected< llvm::orc::ExecutorAddr > getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const
static llvm::Expected< std::unique_ptr< llvm::orc::LLJITBuilder > > createDefaultJITBuilder(llvm::orc::JITTargetMachineBuilder JTMB)
virtual llvm::Error removeModule(PartialTranslationUnit &PTU)
IncrementalExecutor(llvm::orc::ThreadSafeContext &TSC)
Defines the clang::TargetInfo interface.
The JSON file list parser is used to communicate input to InstallAPI.
The class keeps track of various objects created as part of processing incremental inputs.
std::unique_ptr< llvm::Module > TheModule
The llvm IR produced for the input.