Go to the documentation of this file.
67 return LS.IPLS.release();
71 return LS.reset(IPLS);
114 CAPIDefinitionGenerator(
117 : Ctx(Ctx), TryToGenerate(TryToGenerate) {}
139 switch (JDLookupFlags) {
149 std::vector<LLVMOrcCLookupSetElement> CLookupSet;
150 CLookupSet.reserve(LookupSet.
size());
151 for (
auto &KV : LookupSet) {
163 CLookupSet.push_back({
Name, SLF});
167 auto Err =
unwrap(TryToGenerate(::
wrap(
this), Ctx, &
LSR, CLookupKind,
168 ::
wrap(&JD), CJDLookupFlags,
169 CLookupSet.data(), CLookupSet.size()));
189 OrcCAPIMaterializationUnit(
198 Discard(Discard), Destroy(Destroy) {}
200 ~OrcCAPIMaterializationUnit() {
207 void materialize(std::unique_ptr<MaterializationResponsibility> R)
override {
210 Materialize(Tmp,
wrap(
R.release()));
261 for (
size_t I = 0;
I != NumPairs; ++
I) {
272 for (
size_t I = 0;
I != NumPairs; ++
I) {
290 unwrap(ES)->setErrorReporter(
297 unwrap(ES)->getExecutorProcessControl().getSymbolStringPool().
get());
301 unwrap(SSP)->clearDeadEntries();
319 return unwrap(
S)->getKey().data();
324 auto RT =
unwrap(JD)->createResourceTracker();
327 return wrap(RT.get());
332 auto RT =
unwrap(JD)->getDefaultResourceTracker();
334 return wrap(RT.get());
345 TmpRT->transferTo(*
unwrap(DstRT));
350 return wrap(TmpRT->remove());
354 std::unique_ptr<DefinitionGenerator> TmpDG(
unwrap(DG));
358 std::unique_ptr<MaterializationUnit> TmpMU(
unwrap(MU));
368 for (
size_t I = 0;
I != NumSyms; ++
I)
370 toJITSymbolFlags(Syms[
I].Flags);
374 return wrap(
new OrcCAPIMaterializationUnit(
380 SymbolMap SM = toSymbolMap(Syms, NumPairs);
390 for (
size_t I = 0;
I != NumPairs; ++
I) {
391 auto pair = CallableAliases[
I];
406 std::unique_ptr<MaterializationResponsibility> TmpMR(
unwrap(MR));
411 return wrap(&
unwrap(MR)->getTargetJITDylib());
417 return wrap(&
unwrap(MR)->getExecutionSession());
423 auto Symbols =
unwrap(MR)->getSymbols();
427 for (
auto const &pair : Symbols) {
429 auto Flags = pair.second;
430 Result[
I] = {
Name, fromJITSymbolFlags(Flags)};
433 *NumPairs = Symbols.size();
444 auto Sym =
unwrap(MR)->getInitializerSymbol();
452 auto Symbols =
unwrap(MR)->getRequestedSymbols();
457 for (
auto &
Name : Symbols) {
461 *NumSymbols = Symbols.size();
472 SymbolMap SM = toSymbolMap(Symbols, NumPairs);
485 for (
size_t I = 0;
I != NumSyms; ++
I)
487 toJITSymbolFlags(Syms[
I].Flags);
495 std::unique_ptr<MaterializationUnit> TmpMU(
unwrap(MU));
504 for (
size_t I = 0;
I != NumSymbols;
I++) {
507 auto OtherMR =
unwrap(MR)->delegate(Syms);
510 return wrap(OtherMR.takeError());
512 *Result =
wrap(OtherMR->release());
523 unwrap(MR)->addDependencies(Sym, SDM);
531 unwrap(MR)->addDependenciesForAll(SDM);
536 unwrap(MR)->failMaterialization();
542 std::unique_ptr<ThreadSafeModule> TmpTSM(
unwrap(TSM));
544 std::unique_ptr<MaterializationResponsibility>(
unwrap(MR)),
560 return wrap(JD.takeError());
561 *Result =
wrap(&*JD);
573 std::unique_ptr<MaterializationUnit> TmpMU(
unwrap(MU));
575 if (
auto Err =
unwrap(JD)->define(TmpMU)) {
588 unwrap(JD)->addGenerator(std::unique_ptr<DefinitionGenerator>(
unwrap(DG)));
593 auto DG = std::make_unique<CAPIDefinitionGenerator>(Ctx,
F);
594 return wrap(DG.release());
600 assert(Result &&
"Result can not be null");
602 "if Filter is null then FilterCtx must also be null");
610 auto ProcessSymsGenerator =
613 if (!ProcessSymsGenerator) {
615 return wrap(ProcessSymsGenerator.takeError());
618 *Result =
wrap(ProcessSymsGenerator->release());
625 assert(Result &&
"Result can not be null");
626 assert(FileName &&
"FileName can not be null");
628 "if Filter is null then FilterCtx must also be null");
636 auto LibrarySymsGenerator =
639 if (!LibrarySymsGenerator) {
641 return wrap(LibrarySymsGenerator.takeError());
644 *Result =
wrap(LibrarySymsGenerator->release());
650 const char *FileName,
const char *TargetTriple) {
651 assert(Result &&
"Result can not be null");
652 assert(FileName &&
"Filename can not be null");
653 assert(ObjLayer &&
"ObjectLayer can not be null");
656 auto TT =
Triple(TargetTriple);
657 auto LibrarySymsGenerator =
659 if (!LibrarySymsGenerator) {
661 return wrap(LibrarySymsGenerator.takeError());
663 *Result =
wrap(LibrarySymsGenerator->release());
666 auto LibrarySymsGenerator =
668 if (!LibrarySymsGenerator) {
670 return wrap(LibrarySymsGenerator.takeError());
672 *Result =
wrap(LibrarySymsGenerator->release());
711 assert(Result &&
"Result can not be null");
716 return wrap(JTMB.takeError());
728 std::make_unique<JITTargetMachineBuilder>(TemplateTM->getTargetTriple());
731 .setCPU(TemplateTM->getTargetCPU().str())
732 .setRelocationModel(TemplateTM->getRelocationModel())
733 .setCodeModel(TemplateTM->getCodeModel())
734 .setCodeGenOptLevel(TemplateTM->getOptLevel())
735 .setFeatures(TemplateTM->getTargetFeatureString())
736 .setOptions(TemplateTM->Options);
740 return wrap(JTMB.release());
750 auto Tmp =
unwrap(JTMB)->getTargetTriple().str();
751 char *TargetTriple = (
char *)malloc(Tmp.size() + 1);
752 strcpy(TargetTriple, Tmp.c_str());
765 *
unwrap(JD), std::unique_ptr<MemoryBuffer>(
unwrap(ObjBuffer))));
773 std::unique_ptr<MemoryBuffer>(
unwrap(ObjBuffer))));
780 std::unique_ptr<MaterializationResponsibility>(
unwrap(R)),
781 std::unique_ptr<MemoryBuffer>(
unwrap(ObjBuffer)));
798 assert(!TSMRef &&
"TSMRef was not reset to null on error");
809 ->setTransform([TransformFunction, Ctx](std::unique_ptr<MemoryBuffer> Obj)
810 ->
Expected<std::unique_ptr<MemoryBuffer>> {
812 if (
LLVMErrorRef Err = TransformFunction(Ctx, &ObjBuffer)) {
813 assert(!ObjBuffer &&
"ObjBuffer was not reset to null on error");
816 return std::unique_ptr<MemoryBuffer>(
unwrap(ObjBuffer));
821 const char *IdentifierOverride) {
822 assert(DumpDir &&
"DumpDir should not be null");
823 assert(IdentifierOverride &&
"IdentifierOverride should not be null");
833 std::unique_ptr<MemoryBuffer>
OB(
unwrap(*ObjBuffer));
835 *ObjBuffer =
wrap(Result->release());
838 *ObjBuffer =
nullptr;
839 return wrap(Result.takeError());
862 auto TTStr = TT.str();
863 return std::unique_ptr<ObjectLayer>(
870 assert(Result &&
"Result can not be null");
880 return wrap(J.takeError());
883 *Result =
wrap(J->release());
893 return wrap(&
unwrap(J)->getExecutionSession());
901 return unwrap(J)->getTargetTriple().str().c_str();
905 return unwrap(J)->getDataLayout().getGlobalPrefix();
911 unwrap(J)->mangleAndIntern(UnmangledName)));
917 *
unwrap(JD), std::unique_ptr<MemoryBuffer>(
unwrap(ObjBuffer))));
925 std::unique_ptr<MemoryBuffer>(
unwrap(ObjBuffer))));
931 std::unique_ptr<ThreadSafeModule> TmpTSM(
unwrap(TSM));
938 std::unique_ptr<ThreadSafeModule> TmpTSM(
unwrap(TSM));
946 assert(Result &&
"Result can not be null");
951 return wrap(Sym.takeError());
954 *Result = Sym->getValue();
959 return wrap(&
unwrap(J)->getObjLinkingLayer());
964 return wrap(&
unwrap(J)->getObjTransformLayer());
970 assert(ES &&
"ES must not be null");
972 *
unwrap(ES), [] {
return std::make_unique<SectionMemoryManager>(); }));
978 assert(RTDyldObjLinkingLayer &&
"RTDyldObjLinkingLayer must not be null");
979 assert(Listener &&
"Listener must not be null");
981 ->registerJITEventListener(*
unwrap(Listener));
985 return wrap(&
unwrap(J)->getIRTransformLayer());
989 return unwrap(J)->getDataLayout().getStringRepresentation().c_str();
999 std::unique_ptr<IndirectStubsManager> TmpISM(
unwrap(ISM));
1007 *
unwrap(ES), ErrorHandlerAddr);
1010 return wrap(LCTM.takeError());
1011 *Result =
wrap(LCTM->release());
1017 std::unique_ptr<LazyCallThroughManager> TmpLCM(
unwrap(LCM));
@ LLVMJITSymbolGenericFlagsMaterializationSideEffectsOnly
LLVMErrorRef LLVMOrcDisposeLLJIT(LLVMOrcLLJITRef J)
Dispose of an LLJIT instance.
struct LLVMOrcOpaqueLookupState * LLVMOrcLookupStateRef
An opaque lookup state object.
LLVMOrcSymbolStringPoolEntryRef * LLVMOrcMaterializationResponsibilityGetRequestedSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols)
Returns the names of any symbols covered by this MaterializationResponsibility object that have queri...
void LLVMOrcDisposeJITTargetMachineBuilder(LLVMOrcJITTargetMachineBuilderRef JTMB)
Dispose of a JITTargetMachineBuilder.
void LLVMOrcDisposeThreadSafeModule(LLVMOrcThreadSafeModuleRef TSM)
Dispose of a ThreadSafeModule.
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
static StringRef getName(Value *V)
Represents a pair of a JITDylib and LLVMOrcCSymbolsList.
struct LLVMOrcOpaqueObjectLayer * LLVMOrcObjectLayerRef
A reference to an orc::ObjectLayer instance.
A utility class for building TargetMachines for JITs.
This is an optimization pass for GlobalISel generic memory operations.
Represents a JIT'd dynamic library.
void LLVMOrcMaterializationResponsibilityAddDependenciesForAll(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCDependenceMapPairs Dependencies, size_t NumPairs)
Adds dependencies to all symbols that the MaterializationResponsibility is responsible for.
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
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
LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForPath(LLVMOrcDefinitionGeneratorRef *Result, const char *FileName, char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx)
Get a LLVMOrcCreateDynamicLibararySearchGeneratorForPath that will reflect library symbols into the J...
static void retainPoolEntry(PoolEntryPtr P)
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
LLVMOrcSymbolStringPoolEntryRef * Symbols
int(* LLVMOrcSymbolPredicate)(void *Ctx, LLVMOrcSymbolStringPoolEntryRef Sym)
Predicate function for SymbolStringPoolEntries.
struct LLVMOrcOpaqueIRTransformLayer * LLVMOrcIRTransformLayerRef
A reference to an orc::IRTransformLayer instance.
LLVMOrcExecutionSessionRef LLVMOrcLLJITGetExecutionSession(LLVMOrcLLJITRef J)
Get a reference to the ExecutionSession for this LLJIT instance.
Constructs LLJIT instances.
LLVMErrorRef LLVMOrcJITDylibClear(LLVMOrcJITDylibRef JD)
Calls remove on all trackers associated with this JITDylib, see JITDylib::clear().
struct LLVMOrcOpaqueSymbolStringPool * LLVMOrcSymbolStringPoolRef
A reference to an orc::SymbolStringPool.
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
struct LLVMOrcOpaqueIndirectStubsManager * LLVMOrcIndirectStubsManagerRef
A reference to an orc::IndirectStubsManager instance.
LLVMErrorRef LLVMOrcJITTargetMachineBuilderDetectHost(LLVMOrcJITTargetMachineBuilderRef *Result)
Create a JITTargetMachineBuilder by detecting the host.
Base class for managing collections of named indirect stubs.
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Pointer to a pooled string representing a symbol name.
static void releasePoolEntry(PoolEntryPtr P)
Triple - Helper class for working with autoconf configuration names.
Manages a set of 'lazy call-through' trampolines.
static PoolEntryPtr moveFromSymbolStringPtr(SymbolStringPtr S)
LLVMErrorRef(* LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction)(LLVMOrcDefinitionGeneratorRef GeneratorObj, void *Ctx, LLVMOrcLookupStateRef *LookupState, LLVMOrcLookupKind Kind, LLVMOrcJITDylibRef JD, LLVMOrcJITDylibLookupFlags JDLookupFlags, LLVMOrcCLookupSet LookupSet, size_t LookupSetSize)
A custom generator function.
void LLVMOrcObjectTransformLayerSetTransform(LLVMOrcObjectTransformLayerRef ObjTransformLayer, LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx)
Set the transform function on an LLVMOrcObjectTransformLayer.
void LLVMOrcDisposeLazyCallThroughManager(LLVMOrcLazyCallThroughManagerRef LCM)
Dispose of an LazyCallThroughManager.
LLVMErrorRef LLVMOrcThreadSafeModuleWithModuleDo(LLVMOrcThreadSafeModuleRef TSM, LLVMOrcGenericIRModuleOperationFunction F, void *Ctx)
Apply the given function to the module contained in this ThreadSafeModule.
API to remove / transfer ownership of JIT resources.
A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
LLVMOrcLookupKind
Lookup kind.
void(* LLVMOrcMaterializationUnitDiscardFunction)(void *Ctx, LLVMOrcJITDylibRef JD, LLVMOrcSymbolStringPoolEntryRef Symbol)
A MaterializationUnit discard callback.
std::unique_ptr< LazyReexportsMaterializationUnit > lazyReexports(LazyCallThroughManager &LCTManager, IndirectStubsManager &ISManager, JITDylib &SourceJD, SymbolAliasMap CallableAliases, ImplSymbolMap *SrcJDLoc=nullptr)
Define lazy-reexports based on the given SymbolAliasMap.
Tagged union holding either a T or a Error.
struct LLVMOrcOpaqueMaterializationResponsibility * LLVMOrcMaterializationResponsibilityRef
A reference to a uniquely owned orc::MaterializationResponsibility instance.
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModuleWithRT(LLVMOrcLLJITRef J, LLVMOrcResourceTrackerRef RT, LLVMOrcThreadSafeModuleRef TSM)
Add an IR module to the given ResourceTracker's JITDylib in the given LLJIT instance.
LLVMOrcSymbolStringPoolRef LLVMOrcExecutionSessionGetSymbolStringPool(LLVMOrcExecutionSessionRef ES)
Return a reference to the SymbolStringPool for an ExecutionSession.
LookupKind
Describes the kind of lookup being performed.
std::pair< iterator, bool > insert(const ValueT &V)
LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyEmitted(LLVMOrcMaterializationResponsibilityRef MR)
Notifies the target JITDylib (and any pending queries on that JITDylib) that all symbols covered by t...
Flags for symbols in the JIT.
@ LLVMOrcJITDylibLookupFlagsMatchAllSymbols
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.
void LLVMOrcIRTransformLayerEmit(LLVMOrcIRTransformLayerRef IRLayer, LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcThreadSafeModuleRef TSM)
Represents a pair of a symbol name and LLVMJITSymbolFlags.
LLVMOrcMaterializationUnitRef LLVMOrcLazyReexports(LLVMOrcLazyCallThroughManagerRef LCTM, LLVMOrcIndirectStubsManagerRef ISM, LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases, size_t NumPairs)
Create a MaterializationUnit to define lazy re-expots.
static void clear(coro::Shape &Shape)
LLVMOrcResourceTrackerRef LLVMOrcJITDylibGetDefaultResourceTracker(LLVMOrcJITDylibRef JD)
Return a reference to the default resource tracker for the given JITDylib.
LLVMOrcJITDylibLookupFlags
JITDylib lookup flags.
void LLVMOrcDisposeCSymbolFlagsMap(LLVMOrcCSymbolFlagsMapPairs Pairs)
Disposes of the passed LLVMOrcCSymbolFlagsMap.
LLVMOrcMaterializationUnitRef LLVMOrcCreateCustomMaterializationUnit(const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym, LLVMOrcMaterializationUnitMaterializeFunction Materialize, LLVMOrcMaterializationUnitDiscardFunction Discard, LLVMOrcMaterializationUnitDestroyFunction Destroy)
Create a custom MaterializationUnit.
struct LLVMOrcOpaqueSymbolStringPoolEntry * LLVMOrcSymbolStringPoolEntryRef
A reference to an orc::SymbolStringPool table entry.
void LLVMOrcIRTransformLayerSetTransform(LLVMOrcIRTransformLayerRef IRTransformLayer, LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx)
Set the transform function of the provided transform layer, passing through a pointer to user provide...
TargetFlagsType & getTargetFlags()
Return a reference to the target-specific flags.
LLVMErrorRef LLVMOrcDumpObjects_CallOperator(LLVMOrcDumpObjectsRef DumpObjects, LLVMMemoryBufferRef *ObjBuffer)
Dump the contents of the given MemoryBuffer.
@ LLVMOrcLookupKindStatic
@ MaterializationSideEffectsOnly
String pool for symbol names used by the JIT.
struct LLVMOrcOpaqueMaterializationUnit * LLVMOrcMaterializationUnitRef
A reference to a uniquely owned orc::MaterializationUnit instance.
LLVMOrcJITDylibRef LLVMOrcExecutionSessionCreateBareJITDylib(LLVMOrcExecutionSessionRef ES, const char *Name)
Create a "bare" JITDylib.
struct LLVMOrcOpaqueThreadSafeModule * LLVMOrcThreadSafeModuleRef
A reference to an orc::ThreadSafeModule instance.
void replace(Container &Cont, typename Container::iterator ContIt, typename Container::iterator ContEnd, RandomAccessIterator ValIt, RandomAccessIterator ValEnd)
Given a sequence container Cont, replace the range [ContIt, ContEnd) with the range [ValIt,...
@ LLVMJITSymbolGenericFlagsCallable
struct LLVMOrcOpaqueLazyCallThroughManager * LLVMOrcLazyCallThroughManagerRef
A reference to an orc::LazyCallThroughManager instance.
LLVMErrorRef LLVMOrcLLJITLookup(LLVMOrcLLJITRef J, LLVMOrcJITTargetAddress *Result, const char *Name)
Look up the given symbol in the main JITDylib of the given LLJIT instance.
Attribute unwrap(LLVMAttributeRef Attr)
Interface for Layers that accept object files.
LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(LLVMOrcExecutionSessionRef ES)
Create a RTDyldObjectLinkingLayer instance using the standard SectionMemoryManager for memory managem...
void LLVMOrcDisposeDumpObjects(LLVMOrcDumpObjectsRef DumpObjects)
Dispose of a DumpObjects instance.
@ LLVMJITSymbolGenericFlagsExported
LLVMContextRef LLVMOrcThreadSafeContextGetContext(LLVMOrcThreadSafeContextRef TSCtx)
Get a reference to the wrapped LLVMContext.
struct LLVMOrcOpaqueObjectTransformLayer * LLVMOrcObjectTransformLayerRef
A reference to an orc::ObjectTransformLayer instance.
void LLVMOrcMaterializationResponsibilityAddDependencies(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcSymbolStringPoolEntryRef Name, LLVMOrcCDependenceMapPairs Dependencies, size_t NumPairs)
Adds dependencies to a symbol that the MaterializationResponsibility is responsible for.
void(* LLVMOrcMaterializationUnitMaterializeFunction)(void *Ctx, LLVMOrcMaterializationResponsibilityRef MR)
A MaterializationUnit materialize callback.
static Expected< JITTargetMachineBuilder > detectHost()
Create a JITTargetMachineBuilder for the host system.
LLVMOrcCSymbolFlagsMapPairs LLVMOrcMaterializationResponsibilityGetSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs)
Returns the symbol flags map for this responsibility instance.
LLVMOrcSymbolStringPoolEntryRef LLVMOrcLLJITMangleAndIntern(LLVMOrcLLJITRef J, const char *UnmangledName)
Mangles the given string according to the LLJIT instance's DataLayout, then interns the result in the...
LLVMOrcObjectLayerRef(* LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction)(void *Ctx, LLVMOrcExecutionSessionRef ES, const char *Triple)
A function for constructing an ObjectLinkingLayer instance to be used by an LLJIT instance.
LLVMOrcJITDylibRef LLVMOrcMaterializationResponsibilityGetTargetDylib(LLVMOrcMaterializationResponsibilityRef MR)
Returns the target JITDylib that these symbols are being materialized into.
static InProgressLookupState * extractLookupState(LookupState &LS)
char * LLVMOrcJITTargetMachineBuilderGetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB)
Returns the target triple for the given JITTargetMachineBuilder as a string.
UnderlyingVector::size_type size() const
void(* LLVMOrcErrorReporterFunction)(void *Ctx, LLVMErrorRef Err)
Error reporter function.
void LLVMOrcObjectLayerEmit(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcMaterializationResponsibilityRef R, LLVMMemoryBufferRef ObjBuffer)
Emit an object buffer to an ObjectLayer.
LLVMOrcJITTargetMachineBuilderRef LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(LLVMTargetMachineRef TM)
Create a JITTargetMachineBuilder from the given TargetMachine template.
LLVMOrcObjectTransformLayerRef LLVMOrcLLJITGetObjTransformLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's object linking layer.
struct LLVMOrcOpaqueJITDylib * LLVMOrcJITDylibRef
A reference to an orc::JITDylib instance.
void LLVMOrcDisposeIndirectStubsManager(LLVMOrcIndirectStubsManagerRef ISM)
Dispose of an IndirectStubsManager.
struct LLVMOrcOpaqueResourceTracker * LLVMOrcResourceTrackerRef
A reference to an orc::ResourceTracker instance.
@ LLVMJITSymbolGenericFlagsWeak
LLVMOrcThreadSafeModuleRef LLVMOrcCreateNewThreadSafeModule(LLVMModuleRef M, LLVMOrcThreadSafeContextRef TSCtx)
Create a ThreadSafeModule wrapper around the given LLVM module.
LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(LLVMOrcDefinitionGeneratorRef *Result, char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx)
Get a DynamicLibrarySearchGenerator that will reflect process symbols into the JITDylib.
struct LLVMOrcOpaqueExecutionSession * LLVMOrcExecutionSessionRef
A reference to an orc::ExecutionSession instance.
std::function< std::unique_ptr< IndirectStubsManager >)> createLocalIndirectStubsManagerBuilder(const Triple &T)
Create a local indriect stubs manager builder.
void LLVMOrcReleaseSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)
Reduces the ref-count for of a SymbolStringPool entry.
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
LLVMOrcLLJITBuilderRef LLVMOrcCreateLLJITBuilder(void)
Create an LLVMOrcLLJITBuilder.
LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyResolved(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolMapPairs Symbols, size_t NumPairs)
@ LLVMOrcSymbolLookupFlagsRequiredSymbol
const char * LLVMOrcLLJITGetDataLayoutStr(LLVMOrcLLJITRef J)
Get the LLJIT instance's default data layout string.
LLVMErrorRef LLVMOrcMaterializationResponsibilityDelegate(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols, LLVMOrcMaterializationResponsibilityRef *Result)
Delegates responsibility for the given symbols to the returned materialization responsibility.
LLVMErrorRef LLVMOrcMaterializationResponsibilityReplace(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcMaterializationUnitRef MU)
Transfers responsibility to the given MaterializationUnit for all symbols defined by that Materializa...
struct LLVMOrcOpaqueLLJIT * LLVMOrcLLJITRef
A reference to an orc::LLJIT instance.
uint8_t IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP
LLVMErrorRef LLVMOrcExecutionSessionCreateJITDylib(LLVMOrcExecutionSessionRef ES, LLVMOrcJITDylibRef *Result, const char *Name)
Create a JITDylib.
void LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(LLVMOrcObjectLayerRef RTDyldObjLinkingLayer, LLVMJITEventListenerRef Listener)
Add the given listener to the given RTDyldObjectLinkingLayer.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Primary interface to the complete machine description for the target machine.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
LLVMOrcSymbolLookupFlags
Symbol lookup flags for lookup sets.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
LLVMOrcDumpObjectsRef LLVMOrcCreateDumpObjects(const char *DumpDir, const char *IdentifierOverride)
Create a DumpObjects instance.
LLVMOrcSymbolStringPoolEntryRef LLVMOrcExecutionSessionIntern(LLVMOrcExecutionSessionRef ES, const char *Name)
Intern a string in the ExecutionSession's SymbolStringPool and return a reference to it.
static void resetLookupState(LookupState &LS, InProgressLookupState *IPLS)
An LLVMContext together with an associated mutex that can be used to lock the context to prevent conc...
LLVMErrorRef LLVMOrcJITDylibDefine(LLVMOrcJITDylibRef JD, LLVMOrcMaterializationUnitRef MU)
Add the given MaterializationUnit to the given JITDylib.
void LLVMOrcSymbolStringPoolClearDeadEntries(LLVMOrcSymbolStringPoolRef SSP)
Clear all unreferenced symbol string pool entries.
LLVMErrorRef LLVMOrcObjectLayerAddObjectFile(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcJITDylibRef JD, LLVMMemoryBufferRef ObjBuffer)
Add an object to an ObjectLayer to the given JITDylib.
void LLVMOrcDisposeObjectLayer(LLVMOrcObjectLayerRef ObjLayer)
Dispose of an ObjectLayer.
LLVMOrcMaterializationUnitRef LLVMOrcAbsoluteSymbols(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs)
Create a MaterializationUnit to define the given symbols as pointing to the corresponding raw address...
void LLVMOrcExecutionSessionSetErrorReporter(LLVMOrcExecutionSessionRef ES, LLVMOrcErrorReporterFunction ReportError, void *Ctx)
Attach a custom error reporter function to the ExecutionSession.
A function object that can be used as an ObjectTransformLayer transform to dump object files to disk ...
Definition generators can be attached to JITDylibs to generate new definitions for otherwise unresolv...
void LLVMOrcDisposeMaterializationUnit(LLVMOrcMaterializationUnitRef MU)
Dispose of a MaterializationUnit.
A Module instance is used to store all the information related to an LLVM module.
Represents a pair of a symbol name and SymbolAliasMapEntry.
LLVMOrcDefinitionGeneratorRef LLVMOrcCreateCustomCAPIDefinitionGenerator(LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction F, void *Ctx)
Create a custom generator.
struct LLVMOrcOpaqueLLJITBuilder * LLVMOrcLLJITBuilderRef
A reference to an orc::LLJITBuilder instance.
LLVMAttributeRef wrap(Attribute Attr)
void LLVMDisposeTargetMachine(LLVMTargetMachineRef T)
Dispose the LLVMTargetMachineRef instance generated by LLVMCreateTargetMachine.
LLVMErrorRef LLVMOrcCreateLLJIT(LLVMOrcLLJITRef *Result, LLVMOrcLLJITBuilderRef Builder)
Create an LLJIT instance from an LLJITBuilder.
StringRef - Represent a constant reference to a string, i.e.
static SymbolStringPtr moveToSymbolStringPtr(PoolEntryPtr P)
LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContext(void)
Create a ThreadSafeContext containing a new LLVMContext.
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
Represents the linkage flags for a symbol definition.
Wraps state for a lookup-in-progress.
void LLVMOrcJITDylibAddGenerator(LLVMOrcJITDylibRef JD, LLVMOrcDefinitionGeneratorRef DG)
Add a DefinitionGenerator to the given JITDylib.
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Load(ObjectLayer &L, const char *FileName, GetObjectFileInterface GetObjFileInterface=GetObjectFileInterface())
Try to create a StaticLibraryDefinitionGenerator from the given path.
void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx)
Dispose of a ThreadSafeContext.
const char * LLVMOrcLLJITGetTripleString(LLVMOrcLLJITRef J)
Return the target triple for this LLJIT instance.
LLVMErrorRef(* LLVMOrcObjectTransformLayerTransformFunction)(void *Ctx, LLVMMemoryBufferRef *ObjInOut)
A function for applying transformations to an object file buffer.
void LLVMOrcDisposeLLJITBuilder(LLVMOrcLLJITBuilderRef Builder)
Dispose of an LLVMOrcLLJITBuilderRef.
void(* LLVMOrcMaterializationUnitDestroyFunction)(void *Ctx)
A MaterializationUnit destruction callback.
LLVMErrorRef LLVMOrcMaterializationResponsibilityDefineMaterializing(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms)
Attempt to claim responsibility for new definitions.
static Expected< std::unique_ptr< DynamicLibrarySearchGenerator > > GetForCurrentProcess(char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate())
Creates a DynamicLibrarySearchGenerator that searches for symbols in the current process.
static SymbolStringPtr copyToSymbolStringPtr(PoolEntryPtr P)
void LLVMOrcReleaseResourceTracker(LLVMOrcResourceTrackerRef RT)
Reduces the ref-count of a ResourceTracker.
LLVMOrcCSymbolsList Names
Should compile to something r4 addze r3 instead we get
struct LLVMOrcOpaqueDumpObjects * LLVMOrcDumpObjectsRef
A reference to an orc::DumpObjects object.
LLVMErrorRef(* LLVMOrcGenericIRModuleOperationFunction)(void *Ctx, LLVMModuleRef M)
A function for inspecting/mutating IR modules, suitable for use with LLVMOrcThreadSafeModuleWithModul...
Lightweight error class with error context and mandatory checking.
An ExecutionSession represents a running JIT program.
@ MatchExportedSymbolsOnly
void LLVMOrcDisposeMaterializationResponsibility(LLVMOrcMaterializationResponsibilityRef MR)
Disposes of the passed MaterializationResponsibility object.
LLVMOrcIRTransformLayerRef LLVMOrcLLJITGetIRTransformLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's IR transform layer.
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(OrcV2CAPIHelper::PoolEntry, LLVMOrcSymbolStringPoolEntryRef) DEFINE_SIMPLE_CONVERSION_FUNCTIONS(MaterializationUnit
void LLVMOrcLLJITBuilderSetJITTargetMachineBuilder(LLVMOrcLLJITBuilderRef Builder, LLVMOrcJITTargetMachineBuilderRef JTMB)
Set the JITTargetMachineBuilder to be used when constructing the LLJIT instance.
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
const char * LLVMOrcSymbolStringPoolEntryStr(LLVMOrcSymbolStringPoolEntryRef S)
struct LLVMOrcOpaqueDefinitionGenerator * LLVMOrcDefinitionGeneratorRef
A reference to an orc::DefinitionGenerator.
void LLVMOrcResourceTrackerTransferTo(LLVMOrcResourceTrackerRef SrcRT, LLVMOrcResourceTrackerRef DstRT)
Transfers tracking of all resources associated with resource tracker SrcRT to resource tracker DstRT.
LLVMOrcResourceTrackerRef LLVMOrcJITDylibCreateResourceTracker(LLVMOrcJITDylibRef JD)
Return a reference to a newly created resource tracker associated with JD.
LLVMOrcExecutionSessionRef LLVMOrcMaterializationResponsibilityGetExecutionSession(LLVMOrcMaterializationResponsibilityRef MR)
Returns the ExecutionSession for this MaterializationResponsibility.
@ LLVMOrcSymbolLookupFlagsWeaklyReferencedSymbol
void LLVMOrcJITTargetMachineBuilderSetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple)
Sets the target triple for the given JITTargetMachineBuilder to the given string.
static PoolEntryPtr getRawPoolEntryPtr(const SymbolStringPtr &S)
void LLVMOrcDisposeDefinitionGenerator(LLVMOrcDefinitionGeneratorRef DG)
Dispose of a JITDylib::DefinitionGenerator.
LLVMOrcIndirectStubsManagerRef LLVMOrcCreateLocalIndirectStubsManager(const char *TargetTriple)
Create a LocalIndirectStubsManager from the given target triple.
std::function< bool(const SymbolStringPtr &)> SymbolPredicate
LLVMErrorRef LLVMOrcLLJITAddObjectFile(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, LLVMMemoryBufferRef ObjBuffer)
Add a buffer representing an object file to the given JITDylib in the given LLJIT instance.
struct LLVMOpaqueError * LLVMErrorRef
Opaque reference to an error instance.
static Expected< std::unique_ptr< DynamicLibrarySearchGenerator > > Load(const char *FileName, char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate())
Permanently loads the library at the given path and, on success, returns a DynamicLibrarySearchGenera...
struct LLVMOrcOpaqueJITTargetMachineBuilder * LLVMOrcJITTargetMachineBuilderRef
A reference to an orc::JITTargetMachineBuilder instance.
@ LLVMOrcJITDylibLookupFlagsMatchExportedSymbolsOnly
LLVMErrorRef LLVMOrcCreateStaticLibrarySearchGeneratorForPath(LLVMOrcDefinitionGeneratorRef *Result, LLVMOrcObjectLayerRef ObjLayer, const char *FileName, const char *TargetTriple)
Get a LLVMOrcCreateStaticLibrarySearchGeneratorForPath that will reflect static library symbols into ...
LLVMErrorRef(* LLVMOrcIRTransformLayerTransformFunction)(void *Ctx, LLVMOrcThreadSafeModuleRef *ModInOut, LLVMOrcMaterializationResponsibilityRef MR)
A function for applying transformations as part of an transform layer.
LLVMOrcJITDylibRef LLVMOrcExecutionSessionGetJITDylibByName(LLVMOrcExecutionSessionRef ES, const char *Name)
Returns the JITDylib with the given name, or NULL if no such JITDylib exists.
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
An LLVM Module together with a shared ThreadSafeContext.
const char LLVMTargetMachineRef TM
void LLVMOrcMaterializationResponsibilityFailMaterialization(LLVMOrcMaterializationResponsibilityRef MR)
Notify all not-yet-emitted covered by this MaterializationResponsibility instance that an error has o...
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModule(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, LLVMOrcThreadSafeModuleRef TSM)
Add an IR module to the given JITDylib in the given LLJIT instance.
void LLVMOrcRetainSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)
Increments the ref-count for a SymbolStringPool entry.
void LLVMOrcDisposeSymbols(LLVMOrcSymbolStringPoolEntryRef *Symbols)
Disposes of the passed LLVMOrcSymbolStringPoolEntryRef* .
void LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator(LLVMOrcLLJITBuilderRef Builder, LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction F, void *Ctx)
Set an ObjectLinkingLayer creator function for this LLJIT instance.
LLVMErrorRef LLVMOrcResourceTrackerRemove(LLVMOrcResourceTrackerRef RT)
Remove all resources associated with the given tracker.
Represents a pair of a symbol name and an evaluated symbol.
struct LLVMOrcOpaqueThreadSafeContext * LLVMOrcThreadSafeContextRef
A reference to an orc::ThreadSafeContext instance.
LLVMOrcSymbolStringPoolEntryRef LLVMOrcMaterializationResponsibilityGetInitializerSymbol(LLVMOrcMaterializationResponsibilityRef MR)
Returns the initialization pseudo-symbol, if any.
Interface for layers that accept LLVM IR.
struct LLVMOpaqueJITEventListener * LLVMJITEventListenerRef
LLVMErrorRef LLVMOrcLLJITAddObjectFileWithRT(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcResourceTrackerRef RT, LLVMMemoryBufferRef ObjBuffer)
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
struct LLVMOpaqueTargetMachine * LLVMTargetMachineRef
LLVMOrcObjectLayerRef LLVMOrcLLJITGetObjLinkingLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's object linking layer.
LLVMOrcJITDylibRef LLVMOrcLLJITGetMainJITDylib(LLVMOrcLLJITRef J)
Return a reference to the Main JITDylib.
char LLVMOrcLLJITGetGlobalPrefix(LLVMOrcLLJITRef J)
Returns the global prefix character according to the LLJIT's DataLayout.
uint64_t LLVMOrcJITTargetAddress
Represents an address in the executor process.
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
LLVMErrorRef LLVMOrcCreateLocalLazyCallThroughManager(const char *TargetTriple, LLVMOrcExecutionSessionRef ES, LLVMOrcJITTargetAddress ErrorHandlerAddr, LLVMOrcLazyCallThroughManagerRef *Result)