LLVM 24.0.0git
OrcV2CBindings.cpp
Go to the documentation of this file.
1//===--------------- OrcV2CBindings.cpp - C bindings OrcV2 APIs -----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "llvm-c/LLJIT.h"
10#include "llvm-c/Orc.h"
11#include "llvm-c/OrcEE.h"
13
23
24using namespace llvm;
25using namespace llvm::orc;
26
27namespace llvm {
28namespace orc {
29
31
33public:
35 return LS.IPLS.release();
36 }
37
39 return LS.reset(IPLS);
40 }
41};
42
43} // namespace orc
44} // namespace llvm
45
49
53
82
83namespace {
84
86public:
88 std::string Name, SymbolFlagsMap InitialSymbolFlags,
89 SymbolStringPtr InitSymbol, void *Ctx,
94 Interface(std::move(InitialSymbolFlags), std::move(InitSymbol))),
95 Name(std::move(Name)), Ctx(Ctx), Materialize(Materialize),
96 Discard(Discard), Destroy(Destroy) {}
97
99 if (Ctx)
100 Destroy(Ctx);
101 }
102
103 StringRef getName() const override { return Name; }
104
105 void materialize(std::unique_ptr<MaterializationResponsibility> R) override {
106 void *Tmp = Ctx;
107 Ctx = nullptr;
108 Materialize(Tmp, wrap(R.release()));
109 }
110
111private:
112 void discard(const JITDylib &JD, const SymbolStringPtr &Name) override {
113 Discard(Ctx, wrap(&JD), wrap(SymbolStringPoolEntryUnsafe::from(Name)));
114 }
115
116 std::string Name;
117 void *Ctx = nullptr;
121};
122
124
125 JITSymbolFlags JSF;
126
127 if (F.GenericFlags & LLVMJITSymbolGenericFlagsExported)
129 if (F.GenericFlags & LLVMJITSymbolGenericFlagsWeak)
131 if (F.GenericFlags & LLVMJITSymbolGenericFlagsCallable)
135
136 JSF.getTargetFlags() = F.TargetFlags;
137
138 return JSF;
139}
140
142 LLVMJITSymbolFlags F = {0, 0};
143 if (JSF & JITSymbolFlags::Exported)
144 F.GenericFlags |= LLVMJITSymbolGenericFlagsExported;
145 if (JSF & JITSymbolFlags::Weak)
146 F.GenericFlags |= LLVMJITSymbolGenericFlagsWeak;
147 if (JSF & JITSymbolFlags::Callable)
148 F.GenericFlags |= LLVMJITSymbolGenericFlagsCallable;
151
152 F.TargetFlags = JSF.getTargetFlags();
153
154 return F;
155}
156
159 Result.reserve(Symbols.Length);
160 for (size_t I = 0; I != Symbols.Length; ++I)
161 Result.insert(unwrap(Symbols.Symbols[I]).moveToSymbolStringPtr());
162 return Result;
163}
164
165static SymbolMap toSymbolMap(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs) {
166 SymbolMap SM;
167 for (size_t I = 0; I != NumPairs; ++I) {
168 JITSymbolFlags Flags = toJITSymbolFlags(Syms[I].Sym.Flags);
169 SM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] = {
170 ExecutorAddr(Syms[I].Sym.Address), Flags};
171 }
172 return SM;
173}
174
178 for (size_t I = 0; I != NumPairs; ++I) {
179 JITDylib *JD = unwrap(Pairs[I].JD);
180 SymbolNameSet Names;
181
182 for (size_t J = 0; J != Pairs[I].Names.Length; ++J) {
183 auto Sym = Pairs[I].Names.Symbols[J];
184 Names.insert(unwrap(Sym).moveToSymbolStringPtr());
185 }
186 SDM[JD] = Names;
187 }
188 return SDM;
189}
190
192 switch (K) {
194 return LookupKind::Static;
196 return LookupKind::DLSym;
197 }
198 llvm_unreachable("unrecognized LLVMOrcLookupKind value");
199}
200
202 switch (K) {
207 }
208 llvm_unreachable("unrecognized LookupKind value");
209}
210
212toJITDylibLookupFlags(LLVMOrcJITDylibLookupFlags LF) {
213 switch (LF) {
218 }
219 llvm_unreachable("unrecognized LLVMOrcJITDylibLookupFlags value");
220}
221
232
233static SymbolLookupFlags toSymbolLookupFlags(LLVMOrcSymbolLookupFlags SLF) {
234 switch (SLF) {
239 }
240 llvm_unreachable("unrecognized LLVMOrcSymbolLookupFlags value");
241}
242
243static LLVMOrcSymbolLookupFlags fromSymbolLookupFlags(SymbolLookupFlags SLF) {
244 switch (SLF) {
249 }
250 llvm_unreachable("unrecognized SymbolLookupFlags value");
251}
252
257
258} // end anonymous namespace
259
260namespace llvm {
261namespace orc {
262
264public:
268 : Dispose(Dispose), Ctx(Ctx), TryToGenerate(TryToGenerate) {}
269
271 if (Dispose)
272 Dispose(Ctx);
273 }
274
276 JITDylibLookupFlags JDLookupFlags,
277 const SymbolLookupSet &LookupSet) override {
278
279 // Take the lookup state.
281
282 // Translate the lookup kind.
283 LLVMOrcLookupKind CLookupKind = fromLookupKind(K);
284
285 // Translate the JITDylibLookupFlags.
286 LLVMOrcJITDylibLookupFlags CJDLookupFlags =
287 fromJITDylibLookupFlags(JDLookupFlags);
288
289 // Translate the lookup set.
290 std::vector<LLVMOrcCLookupSetElement> CLookupSet;
291 CLookupSet.reserve(LookupSet.size());
292 for (auto &KV : LookupSet) {
295 LLVMOrcSymbolLookupFlags SLF = fromSymbolLookupFlags(KV.second);
296 CLookupSet.push_back({Name, SLF});
297 }
298
299 // Run the C TryToGenerate function.
300 auto Err = unwrap(TryToGenerate(::wrap(this), Ctx, &LSR, CLookupKind,
301 ::wrap(&JD), CJDLookupFlags,
302 CLookupSet.data(), CLookupSet.size()));
303
304 // Restore the lookup state.
306
307 return Err;
308 }
309
310private:
312 void *Ctx;
314};
315
316} // end namespace orc
317} // end namespace llvm
318
321 void *Ctx) {
322 unwrap(ES)->setErrorReporter(
323 [=](Error Err) { ReportError(Ctx, wrap(std::move(Err))); });
324}
325
328 return wrap(
329 unwrap(ES)->getExecutorProcessControl().getSymbolStringPool().get());
330}
331
333 unwrap(SSP)->clearDeadEntries();
334}
335
340
343 LLVMOrcCJITDylibSearchOrder SearchOrder, size_t SearchOrderSize,
344 LLVMOrcCLookupSet Symbols, size_t SymbolsSize,
346 assert(ES && "ES cannot be null");
347 assert(SearchOrder && "SearchOrder cannot be null");
348 assert(Symbols && "Symbols cannot be null");
349 assert(HandleResult && "HandleResult cannot be null");
350
352 for (size_t I = 0; I != SearchOrderSize; ++I)
353 SO.push_back({unwrap(SearchOrder[I].JD),
354 toJITDylibLookupFlags(SearchOrder[I].JDLookupFlags)});
355
356 SymbolLookupSet SLS;
357 for (size_t I = 0; I != SymbolsSize; ++I)
358 SLS.add(unwrap(Symbols[I].Name).moveToSymbolStringPtr(),
359 toSymbolLookupFlags(Symbols[I].LookupFlags));
360
361 unwrap(ES)->lookup(
362 toLookupKind(K), SO, std::move(SLS), SymbolState::Ready,
363 [HandleResult, Ctx](Expected<SymbolMap> Result) {
364 if (Result) {
366 for (auto &KV : *Result)
369 fromExecutorSymbolDef(KV.second)});
370 HandleResult(LLVMErrorSuccess, CResult.data(), CResult.size(), Ctx);
371 } else
372 HandleResult(wrap(Result.takeError()), nullptr, 0, Ctx);
373 },
375}
376
380
384
386 return unwrap(S).rawPtr()->getKey().data();
387}
388
391 auto RT = unwrap(JD)->createResourceTracker();
392 // Retain the pointer for the C API client.
393 RT->Retain();
394 return wrap(RT.get());
395}
396
399 auto RT = unwrap(JD)->getDefaultResourceTracker();
400 // Retain the pointer for the C API client.
401 return wrap(RT.get());
402}
403
408
414
419
421 std::unique_ptr<DefinitionGenerator> TmpDG(unwrap(DG));
422}
423
425 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
426}
427
429 const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms,
430 size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym,
434 SymbolFlagsMap SFM;
435 for (size_t I = 0; I != NumSyms; ++I)
436 SFM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] =
437 toJITSymbolFlags(Syms[I].Flags);
438
439 auto IS = unwrap(InitSym).moveToSymbolStringPtr();
440
441 return wrap(new OrcCAPIMaterializationUnit(
442 Name, std::move(SFM), std::move(IS), Ctx, Materialize, Discard, Destroy));
443}
444
447 SymbolMap SM = toSymbolMap(Syms, NumPairs);
448 return wrap(absoluteSymbols(std::move(SM)).release());
449}
450
453 LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases,
454 size_t NumPairs) {
455
456 SymbolAliasMap SAM;
457 for (size_t I = 0; I != NumPairs; ++I) {
458 auto pair = CallableAliases[I];
459 JITSymbolFlags Flags = toJITSymbolFlags(pair.Entry.Flags);
460 SymbolStringPtr Name = unwrap(pair.Entry.Name).moveToSymbolStringPtr();
461 SAM[unwrap(pair.Name).moveToSymbolStringPtr()] =
462 SymbolAliasMapEntry(Name, Flags);
463 }
464
465 return wrap(lazyReexports(*unwrap(LCTM), *unwrap(ISM), *unwrap(SourceJD),
466 std::move(SAM))
467 .release());
468}
469
472 std::unique_ptr<MaterializationResponsibility> TmpMR(unwrap(MR));
473}
474
479
485
487 LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs) {
488
489 auto Symbols = unwrap(MR)->getSymbols();
491 safe_malloc(Symbols.size() * sizeof(LLVMOrcCSymbolFlagsMapPair)));
492 size_t I = 0;
493 for (auto const &pair : Symbols) {
494 auto Name = wrap(SymbolStringPoolEntryUnsafe::from(pair.first));
495 auto Flags = pair.second;
496 Result[I] = {Name, fromJITSymbolFlags(Flags)};
497 I++;
498 }
499 *NumPairs = Symbols.size();
500 return Result;
501}
502
506
513
516 LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols) {
517
518 auto Symbols = unwrap(MR)->getRequestedSymbols();
521 Symbols.size() * sizeof(LLVMOrcSymbolStringPoolEntryRef)));
522 size_t I = 0;
523 for (auto &Name : Symbols) {
525 I++;
526 }
527 *NumSymbols = Symbols.size();
528 return Result;
529}
530
532 free(Symbols);
533}
534
537 size_t NumSymbols) {
538 SymbolMap SM = toSymbolMap(Symbols, NumSymbols);
539 return wrap(unwrap(MR)->notifyResolved(std::move(SM)));
540}
541
544 LLVMOrcCSymbolDependenceGroup *SymbolDepGroups, size_t NumSymbolDepGroups) {
545 std::vector<SymbolDependenceGroup> SDGs;
546 SDGs.reserve(NumSymbolDepGroups);
547 for (size_t I = 0; I != NumSymbolDepGroups; ++I) {
548 SDGs.push_back(SymbolDependenceGroup());
549 auto &SDG = SDGs.back();
550 SDG.Symbols = toSymbolNameSet(SymbolDepGroups[I].Symbols);
551 SDG.Dependencies = toSymbolDependenceMap(
552 SymbolDepGroups[I].Dependencies, SymbolDepGroups[I].NumDependencies);
553 }
554 return wrap(unwrap(MR)->notifyEmitted(SDGs));
555}
556
559 LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms) {
560 SymbolFlagsMap SFM;
561 for (size_t I = 0; I != NumSyms; ++I)
562 SFM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] =
563 toJITSymbolFlags(Syms[I].Flags);
564
565 return wrap(unwrap(MR)->defineMaterializing(std::move(SFM)));
566}
567
571 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
572 return wrap(unwrap(MR)->replace(std::move(TmpMU)));
573}
574
577 LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols,
579 SymbolNameSet Syms;
580 for (size_t I = 0; I != NumSymbols; I++) {
581 Syms.insert(unwrap(Symbols[I]).moveToSymbolStringPtr());
582 }
583 auto OtherMR = unwrap(MR)->delegate(Syms);
584
585 if (!OtherMR) {
586 return wrap(OtherMR.takeError());
587 }
588 *Result = wrap(OtherMR->release());
589 return LLVMErrorSuccess;
590}
591
596
600 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
601 unwrap(IRLayer)->emit(
602 std::unique_ptr<MaterializationResponsibility>(unwrap(MR)),
603 std::move(*TmpTSM));
604}
605
608 const char *Name) {
609 return wrap(&unwrap(ES)->createBareJITDylib(Name));
610}
611
615 const char *Name) {
616 auto JD = unwrap(ES)->createJITDylib(Name);
617 if (!JD)
618 return wrap(JD.takeError());
619 *Result = wrap(&*JD);
620 return LLVMErrorSuccess;
621}
622
625 const char *Name) {
626 return wrap(unwrap(ES)->getJITDylibByName(Name));
627}
628
631 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
632
633 if (auto Err = unwrap(JD)->define(TmpMU)) {
634 TmpMU.release();
635 return wrap(std::move(Err));
636 }
637 return LLVMErrorSuccess;
638}
639
643
646 unwrap(JD)->addGenerator(std::unique_ptr<DefinitionGenerator>(unwrap(DG)));
647}
648
652 auto DG = std::make_unique<CAPIDefinitionGenerator>(Dispose, Ctx, F);
653 return wrap(DG.release());
654}
655
662
665 LLVMOrcSymbolPredicate Filter, void *FilterCtx) {
666 assert(Result && "Result can not be null");
667 assert((Filter || !FilterCtx) &&
668 "if Filter is null then FilterCtx must also be null");
669
671 if (Filter)
672 Pred = [=](const SymbolStringPtr &Name) -> bool {
673 return Filter(FilterCtx, wrap(SymbolStringPoolEntryUnsafe::from(Name)));
674 };
675
676 auto ProcessSymsGenerator =
678
679 if (!ProcessSymsGenerator) {
680 *Result = nullptr;
681 return wrap(ProcessSymsGenerator.takeError());
682 }
683
684 *Result = wrap(ProcessSymsGenerator->release());
685 return LLVMErrorSuccess;
686}
687
689 LLVMOrcDefinitionGeneratorRef *Result, const char *FileName,
690 char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx) {
691 assert(Result && "Result can not be null");
692 assert(FileName && "FileName can not be null");
693 assert((Filter || !FilterCtx) &&
694 "if Filter is null then FilterCtx must also be null");
695
697 if (Filter)
698 Pred = [=](const SymbolStringPtr &Name) -> bool {
699 return Filter(FilterCtx, wrap(SymbolStringPoolEntryUnsafe::from(Name)));
700 };
701
702 auto LibrarySymsGenerator =
704
705 if (!LibrarySymsGenerator) {
706 *Result = nullptr;
707 return wrap(LibrarySymsGenerator.takeError());
708 }
709
710 *Result = wrap(LibrarySymsGenerator->release());
711 return LLVMErrorSuccess;
712}
713
716 const char *FileName) {
717 assert(Result && "Result can not be null");
718 assert(FileName && "Filename can not be null");
719 assert(ObjLayer && "ObjectLayer can not be null");
720
721 auto LibrarySymsGenerator =
723 if (!LibrarySymsGenerator) {
724 *Result = nullptr;
725 return wrap(LibrarySymsGenerator.takeError());
726 }
727 *Result = wrap(LibrarySymsGenerator->release());
728 return LLVMErrorSuccess;
729}
730
734
737 return wrap(new ThreadSafeContext(std::unique_ptr<LLVMContext>(unwrap(Ctx))));
738}
739
743
747 void *Ctx) {
748 return wrap(unwrap(TSCtx)->withContextDo(
749 [&](LLVMContext *C) { return unwrap(F(Ctx, wrap(C))); }));
750}
751
755 void *Ctx) {
756 return wrap(unwrap(TSM)->withModuleDo(
757 [&](Module &M) { return unwrap(F(Ctx, wrap(&M))); }));
758}
759
763 return wrap(
764 new ThreadSafeModule(std::unique_ptr<Module>(unwrap(M)), *unwrap(TSCtx)));
765}
766
770
771// Like JITTargetMachineBuilder::detectHost, but the target machines read the
772// options that LLVMParseCommandLineOptions sets.
775 if (JTMB)
776 JTMB->getOptions().MCOptions.LibraryOptions = &cl::getCAPILibraryOptions();
777 return JTMB;
778}
779
782 assert(Result && "Result can not be null");
783
784 auto JTMB = detectHostForCAPI();
785 if (!JTMB) {
786 Result = nullptr;
787 return wrap(JTMB.takeError());
788 }
789
790 *Result = wrap(new JITTargetMachineBuilder(std::move(*JTMB)));
791 return LLVMErrorSuccess;
792}
793
796 auto *TemplateTM = unwrap(TM);
797
798 auto JTMB =
799 std::make_unique<JITTargetMachineBuilder>(TemplateTM->getTargetTriple());
800
801 (*JTMB)
802 .setCPU(TemplateTM->getTargetCPU().str())
803 .setRelocationModel(TemplateTM->getRelocationModel())
804 .setCodeModel(TemplateTM->getCodeModel())
805 .setCodeGenOptLevel(TemplateTM->getOptLevel())
806 .setFeatures(TemplateTM->getTargetFeatureString())
807 .setOptions(TemplateTM->Options);
808
810
811 return wrap(JTMB.release());
812}
813
818
821 auto Tmp = unwrap(JTMB)->getTargetTriple().str();
822 char *TargetTriple = (char *)malloc(Tmp.size() + 1);
823 strcpy(TargetTriple, Tmp.c_str());
824 return TargetTriple;
825}
826
828 LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple) {
829 unwrap(JTMB)->getTargetTriple() = Triple(TargetTriple);
830}
831
834 LLVMMemoryBufferRef ObjBuffer) {
835 return wrap(unwrap(ObjLayer)->add(
836 *unwrap(JD), std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
837}
838
841 LLVMMemoryBufferRef ObjBuffer) {
842 return wrap(
843 unwrap(ObjLayer)->add(ResourceTrackerSP(unwrap(RT)),
844 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
845}
846
849 LLVMMemoryBufferRef ObjBuffer) {
850 unwrap(ObjLayer)->emit(
851 std::unique_ptr<MaterializationResponsibility>(unwrap(R)),
852 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer)));
853}
854
856 delete unwrap(ObjLayer);
857}
858
861 LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx) {
863 ->setTransform(
864 [=](ThreadSafeModule TSM,
867 wrap(new ThreadSafeModule(std::move(TSM)));
868 if (LLVMErrorRef Err = TransformFunction(Ctx, &TSMRef, wrap(&R))) {
869 assert(!TSMRef && "TSMRef was not reset to null on error");
870 return unwrap(Err);
871 }
872 assert(TSMRef && "Transform succeeded, but TSMRef was set to null");
873 ThreadSafeModule Result = std::move(*unwrap(TSMRef));
875 return std::move(Result);
876 });
877}
878
880 LLVMOrcObjectTransformLayerRef ObjTransformLayer,
881 LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx) {
882 unwrap(ObjTransformLayer)
883 ->setTransform([TransformFunction, Ctx](std::unique_ptr<MemoryBuffer> Obj)
884 -> Expected<std::unique_ptr<MemoryBuffer>> {
885 LLVMMemoryBufferRef ObjBuffer = wrap(Obj.release());
886 if (LLVMErrorRef Err = TransformFunction(Ctx, &ObjBuffer)) {
887 assert(!ObjBuffer && "ObjBuffer was not reset to null on error");
888 return unwrap(Err);
889 }
890 return std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer));
891 });
892}
893
895 const char *IdentifierOverride) {
896 assert(DumpDir && "DumpDir should not be null");
897 assert(IdentifierOverride && "IdentifierOverride should not be null");
898 return wrap(new DumpObjects(DumpDir, IdentifierOverride));
899}
900
904
906 LLVMMemoryBufferRef *ObjBuffer) {
907 std::unique_ptr<MemoryBuffer> OB(unwrap(*ObjBuffer));
908 if (auto Result = (*unwrap(DumpObjects))(std::move(OB))) {
909 *ObjBuffer = wrap(Result->release());
910 return LLVMErrorSuccess;
911 } else {
912 *ObjBuffer = nullptr;
913 return wrap(Result.takeError());
914 }
915}
916
920
922 delete unwrap(Builder);
923}
924
927 unwrap(Builder)->setJITTargetMachineBuilder(std::move(*unwrap(JTMB)));
929}
930
934 unwrap(Builder)->setObjectLinkingLayerCreator(
935 [=](ExecutionSession &ES,
936 jitlink::JITLinkMemoryManager &MemMgr /* <- Currently ignored */) {
937 auto TTStr = ES.getTargetTriple().str();
938 return std::unique_ptr<ObjectLayer>(
939 unwrap(F(Ctx, wrap(&ES), TTStr.c_str())));
940 });
941}
942
944 LLVMOrcLLJITBuilderRef Builder) {
945 assert(Result && "Result can not be null");
946
947 if (!Builder)
948 Builder = LLVMOrcCreateLLJITBuilder();
949
950 // Detect the host here, as LLJITBuilder would without a
951 // JITTargetMachineBuilder.
952 if (!unwrap(Builder)->getJITTargetMachineBuilder()) {
953 auto JTMB = detectHostForCAPI();
954 if (!JTMB) {
956 return wrap(JTMB.takeError());
957 }
958 unwrap(Builder)->setJITTargetMachineBuilder(std::move(*JTMB));
959 }
960
961 auto J = unwrap(Builder)->create();
963
964 if (!J) {
965 Result = nullptr;
966 return wrap(J.takeError());
967 }
968
969 *Result = wrap(J->release());
970 return LLVMErrorSuccess;
971}
972
977
981
983 return wrap(&unwrap(J)->getMainJITDylib());
984}
985
987 return unwrap(J)->getTargetTriple().str().c_str();
988}
989
991 return unwrap(J)->getDataLayout().getGlobalPrefix();
992}
993
995LLVMOrcLLJITMangleAndIntern(LLVMOrcLLJITRef J, const char *UnmangledName) {
997 unwrap(J)->mangleAndIntern(UnmangledName)));
998}
999
1001 LLVMMemoryBufferRef ObjBuffer) {
1002 return wrap(unwrap(J)->addObjectFile(
1003 *unwrap(JD), std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
1004}
1005
1008 LLVMMemoryBufferRef ObjBuffer) {
1009 return wrap(unwrap(J)->addObjectFile(
1011 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
1012}
1013
1017 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
1018 return wrap(unwrap(J)->addIRModule(*unwrap(JD), std::move(*TmpTSM)));
1019}
1020
1024 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
1025 return wrap(unwrap(J)->addIRModule(ResourceTrackerSP(unwrap(RT)),
1026 std::move(*TmpTSM)));
1027}
1028
1031 const char *Name) {
1032 assert(Result && "Result can not be null");
1033
1034 auto Sym = unwrap(J)->lookup(Name);
1035 if (!Sym) {
1036 *Result = 0;
1037 return wrap(Sym.takeError());
1038 }
1039
1040 *Result = Sym->getValue();
1041 return LLVMErrorSuccess;
1042}
1043
1045 return wrap(&unwrap(J)->getObjLinkingLayer());
1046}
1047
1050 return wrap(&unwrap(J)->getObjTransformLayer());
1051}
1052
1055 assert(Result && "Result must not be null");
1056 assert(ES && "ES must not be null");
1058 if (!MM)
1059 return wrap(MM.takeError());
1060 *Result = wrap(new ObjectLinkingLayer(*unwrap(ES), std::move(*MM)));
1061 return LLVMErrorSuccess;
1062}
1063
1067 assert(ES && "ES must not be null");
1068 return wrap(
1069 new RTDyldObjectLinkingLayer(*unwrap(ES), [](const MemoryBuffer &) {
1070 return std::make_unique<SectionMemoryManager>();
1071 }));
1072}
1073
1076 LLVMOrcExecutionSessionRef ES, LLVMBool ReserveAlloc) {
1077 assert(ES && "ES must not be null");
1078 return wrap(new RTDyldObjectLinkingLayer(
1079 *unwrap(ES), [ReserveAlloc](const MemoryBuffer &) {
1080 return std::make_unique<SectionMemoryManager>(nullptr, ReserveAlloc);
1081 }));
1082}
1083
1086 LLVMOrcExecutionSessionRef ES, void *CreateContextCtx,
1093
1094 struct MCJITMemoryManagerLikeCallbacks {
1095 MCJITMemoryManagerLikeCallbacks() = default;
1096 MCJITMemoryManagerLikeCallbacks(
1097 void *CreateContextCtx,
1104 : CreateContextCtx(CreateContextCtx), CreateContext(CreateContext),
1105 NotifyTerminating(NotifyTerminating),
1106 AllocateCodeSection(AllocateCodeSection),
1107 AllocateDataSection(AllocateDataSection),
1108 FinalizeMemory(FinalizeMemory), Destroy(Destroy) {}
1109
1110 MCJITMemoryManagerLikeCallbacks(MCJITMemoryManagerLikeCallbacks &&Other) {
1111 std::swap(CreateContextCtx, Other.CreateContextCtx);
1112 std::swap(CreateContext, Other.CreateContext);
1113 std::swap(NotifyTerminating, Other.NotifyTerminating);
1114 std::swap(AllocateCodeSection, Other.AllocateCodeSection);
1115 std::swap(AllocateDataSection, Other.AllocateDataSection);
1116 std::swap(FinalizeMemory, Other.FinalizeMemory);
1117 std::swap(Destroy, Other.Destroy);
1118 }
1119
1120 ~MCJITMemoryManagerLikeCallbacks() {
1121 if (NotifyTerminating)
1122 NotifyTerminating(CreateContextCtx);
1123 }
1124
1125 void *CreateContextCtx = nullptr;
1126 LLVMMemoryManagerCreateContextCallback CreateContext = nullptr;
1127 LLVMMemoryManagerNotifyTerminatingCallback NotifyTerminating = nullptr;
1128 LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection = nullptr;
1129 LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection = nullptr;
1130 LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory = nullptr;
1131 LLVMMemoryManagerDestroyCallback Destroy = nullptr;
1132 };
1133
1134 class MCJITMemoryManagerLikeCallbacksMemMgr : public RTDyldMemoryManager {
1135 public:
1136 MCJITMemoryManagerLikeCallbacksMemMgr(
1137 const MCJITMemoryManagerLikeCallbacks &CBs)
1138 : CBs(CBs) {
1139 Opaque = CBs.CreateContext(CBs.CreateContextCtx);
1140 }
1141 ~MCJITMemoryManagerLikeCallbacksMemMgr() override { CBs.Destroy(Opaque); }
1142
1143 uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
1144 unsigned SectionID,
1145 StringRef SectionName) override {
1146 return CBs.AllocateCodeSection(Opaque, Size, Alignment, SectionID,
1147 SectionName.str().c_str());
1148 }
1149
1150 uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
1151 unsigned SectionID, StringRef SectionName,
1152 bool isReadOnly) override {
1153 return CBs.AllocateDataSection(Opaque, Size, Alignment, SectionID,
1154 SectionName.str().c_str(), isReadOnly);
1155 }
1156
1157 bool finalizeMemory(std::string *ErrMsg) override {
1158 char *ErrMsgCString = nullptr;
1159 bool Result = CBs.FinalizeMemory(Opaque, &ErrMsgCString);
1160 assert((Result || !ErrMsgCString) &&
1161 "Did not expect an error message if FinalizeMemory succeeded");
1162 if (ErrMsgCString) {
1163 if (ErrMsg)
1164 *ErrMsg = ErrMsgCString;
1165 free(ErrMsgCString);
1166 }
1167 return Result;
1168 }
1169
1170 private:
1171 const MCJITMemoryManagerLikeCallbacks &CBs;
1172 void *Opaque = nullptr;
1173 };
1174
1175 assert(ES && "ES must not be null");
1176 assert(CreateContext && "CreateContext must not be null");
1177 assert(NotifyTerminating && "NotifyTerminating must not be null");
1178 assert(AllocateCodeSection && "AllocateCodeSection must not be null");
1179 assert(AllocateDataSection && "AllocateDataSection must not be null");
1180 assert(FinalizeMemory && "FinalizeMemory must not be null");
1181 assert(Destroy && "Destroy must not be null");
1182
1183 MCJITMemoryManagerLikeCallbacks CBs(
1184 CreateContextCtx, CreateContext, NotifyTerminating, AllocateCodeSection,
1185 AllocateDataSection, FinalizeMemory, Destroy);
1186
1187 return wrap(new RTDyldObjectLinkingLayer(
1188 *unwrap(ES), [CBs = std::move(CBs)](const MemoryBuffer &) {
1189 return std::make_unique<MCJITMemoryManagerLikeCallbacksMemMgr>(CBs);
1190 }));
1191
1192 return nullptr;
1193}
1194
1196 LLVMOrcObjectLayerRef RTDyldObjLinkingLayer,
1197 LLVMJITEventListenerRef Listener) {
1198 assert(RTDyldObjLinkingLayer && "RTDyldObjLinkingLayer must not be null");
1199 assert(Listener && "Listener must not be null");
1200 reinterpret_cast<RTDyldObjectLinkingLayer *>(unwrap(RTDyldObjLinkingLayer))
1201 ->registerJITEventListener(*unwrap(Listener));
1202}
1203
1207
1209 return unwrap(J)->getDataLayout().getStringRepresentation().c_str();
1210}
1211
1214 auto builder = createLocalIndirectStubsManagerBuilder(Triple(TargetTriple));
1215 return wrap(builder().release());
1216}
1217
1219 std::unique_ptr<IndirectStubsManager> TmpISM(unwrap(ISM));
1220}
1221
1223 const char *TargetTriple, LLVMOrcExecutionSessionRef ES,
1224 LLVMOrcJITTargetAddress ErrorHandlerAddr,
1227 Triple(TargetTriple), *unwrap(ES), ExecutorAddr(ErrorHandlerAddr));
1228
1229 if (!LCTM)
1230 return wrap(LCTM.takeError());
1231 *Result = wrap(LCTM->release());
1232 return LLVMErrorSuccess;
1233}
1234
1237 std::unique_ptr<LazyCallThroughManager> TmpLCM(unwrap(LCM));
1238}
SDValue Pred
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
@ GlobalPrefix
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
LLVM_C_EXTERN_C_BEGIN typedef void *(* LLVMMemoryManagerCreateContextCallback)(void *CtxCtx)
Definition OrcEE.h:36
void(* LLVMMemoryManagerNotifyTerminatingCallback)(void *CtxCtx)
Definition OrcEE.h:37
static Expected< JITTargetMachineBuilder > detectHostForCAPI()
StringRef getName() const override
Return the name of this materialization unit.
void materialize(std::unique_ptr< MaterializationResponsibility > R) override
Implementations of this method should materialize all symbols in the materialzation unit,...
OrcCAPIMaterializationUnit(std::string Name, SymbolFlagsMap InitialSymbolFlags, SymbolStringPtr InitSymbol, void *Ctx, LLVMOrcMaterializationUnitMaterializeFunction Materialize, LLVMOrcMaterializationUnitDiscardFunction Discard, LLVMOrcMaterializationUnitDestroyFunction Destroy)
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
Flags for symbols in the JIT.
Definition JITSymbol.h:75
TargetFlagsType & getTargetFlags()
Return a reference to the target-specific flags.
Definition JITSymbol.h:173
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:76
This interface provides simple read-only access to a block of memory, and provides simple methods for...
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
virtual uint8_t * allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName, bool IsReadOnly)=0
Allocate a memory block of (at least) the given size suitable for data.
virtual uint8_t * allocateCodeSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, StringRef SectionName)=0
Allocate a memory block of (at least) the given size suitable for executable code.
virtual bool finalizeMemory(std::string *ErrMsg=nullptr)=0
This method is called when object loading is complete and section page permissions can be applied.
void push_back(const T &Elt)
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Primary interface to the complete machine description for the target machine.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
const std::string & str() const
Definition Triple.h:582
std::pair< iterator, bool > insert(const ValueT &V)
Definition DenseSet.h:210
Error tryToGenerate(LookupState &LS, LookupKind K, JITDylib &JD, JITDylibLookupFlags JDLookupFlags, const SymbolLookupSet &LookupSet) override
DefinitionGenerators should override this method to insert new definitions into the parent JITDylib.
CAPIDefinitionGenerator(LLVMOrcDisposeCAPIDefinitionGeneratorFunction Dispose, void *Ctx, LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction TryToGenerate)
Definition generators can be attached to JITDylibs to generate new definitions for otherwise unresolv...
Definition Core.h:625
A function object that can be used as an ObjectTransformLayer transform to dump object files to disk ...
Definition DebugUtils.h:109
std::function< bool(const SymbolStringPtr &)> SymbolPredicate
static Expected< std::unique_ptr< DynamicLibrarySearchGenerator > > Load(const char *FileName, char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate(), AddAbsoluteSymbolsFn AddAbsoluteSymbols=nullptr)
Permanently loads the library at the given path and, on success, returns a DynamicLibrarySearchGenera...
static Expected< std::unique_ptr< DynamicLibrarySearchGenerator > > GetForCurrentProcess(char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate(), AddAbsoluteSymbolsFn AddAbsoluteSymbols=nullptr)
Creates a DynamicLibrarySearchGenerator that searches for symbols in the current process.
An ExecutionSession represents a running JIT program.
Definition Core.h:1096
const Triple & getTargetTriple() const
Return the triple for the executor.
Definition Core.h:1166
Represents an address in the executor process.
uint64_t getValue() const
Represents a defining location for a JIT symbol.
const JITSymbolFlags & getFlags() const
const ExecutorAddr & getAddress() const
Interface for layers that accept LLVM IR.
Definition Layer.h:65
A layer that applies a transform to emitted modules.
Base class for managing collections of named indirect stubs.
Represents a JIT'd dynamic library.
Definition Core.h:668
A utility class for building TargetMachines for JITs.
static LLVM_ABI Expected< JITTargetMachineBuilder > detectHost()
Create a JITTargetMachineBuilder for the host system.
Constructs LLJIT instances.
Definition LLJIT.h:586
A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
Definition LLJIT.h:45
Manages a set of 'lazy call-through' trampolines.
Wraps state for a lookup-in-progress.
Definition Core.h:600
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition Core.h:343
A MaterializationUnit represents a set of symbol definitions that can be materialized as a group,...
Interface for Layers that accept object files.
Definition Layer.h:131
An ObjectLayer implementation built on JITLink.
static InProgressLookupState * extractLookupState(LookupState &LS)
static void resetLookupState(LookupState &LS, InProgressLookupState *IPLS)
API to remove / transfer ownership of JIT resources.
Definition Core.h:65
LLVM_ABI void transferTo(ResourceTracker &DstRT)
Transfer all resources associated with this key to the given tracker, which must target the same JITD...
Definition Core.cpp:63
LLVM_ABI Error remove()
Remove all resources associated with this key.
Definition Core.cpp:59
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Load(ObjectLayer &L, const char *FileName, VisitMembersFunction VisitMembers=VisitMembersFunction(), GetObjectFileInterface GetObjFileInterface=GetObjectFileInterface())
Try to create a StaticLibraryDefinitionGenerator from the given path.
A set of symbols to look up, each associated with a SymbolLookupFlags value.
UnderlyingVector::size_type size() const
SymbolLookupSet & add(SymbolStringPtr Name, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
Add an element to the set.
Provides unsafe access to ownership operations on SymbolStringPtr.
SymbolStringPool::PoolMapEntry PoolEntry
static SymbolStringPoolEntryUnsafe from(const SymbolStringPtrBase &S)
Create an unsafe pool entry ref without changing the ref-count.
static SymbolStringPoolEntryUnsafe take(SymbolStringPtr &&S)
Consumes the given SymbolStringPtr without releasing the pool entry.
String pool for symbol names used by the JIT.
Pointer to a pooled string representing a symbol name.
An LLVMContext together with an associated mutex that can be used to lock the context to prevent conc...
An LLVM Module together with a shared ThreadSafeContext.
LLVM_C_ABI LLVMContextRef LLVMContextCreate(void)
Create a new context.
Definition Core.cpp:110
#define LLVMErrorSuccess
Definition Error.h:29
struct LLVMOpaqueError * LLVMErrorRef
Opaque reference to an error instance.
Definition Error.h:34
void LLVMOrcDisposeLLJITBuilder(LLVMOrcLLJITBuilderRef Builder)
Dispose of an LLVMOrcLLJITBuilderRef.
LLVMErrorRef LLVMOrcLLJITAddObjectFile(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, LLVMMemoryBufferRef ObjBuffer)
Add a buffer representing an object file to the given JITDylib in the given LLJIT instance.
LLVMOrcIRTransformLayerRef LLVMOrcLLJITGetIRTransformLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's IR transform layer.
struct LLVMOrcOpaqueLLJIT * LLVMOrcLLJITRef
A reference to an orc::LLJIT instance.
Definition LLJIT.h:71
LLVMOrcObjectLayerRef(* LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction)(void *Ctx, LLVMOrcExecutionSessionRef ES, const char *Triple)
A function for constructing an ObjectLinkingLayer instance to be used by an LLJIT instance.
Definition LLJIT.h:60
LLVMOrcObjectLayerRef LLVMOrcLLJITGetObjLinkingLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's object linking layer.
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModuleWithRT(LLVMOrcLLJITRef J, LLVMOrcResourceTrackerRef RT, LLVMOrcThreadSafeModuleRef TSM)
Add an IR module to the given ResourceTracker's JITDylib in the given LLJIT instance.
void LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator(LLVMOrcLLJITBuilderRef Builder, LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction F, void *Ctx)
Set an ObjectLinkingLayer creator function for this LLJIT instance.
const char * LLVMOrcLLJITGetTripleString(LLVMOrcLLJITRef J)
Return the target triple for this LLJIT instance.
const char * LLVMOrcLLJITGetDataLayoutStr(LLVMOrcLLJITRef J)
Get the LLJIT instance's default data layout string.
LLVMOrcJITDylibRef LLVMOrcLLJITGetMainJITDylib(LLVMOrcLLJITRef J)
Return a reference to the Main JITDylib.
LLVMErrorRef LLVMOrcLLJITLookup(LLVMOrcLLJITRef J, LLVMOrcJITTargetAddress *Result, const char *Name)
Look up the given symbol in the main JITDylib of the given LLJIT 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...
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModule(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, LLVMOrcThreadSafeModuleRef TSM)
Add an IR module to the given JITDylib in the given LLJIT instance.
struct LLVMOrcOpaqueLLJITBuilder * LLVMOrcLLJITBuilderRef
A reference to an orc::LLJITBuilder instance.
Definition LLJIT.h:66
LLVMErrorRef LLVMOrcDisposeLLJIT(LLVMOrcLLJITRef J)
Dispose of an LLJIT instance.
char LLVMOrcLLJITGetGlobalPrefix(LLVMOrcLLJITRef J)
Returns the global prefix character according to the LLJIT's DataLayout.
void LLVMOrcLLJITBuilderSetJITTargetMachineBuilder(LLVMOrcLLJITBuilderRef Builder, LLVMOrcJITTargetMachineBuilderRef JTMB)
Set the JITTargetMachineBuilder to be used when constructing the LLJIT instance.
LLVMOrcLLJITBuilderRef LLVMOrcCreateLLJITBuilder(void)
Create an LLVMOrcLLJITBuilder.
LLVMErrorRef LLVMOrcCreateLLJIT(LLVMOrcLLJITRef *Result, LLVMOrcLLJITBuilderRef Builder)
Create an LLJIT instance from an LLJITBuilder.
LLVMOrcExecutionSessionRef LLVMOrcLLJITGetExecutionSession(LLVMOrcLLJITRef J)
Get a reference to the ExecutionSession for this LLJIT instance.
LLVMErrorRef LLVMOrcLLJITAddObjectFileWithRT(LLVMOrcLLJITRef J, LLVMOrcResourceTrackerRef RT, LLVMMemoryBufferRef ObjBuffer)
Add a buffer representing an object file to the given ResourceTracker's JITDylib in the given LLJIT i...
LLVMOrcObjectTransformLayerRef LLVMOrcLLJITGetObjTransformLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's object linking layer.
LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManagerReserveAlloc(LLVMOrcExecutionSessionRef ES, LLVMBool ReserveAlloc)
Create a RTDyldObjectLinkingLayer instance using the standard SectionMemoryManager for memory managem...
void LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(LLVMOrcObjectLayerRef RTDyldObjLinkingLayer, LLVMJITEventListenerRef Listener)
Add the given listener to the given RTDyldObjectLinkingLayer.
LLVMErrorRef LLVMOrcCreateObjectLinkingLayerWithInProcessMemoryManager(LLVMOrcObjectLayerRef *Result, LLVMOrcExecutionSessionRef ES)
Create a ObjectLinkingLayer instance using the standard JITLink InProcessMemoryManager for memory man...
LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(LLVMOrcExecutionSessionRef ES)
Create a RTDyldObjectLinkingLayer instance using the standard SectionMemoryManager for memory managem...
LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithMCJITMemoryManagerLikeCallbacks(LLVMOrcExecutionSessionRef ES, void *CreateContextCtx, LLVMMemoryManagerCreateContextCallback CreateContext, LLVMMemoryManagerNotifyTerminatingCallback NotifyTerminating, LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection, LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection, LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory, LLVMMemoryManagerDestroyCallback Destroy)
Create a RTDyldObjectLinkingLayer instance using MCJIT-memory-manager-like callbacks.
uint64_t LLVMOrcJITTargetAddress
Represents an address in the executor process.
Definition Orc.h:47
void LLVMOrcObjectTransformLayerSetTransform(LLVMOrcObjectTransformLayerRef ObjTransformLayer, LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx)
Set the transform function on an LLVMOrcObjectTransformLayer.
void LLVMOrcDisposeDefinitionGenerator(LLVMOrcDefinitionGeneratorRef DG)
Dispose of a JITDylib::DefinitionGenerator.
LLVMErrorRef(* LLVMOrcGenericIRModuleOperationFunction)(void *Ctx, LLVMModuleRef M)
A function for inspecting/mutating IR modules, suitable for use with LLVMOrcThreadSafeModuleWithModul...
Definition Orc.h:398
LLVMErrorRef LLVMOrcCreateStaticLibrarySearchGeneratorForPath(LLVMOrcDefinitionGeneratorRef *Result, LLVMOrcObjectLayerRef ObjLayer, const char *FileName)
Get a LLVMOrcCreateStaticLibrarySearchGeneratorForPath that will reflect static library symbols into ...
void LLVMOrcDisposeSymbols(LLVMOrcSymbolStringPoolEntryRef *Symbols)
Disposes of the passed LLVMOrcSymbolStringPoolEntryRef* .
LLVMOrcLookupKind
Lookup kind.
Definition Orc.h:200
void LLVMOrcDisposeLazyCallThroughManager(LLVMOrcLazyCallThroughManagerRef LCM)
Dispose of an LazyCallThroughManager.
struct LLVMOrcOpaqueObjectTransformLayer * LLVMOrcObjectTransformLayerRef
A reference to an orc::ObjectTransformLayer instance.
Definition Orc.h:451
LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForPath(LLVMOrcDefinitionGeneratorRef *Result, const char *FileName, char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx)
Get a LLVMOrcCreateDynamicLibararySearchGeneratorForPath that will reflect library symbols into the J...
void LLVMOrcDisposeThreadSafeModule(LLVMOrcThreadSafeModuleRef TSM)
Dispose of a ThreadSafeModule.
LLVMOrcDumpObjectsRef LLVMOrcCreateDumpObjects(const char *DumpDir, const char *IdentifierOverride)
Create a DumpObjects instance.
LLVMErrorRef LLVMOrcJITDylibDefine(LLVMOrcJITDylibRef JD, LLVMOrcMaterializationUnitRef MU)
Add the given MaterializationUnit to the given JITDylib.
LLVMErrorRef(* LLVMOrcObjectTransformLayerTransformFunction)(void *Ctx, LLVMMemoryBufferRef *ObjInOut)
A function for applying transformations to an object file buffer.
Definition Orc.h:467
LLVMOrcSymbolStringPoolEntryRef LLVMOrcMaterializationResponsibilityGetInitializerSymbol(LLVMOrcMaterializationResponsibilityRef MR)
Returns the initialization pseudo-symbol, if any.
void LLVMOrcReleaseSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)
Reduces the ref-count for of a SymbolStringPool entry.
LLVMOrcCSymbolFlagsMapPair * LLVMOrcCSymbolFlagsMapPairs
Represents a list of (SymbolStringPtr, JITSymbolFlags) pairs that can be used to construct a SymbolFl...
Definition Orc.h:119
void LLVMOrcDisposeIndirectStubsManager(LLVMOrcIndirectStubsManagerRef ISM)
Dispose of an IndirectStubsManager.
void LLVMOrcResourceTrackerTransferTo(LLVMOrcResourceTrackerRef SrcRT, LLVMOrcResourceTrackerRef DstRT)
Transfers tracking of all resources associated with resource tracker SrcRT to resource tracker DstRT.
LLVMOrcMaterializationUnitRef LLVMOrcCreateCustomMaterializationUnit(const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym, LLVMOrcMaterializationUnitMaterializeFunction Materialize, LLVMOrcMaterializationUnitDiscardFunction Discard, LLVMOrcMaterializationUnitDestroyFunction Destroy)
Create a custom MaterializationUnit.
LLVMOrcMaterializationUnitRef LLVMOrcLazyReexports(LLVMOrcLazyCallThroughManagerRef LCTM, LLVMOrcIndirectStubsManagerRef ISM, LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases, size_t NumPairs)
Create a MaterializationUnit to define lazy re-expots.
LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyEmitted(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolDependenceGroup *SymbolDepGroups, size_t NumSymbolDepGroups)
Notifies the target JITDylib (and any pending queries on that JITDylib) that all symbols covered by t...
LLVMOrcCSymbolAliasMapPair * LLVMOrcCSymbolAliasMapPairs
Represents a list of (SymbolStringPtr, (SymbolStringPtr, JITSymbolFlags)) pairs that can be used to c...
Definition Orc.h:155
LLVMOrcCSymbolMapPair * LLVMOrcCSymbolMapPairs
Represents a list of (SymbolStringPtr, JITEvaluatedSymbol) pairs that can be used to construct a Symb...
Definition Orc.h:133
void LLVMOrcJITDylibAddGenerator(LLVMOrcJITDylibRef JD, LLVMOrcDefinitionGeneratorRef DG)
Add a DefinitionGenerator to the given JITDylib.
LLVMErrorRef LLVMOrcExecutionSessionCreateJITDylib(LLVMOrcExecutionSessionRef ES, LLVMOrcJITDylibRef *Result, const char *Name)
Create a JITDylib.
struct LLVMOrcOpaqueJITTargetMachineBuilder * LLVMOrcJITTargetMachineBuilderRef
A reference to an orc::JITTargetMachineBuilder instance.
Definition Orc.h:411
LLVMOrcJITDylibRef LLVMOrcMaterializationResponsibilityGetTargetDylib(LLVMOrcMaterializationResponsibilityRef MR)
Returns the target JITDylib that these symbols are being materialized into.
void LLVMOrcRetainSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)
Increments the ref-count for a SymbolStringPool entry.
LLVMErrorRef LLVMOrcMaterializationResponsibilityReplace(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcMaterializationUnitRef MU)
Transfers responsibility to the given MaterializationUnit for all symbols defined by that Materializa...
void LLVMOrcObjectLayerEmit(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcMaterializationResponsibilityRef R, LLVMMemoryBufferRef ObjBuffer)
Emit an object buffer to an ObjectLayer.
LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContextFromLLVMContext(LLVMContextRef Ctx)
Create a ThreadSafeContextRef from a given LLVMContext, which must not be associated with any existin...
char * LLVMOrcJITTargetMachineBuilderGetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB)
Returns the target triple for the given JITTargetMachineBuilder as a string.
void LLVMOrcLookupStateContinueLookup(LLVMOrcLookupStateRef S, LLVMErrorRef Err)
Continue a lookup that was suspended in a generator (see LLVMOrcCAPIDefinitionGeneratorTryToGenerateF...
LLVMErrorRef LLVMOrcObjectLayerAddObjectFileWithRT(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcResourceTrackerRef RT, LLVMMemoryBufferRef ObjBuffer)
Add an object to an ObjectLayer using the given ResourceTracker.
void(* LLVMOrcErrorReporterFunction)(void *Ctx, LLVMErrorRef Err)
Error reporter function.
Definition Orc.h:94
void LLVMOrcDisposeObjectLayer(LLVMOrcObjectLayerRef ObjLayer)
Dispose of an ObjectLayer.
void LLVMOrcExecutionSessionLookup(LLVMOrcExecutionSessionRef ES, LLVMOrcLookupKind K, LLVMOrcCJITDylibSearchOrder SearchOrder, size_t SearchOrderSize, LLVMOrcCLookupSet Symbols, size_t SymbolsSize, LLVMOrcExecutionSessionLookupHandleResultFunction HandleResult, void *Ctx)
Look up symbols in an execution session.
struct LLVMOrcOpaqueMaterializationResponsibility * LLVMOrcMaterializationResponsibilityRef
A reference to a uniquely owned orc::MaterializationResponsibility instance.
Definition Orc.h:272
void LLVMOrcDisposeMaterializationResponsibility(LLVMOrcMaterializationResponsibilityRef MR)
Disposes of the passed MaterializationResponsibility object.
LLVMOrcCSymbolFlagsMapPairs LLVMOrcMaterializationResponsibilityGetSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs)
Returns the symbol flags map for this responsibility instance.
LLVMOrcJITTargetMachineBuilderRef LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(LLVMTargetMachineRef TM)
Create a JITTargetMachineBuilder from the given TargetMachine template.
void(* LLVMOrcDisposeCAPIDefinitionGeneratorFunction)(void *Ctx)
Disposer for a custom generator.
Definition Orc.h:376
struct LLVMOrcOpaqueThreadSafeModule * LLVMOrcThreadSafeModuleRef
A reference to an orc::ThreadSafeModule instance.
Definition Orc.h:392
struct LLVMOrcOpaqueExecutionSession * LLVMOrcExecutionSessionRef
A reference to an orc::ExecutionSession instance.
Definition Orc.h:89
LLVMOrcMaterializationUnitRef LLVMOrcAbsoluteSymbols(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs)
Create a MaterializationUnit to define the given symbols as pointing to the corresponding raw address...
struct LLVMOrcOpaqueIndirectStubsManager * LLVMOrcIndirectStubsManagerRef
A reference to an orc::IndirectStubsManager instance.
Definition Orc.h:473
void(* LLVMOrcExecutionSessionLookupHandleResultFunction)(LLVMErrorRef Err, LLVMOrcCSymbolMapPairs Result, size_t NumPairs, void *Ctx)
Callback type for ExecutionSession lookups.
Definition Orc.h:554
LLVMErrorRef LLVMOrcJITDylibClear(LLVMOrcJITDylibRef JD)
Calls remove on all trackers associated with this JITDylib, see JITDylib::clear().
LLVMOrcThreadSafeModuleRef LLVMOrcCreateNewThreadSafeModule(LLVMModuleRef M, LLVMOrcThreadSafeContextRef TSCtx)
Create a ThreadSafeModule wrapper around the given LLVM module.
void LLVMOrcReleaseResourceTracker(LLVMOrcResourceTrackerRef RT)
Reduces the ref-count of a ResourceTracker.
LLVMOrcSymbolStringPoolRef LLVMOrcExecutionSessionGetSymbolStringPool(LLVMOrcExecutionSessionRef ES)
Return a reference to the SymbolStringPool for an ExecutionSession.
void LLVMOrcSymbolStringPoolClearDeadEntries(LLVMOrcSymbolStringPoolRef SSP)
Clear all unreferenced symbol string pool entries.
LLVMOrcExecutionSessionRef LLVMOrcMaterializationResponsibilityGetExecutionSession(LLVMOrcMaterializationResponsibilityRef MR)
Returns the ExecutionSession for this MaterializationResponsibility.
LLVMOrcIndirectStubsManagerRef LLVMOrcCreateLocalIndirectStubsManager(const char *TargetTriple)
Create a LocalIndirectStubsManager from the given target triple.
LLVMErrorRef LLVMOrcJITTargetMachineBuilderDetectHost(LLVMOrcJITTargetMachineBuilderRef *Result)
Create a JITTargetMachineBuilder by detecting the host.
LLVMErrorRef(* LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction)(LLVMOrcDefinitionGeneratorRef GeneratorObj, void *Ctx, LLVMOrcLookupStateRef *LookupState, LLVMOrcLookupKind Kind, LLVMOrcJITDylibRef JD, LLVMOrcJITDylibLookupFlags JDLookupFlags, LLVMOrcCLookupSet LookupSet, size_t LookupSetSize)
A custom generator function.
Definition Orc.h:364
void LLVMOrcIRTransformLayerEmit(LLVMOrcIRTransformLayerRef IRLayer, LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcThreadSafeModuleRef TSM)
LLVMOrcCJITDylibSearchOrderElement * LLVMOrcCJITDylibSearchOrder
A JITDylib search order.
Definition Orc.h:230
LLVMErrorRef(* LLVMOrcIRTransformLayerTransformFunction)(void *Ctx, LLVMOrcThreadSafeModuleRef *ModInOut, LLVMOrcMaterializationResponsibilityRef MR)
A function for applying transformations as part of an transform layer.
Definition Orc.h:444
struct LLVMOrcOpaqueSymbolStringPool * LLVMOrcSymbolStringPoolRef
A reference to an orc::SymbolStringPool.
Definition Orc.h:99
void(* LLVMOrcMaterializationUnitDestroyFunction)(void *Ctx)
A MaterializationUnit destruction callback.
Definition Orc.h:304
void LLVMOrcDisposeDumpObjects(LLVMOrcDumpObjectsRef DumpObjects)
Dispose of a DumpObjects instance.
struct LLVMOrcOpaqueResourceTracker * LLVMOrcResourceTrackerRef
A reference to an orc::ResourceTracker instance.
Definition Orc.h:309
void LLVMOrcIRTransformLayerSetTransform(LLVMOrcIRTransformLayerRef IRTransformLayer, LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx)
Set the transform function of the provided transform layer, passing through a pointer to user provide...
void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx)
Dispose of a ThreadSafeContext.
LLVMOrcCDependenceMapPair * LLVMOrcCDependenceMapPairs
Represents a list of (JITDylibRef, (LLVMOrcSymbolStringPoolEntryRef*, size_t)) pairs that can be used...
Definition Orc.h:183
const char * LLVMOrcSymbolStringPoolEntryStr(LLVMOrcSymbolStringPoolEntryRef S)
Return the c-string for the given symbol.
LLVMErrorRef(* LLVMOrcGenericContextOperationFunction)(void *Ctx, LLVMContextRef C)
A function for inspecting/mutating LLVM contexts, suitable for use with LLVMOrcThreadSafeContextWithC...
Definition Orc.h:405
LLVMErrorRef LLVMOrcThreadSafeContextWithContextDo(LLVMOrcThreadSafeContextRef TSCtx, LLVMOrcGenericContextOperationFunction F, void *Ctx)
Apply the given function to the LLVMContext contained in this ThreadSafeContext.
LLVMErrorRef LLVMOrcThreadSafeModuleWithModuleDo(LLVMOrcThreadSafeModuleRef TSM, LLVMOrcGenericIRModuleOperationFunction F, void *Ctx)
Apply the given function to the module contained in this ThreadSafeModule.
LLVMErrorRef LLVMOrcObjectLayerAddObjectFile(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcJITDylibRef JD, LLVMMemoryBufferRef ObjBuffer)
Add an object to an ObjectLayer to the given JITDylib.
LLVMErrorRef LLVMOrcMaterializationResponsibilityDelegate(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols, LLVMOrcMaterializationResponsibilityRef *Result)
Delegates responsibility for the given symbols to the returned materialization responsibility.
LLVMOrcCLookupSetElement * LLVMOrcCLookupSet
A set of symbols to look up / generate.
Definition Orc.h:260
LLVMOrcResourceTrackerRef LLVMOrcJITDylibCreateResourceTracker(LLVMOrcJITDylibRef JD)
Return a reference to a newly created resource tracker associated with JD.
struct LLVMOrcOpaqueObjectLayer * LLVMOrcObjectLayerRef
A reference to an orc::ObjectLayer instance.
Definition Orc.h:417
int(* LLVMOrcSymbolPredicate)(void *Ctx, LLVMOrcSymbolStringPoolEntryRef Sym)
Predicate function for SymbolStringPoolEntries.
Definition Orc.h:381
void LLVMOrcDisposeJITTargetMachineBuilder(LLVMOrcJITTargetMachineBuilderRef JTMB)
Dispose of a JITTargetMachineBuilder.
void LLVMOrcJITTargetMachineBuilderSetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple)
Sets the target triple for the given JITTargetMachineBuilder to the given string.
struct LLVMOrcOpaqueDefinitionGenerator * LLVMOrcDefinitionGeneratorRef
A reference to an orc::DefinitionGenerator.
Definition Orc.h:314
LLVMOrcJITDylibRef LLVMOrcExecutionSessionGetJITDylibByName(LLVMOrcExecutionSessionRef ES, const char *Name)
Returns the JITDylib with the given name, or NULL if no such JITDylib exists.
void LLVMOrcMaterializationResponsibilityFailMaterialization(LLVMOrcMaterializationResponsibilityRef MR)
Notify all not-yet-emitted covered by this MaterializationResponsibility instance that an error has o...
struct LLVMOrcOpaqueSymbolStringPoolEntry * LLVMOrcSymbolStringPoolEntryRef
A reference to an orc::SymbolStringPool table entry.
Definition Orc.h:104
void LLVMOrcDisposeCSymbolFlagsMap(LLVMOrcCSymbolFlagsMapPairs Pairs)
Disposes of the passed LLVMOrcCSymbolFlagsMap.
LLVMErrorRef LLVMOrcMaterializationResponsibilityDefineMaterializing(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms)
Attempt to claim responsibility for new definitions.
LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContext(void)
Create a ThreadSafeContextRef containing a new LLVMContext.
void(* LLVMOrcMaterializationUnitDiscardFunction)(void *Ctx, LLVMOrcJITDylibRef JD, LLVMOrcSymbolStringPoolEntryRef Symbol)
A MaterializationUnit discard callback.
Definition Orc.h:294
LLVMOrcResourceTrackerRef LLVMOrcJITDylibGetDefaultResourceTracker(LLVMOrcJITDylibRef JD)
Return a reference to the default resource tracker for the given JITDylib.
LLVMOrcSymbolStringPoolEntryRef * LLVMOrcMaterializationResponsibilityGetRequestedSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols)
Returns the names of any symbols covered by this MaterializationResponsibility object that have queri...
void(* LLVMOrcMaterializationUnitMaterializeFunction)(void *Ctx, LLVMOrcMaterializationResponsibilityRef MR)
A MaterializationUnit materialize callback.
Definition Orc.h:285
struct LLVMOrcOpaqueDumpObjects * LLVMOrcDumpObjectsRef
A reference to an orc::DumpObjects object.
Definition Orc.h:488
LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(LLVMOrcDefinitionGeneratorRef *Result, char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx)
Get a DynamicLibrarySearchGenerator that will reflect process symbols into the JITDylib.
struct LLVMOrcOpaqueIRTransformLayer * LLVMOrcIRTransformLayerRef
A reference to an orc::IRTransformLayer instance.
Definition Orc.h:427
struct LLVMOrcOpaqueLookupState * LLVMOrcLookupStateRef
An opaque lookup state object.
Definition Orc.h:329
LLVMOrcDefinitionGeneratorRef LLVMOrcCreateCustomCAPIDefinitionGenerator(LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction F, void *Ctx, LLVMOrcDisposeCAPIDefinitionGeneratorFunction Dispose)
Create a custom generator.
LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyResolved(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolMapPairs Symbols, size_t NumSymbols)
Notifies the target JITDylib that the given symbols have been resolved.
LLVMErrorRef LLVMOrcCreateLocalLazyCallThroughManager(const char *TargetTriple, LLVMOrcExecutionSessionRef ES, LLVMOrcJITTargetAddress ErrorHandlerAddr, LLVMOrcLazyCallThroughManagerRef *Result)
void LLVMOrcDisposeMaterializationUnit(LLVMOrcMaterializationUnitRef MU)
Dispose of a MaterializationUnit.
LLVMErrorRef LLVMOrcResourceTrackerRemove(LLVMOrcResourceTrackerRef RT)
Remove all resources associated with the given tracker.
struct LLVMOrcOpaqueMaterializationUnit * LLVMOrcMaterializationUnitRef
A reference to a uniquely owned orc::MaterializationUnit instance.
Definition Orc.h:265
LLVMOrcJITDylibRef LLVMOrcExecutionSessionCreateBareJITDylib(LLVMOrcExecutionSessionRef ES, const char *Name)
Create a "bare" JITDylib.
LLVMOrcSymbolStringPoolEntryRef LLVMOrcExecutionSessionIntern(LLVMOrcExecutionSessionRef ES, const char *Name)
Intern a string in the ExecutionSession's SymbolStringPool and return a reference to it.
void LLVMOrcExecutionSessionSetErrorReporter(LLVMOrcExecutionSessionRef ES, LLVMOrcErrorReporterFunction ReportError, void *Ctx)
Attach a custom error reporter function to the ExecutionSession.
LLVMErrorRef LLVMOrcDumpObjects_CallOperator(LLVMOrcDumpObjectsRef DumpObjects, LLVMMemoryBufferRef *ObjBuffer)
Dump the contents of the given MemoryBuffer.
struct LLVMOrcOpaqueJITDylib * LLVMOrcJITDylibRef
A reference to an orc::JITDylib instance.
Definition Orc.h:160
struct LLVMOrcOpaqueThreadSafeContext * LLVMOrcThreadSafeContextRef
A reference to an orc::ThreadSafeContext instance.
Definition Orc.h:387
LLVMOrcJITDylibLookupFlags
JITDylib lookup flags.
Definition Orc.h:211
@ LLVMOrcLookupKindDLSym
Definition Orc.h:202
@ LLVMOrcLookupKindStatic
Definition Orc.h:201
@ LLVMJITSymbolGenericFlagsWeak
Definition Orc.h:60
@ LLVMJITSymbolGenericFlagsExported
Definition Orc.h:59
@ LLVMJITSymbolGenericFlagsCallable
Definition Orc.h:61
@ LLVMJITSymbolGenericFlagsMaterializationSideEffectsOnly
Definition Orc.h:62
@ LLVMOrcSymbolLookupFlagsRequiredSymbol
Definition Orc.h:237
@ LLVMOrcSymbolLookupFlagsWeaklyReferencedSymbol
Definition Orc.h:238
@ LLVMOrcJITDylibLookupFlagsMatchAllSymbols
Definition Orc.h:213
@ LLVMOrcJITDylibLookupFlagsMatchExportedSymbolsOnly
Definition Orc.h:212
void(* LLVMMemoryManagerDestroyCallback)(void *Opaque)
LLVMBool(* LLVMMemoryManagerFinalizeMemoryCallback)(void *Opaque, char **ErrMsg)
uint8_t *(* LLVMMemoryManagerAllocateDataSectionCallback)(void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID, const char *SectionName, LLVMBool IsReadOnly)
uint8_t *(* LLVMMemoryManagerAllocateCodeSectionCallback)(void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID, const char *SectionName)
int LLVMBool
Definition Types.h:28
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
Definition Types.h:48
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
Definition Types.h:53
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
Definition Types.h:61
struct LLVMOpaqueJITEventListener * LLVMJITEventListenerRef
Definition Types.h:165
struct LLVMOpaqueTargetMachine * LLVMTargetMachineRef
LLVM_C_ABI void LLVMDisposeTargetMachine(LLVMTargetMachineRef T)
Dispose the LLVMTargetMachineRef instance generated by LLVMCreateTargetMachine.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static LLVMJITEvaluatedSymbol fromExecutorSymbolDef(const ExecutorSymbolDef &S)
static JITSymbolFlags toJITSymbolFlags(LLVMJITSymbolFlags F)
static SymbolNameSet toSymbolNameSet(LLVMOrcCSymbolsList Symbols)
static JITDylibLookupFlags toJITDylibLookupFlags(LLVMOrcJITDylibLookupFlags LF)
static LLVMOrcSymbolLookupFlags fromSymbolLookupFlags(SymbolLookupFlags SLF)
static SymbolMap toSymbolMap(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs)
static LLVMOrcLookupKind fromLookupKind(LookupKind K)
static LLVMOrcJITDylibLookupFlags fromJITDylibLookupFlags(JITDylibLookupFlags LF)
static SymbolDependenceMap toSymbolDependenceMap(LLVMOrcCDependenceMapPairs Pairs, size_t NumPairs)
static LookupKind toLookupKind(LLVMOrcLookupKind K)
static SymbolLookupFlags toSymbolLookupFlags(LLVMOrcSymbolLookupFlags SLF)
static LLVMJITSymbolFlags fromJITSymbolFlags(JITSymbolFlags JSF)
LLVM_ABI LibraryOptionsContext & getCAPILibraryOptions()
std::vector< std::pair< JITDylib *, JITDylibLookupFlags > > JITDylibSearchOrder
A list of (JITDylib*, JITDylibLookupFlags) pairs to be used as a search order during symbol lookup.
Definition Core.h:142
IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP
Definition Core.h:59
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
SymbolLookupFlags
Lookup flags that apply to each symbol in a lookup.
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
DenseMap< SymbolStringPtr, ExecutorSymbolDef > SymbolMap
A map from symbol names (as SymbolStringPtrs) to JITSymbols (address/flags pairs).
LLVM_ABI std::function< std::unique_ptr< IndirectStubsManager >()> createLocalIndirectStubsManagerBuilder(const Triple &T)
Create a local indirect stubs manager builder.
LLVM_ABI Expected< std::unique_ptr< LazyCallThroughManager > > createLocalLazyCallThroughManager(const Triple &T, ExecutionSession &ES, ExecutorAddr ErrorHandlerAddr)
Create a LocalLazyCallThroughManager from the given triple and execution session.
std::unique_ptr< LazyReexportsMaterializationUnit > lazyReexports(LazyCallThroughManager &LCTManager, RedirectableSymbolManager &RSManager, JITDylib &SourceJD, SymbolAliasMap CallableAliases, ImplSymbolMap *SrcJDLoc=nullptr)
Define lazy-reexports based on the given SymbolAliasMap.
LookupKind
Describes the kind of lookup being performed.
Definition Core.h:138
LLVM_ABI RegisterDependenciesFunction NoDependenciesToRegister
This can be used as the value for a RegisterDependenciesFunction if there are no dependants to regist...
Definition Core.cpp:42
DenseMap< JITDylib *, SymbolNameSet > SymbolDependenceMap
A map from JITDylibs to sets of symbols.
DenseSet< SymbolStringPtr > SymbolNameSet
A set of symbol names (represented by SymbolStringPtrs for.
@ Ready
Emitted to memory, but waiting on transitive dependencies.
Definition Core.h:545
DenseMap< SymbolStringPtr, SymbolAliasMapEntry > SymbolAliasMap
A map of Symbols to (Symbol, Flags) pairs.
Definition Core.h:167
DenseMap< SymbolStringPtr, JITSymbolFlags > SymbolFlagsMap
A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
Definition MemAlloc.h:25
@ Other
Any other memory.
Definition ModRef.h:68
Attribute unwrap(LLVMAttributeRef Attr)
Definition Attributes.h:394
void replace(R &&Range, const T &OldValue, const T &NewValue)
Provide wrappers to std::replace which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1926
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1933
LLVMAttributeRef wrap(Attribute Attr)
Definition Attributes.h:389
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:879
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:881
Represents an evaluated symbol address and flags.
Definition Orc.h:81
Represents the linkage flags for a symbol definition.
Definition Orc.h:73
LLVMOrcCSymbolsList Names
Definition Orc.h:176
A set of symbols that share dependencies.
Definition Orc.h:188
Represents a pair of a symbol name and LLVMJITSymbolFlags.
Definition Orc.h:110
Represents a pair of a symbol name and an evaluated symbol.
Definition Orc.h:124
Represents a list of LLVMOrcSymbolStringPoolEntryRef and the associated length.
Definition Orc.h:166
LLVMOrcSymbolStringPoolEntryRef * Symbols
Definition Orc.h:167
size_t Length
Definition Orc.h:168
A set of symbols and the their dependencies.
Definition Core.h:331