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(TSM)->withModuleDo(
749 [&](Module &M) { return unwrap(F(Ctx, wrap(&M))); }));
750}
751
755 return wrap(
756 new ThreadSafeModule(std::unique_ptr<Module>(unwrap(M)), *unwrap(TSCtx)));
757}
758
762
763// Like JITTargetMachineBuilder::detectHost, but the target machines read the
764// options that LLVMParseCommandLineOptions sets.
767 if (JTMB)
768 JTMB->getOptions().MCOptions.LibraryOptions = &cl::getCAPILibraryOptions();
769 return JTMB;
770}
771
774 assert(Result && "Result can not be null");
775
776 auto JTMB = detectHostForCAPI();
777 if (!JTMB) {
778 Result = nullptr;
779 return wrap(JTMB.takeError());
780 }
781
782 *Result = wrap(new JITTargetMachineBuilder(std::move(*JTMB)));
783 return LLVMErrorSuccess;
784}
785
788 auto *TemplateTM = unwrap(TM);
789
790 auto JTMB =
791 std::make_unique<JITTargetMachineBuilder>(TemplateTM->getTargetTriple());
792
793 (*JTMB)
794 .setCPU(TemplateTM->getTargetCPU().str())
795 .setRelocationModel(TemplateTM->getRelocationModel())
796 .setCodeModel(TemplateTM->getCodeModel())
797 .setCodeGenOptLevel(TemplateTM->getOptLevel())
798 .setFeatures(TemplateTM->getTargetFeatureString())
799 .setOptions(TemplateTM->Options);
800
802
803 return wrap(JTMB.release());
804}
805
810
813 auto Tmp = unwrap(JTMB)->getTargetTriple().str();
814 char *TargetTriple = (char *)malloc(Tmp.size() + 1);
815 strcpy(TargetTriple, Tmp.c_str());
816 return TargetTriple;
817}
818
820 LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple) {
821 unwrap(JTMB)->getTargetTriple() = Triple(TargetTriple);
822}
823
826 LLVMMemoryBufferRef ObjBuffer) {
827 return wrap(unwrap(ObjLayer)->add(
828 *unwrap(JD), std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
829}
830
833 LLVMMemoryBufferRef ObjBuffer) {
834 return wrap(
835 unwrap(ObjLayer)->add(ResourceTrackerSP(unwrap(RT)),
836 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
837}
838
841 LLVMMemoryBufferRef ObjBuffer) {
842 unwrap(ObjLayer)->emit(
843 std::unique_ptr<MaterializationResponsibility>(unwrap(R)),
844 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer)));
845}
846
848 delete unwrap(ObjLayer);
849}
850
853 LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx) {
855 ->setTransform(
856 [=](ThreadSafeModule TSM,
859 wrap(new ThreadSafeModule(std::move(TSM)));
860 if (LLVMErrorRef Err = TransformFunction(Ctx, &TSMRef, wrap(&R))) {
861 assert(!TSMRef && "TSMRef was not reset to null on error");
862 return unwrap(Err);
863 }
864 assert(TSMRef && "Transform succeeded, but TSMRef was set to null");
865 ThreadSafeModule Result = std::move(*unwrap(TSMRef));
867 return std::move(Result);
868 });
869}
870
872 LLVMOrcObjectTransformLayerRef ObjTransformLayer,
873 LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx) {
874 unwrap(ObjTransformLayer)
875 ->setTransform([TransformFunction, Ctx](std::unique_ptr<MemoryBuffer> Obj)
876 -> Expected<std::unique_ptr<MemoryBuffer>> {
877 LLVMMemoryBufferRef ObjBuffer = wrap(Obj.release());
878 if (LLVMErrorRef Err = TransformFunction(Ctx, &ObjBuffer)) {
879 assert(!ObjBuffer && "ObjBuffer was not reset to null on error");
880 return unwrap(Err);
881 }
882 return std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer));
883 });
884}
885
887 const char *IdentifierOverride) {
888 assert(DumpDir && "DumpDir should not be null");
889 assert(IdentifierOverride && "IdentifierOverride should not be null");
890 return wrap(new DumpObjects(DumpDir, IdentifierOverride));
891}
892
896
898 LLVMMemoryBufferRef *ObjBuffer) {
899 std::unique_ptr<MemoryBuffer> OB(unwrap(*ObjBuffer));
900 if (auto Result = (*unwrap(DumpObjects))(std::move(OB))) {
901 *ObjBuffer = wrap(Result->release());
902 return LLVMErrorSuccess;
903 } else {
904 *ObjBuffer = nullptr;
905 return wrap(Result.takeError());
906 }
907}
908
912
914 delete unwrap(Builder);
915}
916
919 unwrap(Builder)->setJITTargetMachineBuilder(std::move(*unwrap(JTMB)));
921}
922
926 unwrap(Builder)->setObjectLinkingLayerCreator(
927 [=](ExecutionSession &ES,
928 jitlink::JITLinkMemoryManager &MemMgr /* <- Currently ignored */) {
929 auto TTStr = ES.getTargetTriple().str();
930 return std::unique_ptr<ObjectLayer>(
931 unwrap(F(Ctx, wrap(&ES), TTStr.c_str())));
932 });
933}
934
936 LLVMOrcLLJITBuilderRef Builder) {
937 assert(Result && "Result can not be null");
938
939 if (!Builder)
940 Builder = LLVMOrcCreateLLJITBuilder();
941
942 // Detect the host here, as LLJITBuilder would without a
943 // JITTargetMachineBuilder.
944 if (!unwrap(Builder)->getJITTargetMachineBuilder()) {
945 auto JTMB = detectHostForCAPI();
946 if (!JTMB) {
948 return wrap(JTMB.takeError());
949 }
950 unwrap(Builder)->setJITTargetMachineBuilder(std::move(*JTMB));
951 }
952
953 auto J = unwrap(Builder)->create();
955
956 if (!J) {
957 Result = nullptr;
958 return wrap(J.takeError());
959 }
960
961 *Result = wrap(J->release());
962 return LLVMErrorSuccess;
963}
964
969
973
975 return wrap(&unwrap(J)->getMainJITDylib());
976}
977
979 return unwrap(J)->getTargetTriple().str().c_str();
980}
981
983 return unwrap(J)->getDataLayout().getGlobalPrefix();
984}
985
987LLVMOrcLLJITMangleAndIntern(LLVMOrcLLJITRef J, const char *UnmangledName) {
989 unwrap(J)->mangleAndIntern(UnmangledName)));
990}
991
993 LLVMMemoryBufferRef ObjBuffer) {
994 return wrap(unwrap(J)->addObjectFile(
995 *unwrap(JD), std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
996}
997
1000 LLVMMemoryBufferRef ObjBuffer) {
1001 return wrap(unwrap(J)->addObjectFile(
1003 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
1004}
1005
1009 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
1010 return wrap(unwrap(J)->addIRModule(*unwrap(JD), std::move(*TmpTSM)));
1011}
1012
1016 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
1017 return wrap(unwrap(J)->addIRModule(ResourceTrackerSP(unwrap(RT)),
1018 std::move(*TmpTSM)));
1019}
1020
1023 const char *Name) {
1024 assert(Result && "Result can not be null");
1025
1026 auto Sym = unwrap(J)->lookup(Name);
1027 if (!Sym) {
1028 *Result = 0;
1029 return wrap(Sym.takeError());
1030 }
1031
1032 *Result = Sym->getValue();
1033 return LLVMErrorSuccess;
1034}
1035
1037 return wrap(&unwrap(J)->getObjLinkingLayer());
1038}
1039
1042 return wrap(&unwrap(J)->getObjTransformLayer());
1043}
1044
1047 assert(Result && "Result must not be null");
1048 assert(ES && "ES must not be null");
1050 if (!MM)
1051 return wrap(MM.takeError());
1052 *Result = wrap(new ObjectLinkingLayer(*unwrap(ES), std::move(*MM)));
1053 return LLVMErrorSuccess;
1054}
1055
1059 assert(ES && "ES must not be null");
1060 return wrap(
1061 new RTDyldObjectLinkingLayer(*unwrap(ES), [](const MemoryBuffer &) {
1062 return std::make_unique<SectionMemoryManager>();
1063 }));
1064}
1065
1068 LLVMOrcExecutionSessionRef ES, LLVMBool ReserveAlloc) {
1069 assert(ES && "ES must not be null");
1070 return wrap(new RTDyldObjectLinkingLayer(
1071 *unwrap(ES), [ReserveAlloc](const MemoryBuffer &) {
1072 return std::make_unique<SectionMemoryManager>(nullptr, ReserveAlloc);
1073 }));
1074}
1075
1078 LLVMOrcExecutionSessionRef ES, void *CreateContextCtx,
1085
1086 struct MCJITMemoryManagerLikeCallbacks {
1087 MCJITMemoryManagerLikeCallbacks() = default;
1088 MCJITMemoryManagerLikeCallbacks(
1089 void *CreateContextCtx,
1096 : CreateContextCtx(CreateContextCtx), CreateContext(CreateContext),
1097 NotifyTerminating(NotifyTerminating),
1098 AllocateCodeSection(AllocateCodeSection),
1099 AllocateDataSection(AllocateDataSection),
1100 FinalizeMemory(FinalizeMemory), Destroy(Destroy) {}
1101
1102 MCJITMemoryManagerLikeCallbacks(MCJITMemoryManagerLikeCallbacks &&Other) {
1103 std::swap(CreateContextCtx, Other.CreateContextCtx);
1104 std::swap(CreateContext, Other.CreateContext);
1105 std::swap(NotifyTerminating, Other.NotifyTerminating);
1106 std::swap(AllocateCodeSection, Other.AllocateCodeSection);
1107 std::swap(AllocateDataSection, Other.AllocateDataSection);
1108 std::swap(FinalizeMemory, Other.FinalizeMemory);
1109 std::swap(Destroy, Other.Destroy);
1110 }
1111
1112 ~MCJITMemoryManagerLikeCallbacks() {
1113 if (NotifyTerminating)
1114 NotifyTerminating(CreateContextCtx);
1115 }
1116
1117 void *CreateContextCtx = nullptr;
1118 LLVMMemoryManagerCreateContextCallback CreateContext = nullptr;
1119 LLVMMemoryManagerNotifyTerminatingCallback NotifyTerminating = nullptr;
1120 LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection = nullptr;
1121 LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection = nullptr;
1122 LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory = nullptr;
1123 LLVMMemoryManagerDestroyCallback Destroy = nullptr;
1124 };
1125
1126 class MCJITMemoryManagerLikeCallbacksMemMgr : public RTDyldMemoryManager {
1127 public:
1128 MCJITMemoryManagerLikeCallbacksMemMgr(
1129 const MCJITMemoryManagerLikeCallbacks &CBs)
1130 : CBs(CBs) {
1131 Opaque = CBs.CreateContext(CBs.CreateContextCtx);
1132 }
1133 ~MCJITMemoryManagerLikeCallbacksMemMgr() override { CBs.Destroy(Opaque); }
1134
1135 uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
1136 unsigned SectionID,
1137 StringRef SectionName) override {
1138 return CBs.AllocateCodeSection(Opaque, Size, Alignment, SectionID,
1139 SectionName.str().c_str());
1140 }
1141
1142 uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
1143 unsigned SectionID, StringRef SectionName,
1144 bool isReadOnly) override {
1145 return CBs.AllocateDataSection(Opaque, Size, Alignment, SectionID,
1146 SectionName.str().c_str(), isReadOnly);
1147 }
1148
1149 bool finalizeMemory(std::string *ErrMsg) override {
1150 char *ErrMsgCString = nullptr;
1151 bool Result = CBs.FinalizeMemory(Opaque, &ErrMsgCString);
1152 assert((Result || !ErrMsgCString) &&
1153 "Did not expect an error message if FinalizeMemory succeeded");
1154 if (ErrMsgCString) {
1155 if (ErrMsg)
1156 *ErrMsg = ErrMsgCString;
1157 free(ErrMsgCString);
1158 }
1159 return Result;
1160 }
1161
1162 private:
1163 const MCJITMemoryManagerLikeCallbacks &CBs;
1164 void *Opaque = nullptr;
1165 };
1166
1167 assert(ES && "ES must not be null");
1168 assert(CreateContext && "CreateContext must not be null");
1169 assert(NotifyTerminating && "NotifyTerminating must not be null");
1170 assert(AllocateCodeSection && "AllocateCodeSection must not be null");
1171 assert(AllocateDataSection && "AllocateDataSection must not be null");
1172 assert(FinalizeMemory && "FinalizeMemory must not be null");
1173 assert(Destroy && "Destroy must not be null");
1174
1175 MCJITMemoryManagerLikeCallbacks CBs(
1176 CreateContextCtx, CreateContext, NotifyTerminating, AllocateCodeSection,
1177 AllocateDataSection, FinalizeMemory, Destroy);
1178
1179 return wrap(new RTDyldObjectLinkingLayer(
1180 *unwrap(ES), [CBs = std::move(CBs)](const MemoryBuffer &) {
1181 return std::make_unique<MCJITMemoryManagerLikeCallbacksMemMgr>(CBs);
1182 }));
1183
1184 return nullptr;
1185}
1186
1188 LLVMOrcObjectLayerRef RTDyldObjLinkingLayer,
1189 LLVMJITEventListenerRef Listener) {
1190 assert(RTDyldObjLinkingLayer && "RTDyldObjLinkingLayer must not be null");
1191 assert(Listener && "Listener must not be null");
1192 reinterpret_cast<RTDyldObjectLinkingLayer *>(unwrap(RTDyldObjLinkingLayer))
1193 ->registerJITEventListener(*unwrap(Listener));
1194}
1195
1199
1201 return unwrap(J)->getDataLayout().getStringRepresentation().c_str();
1202}
1203
1206 auto builder = createLocalIndirectStubsManagerBuilder(Triple(TargetTriple));
1207 return wrap(builder().release());
1208}
1209
1211 std::unique_ptr<IndirectStubsManager> TmpISM(unwrap(ISM));
1212}
1213
1215 const char *TargetTriple, LLVMOrcExecutionSessionRef ES,
1216 LLVMOrcJITTargetAddress ErrorHandlerAddr,
1219 Triple(TargetTriple), *unwrap(ES), ExecutorAddr(ErrorHandlerAddr));
1220
1221 if (!LCTM)
1222 return wrap(LCTM.takeError());
1223 *Result = wrap(LCTM->release());
1224 return LLVMErrorSuccess;
1225}
1226
1229 std::unique_ptr<LazyCallThroughManager> TmpLCM(unwrap(LCM));
1230}
SDValue Pred
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
@ GlobalPrefix
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 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:444
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:460
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:404
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:466
void(* LLVMOrcExecutionSessionLookupHandleResultFunction)(LLVMErrorRef Err, LLVMOrcCSymbolMapPairs Result, size_t NumPairs, void *Ctx)
Callback type for ExecutionSession lookups.
Definition Orc.h:547
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:437
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 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:410
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:481
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:420
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:397
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:392
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