Go to the documentation of this file.
27 #define DEBUG_TYPE "orc"
53 std::vector<Type *> HelperArgTypes;
54 for (
auto *
Arg : HelperPrefixArgs)
55 HelperArgTypes.push_back(
Arg->getType());
56 for (
auto *
T : WrapperFnType->
params())
57 HelperArgTypes.push_back(
T);
65 WrapperFn->setVisibility(WrapperVisibility);
70 std::vector<Value *> HelperArgs;
71 for (
auto *
Arg : HelperPrefixArgs)
72 HelperArgs.push_back(
Arg);
73 for (
auto &
Arg : WrapperFn->args())
74 HelperArgs.push_back(&
Arg);
75 auto *HelperResult = IB.
CreateCall(HelperFn, HelperArgs);
76 if (HelperFn->getReturnType()->isVoidTy())
84 class GenericLLVMIRPlatformSupport;
88 class GenericLLVMIRPlatform :
public Platform {
90 GenericLLVMIRPlatform(GenericLLVMIRPlatformSupport &
S) :
S(
S) {}
101 GenericLLVMIRPlatformSupport &
S;
107 class GlobalCtorDtorScraper {
109 GlobalCtorDtorScraper(GenericLLVMIRPlatformSupport &PS,
112 : PS(PS), InitFunctionPrefix(InitFunctionPrefix),
113 DeInitFunctionPrefix(DeInitFunctionPrefix) {}
118 GenericLLVMIRPlatformSupport &PS;
130 GenericLLVMIRPlatformSupport(
LLJIT &J)
131 : J(J), InitFunctionPrefix(J.
mangle(
"__orc_init_func.")),
132 DeInitFunctionPrefix(J.
mangle(
"__orc_deinit_func.")) {
134 getExecutionSession().setPlatform(
135 std::make_unique<GenericLLVMIRPlatform>(*
this));
137 setInitTransform(J, GlobalCtorDtorScraper(*
this, InitFunctionPrefix,
138 DeInitFunctionPrefix));
142 StdInterposes[J.
mangleAndIntern(
"__lljit.platform_support_instance")] =
167 auto Ctx = std::make_unique<LLVMContext>();
168 auto M = std::make_unique<Module>(
"__standard_lib", *Ctx);
177 DSOHandle->setInitializer(
180 auto *GenericIRPlatformSupportTy =
185 nullptr,
"__lljit.platform_support_instance");
191 {PlatformInstanceDecl, DSOHandle});
207 if ((*KV.first).startswith(InitFunctionPrefix)) {
208 InitSymbols[&JD].add(KV.first,
210 InitFunctions[&JD].add(KV.first);
211 }
else if ((*KV.first).startswith(DeInitFunctionPrefix)) {
212 DeInitFunctions[&JD].add(KV.first);
220 dbgs() <<
"GenericLLVMIRPlatformSupport getting initializers to run\n";
222 if (
auto Initializers = getInitializers(JD)) {
224 {
dbgs() <<
"GenericLLVMIRPlatformSupport running initializers\n"; });
225 for (
auto InitFnAddr : *Initializers) {
227 dbgs() <<
" Running init " <<
formatv(
"{0:x16}", InitFnAddr)
230 auto *InitFn = jitTargetAddressToFunction<void (*)()>(InitFnAddr);
234 return Initializers.takeError();
240 dbgs() <<
"GenericLLVMIRPlatformSupport getting deinitializers to run\n";
242 if (
auto Deinitializers = getDeinitializers(JD)) {
244 dbgs() <<
"GenericLLVMIRPlatformSupport running deinitializers\n";
246 for (
auto DeinitFnAddr : *Deinitializers) {
248 dbgs() <<
" Running deinit " <<
formatv(
"{0:x16}", DeinitFnAddr)
251 auto *DeinitFn = jitTargetAddressToFunction<void (*)()>(DeinitFnAddr);
255 return Deinitializers.takeError();
261 getExecutionSession().runSessionLocked([&]() {
262 InitFunctions[&JD].add(InitName);
267 getExecutionSession().runSessionLocked(
268 [&]() { DeInitFunctions[&JD].add(DeInitName); });
274 if (
auto Err = issueInitLookups(JD))
278 std::vector<JITDylibSP> DFSLinkOrder;
280 if (
auto Err = getExecutionSession().runSessionLocked([&]() ->
Error {
282 DFSLinkOrder =
std::move(*DFSLinkOrderOrErr);
284 return DFSLinkOrderOrErr.takeError();
286 for (
auto &NextJD : DFSLinkOrder) {
287 auto IFItr = InitFunctions.find(NextJD.get());
288 if (IFItr != InitFunctions.end()) {
289 LookupSymbols[NextJD.get()] = std::move(IFItr->second);
290 InitFunctions.erase(IFItr);
298 dbgs() <<
"JITDylib init order is [ ";
302 dbgs() <<
"Looking up init functions:\n";
303 for (
auto &KV : LookupSymbols)
304 dbgs() <<
" \"" << KV.first->getName() <<
"\": " << KV.second <<
"\n";
307 auto &ES = getExecutionSession();
313 std::vector<JITTargetAddress> Initializers;
314 while (!DFSLinkOrder.empty()) {
315 auto &NextJD = *DFSLinkOrder.back();
316 DFSLinkOrder.pop_back();
320 for (
auto &KV : InitsItr->second)
321 Initializers.push_back(KV.second.getAddress());
328 auto &ES = getExecutionSession();
333 std::vector<JITDylibSP> DFSLinkOrder;
335 if (
auto Err = ES.runSessionLocked([&]() ->
Error {
336 if (auto DFSLinkOrderOrErr = JD.getDFSLinkOrder())
337 DFSLinkOrder = std::move(*DFSLinkOrderOrErr);
339 return DFSLinkOrderOrErr.takeError();
341 for (auto &NextJD : DFSLinkOrder) {
342 auto &JDLookupSymbols = LookupSymbols[NextJD.get()];
343 auto DIFItr = DeInitFunctions.find(NextJD.get());
344 if (DIFItr != DeInitFunctions.end()) {
345 LookupSymbols[NextJD.get()] = std::move(DIFItr->second);
346 DeInitFunctions.erase(DIFItr);
348 JDLookupSymbols.add(LLJITRunAtExits,
349 SymbolLookupFlags::WeaklyReferencedSymbol);
356 dbgs() <<
"JITDylib deinit order is [ ";
357 for (
auto &JD : DFSLinkOrder)
360 dbgs() <<
"Looking up deinit functions:\n";
361 for (
auto &KV : LookupSymbols)
362 dbgs() <<
" \"" << KV.first->getName() <<
"\": " << KV.second <<
"\n";
370 std::vector<JITTargetAddress> DeInitializers;
371 for (
auto &NextJD : DFSLinkOrder) {
374 "Every JD should have at least __lljit_run_atexits");
376 auto RunAtExitsItr = DeInitsItr->second.find(LLJITRunAtExits);
377 if (RunAtExitsItr != DeInitsItr->second.end())
378 DeInitializers.push_back(RunAtExitsItr->second.getAddress());
380 for (
auto &KV : DeInitsItr->second)
381 if (KV.first != LLJITRunAtExits)
382 DeInitializers.push_back(KV.second.getAddress());
385 return DeInitializers;
392 std::vector<JITDylibSP> DFSLinkOrder;
394 if (
auto Err = getExecutionSession().runSessionLocked([&]() ->
Error {
396 DFSLinkOrder =
std::move(*DFSLinkOrderOrErr);
398 return DFSLinkOrderOrErr.takeError();
400 for (
auto &NextJD : DFSLinkOrder) {
401 auto ISItr = InitSymbols.find(NextJD.get());
402 if (ISItr != InitSymbols.end()) {
403 RequiredInitSymbols[NextJD.get()] = std::move(ISItr->second);
404 InitSymbols.erase(ISItr);
416 static void registerAtExitHelper(
void *Self,
void (*
F)(
void *),
void *Ctx,
419 dbgs() <<
"Registering atexit function " << (
void *)
F <<
" for JD "
422 static_cast<GenericLLVMIRPlatformSupport *
>(Self)->AtExitMgr.registerAtExit(
426 static void runAtExitsHelper(
void *Self,
void *DSOHandle) {
428 dbgs() <<
"Running atexit functions for JD "
429 << (*
static_cast<JITDylib **
>(DSOHandle))->getName() <<
"\n";
431 static_cast<GenericLLVMIRPlatformSupport *
>(Self)->AtExitMgr.runAtExits(
438 auto Ctx = std::make_unique<LLVMContext>();
439 auto M = std::make_unique<Module>(
"__standard_lib", *Ctx);
440 M->setDataLayout(J.getDataLayout());
442 auto *GenericIRPlatformSupportTy =
447 nullptr,
"__lljit.platform_support_instance");
461 {PlatformInstanceDecl});
467 std::string InitFunctionPrefix;
468 std::string DeInitFunctionPrefix;
476 return S.setupJITDylib(JD);
479 Error GenericLLVMIRPlatform::teardownJITDylib(
JITDylib &JD) {
485 return S.notifyAdding(RT, MU);
492 auto &Ctx =
M.getContext();
493 auto *GlobalCtors =
M.getNamedGlobal(
"llvm.global_ctors");
494 auto *GlobalDtors =
M.getNamedGlobal(
"llvm.global_dtors");
497 bool isCtor) ->
Error {
501 std::string InitOrDeInitFunctionName;
504 << InitFunctionPrefix <<
M.getModuleIdentifier();
507 << DeInitFunctionPrefix <<
M.getModuleIdentifier();
510 auto InternedInitOrDeInitName =
Mangle(InitOrDeInitFunctionName);
511 if (
auto Err =
R.defineMaterializing(
512 {{InternedInitOrDeInitName, JITSymbolFlags::Callable}}))
519 std::vector<std::pair<Function *, unsigned>> InitsOrDeInits;
522 for (
auto E : COrDtors)
523 InitsOrDeInits.push_back(std::make_pair(
E.Func,
E.Priority));
525 [](
const std::pair<Function *, unsigned> &
LHS,
526 const std::pair<Function *, unsigned> &
RHS) {
527 return LHS.second <
RHS.second;
530 auto *InitOrDeInitFuncEntryBlock =
533 for (
auto &KV : InitsOrDeInits)
534 IB.CreateCall(KV.first);
538 PS.registerInitFunc(
R.getTargetJITDylib(), InternedInitOrDeInitName);
540 PS.registerDeInitFunc(
R.getTargetJITDylib(), InternedInitOrDeInitName);
546 if (
auto Err = RegisterCOrDtors(GlobalCtors,
true))
548 if (
auto Err = RegisterCOrDtors(GlobalDtors,
false))
566 InactivePlatformSupport() =
default;
569 LLVM_DEBUG(
dbgs() <<
"InactivePlatformSupport: no initializers running for "
576 dbgs() <<
"InactivePlatformSupport: no deinitializers running for "
600 dbgs() <<
" No explicitly set JITTargetMachineBuilder. "
601 "Detecting host...\n";
606 return JTMBOrErr.takeError();
610 dbgs() <<
" JITTargetMachineBuilder is "
612 <<
" Pre-constructed ExecutionSession: " << (
ES ?
"Yes" :
"No")
618 dbgs() <<
"None (will be created by JITTargetMachineBuilder)\n";
620 dbgs() <<
" Custom object-linking-layer creator: "
621 << (CreateObjectLinkingLayer ?
"Yes" :
"No") <<
"\n"
622 <<
" Custom compile-function creator: "
623 << (CreateCompileFunction ?
"Yes" :
"No") <<
"\n"
624 <<
" Custom platform-setup function: "
625 << (SetUpPlatform ?
"Yes" :
"No") <<
"\n"
626 <<
" Number of compile threads: " << NumCompileThreads;
627 if (!NumCompileThreads)
628 dbgs() <<
" (code will be compiled on the execution thread)\n";
636 dbgs() <<
"ExecutorProcessControl not specified, "
637 "Creating SelfExecutorProcessControl instance\n";
642 return EPCOrErr.takeError();
645 dbgs() <<
"Using explicitly specified ExecutorProcessControl instance "
646 << EPC.get() <<
"\n";
651 if (!CreateObjectLinkingLayer) {
652 auto &
TT = JTMB->getTargetTriple();
658 CreateObjectLinkingLayer =
662 ObjLinkingLayer->addPlugin(std::make_unique<EHFrameRegistrationPlugin>(
663 ES, std::make_unique<jitlink::InProcessEHFrameRegistrar>()));
675 if (
auto Err =
ES->endSession())
680 assert(TSM &&
"Can not add null module");
694 std::unique_ptr<MemoryBuffer> Obj) {
695 assert(Obj &&
"Can not add null object");
706 if (
auto Sym =
ES->lookup(
711 return Sym.takeError();
718 if (
S.CreateObjectLinkingLayer)
719 return S.CreateObjectLinkingLayer(
ES,
S.JTMB->getTargetTriple());
723 auto GetMemMgr = []() {
return std::make_unique<SectionMemoryManager>(); };
725 std::make_unique<RTDyldObjectLinkingLayer>(
ES,
std::move(GetMemMgr));
727 if (
S.JTMB->getTargetTriple().isOSBinFormatCOFF()) {
728 Layer->setOverrideObjectFlagsWithResponsibilityFlags(
true);
729 Layer->setAutoClaimResponsibilityForObjectSymbols(
true);
735 return std::unique_ptr<ObjectLayer>(
std::move(Layer));
743 if (
S.CreateCompileFunction)
744 return S.CreateCompileFunction(
std::move(JTMB));
748 if (
S.NumCompileThreads > 0)
749 return std::make_unique<ConcurrentIRCompiler>(
std::move(JTMB));
753 return TM.takeError();
755 return std::make_unique<TMOwningSimpleCompiler>(
std::move(*
TM));
763 assert(!(
S.EPC &&
S.ES) &&
"EPC and ES should not both be set");
766 ES = std::make_unique<ExecutionSession>(
std::move(
S.EPC));
771 ES = std::make_unique<ExecutionSession>(
std::move(*EPC));
773 Err = EPC.takeError();
778 if (
auto MainOrErr = this->
ES->createJITDylib(
"main"))
781 Err = MainOrErr.takeError();
787 else if (
auto DLOrErr =
S.JTMB->getDefaultDataLayoutForTarget())
790 Err = DLOrErr.takeError();
796 Err = ObjLayer.takeError();
805 if (!CompileFunction) {
806 Err = CompileFunction.takeError();
816 if (
S.NumCompileThreads > 0) {
820 ES->setDispatchTask([
this](std::unique_ptr<Task>
T) {
826 std::unique_ptr<Task> T(UnownedT);
833 Err =
S.SetUpPlatform(*
this);
839 std::string MangledName;
848 if (
M.getDataLayout().isDefault())
851 if (
M.getDataLayout() !=
DL)
852 return make_error<StringError>(
853 "Added modules have incompatible data layouts: " +
854 M.getDataLayout().getStringRepresentation() +
" (module) vs " +
863 {
dbgs() <<
"Setting up GenericLLVMIRPlatform support for LLJIT\n"; });
869 {
dbgs() <<
"Explicitly deactivated platform support for LLJIT\n"; });
877 TT =
JTMB->getTargetTriple();
882 assert(TSM &&
"Can not add null module");
885 [&](
Module &
M) ->
Error { return applyDataLayout(M); }))
888 return CODLayer->add(JD,
std::move(TSM));
904 S.TT, *
ES,
S.LazyCompileFailureAddr.getValue()))
907 Err = LCTMgrOrErr.takeError();
921 Err = make_error<StringError>(
"Could not construct "
922 "IndirectStubsManagerBuilder for target " +
929 CODLayer = std::make_unique<CompileOnDemandLayer>(
932 if (
S.NumCompileThreads > 0)
933 CODLayer->setCloneToNewContextOnEmit(
true);
Represents an address in the executor process.
void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it.
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
static StringRef getName(Value *V)
ThreadPoolStrategy hardware_concurrency(unsigned ThreadCount=0)
Returns a default thread strategy where all available hardware resources are to be used,...
A utility class for building TargetMachines for JITs.
This is an optimization pass for GlobalISel generic memory operations.
Represents a JIT'd dynamic library.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Expected< std::unique_ptr< TargetMachine > > createTargetMachine()
Create a TargetMachine.
JITDylib & getMainJITDylib()
Returns a reference to the JITDylib representing the JIT'd main program.
Optional< JITTargetMachineBuilder > JTMB
iterator_range< CtorDtorIterator > getConstructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
@ HiddenVisibility
The GV is hidden.
Error prepareForConstruction()
A raw_ostream that writes to an std::string.
ResourceTrackerSP getDefaultResourceTracker()
Get the default resource tracker for this JITDylib.
LLJIT(LLJITBuilderState &S, Error &Err)
Create an LLJIT instance with a single compile thread.
const std::string & getName() const
Get the name for this JITLinkDylib.
Pointer to a pooled string representing a symbol name.
static ErrorSuccess success()
Create a success value.
std::unique_ptr< IRTransformLayer > InitHelperTransformLayer
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
const Triple & getTargetTriple() const
Returns a reference to the triple for this instance.
Error addObjectFile(ResourceTrackerSP RT, std::unique_ptr< MemoryBuffer > Obj)
Adds an object file to the given JITDylib.
Triple - Helper class for working with autoconf configuration names.
friend void setUpGenericLLVMIRPlatform(LLJIT &J)
Configure the LLJIT instance to scrape modules for llvm.global_ctors and llvm.global_dtors variables ...
Error addLazyIRModule(JITDylib &JD, ThreadSafeModule M)
Add a module to be lazily compiled to JITDylib JD.
auto reverse(ContainerTy &&C, std::enable_if_t< has_rbegin< ContainerTy >::value > *=nullptr)
API to remove / transfer ownership of JIT resources.
A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
void setPlatformSupport(std::unique_ptr< PlatformSupport > PS)
Set the PlatformSupport instance.
@ DefaultVisibility
The GV is visible.
Tagged union holding either a T or a Error.
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T, ArrayRef< StringLiteral > StandardNames)
Initialize the set of available library functions based on the specified target triple.
const std::string & getStringRepresentation() const
Returns the string representation of the DataLayout.
static StructType * create(LLVMContext &Context, StringRef Name)
This creates an identified struct.
static IntegerType * getInt8Ty(LLVMContext &C)
static Expected< std::unique_ptr< IRCompileLayer::IRCompiler > > createCompileFunction(LLJITBuilderState &S, JITTargetMachineBuilder JTMB)
Flags for symbols in the JIT.
A MaterializationUnit represents a set of symbol definitions that can be materialized as a group,...
Represents a symbol that has been evaluated to an address already.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Expected< ExecutorAddr > lookupLinkerMangled(JITDylib &JD, SymbolStringPtr Name)
Look up a symbol in JITDylib JD by the symbol's linker-mangled name (to look up symbols based on thei...
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
JITDylib & getJITDylib() const
Return the JITDylib targeted by this tracker.
auto formatv(const char *Fmt, Ts &&... Vals) -> formatv_object< decltype(std::make_tuple(detail::build_format_adapter(std::forward< Ts >(Vals))...))>
std::vector< JITTargetAddress > LookupResult
Error addIRModule(ResourceTrackerSP RT, ThreadSafeModule TSM)
Adds an IR module with the given ResourceTracker.
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
VisibilityTypes
An enumeration for the kinds of visibility of global values.
std::string mangle(StringRef UnmangledName) const
Returns a linker-mangled version of UnmangledName.
static Expected< std::vector< JITDylibSP > > getDFSLinkOrder(ArrayRef< JITDylibSP > JDs)
Returns the given JITDylibs and all of their transitive dependencies in DFS order (based on linkage r...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
SymbolStringPtr mangleAndIntern(StringRef UnmangledName) const
Returns an interned, linker-mangled version of UnmangledName.
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, bool CannotUsePrivateLabel) const
Print the appropriate prefix and the specified global variable's name.
bool isOSBinFormatMachO() const
Tests whether the environment is MachO.
Helper for Errors used as out-parameters.
static Constant * get(Type *Ty, uint64_t V, bool IsSigned=false)
If Ty is a vector type, return a Constant with a splat of the given value.
An interface for Itanium __cxa_atexit interposer implementations.
ArrayRef< Type * > params() const
static Expected< JITTargetMachineBuilder > detectHost()
Create a JITTargetMachineBuilder for the host system.
static Expected< std::unique_ptr< ObjectLayer > > createObjectLinkingLayer(LLJITBuilderState &S, ExecutionSession &ES)
ArchType getArch() const
Get the parsed architecture type of this triple.
ReturnInst * CreateRet(Value *V)
Create a 'ret <val>' instruction.
iterator_range< CtorDtorIterator > getDestructors(const Module &M)
Create an iterator range over the entries of the llvm.global_ctors array.
std::unique_ptr< ObjectTransformLayer > ObjTransformLayer
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
const SymbolStringPtr & getInitializerSymbol() const
Returns the initialization symbol for this MaterializationUnit (if any).
std::unique_ptr< ExecutionSession > ES
std::unique_ptr< ThreadPool > CompileThreads
std::function< std::unique_ptr< IndirectStubsManager >)> createLocalIndirectStubsManagerBuilder(const Triple &T)
Create a local indriect stubs manager builder.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
void setUpGenericLLVMIRPlatform(LLJIT &J)
Configure the LLJIT instance to scrape modules for llvm.global_ctors and llvm.global_dtors variables ...
const SymbolFlagsMap & getSymbols() const
Return the set of symbols that this source provides.
std::unique_ptr< IRCompileLayer > CompileLayer
uint8_t IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A Module instance is used to store all the information related to an LLVM module.
decltype(auto) withModuleDo(Func &&F)
Locks the associated ThreadSafeContext and calls the given function on the contained Module.
virtual ~LLJIT()
Destruct this instance.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
if(llvm_vc STREQUAL "") set(fake_version_inc "$
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
Expected< std::unique_ptr< LazyCallThroughManager > > createLocalLazyCallThroughManager(const Triple &T, ExecutionSession &ES, JITTargetAddress ErrorHandlerAddr)
Create a LocalLazyCallThroughManager from the given triple and execution session.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
this could be done in SelectionDAGISel along with other special for
JITTargetAddress pointerToJITTargetAddress(T *Ptr)
Convert a pointer to a JITTargetAddress.
Mangles symbol names then uniques them in the context of an ExecutionSession.
static Expected< std::unique_ptr< SelfExecutorProcessControl > > Create(std::shared_ptr< SymbolStringPool > SSP=nullptr, std::unique_ptr< TaskDispatcher > D=nullptr, std::unique_ptr< jitlink::JITLinkMemoryManager > MemMgr=nullptr)
Create a SelfExecutorProcessControl with the given symbol string pool and memory manager.
Error prepareForConstruction()
Called prior to JIT class construcion to fix up defaults.
std::unique_ptr< IRTransformLayer > TransformLayer
static IntegerType * getInt64Ty(LLVMContext &C)
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
std::error_code inconvertibleErrorCode()
The value returned by this function can be returned from convertToErrorCode for Error values where no...
Lightweight error class with error context and mandatory checking.
An ExecutionSession represents a running JIT program.
void sort(IteratorTy Start, IteratorTy End)
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
@ ExternalLinkage
Externally visible function.
static Type * getVoidTy(LLVMContext &C)
Error define(std::unique_ptr< MaterializationUnitType > &&MU, ResourceTrackerSP RT=nullptr)
Define all symbols provided by the materialization unit to be part of this JITDylib.
ReturnInst * CreateRetVoid()
Create a 'ret void' instruction.
An LLVM Module together with a shared ThreadSafeContext.
const char LLVMTargetMachineRef TM
Error applyDataLayout(Module &M)
Error setUpInactivePlatform(LLJIT &J)
Configure the LLJIT instance to disable platform support explicitly.
Type * getReturnType() const
std::unique_ptr< ObjectLayer > ObjLinkingLayer
JITDylibSearchOrder makeJITDylibSearchOrder(ArrayRef< JITDylib * > JDs, JITDylibLookupFlags Flags=JITDylibLookupFlags::MatchExportedSymbolsOnly)
Convenience function for creating a search order from an ArrayRef of JITDylib*, all with the same fla...
CallInst * CreateCall(FunctionType *FTy, Value *Callee, ArrayRef< Value * > Args=None, const Twine &Name="", MDNode *FPMathTag=nullptr)
ExecutionSession & getExecutionSession()
Returns the ExecutionSession for this instance.
Class to represent function types.
const DataLayout & getDataLayout() const
Returns a reference to the DataLayout for this instance.