LLVM 22.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
20
21using namespace llvm;
22using namespace llvm::orc;
23
24namespace llvm {
25namespace orc {
26
28
30public:
32 return LS.IPLS.release();
33 }
34
36 return LS.reset(IPLS);
37 }
38};
39
40} // namespace orc
41} // namespace llvm
42
44 return reinterpret_cast<LLVMOrcSymbolStringPoolEntryRef>(E.rawPtr());
45}
46
48 return reinterpret_cast<SymbolStringPoolEntryUnsafe::PoolEntry *>(E);
49}
50
79
80namespace {
81
83public:
85 std::string Name, SymbolFlagsMap InitialSymbolFlags,
86 SymbolStringPtr InitSymbol, void *Ctx,
91 Interface(std::move(InitialSymbolFlags), std::move(InitSymbol))),
92 Name(std::move(Name)), Ctx(Ctx), Materialize(Materialize),
93 Discard(Discard), Destroy(Destroy) {}
94
96 if (Ctx)
97 Destroy(Ctx);
98 }
99
100 StringRef getName() const override { return Name; }
101
102 void materialize(std::unique_ptr<MaterializationResponsibility> R) override {
103 void *Tmp = Ctx;
104 Ctx = nullptr;
105 Materialize(Tmp, wrap(R.release()));
106 }
107
108private:
109 void discard(const JITDylib &JD, const SymbolStringPtr &Name) override {
110 Discard(Ctx, wrap(&JD), wrap(SymbolStringPoolEntryUnsafe::from(Name)));
111 }
112
113 std::string Name;
114 void *Ctx = nullptr;
118};
119
121
122 JITSymbolFlags JSF;
123
124 if (F.GenericFlags & LLVMJITSymbolGenericFlagsExported)
126 if (F.GenericFlags & LLVMJITSymbolGenericFlagsWeak)
128 if (F.GenericFlags & LLVMJITSymbolGenericFlagsCallable)
132
133 JSF.getTargetFlags() = F.TargetFlags;
134
135 return JSF;
136}
137
139 LLVMJITSymbolFlags F = {0, 0};
140 if (JSF & JITSymbolFlags::Exported)
141 F.GenericFlags |= LLVMJITSymbolGenericFlagsExported;
142 if (JSF & JITSymbolFlags::Weak)
143 F.GenericFlags |= LLVMJITSymbolGenericFlagsWeak;
144 if (JSF & JITSymbolFlags::Callable)
145 F.GenericFlags |= LLVMJITSymbolGenericFlagsCallable;
148
149 F.TargetFlags = JSF.getTargetFlags();
150
151 return F;
152}
153
156 Result.reserve(Symbols.Length);
157 for (size_t I = 0; I != Symbols.Length; ++I)
158 Result.insert(unwrap(Symbols.Symbols[I]).moveToSymbolStringPtr());
159 return Result;
160}
161
162static SymbolMap toSymbolMap(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs) {
163 SymbolMap SM;
164 for (size_t I = 0; I != NumPairs; ++I) {
165 JITSymbolFlags Flags = toJITSymbolFlags(Syms[I].Sym.Flags);
166 SM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] = {
167 ExecutorAddr(Syms[I].Sym.Address), Flags};
168 }
169 return SM;
170}
171
175 for (size_t I = 0; I != NumPairs; ++I) {
176 JITDylib *JD = unwrap(Pairs[I].JD);
177 SymbolNameSet Names;
178
179 for (size_t J = 0; J != Pairs[I].Names.Length; ++J) {
180 auto Sym = Pairs[I].Names.Symbols[J];
181 Names.insert(unwrap(Sym).moveToSymbolStringPtr());
182 }
183 SDM[JD] = Names;
184 }
185 return SDM;
186}
187
189 switch (K) {
191 return LookupKind::Static;
193 return LookupKind::DLSym;
194 }
195 llvm_unreachable("unrecognized LLVMOrcLookupKind value");
196}
197
199 switch (K) {
200 case LookupKind::Static:
202 case LookupKind::DLSym:
204 }
205 llvm_unreachable("unrecognized LookupKind value");
206}
207
210 switch (LF) {
212 return JITDylibLookupFlags::MatchExportedSymbolsOnly;
214 return JITDylibLookupFlags::MatchAllSymbols;
215 }
216 llvm_unreachable("unrecognized LLVMOrcJITDylibLookupFlags value");
217}
218
221 switch (LF) {
222 case JITDylibLookupFlags::MatchExportedSymbolsOnly:
224 case JITDylibLookupFlags::MatchAllSymbols:
226 }
227 llvm_unreachable("unrecognized JITDylibLookupFlags value");
228}
229
231 switch (SLF) {
233 return SymbolLookupFlags::RequiredSymbol;
235 return SymbolLookupFlags::WeaklyReferencedSymbol;
236 }
237 llvm_unreachable("unrecognized LLVMOrcSymbolLookupFlags value");
238}
239
241 switch (SLF) {
242 case SymbolLookupFlags::RequiredSymbol:
244 case SymbolLookupFlags::WeaklyReferencedSymbol:
246 }
247 llvm_unreachable("unrecognized SymbolLookupFlags value");
248}
249
252 return {S.getAddress().getValue(), fromJITSymbolFlags(S.getFlags())};
253}
254
255} // end anonymous namespace
256
257namespace llvm {
258namespace orc {
259
261public:
265 : Dispose(Dispose), Ctx(Ctx), TryToGenerate(TryToGenerate) {}
266
268 if (Dispose)
269 Dispose(Ctx);
270 }
271
273 JITDylibLookupFlags JDLookupFlags,
274 const SymbolLookupSet &LookupSet) override {
275
276 // Take the lookup state.
278
279 // Translate the lookup kind.
280 LLVMOrcLookupKind CLookupKind = fromLookupKind(K);
281
282 // Translate the JITDylibLookupFlags.
283 LLVMOrcJITDylibLookupFlags CJDLookupFlags =
284 fromJITDylibLookupFlags(JDLookupFlags);
285
286 // Translate the lookup set.
287 std::vector<LLVMOrcCLookupSetElement> CLookupSet;
288 CLookupSet.reserve(LookupSet.size());
289 for (auto &KV : LookupSet) {
292 LLVMOrcSymbolLookupFlags SLF = fromSymbolLookupFlags(KV.second);
293 CLookupSet.push_back({Name, SLF});
294 }
295
296 // Run the C TryToGenerate function.
297 auto Err = unwrap(TryToGenerate(::wrap(this), Ctx, &LSR, CLookupKind,
298 ::wrap(&JD), CJDLookupFlags,
299 CLookupSet.data(), CLookupSet.size()));
300
301 // Restore the lookup state.
303
304 return Err;
305 }
306
307private:
309 void *Ctx;
311};
312
313} // end namespace orc
314} // end namespace llvm
315
318 void *Ctx) {
319 unwrap(ES)->setErrorReporter(
320 [=](Error Err) { ReportError(Ctx, wrap(std::move(Err))); });
321}
322
325 return wrap(
326 unwrap(ES)->getExecutorProcessControl().getSymbolStringPool().get());
327}
328
330 unwrap(SSP)->clearDeadEntries();
331}
332
336}
337
340 LLVMOrcCJITDylibSearchOrder SearchOrder, size_t SearchOrderSize,
341 LLVMOrcCLookupSet Symbols, size_t SymbolsSize,
343 assert(ES && "ES cannot be null");
344 assert(SearchOrder && "SearchOrder cannot be null");
345 assert(Symbols && "Symbols cannot be null");
346 assert(HandleResult && "HandleResult cannot be null");
347
349 for (size_t I = 0; I != SearchOrderSize; ++I)
350 SO.push_back({unwrap(SearchOrder[I].JD),
351 toJITDylibLookupFlags(SearchOrder[I].JDLookupFlags)});
352
353 SymbolLookupSet SLS;
354 for (size_t I = 0; I != SymbolsSize; ++I)
355 SLS.add(unwrap(Symbols[I].Name).moveToSymbolStringPtr(),
356 toSymbolLookupFlags(Symbols[I].LookupFlags));
357
358 unwrap(ES)->lookup(
359 toLookupKind(K), SO, std::move(SLS), SymbolState::Ready,
360 [HandleResult, Ctx](Expected<SymbolMap> Result) {
361 if (Result) {
363 for (auto &KV : *Result)
365 wrap(SymbolStringPoolEntryUnsafe::from(KV.first)),
366 fromExecutorSymbolDef(KV.second)});
367 HandleResult(LLVMErrorSuccess, CResult.data(), CResult.size(), Ctx);
368 } else
369 HandleResult(wrap(Result.takeError()), nullptr, 0, Ctx);
370 },
372}
373
375 unwrap(S).retain();
376}
377
379 unwrap(S).release();
380}
381
383 return unwrap(S).rawPtr()->getKey().data();
384}
385
388 auto RT = unwrap(JD)->createResourceTracker();
389 // Retain the pointer for the C API client.
390 RT->Retain();
391 return wrap(RT.get());
392}
393
396 auto RT = unwrap(JD)->getDefaultResourceTracker();
397 // Retain the pointer for the C API client.
398 return wrap(RT.get());
399}
400
402 ResourceTrackerSP TmpRT(unwrap(RT));
403 TmpRT->Release();
404}
405
408 ResourceTrackerSP TmpRT(unwrap(SrcRT));
409 TmpRT->transferTo(*unwrap(DstRT));
410}
411
413 ResourceTrackerSP TmpRT(unwrap(RT));
414 return wrap(TmpRT->remove());
415}
416
418 std::unique_ptr<DefinitionGenerator> TmpDG(unwrap(DG));
419}
420
422 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
423}
424
426 const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms,
427 size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym,
431 SymbolFlagsMap SFM;
432 for (size_t I = 0; I != NumSyms; ++I)
433 SFM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] =
434 toJITSymbolFlags(Syms[I].Flags);
435
436 auto IS = unwrap(InitSym).moveToSymbolStringPtr();
437
438 return wrap(new OrcCAPIMaterializationUnit(
439 Name, std::move(SFM), std::move(IS), Ctx, Materialize, Discard, Destroy));
440}
441
444 SymbolMap SM = toSymbolMap(Syms, NumPairs);
445 return wrap(absoluteSymbols(std::move(SM)).release());
446}
447
450 LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases,
451 size_t NumPairs) {
452
453 SymbolAliasMap SAM;
454 for (size_t I = 0; I != NumPairs; ++I) {
455 auto pair = CallableAliases[I];
456 JITSymbolFlags Flags = toJITSymbolFlags(pair.Entry.Flags);
458 SAM[unwrap(pair.Name).moveToSymbolStringPtr()] =
460 }
461
462 return wrap(lazyReexports(*unwrap(LCTM), *unwrap(ISM), *unwrap(SourceJD),
463 std::move(SAM))
464 .release());
465}
466
469 std::unique_ptr<MaterializationResponsibility> TmpMR(unwrap(MR));
470}
471
474 return wrap(&unwrap(MR)->getTargetJITDylib());
475}
476
480 return wrap(&unwrap(MR)->getExecutionSession());
481}
482
484 LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs) {
485
486 auto Symbols = unwrap(MR)->getSymbols();
488 safe_malloc(Symbols.size() * sizeof(LLVMOrcCSymbolFlagsMapPair)));
489 size_t I = 0;
490 for (auto const &pair : Symbols) {
491 auto Name = wrap(SymbolStringPoolEntryUnsafe::from(pair.first));
492 auto Flags = pair.second;
493 Result[I] = {Name, fromJITSymbolFlags(Flags)};
494 I++;
495 }
496 *NumPairs = Symbols.size();
497 return Result;
498}
499
501 free(Pairs);
502}
503
507 auto Sym = unwrap(MR)->getInitializerSymbol();
509}
510
513 LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols) {
514
515 auto Symbols = unwrap(MR)->getRequestedSymbols();
518 Symbols.size() * sizeof(LLVMOrcSymbolStringPoolEntryRef)));
519 size_t I = 0;
520 for (auto &Name : Symbols) {
522 I++;
523 }
524 *NumSymbols = Symbols.size();
525 return Result;
526}
527
529 free(Symbols);
530}
531
534 size_t NumSymbols) {
535 SymbolMap SM = toSymbolMap(Symbols, NumSymbols);
536 return wrap(unwrap(MR)->notifyResolved(std::move(SM)));
537}
538
541 LLVMOrcCSymbolDependenceGroup *SymbolDepGroups, size_t NumSymbolDepGroups) {
542 std::vector<SymbolDependenceGroup> SDGs;
543 SDGs.reserve(NumSymbolDepGroups);
544 for (size_t I = 0; I != NumSymbolDepGroups; ++I) {
545 SDGs.push_back(SymbolDependenceGroup());
546 auto &SDG = SDGs.back();
547 SDG.Symbols = toSymbolNameSet(SymbolDepGroups[I].Symbols);
548 SDG.Dependencies = toSymbolDependenceMap(
549 SymbolDepGroups[I].Dependencies, SymbolDepGroups[I].NumDependencies);
550 }
551 return wrap(unwrap(MR)->notifyEmitted(SDGs));
552}
553
556 LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms) {
557 SymbolFlagsMap SFM;
558 for (size_t I = 0; I != NumSyms; ++I)
559 SFM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] =
560 toJITSymbolFlags(Syms[I].Flags);
561
562 return wrap(unwrap(MR)->defineMaterializing(std::move(SFM)));
563}
564
568 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
569 return wrap(unwrap(MR)->replace(std::move(TmpMU)));
570}
571
574 LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols,
576 SymbolNameSet Syms;
577 for (size_t I = 0; I != NumSymbols; I++) {
578 Syms.insert(unwrap(Symbols[I]).moveToSymbolStringPtr());
579 }
580 auto OtherMR = unwrap(MR)->delegate(Syms);
581
582 if (!OtherMR) {
583 return wrap(OtherMR.takeError());
584 }
585 *Result = wrap(OtherMR->release());
586 return LLVMErrorSuccess;
587}
588
591 unwrap(MR)->failMaterialization();
592}
593
597 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
598 unwrap(IRLayer)->emit(
599 std::unique_ptr<MaterializationResponsibility>(unwrap(MR)),
600 std::move(*TmpTSM));
601}
602
605 const char *Name) {
606 return wrap(&unwrap(ES)->createBareJITDylib(Name));
607}
608
612 const char *Name) {
613 auto JD = unwrap(ES)->createJITDylib(Name);
614 if (!JD)
615 return wrap(JD.takeError());
616 *Result = wrap(&*JD);
617 return LLVMErrorSuccess;
618}
619
622 const char *Name) {
623 return wrap(unwrap(ES)->getJITDylibByName(Name));
624}
625
628 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
629
630 if (auto Err = unwrap(JD)->define(TmpMU)) {
631 TmpMU.release();
632 return wrap(std::move(Err));
633 }
634 return LLVMErrorSuccess;
635}
636
638 return wrap(unwrap(JD)->clear());
639}
640
643 unwrap(JD)->addGenerator(std::unique_ptr<DefinitionGenerator>(unwrap(DG)));
644}
645
649 auto DG = std::make_unique<CAPIDefinitionGenerator>(Dispose, Ctx, F);
650 return wrap(DG.release());
651}
652
654 LLVMErrorRef Err) {
655 LookupState LS;
657 LS.continueLookup(unwrap(Err));
658}
659
662 LLVMOrcSymbolPredicate Filter, void *FilterCtx) {
663 assert(Result && "Result can not be null");
664 assert((Filter || !FilterCtx) &&
665 "if Filter is null then FilterCtx must also be null");
666
668 if (Filter)
669 Pred = [=](const SymbolStringPtr &Name) -> bool {
671 };
672
673 auto ProcessSymsGenerator =
675
676 if (!ProcessSymsGenerator) {
677 *Result = nullptr;
678 return wrap(ProcessSymsGenerator.takeError());
679 }
680
681 *Result = wrap(ProcessSymsGenerator->release());
682 return LLVMErrorSuccess;
683}
684
686 LLVMOrcDefinitionGeneratorRef *Result, const char *FileName,
687 char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx) {
688 assert(Result && "Result can not be null");
689 assert(FileName && "FileName can not be null");
690 assert((Filter || !FilterCtx) &&
691 "if Filter is null then FilterCtx must also be null");
692
694 if (Filter)
695 Pred = [=](const SymbolStringPtr &Name) -> bool {
697 };
698
699 auto LibrarySymsGenerator =
701
702 if (!LibrarySymsGenerator) {
703 *Result = nullptr;
704 return wrap(LibrarySymsGenerator.takeError());
705 }
706
707 *Result = wrap(LibrarySymsGenerator->release());
708 return LLVMErrorSuccess;
709}
710
713 const char *FileName) {
714 assert(Result && "Result can not be null");
715 assert(FileName && "Filename can not be null");
716 assert(ObjLayer && "ObjectLayer can not be null");
717
718 auto LibrarySymsGenerator =
720 if (!LibrarySymsGenerator) {
721 *Result = nullptr;
722 return wrap(LibrarySymsGenerator.takeError());
723 }
724 *Result = wrap(LibrarySymsGenerator->release());
725 return LLVMErrorSuccess;
726}
727
729 return wrap(new ThreadSafeContext(std::make_unique<LLVMContext>()));
730}
731
734 return wrap(new ThreadSafeContext(std::unique_ptr<LLVMContext>(unwrap(Ctx))));
735}
736
738 delete unwrap(TSCtx);
739}
740
744 void *Ctx) {
745 return wrap(unwrap(TSM)->withModuleDo(
746 [&](Module &M) { return unwrap(F(Ctx, wrap(&M))); }));
747}
748
752 return wrap(
753 new ThreadSafeModule(std::unique_ptr<Module>(unwrap(M)), *unwrap(TSCtx)));
754}
755
757 delete unwrap(TSM);
758}
759
762 assert(Result && "Result can not be null");
763
765 if (!JTMB) {
766 Result = nullptr;
767 return wrap(JTMB.takeError());
768 }
769
770 *Result = wrap(new JITTargetMachineBuilder(std::move(*JTMB)));
771 return LLVMErrorSuccess;
772}
773
776 auto *TemplateTM = unwrap(TM);
777
778 auto JTMB =
779 std::make_unique<JITTargetMachineBuilder>(TemplateTM->getTargetTriple());
780
781 (*JTMB)
782 .setCPU(TemplateTM->getTargetCPU().str())
783 .setRelocationModel(TemplateTM->getRelocationModel())
784 .setCodeModel(TemplateTM->getCodeModel())
785 .setCodeGenOptLevel(TemplateTM->getOptLevel())
786 .setFeatures(TemplateTM->getTargetFeatureString())
787 .setOptions(TemplateTM->Options);
788
790
791 return wrap(JTMB.release());
792}
793
796 delete unwrap(JTMB);
797}
798
801 auto Tmp = unwrap(JTMB)->getTargetTriple().str();
802 char *TargetTriple = (char *)malloc(Tmp.size() + 1);
803 strcpy(TargetTriple, Tmp.c_str());
804 return TargetTriple;
805}
806
808 LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple) {
809 unwrap(JTMB)->getTargetTriple() = Triple(TargetTriple);
810}
811
814 LLVMMemoryBufferRef ObjBuffer) {
815 return wrap(unwrap(ObjLayer)->add(
816 *unwrap(JD), std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
817}
818
821 LLVMMemoryBufferRef ObjBuffer) {
822 return wrap(
823 unwrap(ObjLayer)->add(ResourceTrackerSP(unwrap(RT)),
824 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
825}
826
829 LLVMMemoryBufferRef ObjBuffer) {
830 unwrap(ObjLayer)->emit(
831 std::unique_ptr<MaterializationResponsibility>(unwrap(R)),
832 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer)));
833}
834
836 delete unwrap(ObjLayer);
837}
838
841 LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx) {
843 ->setTransform(
844 [=](ThreadSafeModule TSM,
847 wrap(new ThreadSafeModule(std::move(TSM)));
848 if (LLVMErrorRef Err = TransformFunction(Ctx, &TSMRef, wrap(&R))) {
849 assert(!TSMRef && "TSMRef was not reset to null on error");
850 return unwrap(Err);
851 }
852 assert(TSMRef && "Transform succeeded, but TSMRef was set to null");
853 ThreadSafeModule Result = std::move(*unwrap(TSMRef));
855 return std::move(Result);
856 });
857}
858
860 LLVMOrcObjectTransformLayerRef ObjTransformLayer,
861 LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx) {
862 unwrap(ObjTransformLayer)
863 ->setTransform([TransformFunction, Ctx](std::unique_ptr<MemoryBuffer> Obj)
864 -> Expected<std::unique_ptr<MemoryBuffer>> {
865 LLVMMemoryBufferRef ObjBuffer = wrap(Obj.release());
866 if (LLVMErrorRef Err = TransformFunction(Ctx, &ObjBuffer)) {
867 assert(!ObjBuffer && "ObjBuffer was not reset to null on error");
868 return unwrap(Err);
869 }
870 return std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer));
871 });
872}
873
875 const char *IdentifierOverride) {
876 assert(DumpDir && "DumpDir should not be null");
877 assert(IdentifierOverride && "IdentifierOverride should not be null");
878 return wrap(new DumpObjects(DumpDir, IdentifierOverride));
879}
880
882 delete unwrap(DumpObjects);
883}
884
886 LLVMMemoryBufferRef *ObjBuffer) {
887 std::unique_ptr<MemoryBuffer> OB(unwrap(*ObjBuffer));
888 if (auto Result = (*unwrap(DumpObjects))(std::move(OB))) {
889 *ObjBuffer = wrap(Result->release());
890 return LLVMErrorSuccess;
891 } else {
892 *ObjBuffer = nullptr;
893 return wrap(Result.takeError());
894 }
895}
896
898 return wrap(new LLJITBuilder());
899}
900
902 delete unwrap(Builder);
903}
904
907 unwrap(Builder)->setJITTargetMachineBuilder(std::move(*unwrap(JTMB)));
909}
910
914 unwrap(Builder)->setObjectLinkingLayerCreator([=](ExecutionSession &ES) {
915 auto TTStr = ES.getTargetTriple().str();
916 return std::unique_ptr<ObjectLayer>(
917 unwrap(F(Ctx, wrap(&ES), TTStr.c_str())));
918 });
919}
920
922 LLVMOrcLLJITBuilderRef Builder) {
923 assert(Result && "Result can not be null");
924
925 if (!Builder)
926 Builder = LLVMOrcCreateLLJITBuilder();
927
928 auto J = unwrap(Builder)->create();
930
931 if (!J) {
932 Result = nullptr;
933 return wrap(J.takeError());
934 }
935
936 *Result = wrap(J->release());
937 return LLVMErrorSuccess;
938}
939
941 delete unwrap(J);
942 return LLVMErrorSuccess;
943}
944
946 return wrap(&unwrap(J)->getExecutionSession());
947}
948
950 return wrap(&unwrap(J)->getMainJITDylib());
951}
952
954 return unwrap(J)->getTargetTriple().str().c_str();
955}
956
958 return unwrap(J)->getDataLayout().getGlobalPrefix();
959}
960
962LLVMOrcLLJITMangleAndIntern(LLVMOrcLLJITRef J, const char *UnmangledName) {
964 unwrap(J)->mangleAndIntern(UnmangledName)));
965}
966
968 LLVMMemoryBufferRef ObjBuffer) {
969 return wrap(unwrap(J)->addObjectFile(
970 *unwrap(JD), std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
971}
972
975 LLVMMemoryBufferRef ObjBuffer) {
976 return wrap(unwrap(J)->addObjectFile(
978 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
979}
980
984 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
985 return wrap(unwrap(J)->addIRModule(*unwrap(JD), std::move(*TmpTSM)));
986}
987
991 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
992 return wrap(unwrap(J)->addIRModule(ResourceTrackerSP(unwrap(RT)),
993 std::move(*TmpTSM)));
994}
995
998 const char *Name) {
999 assert(Result && "Result can not be null");
1000
1001 auto Sym = unwrap(J)->lookup(Name);
1002 if (!Sym) {
1003 *Result = 0;
1004 return wrap(Sym.takeError());
1005 }
1006
1007 *Result = Sym->getValue();
1008 return LLVMErrorSuccess;
1009}
1010
1012 return wrap(&unwrap(J)->getObjLinkingLayer());
1013}
1014
1017 return wrap(&unwrap(J)->getObjTransformLayer());
1018}
1019
1023 assert(ES && "ES must not be null");
1024 return wrap(
1025 new RTDyldObjectLinkingLayer(*unwrap(ES), [](const MemoryBuffer &) {
1026 return std::make_unique<SectionMemoryManager>();
1027 }));
1028}
1029
1032 LLVMOrcExecutionSessionRef ES, void *CreateContextCtx,
1039
1040 struct MCJITMemoryManagerLikeCallbacks {
1041 MCJITMemoryManagerLikeCallbacks() = default;
1042 MCJITMemoryManagerLikeCallbacks(
1043 void *CreateContextCtx,
1050 : CreateContextCtx(CreateContextCtx), CreateContext(CreateContext),
1051 NotifyTerminating(NotifyTerminating),
1052 AllocateCodeSection(AllocateCodeSection),
1053 AllocateDataSection(AllocateDataSection),
1054 FinalizeMemory(FinalizeMemory), Destroy(Destroy) {}
1055
1056 MCJITMemoryManagerLikeCallbacks(MCJITMemoryManagerLikeCallbacks &&Other) {
1057 std::swap(CreateContextCtx, Other.CreateContextCtx);
1058 std::swap(CreateContext, Other.CreateContext);
1059 std::swap(NotifyTerminating, Other.NotifyTerminating);
1060 std::swap(AllocateCodeSection, Other.AllocateCodeSection);
1061 std::swap(AllocateDataSection, Other.AllocateDataSection);
1062 std::swap(FinalizeMemory, Other.FinalizeMemory);
1063 std::swap(Destroy, Other.Destroy);
1064 }
1065
1066 ~MCJITMemoryManagerLikeCallbacks() {
1067 if (NotifyTerminating)
1068 NotifyTerminating(CreateContextCtx);
1069 }
1070
1071 void *CreateContextCtx = nullptr;
1072 LLVMMemoryManagerCreateContextCallback CreateContext = nullptr;
1073 LLVMMemoryManagerNotifyTerminatingCallback NotifyTerminating = nullptr;
1074 LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection = nullptr;
1075 LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection = nullptr;
1076 LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory = nullptr;
1077 LLVMMemoryManagerDestroyCallback Destroy = nullptr;
1078 };
1079
1080 class MCJITMemoryManagerLikeCallbacksMemMgr : public RTDyldMemoryManager {
1081 public:
1082 MCJITMemoryManagerLikeCallbacksMemMgr(
1083 const MCJITMemoryManagerLikeCallbacks &CBs)
1084 : CBs(CBs) {
1085 Opaque = CBs.CreateContext(CBs.CreateContextCtx);
1086 }
1087 ~MCJITMemoryManagerLikeCallbacksMemMgr() override { CBs.Destroy(Opaque); }
1088
1089 uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
1090 unsigned SectionID,
1091 StringRef SectionName) override {
1092 return CBs.AllocateCodeSection(Opaque, Size, Alignment, SectionID,
1093 SectionName.str().c_str());
1094 }
1095
1096 uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
1097 unsigned SectionID, StringRef SectionName,
1098 bool isReadOnly) override {
1099 return CBs.AllocateDataSection(Opaque, Size, Alignment, SectionID,
1100 SectionName.str().c_str(), isReadOnly);
1101 }
1102
1103 bool finalizeMemory(std::string *ErrMsg) override {
1104 char *ErrMsgCString = nullptr;
1105 bool Result = CBs.FinalizeMemory(Opaque, &ErrMsgCString);
1106 assert((Result || !ErrMsgCString) &&
1107 "Did not expect an error message if FinalizeMemory succeeded");
1108 if (ErrMsgCString) {
1109 if (ErrMsg)
1110 *ErrMsg = ErrMsgCString;
1111 free(ErrMsgCString);
1112 }
1113 return Result;
1114 }
1115
1116 private:
1117 const MCJITMemoryManagerLikeCallbacks &CBs;
1118 void *Opaque = nullptr;
1119 };
1120
1121 assert(ES && "ES must not be null");
1122 assert(CreateContext && "CreateContext must not be null");
1123 assert(NotifyTerminating && "NotifyTerminating must not be null");
1124 assert(AllocateCodeSection && "AllocateCodeSection must not be null");
1125 assert(AllocateDataSection && "AllocateDataSection must not be null");
1126 assert(FinalizeMemory && "FinalizeMemory must not be null");
1127 assert(Destroy && "Destroy must not be null");
1128
1129 MCJITMemoryManagerLikeCallbacks CBs(
1130 CreateContextCtx, CreateContext, NotifyTerminating, AllocateCodeSection,
1131 AllocateDataSection, FinalizeMemory, Destroy);
1132
1133 return wrap(new RTDyldObjectLinkingLayer(
1134 *unwrap(ES), [CBs = std::move(CBs)](const MemoryBuffer &) {
1135 return std::make_unique<MCJITMemoryManagerLikeCallbacksMemMgr>(CBs);
1136 }));
1137
1138 return nullptr;
1139}
1140
1142 LLVMOrcObjectLayerRef RTDyldObjLinkingLayer,
1143 LLVMJITEventListenerRef Listener) {
1144 assert(RTDyldObjLinkingLayer && "RTDyldObjLinkingLayer must not be null");
1145 assert(Listener && "Listener must not be null");
1146 reinterpret_cast<RTDyldObjectLinkingLayer *>(unwrap(RTDyldObjLinkingLayer))
1147 ->registerJITEventListener(*unwrap(Listener));
1148}
1149
1151 return wrap(&unwrap(J)->getIRTransformLayer());
1152}
1153
1155 return unwrap(J)->getDataLayout().getStringRepresentation().c_str();
1156}
1157
1160 auto builder = createLocalIndirectStubsManagerBuilder(Triple(TargetTriple));
1161 return wrap(builder().release());
1162}
1163
1165 std::unique_ptr<IndirectStubsManager> TmpISM(unwrap(ISM));
1166}
1167
1169 const char *TargetTriple, LLVMOrcExecutionSessionRef ES,
1170 LLVMOrcJITTargetAddress ErrorHandlerAddr,
1173 Triple(TargetTriple), *unwrap(ES), ExecutorAddr(ErrorHandlerAddr));
1174
1175 if (!LCTM)
1176 return wrap(LCTM.takeError());
1177 *Result = wrap(LCTM->release());
1178 return LLVMErrorSuccess;
1179}
1180
1183 std::unique_ptr<LazyCallThroughManager> TmpLCM(unwrap(LCM));
1184}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
@ GlobalPrefix
Definition: AsmWriter.cpp:435
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
std::string Name
uint64_t Size
std::optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1328
Symbol * Sym
Definition: ELF_riscv.cpp:479
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
LLVM_C_EXTERN_C_BEGIN typedef void *(* LLVMMemoryManagerCreateContextCallback)(void *CtxCtx)
Definition: OrcEE.h:36
void(* LLVMMemoryManagerNotifyTerminatingCallback)(void *CtxCtx)
Definition: OrcEE.h:37
LLVMOrcSymbolStringPoolEntryRef wrap(SymbolStringPoolEntryUnsafe E)
SymbolStringPoolEntryUnsafe unwrap(LLVMOrcSymbolStringPoolEntryRef E)
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
@ MaterializationSideEffectsOnly
Definition: JITSymbol.h:88
This interface provides simple read-only access to a block of memory, and provides simple methods for...
Definition: MemoryBuffer.h:52
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
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.
size_t size() const
Definition: SmallVector.h:79
void push_back(const T &Elt)
Definition: SmallVector.h:414
pointer data()
Return a pointer to the vector's buffer, even if empty().
Definition: SmallVector.h:287
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1197
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
StringRef getKey() const
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:55
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:148
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:83
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:47
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:194
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:859
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:1355
const Triple & getTargetTriple() const
Return the triple for the executor.
Definition: Core.h:1398
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:68
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:902
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:513
A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
Definition: LLJIT.h:42
Manages a set of 'lazy call-through' trampolines.
Definition: LazyReexports.h:40
Wraps state for a lookup-in-progress.
Definition: Core.h:834
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:576
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:134
static InProgressLookupState * extractLookupState(LookupState &LS)
static void resetLookupState(LookupState &LS, InProgressLookupState *IPLS)
API to remove / transfer ownership of JIT resources.
Definition: Core.h:78
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:59
LLVM_ABI Error remove()
Remove all resources associated with this key.
Definition: Core.cpp:55
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.
Definition: Core.h:195
UnderlyingVector::size_type size() const
Definition: Core.h:276
SymbolLookupSet & add(SymbolStringPtr Name, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
Add an element to the set.
Definition: Core.h:261
Provides unsafe access to ownership operations on SymbolStringPtr.
static SymbolStringPoolEntryUnsafe from(const SymbolStringPtr &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.
SymbolStringPtr moveToSymbolStringPtr()
Creates a SymbolStringPtr for this entry without performing a retain operation during construction.
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.
#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:67
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:56
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:62
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.
void LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(LLVMOrcObjectLayerRef RTDyldObjLinkingLayer, LLVMJITEventListenerRef Listener)
Add the given listener to the given RTDyldObjectLinkingLayer.
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.
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...
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)
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.
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.
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
LLVMOrcSymbolLookupFlags
Symbol lookup flags for lookup sets.
Definition: Orc.h:236
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)
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
Definition: TargetMachine.h:36
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)
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:174
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP
Definition: Core.h:52
SymbolLookupFlags
Lookup flags that apply to each symbol in a lookup.
Definition: Core.h:157
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
Definition: Core.h:147
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:169
LLVM_ABI RegisterDependenciesFunction NoDependenciesToRegister
This can be used as the value for a RegisterDependenciesFunction if there are no dependants to regist...
Definition: Core.cpp:38
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
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
Attribute unwrap(LLVMAttributeRef Attr)
Definition: Attributes.h:351
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:1879
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:1886
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:346
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:856
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:858
Represents an evaluated symbol address and flags.
Definition: Orc.h:81
Represents the linkage flags for a symbol definition.
Definition: Orc.h:73
Represents a pair of a JITDylib and LLVMOrcCSymbolsList.
Definition: Orc.h:174
LLVMOrcCSymbolsList Names
Definition: Orc.h:176
An element type for a JITDylib search order.
Definition: Orc.h:219
An element type for a symbol lookup set.
Definition: Orc.h:244
Represents a pair of a symbol name and SymbolAliasMapEntry.
Definition: Orc.h:146
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:564