LLVM 19.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
19
20using namespace llvm;
21using namespace llvm::orc;
22
23namespace llvm {
24namespace orc {
25
27
29public:
31 return LS.IPLS.release();
32 }
33
35 return LS.reset(IPLS);
36 }
37};
38
39} // namespace orc
40} // namespace llvm
41
43 return reinterpret_cast<LLVMOrcSymbolStringPoolEntryRef>(E.rawPtr());
44}
45
47 return reinterpret_cast<SymbolStringPoolEntryUnsafe::PoolEntry *>(E);
48}
49
78
79namespace {
80
82public:
84 std::string Name, SymbolFlagsMap InitialSymbolFlags,
85 SymbolStringPtr InitSymbol, void *Ctx,
90 Interface(std::move(InitialSymbolFlags), std::move(InitSymbol))),
91 Name(std::move(Name)), Ctx(Ctx), Materialize(Materialize),
92 Discard(Discard), Destroy(Destroy) {}
93
95 if (Ctx)
96 Destroy(Ctx);
97 }
98
99 StringRef getName() const override { return Name; }
100
101 void materialize(std::unique_ptr<MaterializationResponsibility> R) override {
102 void *Tmp = Ctx;
103 Ctx = nullptr;
104 Materialize(Tmp, wrap(R.release()));
105 }
106
107private:
108 void discard(const JITDylib &JD, const SymbolStringPtr &Name) override {
109 Discard(Ctx, wrap(&JD), wrap(SymbolStringPoolEntryUnsafe::from(Name)));
110 }
111
112 std::string Name;
113 void *Ctx = nullptr;
117};
118
120
121 JITSymbolFlags JSF;
122
123 if (F.GenericFlags & LLVMJITSymbolGenericFlagsExported)
125 if (F.GenericFlags & LLVMJITSymbolGenericFlagsWeak)
127 if (F.GenericFlags & LLVMJITSymbolGenericFlagsCallable)
131
132 JSF.getTargetFlags() = F.TargetFlags;
133
134 return JSF;
135}
136
138 LLVMJITSymbolFlags F = {0, 0};
139 if (JSF & JITSymbolFlags::Exported)
140 F.GenericFlags |= LLVMJITSymbolGenericFlagsExported;
141 if (JSF & JITSymbolFlags::Weak)
142 F.GenericFlags |= LLVMJITSymbolGenericFlagsWeak;
143 if (JSF & JITSymbolFlags::Callable)
144 F.GenericFlags |= LLVMJITSymbolGenericFlagsCallable;
147
148 F.TargetFlags = JSF.getTargetFlags();
149
150 return F;
151}
152
155 Result.reserve(Symbols.Length);
156 for (size_t I = 0; I != Symbols.Length; ++I)
157 Result.insert(unwrap(Symbols.Symbols[I]).moveToSymbolStringPtr());
158 return Result;
159}
160
161static SymbolMap toSymbolMap(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs) {
162 SymbolMap SM;
163 for (size_t I = 0; I != NumPairs; ++I) {
164 JITSymbolFlags Flags = toJITSymbolFlags(Syms[I].Sym.Flags);
165 SM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] = {
166 ExecutorAddr(Syms[I].Sym.Address), Flags};
167 }
168 return SM;
169}
170
174 for (size_t I = 0; I != NumPairs; ++I) {
175 JITDylib *JD = unwrap(Pairs[I].JD);
176 SymbolNameSet Names;
177
178 for (size_t J = 0; J != Pairs[I].Names.Length; ++J) {
179 auto Sym = Pairs[I].Names.Symbols[J];
180 Names.insert(unwrap(Sym).moveToSymbolStringPtr());
181 }
182 SDM[JD] = Names;
183 }
184 return SDM;
185}
186
188 switch (K) {
190 return LookupKind::Static;
192 return LookupKind::DLSym;
193 }
194 llvm_unreachable("unrecognized LLVMOrcLookupKind value");
195}
196
198 switch (K) {
199 case LookupKind::Static:
201 case LookupKind::DLSym:
203 }
204 llvm_unreachable("unrecognized LookupKind value");
205}
206
209 switch (LF) {
211 return JITDylibLookupFlags::MatchExportedSymbolsOnly;
213 return JITDylibLookupFlags::MatchAllSymbols;
214 }
215 llvm_unreachable("unrecognized LLVMOrcJITDylibLookupFlags value");
216}
217
220 switch (LF) {
221 case JITDylibLookupFlags::MatchExportedSymbolsOnly:
223 case JITDylibLookupFlags::MatchAllSymbols:
225 }
226 llvm_unreachable("unrecognized JITDylibLookupFlags value");
227}
228
230 switch (SLF) {
232 return SymbolLookupFlags::RequiredSymbol;
234 return SymbolLookupFlags::WeaklyReferencedSymbol;
235 }
236 llvm_unreachable("unrecognized LLVMOrcSymbolLookupFlags value");
237}
238
240 switch (SLF) {
241 case SymbolLookupFlags::RequiredSymbol:
243 case SymbolLookupFlags::WeaklyReferencedSymbol:
245 }
246 llvm_unreachable("unrecognized SymbolLookupFlags value");
247}
248
251 return {S.getAddress().getValue(), fromJITSymbolFlags(S.getFlags())};
252}
253
254} // end anonymous namespace
255
256namespace llvm {
257namespace orc {
258
260public:
264 : Dispose(Dispose), Ctx(Ctx), TryToGenerate(TryToGenerate) {}
265
267 if (Dispose)
268 Dispose(Ctx);
269 }
270
272 JITDylibLookupFlags JDLookupFlags,
273 const SymbolLookupSet &LookupSet) override {
274
275 // Take the lookup state.
277
278 // Translate the lookup kind.
279 LLVMOrcLookupKind CLookupKind = fromLookupKind(K);
280
281 // Translate the JITDylibLookupFlags.
282 LLVMOrcJITDylibLookupFlags CJDLookupFlags =
283 fromJITDylibLookupFlags(JDLookupFlags);
284
285 // Translate the lookup set.
286 std::vector<LLVMOrcCLookupSetElement> CLookupSet;
287 CLookupSet.reserve(LookupSet.size());
288 for (auto &KV : LookupSet) {
291 LLVMOrcSymbolLookupFlags SLF = fromSymbolLookupFlags(KV.second);
292 CLookupSet.push_back({Name, SLF});
293 }
294
295 // Run the C TryToGenerate function.
296 auto Err = unwrap(TryToGenerate(::wrap(this), Ctx, &LSR, CLookupKind,
297 ::wrap(&JD), CJDLookupFlags,
298 CLookupSet.data(), CLookupSet.size()));
299
300 // Restore the lookup state.
302
303 return Err;
304 }
305
306private:
308 void *Ctx;
310};
311
312} // end namespace orc
313} // end namespace llvm
314
317 void *Ctx) {
318 unwrap(ES)->setErrorReporter(
319 [=](Error Err) { ReportError(Ctx, wrap(std::move(Err))); });
320}
321
324 return wrap(
325 unwrap(ES)->getExecutorProcessControl().getSymbolStringPool().get());
326}
327
329 unwrap(SSP)->clearDeadEntries();
330}
331
335}
336
339 LLVMOrcCJITDylibSearchOrder SearchOrder, size_t SearchOrderSize,
340 LLVMOrcCLookupSet Symbols, size_t SymbolsSize,
342 assert(ES && "ES cannot be null");
343 assert(SearchOrder && "SearchOrder cannot be null");
344 assert(Symbols && "Symbols cannot be null");
345 assert(HandleResult && "HandleResult cannot be null");
346
348 for (size_t I = 0; I != SearchOrderSize; ++I)
349 SO.push_back({unwrap(SearchOrder[I].JD),
350 toJITDylibLookupFlags(SearchOrder[I].JDLookupFlags)});
351
352 SymbolLookupSet SLS;
353 for (size_t I = 0; I != SymbolsSize; ++I)
354 SLS.add(unwrap(Symbols[I].Name).moveToSymbolStringPtr(),
355 toSymbolLookupFlags(Symbols[I].LookupFlags));
356
357 unwrap(ES)->lookup(
358 toLookupKind(K), SO, std::move(SLS), SymbolState::Ready,
359 [HandleResult, Ctx](Expected<SymbolMap> Result) {
360 if (Result) {
362 for (auto &KV : *Result)
364 wrap(SymbolStringPoolEntryUnsafe::from(KV.first)),
365 fromExecutorSymbolDef(KV.second)});
366 HandleResult(LLVMErrorSuccess, CResult.data(), CResult.size(), Ctx);
367 } else
368 HandleResult(wrap(Result.takeError()), nullptr, 0, Ctx);
369 },
371}
372
374 unwrap(S).retain();
375}
376
378 unwrap(S).release();
379}
380
382 return unwrap(S).rawPtr()->getKey().data();
383}
384
387 auto RT = unwrap(JD)->createResourceTracker();
388 // Retain the pointer for the C API client.
389 RT->Retain();
390 return wrap(RT.get());
391}
392
395 auto RT = unwrap(JD)->getDefaultResourceTracker();
396 // Retain the pointer for the C API client.
397 return wrap(RT.get());
398}
399
401 ResourceTrackerSP TmpRT(unwrap(RT));
402 TmpRT->Release();
403}
404
407 ResourceTrackerSP TmpRT(unwrap(SrcRT));
408 TmpRT->transferTo(*unwrap(DstRT));
409}
410
412 ResourceTrackerSP TmpRT(unwrap(RT));
413 return wrap(TmpRT->remove());
414}
415
417 std::unique_ptr<DefinitionGenerator> TmpDG(unwrap(DG));
418}
419
421 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
422}
423
425 const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms,
426 size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym,
430 SymbolFlagsMap SFM;
431 for (size_t I = 0; I != NumSyms; ++I)
432 SFM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] =
433 toJITSymbolFlags(Syms[I].Flags);
434
435 auto IS = unwrap(InitSym).moveToSymbolStringPtr();
436
437 return wrap(new OrcCAPIMaterializationUnit(
438 Name, std::move(SFM), std::move(IS), Ctx, Materialize, Discard, Destroy));
439}
440
443 SymbolMap SM = toSymbolMap(Syms, NumPairs);
444 return wrap(absoluteSymbols(std::move(SM)).release());
445}
446
449 LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases,
450 size_t NumPairs) {
451
452 SymbolAliasMap SAM;
453 for (size_t I = 0; I != NumPairs; ++I) {
454 auto pair = CallableAliases[I];
455 JITSymbolFlags Flags = toJITSymbolFlags(pair.Entry.Flags);
457 SAM[unwrap(pair.Name).moveToSymbolStringPtr()] =
459 }
460
461 return wrap(lazyReexports(*unwrap(LCTM), *unwrap(ISM), *unwrap(SourceJD),
462 std::move(SAM))
463 .release());
464}
465
468 std::unique_ptr<MaterializationResponsibility> TmpMR(unwrap(MR));
469}
470
473 return wrap(&unwrap(MR)->getTargetJITDylib());
474}
475
479 return wrap(&unwrap(MR)->getExecutionSession());
480}
481
483 LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs) {
484
485 auto Symbols = unwrap(MR)->getSymbols();
487 safe_malloc(Symbols.size() * sizeof(LLVMOrcCSymbolFlagsMapPair)));
488 size_t I = 0;
489 for (auto const &pair : Symbols) {
490 auto Name = wrap(SymbolStringPoolEntryUnsafe::from(pair.first));
491 auto Flags = pair.second;
492 Result[I] = {Name, fromJITSymbolFlags(Flags)};
493 I++;
494 }
495 *NumPairs = Symbols.size();
496 return Result;
497}
498
500 free(Pairs);
501}
502
506 auto Sym = unwrap(MR)->getInitializerSymbol();
508}
509
512 LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols) {
513
514 auto Symbols = unwrap(MR)->getRequestedSymbols();
517 Symbols.size() * sizeof(LLVMOrcSymbolStringPoolEntryRef)));
518 size_t I = 0;
519 for (auto &Name : Symbols) {
521 I++;
522 }
523 *NumSymbols = Symbols.size();
524 return Result;
525}
526
528 free(Symbols);
529}
530
533 size_t NumSymbols) {
534 SymbolMap SM = toSymbolMap(Symbols, NumSymbols);
535 return wrap(unwrap(MR)->notifyResolved(std::move(SM)));
536}
537
540 LLVMOrcCSymbolDependenceGroup *SymbolDepGroups, size_t NumSymbolDepGroups) {
541 std::vector<SymbolDependenceGroup> SDGs;
542 SDGs.reserve(NumSymbolDepGroups);
543 for (size_t I = 0; I != NumSymbolDepGroups; ++I) {
544 SDGs.push_back(SymbolDependenceGroup());
545 auto &SDG = SDGs.back();
546 SDG.Symbols = toSymbolNameSet(SymbolDepGroups[I].Symbols);
547 SDG.Dependencies = toSymbolDependenceMap(
548 SymbolDepGroups[I].Dependencies, SymbolDepGroups[I].NumDependencies);
549 }
550 return wrap(unwrap(MR)->notifyEmitted(SDGs));
551}
552
555 LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms) {
556 SymbolFlagsMap SFM;
557 for (size_t I = 0; I != NumSyms; ++I)
558 SFM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] =
559 toJITSymbolFlags(Syms[I].Flags);
560
561 return wrap(unwrap(MR)->defineMaterializing(std::move(SFM)));
562}
563
567 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
568 return wrap(unwrap(MR)->replace(std::move(TmpMU)));
569}
570
573 LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols,
575 SymbolNameSet Syms;
576 for (size_t I = 0; I != NumSymbols; I++) {
577 Syms.insert(unwrap(Symbols[I]).moveToSymbolStringPtr());
578 }
579 auto OtherMR = unwrap(MR)->delegate(Syms);
580
581 if (!OtherMR) {
582 return wrap(OtherMR.takeError());
583 }
584 *Result = wrap(OtherMR->release());
585 return LLVMErrorSuccess;
586}
587
590 unwrap(MR)->failMaterialization();
591}
592
596 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
597 unwrap(IRLayer)->emit(
598 std::unique_ptr<MaterializationResponsibility>(unwrap(MR)),
599 std::move(*TmpTSM));
600}
601
604 const char *Name) {
605 return wrap(&unwrap(ES)->createBareJITDylib(Name));
606}
607
611 const char *Name) {
612 auto JD = unwrap(ES)->createJITDylib(Name);
613 if (!JD)
614 return wrap(JD.takeError());
615 *Result = wrap(&*JD);
616 return LLVMErrorSuccess;
617}
618
621 const char *Name) {
622 return wrap(unwrap(ES)->getJITDylibByName(Name));
623}
624
627 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
628
629 if (auto Err = unwrap(JD)->define(TmpMU)) {
630 TmpMU.release();
631 return wrap(std::move(Err));
632 }
633 return LLVMErrorSuccess;
634}
635
637 return wrap(unwrap(JD)->clear());
638}
639
642 unwrap(JD)->addGenerator(std::unique_ptr<DefinitionGenerator>(unwrap(DG)));
643}
644
648 auto DG = std::make_unique<CAPIDefinitionGenerator>(Dispose, Ctx, F);
649 return wrap(DG.release());
650}
651
653 LLVMErrorRef Err) {
654 LookupState LS;
656 LS.continueLookup(unwrap(Err));
657}
658
661 LLVMOrcSymbolPredicate Filter, void *FilterCtx) {
662 assert(Result && "Result can not be null");
663 assert((Filter || !FilterCtx) &&
664 "if Filter is null then FilterCtx must also be null");
665
667 if (Filter)
668 Pred = [=](const SymbolStringPtr &Name) -> bool {
670 };
671
672 auto ProcessSymsGenerator =
674
675 if (!ProcessSymsGenerator) {
676 *Result = nullptr;
677 return wrap(ProcessSymsGenerator.takeError());
678 }
679
680 *Result = wrap(ProcessSymsGenerator->release());
681 return LLVMErrorSuccess;
682}
683
685 LLVMOrcDefinitionGeneratorRef *Result, const char *FileName,
686 char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx) {
687 assert(Result && "Result can not be null");
688 assert(FileName && "FileName can not be null");
689 assert((Filter || !FilterCtx) &&
690 "if Filter is null then FilterCtx must also be null");
691
693 if (Filter)
694 Pred = [=](const SymbolStringPtr &Name) -> bool {
696 };
697
698 auto LibrarySymsGenerator =
700
701 if (!LibrarySymsGenerator) {
702 *Result = nullptr;
703 return wrap(LibrarySymsGenerator.takeError());
704 }
705
706 *Result = wrap(LibrarySymsGenerator->release());
707 return LLVMErrorSuccess;
708}
709
712 const char *FileName) {
713 assert(Result && "Result can not be null");
714 assert(FileName && "Filename can not be null");
715 assert(ObjLayer && "ObjectLayer can not be null");
716
717 auto LibrarySymsGenerator =
719 if (!LibrarySymsGenerator) {
720 *Result = nullptr;
721 return wrap(LibrarySymsGenerator.takeError());
722 }
723 *Result = wrap(LibrarySymsGenerator->release());
724 return LLVMErrorSuccess;
725}
726
728 return wrap(new ThreadSafeContext(std::make_unique<LLVMContext>()));
729}
730
733 return wrap(unwrap(TSCtx)->getContext());
734}
735
737 delete unwrap(TSCtx);
738}
739
743 void *Ctx) {
744 return wrap(unwrap(TSM)->withModuleDo(
745 [&](Module &M) { return unwrap(F(Ctx, wrap(&M))); }));
746}
747
751 return wrap(
752 new ThreadSafeModule(std::unique_ptr<Module>(unwrap(M)), *unwrap(TSCtx)));
753}
754
756 delete unwrap(TSM);
757}
758
761 assert(Result && "Result can not be null");
762
764 if (!JTMB) {
765 Result = nullptr;
766 return wrap(JTMB.takeError());
767 }
768
769 *Result = wrap(new JITTargetMachineBuilder(std::move(*JTMB)));
770 return LLVMErrorSuccess;
771}
772
775 auto *TemplateTM = unwrap(TM);
776
777 auto JTMB =
778 std::make_unique<JITTargetMachineBuilder>(TemplateTM->getTargetTriple());
779
780 (*JTMB)
781 .setCPU(TemplateTM->getTargetCPU().str())
782 .setRelocationModel(TemplateTM->getRelocationModel())
783 .setCodeModel(TemplateTM->getCodeModel())
784 .setCodeGenOptLevel(TemplateTM->getOptLevel())
785 .setFeatures(TemplateTM->getTargetFeatureString())
786 .setOptions(TemplateTM->Options);
787
789
790 return wrap(JTMB.release());
791}
792
795 delete unwrap(JTMB);
796}
797
800 auto Tmp = unwrap(JTMB)->getTargetTriple().str();
801 char *TargetTriple = (char *)malloc(Tmp.size() + 1);
802 strcpy(TargetTriple, Tmp.c_str());
803 return TargetTriple;
804}
805
807 LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple) {
808 unwrap(JTMB)->getTargetTriple() = Triple(TargetTriple);
809}
810
813 LLVMMemoryBufferRef ObjBuffer) {
814 return wrap(unwrap(ObjLayer)->add(
815 *unwrap(JD), std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
816}
817
820 LLVMMemoryBufferRef ObjBuffer) {
821 return wrap(
822 unwrap(ObjLayer)->add(ResourceTrackerSP(unwrap(RT)),
823 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
824}
825
828 LLVMMemoryBufferRef ObjBuffer) {
829 unwrap(ObjLayer)->emit(
830 std::unique_ptr<MaterializationResponsibility>(unwrap(R)),
831 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer)));
832}
833
835 delete unwrap(ObjLayer);
836}
837
840 LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx) {
842 ->setTransform(
843 [=](ThreadSafeModule TSM,
846 wrap(new ThreadSafeModule(std::move(TSM)));
847 if (LLVMErrorRef Err = TransformFunction(Ctx, &TSMRef, wrap(&R))) {
848 assert(!TSMRef && "TSMRef was not reset to null on error");
849 return unwrap(Err);
850 }
851 assert(TSMRef && "Transform succeeded, but TSMRef was set to null");
852 ThreadSafeModule Result = std::move(*unwrap(TSMRef));
854 return std::move(Result);
855 });
856}
857
859 LLVMOrcObjectTransformLayerRef ObjTransformLayer,
860 LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx) {
861 unwrap(ObjTransformLayer)
862 ->setTransform([TransformFunction, Ctx](std::unique_ptr<MemoryBuffer> Obj)
863 -> Expected<std::unique_ptr<MemoryBuffer>> {
864 LLVMMemoryBufferRef ObjBuffer = wrap(Obj.release());
865 if (LLVMErrorRef Err = TransformFunction(Ctx, &ObjBuffer)) {
866 assert(!ObjBuffer && "ObjBuffer was not reset to null on error");
867 return unwrap(Err);
868 }
869 return std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer));
870 });
871}
872
874 const char *IdentifierOverride) {
875 assert(DumpDir && "DumpDir should not be null");
876 assert(IdentifierOverride && "IdentifierOverride should not be null");
877 return wrap(new DumpObjects(DumpDir, IdentifierOverride));
878}
879
881 delete unwrap(DumpObjects);
882}
883
885 LLVMMemoryBufferRef *ObjBuffer) {
886 std::unique_ptr<MemoryBuffer> OB(unwrap(*ObjBuffer));
887 if (auto Result = (*unwrap(DumpObjects))(std::move(OB))) {
888 *ObjBuffer = wrap(Result->release());
889 return LLVMErrorSuccess;
890 } else {
891 *ObjBuffer = nullptr;
892 return wrap(Result.takeError());
893 }
894}
895
897 return wrap(new LLJITBuilder());
898}
899
901 delete unwrap(Builder);
902}
903
906 unwrap(Builder)->setJITTargetMachineBuilder(std::move(*unwrap(JTMB)));
908}
909
913 unwrap(Builder)->setObjectLinkingLayerCreator(
914 [=](ExecutionSession &ES, const Triple &TT) {
915 auto TTStr = TT.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(new RTDyldObjectLinkingLayer(
1025 *unwrap(ES), [] { return std::make_unique<SectionMemoryManager>(); }));
1026}
1027
1030 LLVMOrcExecutionSessionRef ES, void *CreateContextCtx,
1037
1038 struct MCJITMemoryManagerLikeCallbacks {
1039 MCJITMemoryManagerLikeCallbacks() = default;
1040 MCJITMemoryManagerLikeCallbacks(
1041 void *CreateContextCtx,
1048 : CreateContextCtx(CreateContextCtx), CreateContext(CreateContext),
1049 NotifyTerminating(NotifyTerminating),
1050 AllocateCodeSection(AllocateCodeSection),
1051 AllocateDataSection(AllocateDataSection),
1052 FinalizeMemory(FinalizeMemory), Destroy(Destroy) {}
1053
1054 MCJITMemoryManagerLikeCallbacks(MCJITMemoryManagerLikeCallbacks &&Other) {
1055 std::swap(CreateContextCtx, Other.CreateContextCtx);
1056 std::swap(CreateContext, Other.CreateContext);
1057 std::swap(NotifyTerminating, Other.NotifyTerminating);
1058 std::swap(AllocateCodeSection, Other.AllocateCodeSection);
1059 std::swap(AllocateDataSection, Other.AllocateDataSection);
1060 std::swap(FinalizeMemory, Other.FinalizeMemory);
1061 std::swap(Destroy, Other.Destroy);
1062 }
1063
1064 ~MCJITMemoryManagerLikeCallbacks() {
1065 if (NotifyTerminating)
1066 NotifyTerminating(CreateContextCtx);
1067 }
1068
1069 void *CreateContextCtx = nullptr;
1070 LLVMMemoryManagerCreateContextCallback CreateContext = nullptr;
1071 LLVMMemoryManagerNotifyTerminatingCallback NotifyTerminating = nullptr;
1072 LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection = nullptr;
1073 LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection = nullptr;
1074 LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory = nullptr;
1075 LLVMMemoryManagerDestroyCallback Destroy = nullptr;
1076 };
1077
1078 class MCJITMemoryManagerLikeCallbacksMemMgr : public RTDyldMemoryManager {
1079 public:
1080 MCJITMemoryManagerLikeCallbacksMemMgr(
1081 const MCJITMemoryManagerLikeCallbacks &CBs)
1082 : CBs(CBs) {
1083 Opaque = CBs.CreateContext(CBs.CreateContextCtx);
1084 }
1085 ~MCJITMemoryManagerLikeCallbacksMemMgr() override { CBs.Destroy(Opaque); }
1086
1087 uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
1088 unsigned SectionID,
1089 StringRef SectionName) override {
1090 return CBs.AllocateCodeSection(Opaque, Size, Alignment, SectionID,
1091 SectionName.str().c_str());
1092 }
1093
1094 uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
1095 unsigned SectionID, StringRef SectionName,
1096 bool isReadOnly) override {
1097 return CBs.AllocateDataSection(Opaque, Size, Alignment, SectionID,
1098 SectionName.str().c_str(), isReadOnly);
1099 }
1100
1101 bool finalizeMemory(std::string *ErrMsg) override {
1102 char *ErrMsgCString = nullptr;
1103 bool Result = CBs.FinalizeMemory(Opaque, &ErrMsgCString);
1104 assert((Result || !ErrMsgCString) &&
1105 "Did not expect an error message if FinalizeMemory succeeded");
1106 if (ErrMsgCString) {
1107 if (ErrMsg)
1108 *ErrMsg = ErrMsgCString;
1109 free(ErrMsgCString);
1110 }
1111 return Result;
1112 }
1113
1114 private:
1115 const MCJITMemoryManagerLikeCallbacks &CBs;
1116 void *Opaque = nullptr;
1117 };
1118
1119 assert(ES && "ES must not be null");
1120 assert(CreateContext && "CreateContext must not be null");
1121 assert(NotifyTerminating && "NotifyTerminating must not be null");
1122 assert(AllocateCodeSection && "AllocateCodeSection must not be null");
1123 assert(AllocateDataSection && "AllocateDataSection must not be null");
1124 assert(FinalizeMemory && "FinalizeMemory must not be null");
1125 assert(Destroy && "Destroy must not be null");
1126
1127 MCJITMemoryManagerLikeCallbacks CBs(
1128 CreateContextCtx, CreateContext, NotifyTerminating, AllocateCodeSection,
1129 AllocateDataSection, FinalizeMemory, Destroy);
1130
1131 return wrap(new RTDyldObjectLinkingLayer(*unwrap(ES), [CBs = std::move(CBs)] {
1132 return std::make_unique<MCJITMemoryManagerLikeCallbacksMemMgr>(CBs);
1133 }));
1134
1135 return nullptr;
1136}
1137
1139 LLVMOrcObjectLayerRef RTDyldObjLinkingLayer,
1140 LLVMJITEventListenerRef Listener) {
1141 assert(RTDyldObjLinkingLayer && "RTDyldObjLinkingLayer must not be null");
1142 assert(Listener && "Listener must not be null");
1143 reinterpret_cast<RTDyldObjectLinkingLayer *>(unwrap(RTDyldObjLinkingLayer))
1144 ->registerJITEventListener(*unwrap(Listener));
1145}
1146
1148 return wrap(&unwrap(J)->getIRTransformLayer());
1149}
1150
1152 return unwrap(J)->getDataLayout().getStringRepresentation().c_str();
1153}
1154
1157 auto builder = createLocalIndirectStubsManagerBuilder(Triple(TargetTriple));
1158 return wrap(builder().release());
1159}
1160
1162 std::unique_ptr<IndirectStubsManager> TmpISM(unwrap(ISM));
1163}
1164
1166 const char *TargetTriple, LLVMOrcExecutionSessionRef ES,
1167 LLVMOrcJITTargetAddress ErrorHandlerAddr,
1170 Triple(TargetTriple), *unwrap(ES), ExecutorAddr(ErrorHandlerAddr));
1171
1172 if (!LCTM)
1173 return wrap(LCTM.takeError());
1174 *Result = wrap(LCTM->release());
1175 return LLVMErrorSuccess;
1176}
1177
1180 std::unique_ptr<LazyCallThroughManager> TmpLCM(unwrap(LCM));
1181}
@ GlobalPrefix
Definition: AsmWriter.cpp:370
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:148
std::string Name
uint64_t Size
std::optional< std::vector< StOtherPiece > > Other
Definition: ELFYAML.cpp:1290
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:35
void(* LLVMMemoryManagerNotifyTerminatingCallback)(void *CtxCtx)
Definition: OrcEE.h:36
LLVMErrorRef LLVMOrcCreateStaticLibrarySearchGeneratorForPath(LLVMOrcDefinitionGeneratorRef *Result, LLVMOrcObjectLayerRef ObjLayer, const char *FileName)
LLVMOrcSymbolStringPoolEntryRef wrap(SymbolStringPoolEntryUnsafe E)
SymbolStringPoolEntryUnsafe unwrap(LLVMOrcSymbolStringPoolEntryRef E)
const char LLVMTargetMachineRef TM
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
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:160
Tagged union holding either a T or a Error.
Definition: Error.h:474
Flags for symbols in the JIT.
Definition: JITSymbol.h:74
TargetFlagsType & getTargetFlags()
Return a reference to the target-specific flags.
Definition: JITSymbol.h:172
@ MaterializationSideEffectsOnly
Definition: JITSymbol.h:87
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
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:91
void push_back(const T &Elt)
Definition: SmallVector.h:426
pointer data()
Return a pointer to the vector's buffer, even if empty().
Definition: SmallVector.h:299
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
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:50
constexpr const char * data() const
data - Get a pointer to the start of the string (which may not be null terminated).
Definition: StringRef.h:131
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:76
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:206
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:946
A function object that can be used as an ObjectTransformLayer transform to dump object files to disk ...
Definition: DebugUtils.h:103
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:1425
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:67
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:989
A utility class for building TargetMachines for JITs.
static Expected< JITTargetMachineBuilder > detectHost()
Create a JITTargetMachineBuilder for the host system.
Constructs LLJIT instances.
Definition: LLJIT.h:505
A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
Definition: LLJIT.h:38
Manages a set of 'lazy call-through' trampolines.
Definition: LazyReexports.h:38
Wraps state for a lookup-in-progress.
Definition: Core.h:921
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:555
A MaterializationUnit represents a set of symbol definitions that can be materialized as a group,...
Definition: Core.h:693
Interface for Layers that accept object files.
Definition: Layer.h:133
static InProgressLookupState * extractLookupState(LookupState &LS)
static void resetLookupState(LookupState &LS, InProgressLookupState *IPLS)
API to remove / transfer ownership of JIT resources.
Definition: Core.h:56
void transferTo(ResourceTracker &DstRT)
Transfer all resources associated with this key to the given tracker, which must target the same JITD...
Definition: Core.cpp:58
Error remove()
Remove all resources associated with this key.
Definition: Core.cpp:54
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Load(ObjectLayer &L, const char *FileName, 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:183
UnderlyingVector::size_type size() const
Definition: Core.h:259
SymbolLookupSet & add(SymbolStringPtr Name, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
Add an element to the set.
Definition: Core.h:244
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:28
struct LLVMOpaqueError * LLVMErrorRef
Opaque reference to an error instance.
Definition: Error.h:33
LLVMErrorRef LLVMOrcLLJITAddObjectFile(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, LLVMMemoryBufferRef ObjBuffer)
Add a buffer representing an object file to the given JITDylib in the given LLJIT instance.
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModuleWithRT(LLVMOrcLLJITRef J, LLVMOrcResourceTrackerRef RT, LLVMOrcThreadSafeModuleRef TSM)
Add an IR module to the given ResourceTracker's JITDylib in the given LLJIT instance.
struct LLVMOrcOpaqueLLJIT * LLVMOrcLLJITRef
A reference to an orc::LLJIT instance.
Definition: LLJIT.h:66
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:55
void LLVMOrcLLJITBuilderSetJITTargetMachineBuilder(LLVMOrcLLJITBuilderRef Builder, LLVMOrcJITTargetMachineBuilderRef JTMB)
Set the JITTargetMachineBuilder to be used when constructing the LLJIT instance.
LLVMErrorRef LLVMOrcDisposeLLJIT(LLVMOrcLLJITRef J)
Dispose of an LLJIT instance.
LLVMOrcObjectLayerRef LLVMOrcLLJITGetObjLinkingLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's object linking layer.
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModule(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, LLVMOrcThreadSafeModuleRef TSM)
Add an IR module to the given JITDylib in the given 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...
LLVMOrcSymbolStringPoolEntryRef LLVMOrcLLJITMangleAndIntern(LLVMOrcLLJITRef J, const char *UnmangledName)
Mangles the given string according to the LLJIT instance's DataLayout, then interns the result in the...
LLVMOrcJITDylibRef LLVMOrcLLJITGetMainJITDylib(LLVMOrcLLJITRef J)
Return a reference to the Main JITDylib.
struct LLVMOrcOpaqueLLJITBuilder * LLVMOrcLLJITBuilderRef
A reference to an orc::LLJITBuilder instance.
Definition: LLJIT.h:61
void LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator(LLVMOrcLLJITBuilderRef Builder, LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction F, void *Ctx)
Set an ObjectLinkingLayer creator function for this LLJIT instance.
LLVMOrcIRTransformLayerRef LLVMOrcLLJITGetIRTransformLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's IR transform layer.
const char * LLVMOrcLLJITGetTripleString(LLVMOrcLLJITRef J)
Return the target triple for this LLJIT instance.
LLVMOrcLLJITBuilderRef LLVMOrcCreateLLJITBuilder(void)
Create an LLVMOrcLLJITBuilder.
void LLVMOrcDisposeLLJITBuilder(LLVMOrcLLJITBuilderRef Builder)
Dispose of an LLVMOrcLLJITBuilderRef.
LLVMOrcExecutionSessionRef LLVMOrcLLJITGetExecutionSession(LLVMOrcLLJITRef J)
Get a reference to the ExecutionSession for this LLJIT instance.
LLVMOrcObjectTransformLayerRef LLVMOrcLLJITGetObjTransformLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's object linking layer.
LLVMErrorRef LLVMOrcCreateLLJIT(LLVMOrcLLJITRef *Result, LLVMOrcLLJITBuilderRef Builder)
Create an LLJIT instance from an LLJITBuilder.
char LLVMOrcLLJITGetGlobalPrefix(LLVMOrcLLJITRef J)
Returns the global prefix character according to the LLJIT's DataLayout.
const char * LLVMOrcLLJITGetDataLayoutStr(LLVMOrcLLJITRef J)
Get the LLJIT instance's default data layout string.
LLVMErrorRef LLVMOrcLLJITLookup(LLVMOrcLLJITRef J, LLVMOrcJITTargetAddress *Result, const char *Name)
Look up the given symbol in the main JITDylib of the given LLJIT instance.
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.
LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(LLVMOrcExecutionSessionRef ES)
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.
uint64_t LLVMOrcJITTargetAddress
Represents an address in the executor process.
Definition: Orc.h:46
void LLVMOrcDisposeMaterializationResponsibility(LLVMOrcMaterializationResponsibilityRef MR)
Disposes of the passed MaterializationResponsibility object.
LLVMErrorRef(* LLVMOrcGenericIRModuleOperationFunction)(void *Ctx, LLVMModuleRef M)
A function for inspecting/mutating IR modules, suitable for use with LLVMOrcThreadSafeModuleWithModul...
Definition: Orc.h:397
LLVMOrcSymbolStringPoolRef LLVMOrcExecutionSessionGetSymbolStringPool(LLVMOrcExecutionSessionRef ES)
Return a reference to the SymbolStringPool for an ExecutionSession.
void LLVMOrcSymbolStringPoolClearDeadEntries(LLVMOrcSymbolStringPoolRef SSP)
Clear all unreferenced symbol string pool entries.
LLVMOrcLookupKind
Lookup kind.
Definition: Orc.h:199
void LLVMOrcDisposeCSymbolFlagsMap(LLVMOrcCSymbolFlagsMapPairs Pairs)
Disposes of the passed LLVMOrcCSymbolFlagsMap.
LLVMOrcSymbolStringPoolEntryRef * LLVMOrcMaterializationResponsibilityGetRequestedSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols)
Returns the names of any symbols covered by this MaterializationResponsibility object that have queri...
LLVMOrcJITDylibRef LLVMOrcMaterializationResponsibilityGetTargetDylib(LLVMOrcMaterializationResponsibilityRef MR)
Returns the target JITDylib that these symbols are being materialized into.
LLVMErrorRef LLVMOrcObjectLayerAddObjectFileWithRT(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcResourceTrackerRef RT, LLVMMemoryBufferRef ObjBuffer)
Add an object to an ObjectLayer using the given ResourceTracker.
LLVMOrcCSymbolFlagsMapPairs LLVMOrcMaterializationResponsibilityGetSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs)
Returns the symbol flags map for this responsibility instance.
LLVMErrorRef LLVMOrcCreateLocalLazyCallThroughManager(const char *TargetTriple, LLVMOrcExecutionSessionRef ES, LLVMOrcJITTargetAddress ErrorHandlerAddr, LLVMOrcLazyCallThroughManagerRef *Result)
void LLVMOrcDisposeMaterializationUnit(LLVMOrcMaterializationUnitRef MU)
Dispose of a MaterializationUnit.
LLVMErrorRef LLVMOrcThreadSafeModuleWithModuleDo(LLVMOrcThreadSafeModuleRef TSM, LLVMOrcGenericIRModuleOperationFunction F, void *Ctx)
Apply the given function to the module contained in this ThreadSafeModule.
LLVMOrcMaterializationUnitRef LLVMOrcCreateCustomMaterializationUnit(const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym, LLVMOrcMaterializationUnitMaterializeFunction Materialize, LLVMOrcMaterializationUnitDiscardFunction Discard, LLVMOrcMaterializationUnitDestroyFunction Destroy)
Create a custom MaterializationUnit.
struct LLVMOrcOpaqueObjectTransformLayer * LLVMOrcObjectTransformLayerRef
A reference to an orc::ObjectTransformLayer instance.
Definition: Orc.h:443
LLVMOrcExecutionSessionRef LLVMOrcMaterializationResponsibilityGetExecutionSession(LLVMOrcMaterializationResponsibilityRef MR)
Returns the ExecutionSession for this MaterializationResponsibility.
void LLVMOrcIRTransformLayerEmit(LLVMOrcIRTransformLayerRef IRLayer, LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcThreadSafeModuleRef TSM)
LLVMErrorRef LLVMOrcMaterializationResponsibilityReplace(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcMaterializationUnitRef MU)
Transfers responsibility to the given MaterializationUnit for all symbols defined by that Materializa...
LLVMOrcResourceTrackerRef LLVMOrcJITDylibCreateResourceTracker(LLVMOrcJITDylibRef JD)
Return a reference to a newly created resource tracker associated with JD.
LLVMErrorRef(* LLVMOrcObjectTransformLayerTransformFunction)(void *Ctx, LLVMMemoryBufferRef *ObjInOut)
A function for applying transformations to an object file buffer.
Definition: Orc.h:459
LLVMOrcMaterializationUnitRef LLVMOrcAbsoluteSymbols(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs)
Create a MaterializationUnit to define the given symbols as pointing to the corresponding raw address...
LLVMOrcThreadSafeModuleRef LLVMOrcCreateNewThreadSafeModule(LLVMModuleRef M, LLVMOrcThreadSafeContextRef TSCtx)
Create a ThreadSafeModule wrapper around the given LLVM module.
LLVMErrorRef LLVMOrcResourceTrackerRemove(LLVMOrcResourceTrackerRef RT)
Remove all resources associated with the given tracker.
void LLVMOrcDisposeObjectLayer(LLVMOrcObjectLayerRef ObjLayer)
Dispose of an ObjectLayer.
void LLVMOrcDisposeThreadSafeModule(LLVMOrcThreadSafeModuleRef TSM)
Dispose of a ThreadSafeModule.
void LLVMOrcObjectTransformLayerSetTransform(LLVMOrcObjectTransformLayerRef ObjTransformLayer, LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx)
Set the transform function on an LLVMOrcObjectTransformLayer.
struct LLVMOrcOpaqueJITTargetMachineBuilder * LLVMOrcJITTargetMachineBuilderRef
A reference to an orc::JITTargetMachineBuilder instance.
Definition: Orc.h:403
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.
void LLVMOrcDisposeDefinitionGenerator(LLVMOrcDefinitionGeneratorRef DG)
Dispose of a JITDylib::DefinitionGenerator.
void(* LLVMOrcErrorReporterFunction)(void *Ctx, LLVMErrorRef Err)
Error reporter function.
Definition: Orc.h:93
LLVMErrorRef LLVMOrcJITTargetMachineBuilderDetectHost(LLVMOrcJITTargetMachineBuilderRef *Result)
Create a JITTargetMachineBuilder by detecting the host.
struct LLVMOrcOpaqueMaterializationResponsibility * LLVMOrcMaterializationResponsibilityRef
A reference to a uniquely owned orc::MaterializationResponsibility instance.
Definition: Orc.h:271
void(* LLVMOrcDisposeCAPIDefinitionGeneratorFunction)(void *Ctx)
Disposer for a custom generator.
Definition: Orc.h:375
struct LLVMOrcOpaqueThreadSafeModule * LLVMOrcThreadSafeModuleRef
A reference to an orc::ThreadSafeModule instance.
Definition: Orc.h:391
LLVMOrcResourceTrackerRef LLVMOrcJITDylibGetDefaultResourceTracker(LLVMOrcJITDylibRef JD)
Return a reference to the default resource tracker for the given JITDylib.
struct LLVMOrcOpaqueExecutionSession * LLVMOrcExecutionSessionRef
A reference to an orc::ExecutionSession instance.
Definition: Orc.h:88
LLVMOrcSymbolStringPoolEntryRef LLVMOrcMaterializationResponsibilityGetInitializerSymbol(LLVMOrcMaterializationResponsibilityRef MR)
Returns the initialization pseudo-symbol, if any.
struct LLVMOrcOpaqueIndirectStubsManager * LLVMOrcIndirectStubsManagerRef
A reference to an orc::IndirectStubsManager instance.
Definition: Orc.h:465
void(* LLVMOrcExecutionSessionLookupHandleResultFunction)(LLVMErrorRef Err, LLVMOrcCSymbolMapPairs Result, size_t NumPairs, void *Ctx)
Callback type for ExecutionSession lookups.
Definition: Orc.h:545
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 LLVMOrcLookupStateContinueLookup(LLVMOrcLookupStateRef S, LLVMErrorRef Err)
Continue a lookup that was suspended in a generator (see LLVMOrcCAPIDefinitionGeneratorTryToGenerateF...
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:363
void LLVMOrcReleaseResourceTracker(LLVMOrcResourceTrackerRef RT)
Reduces the ref-count of a ResourceTracker.
void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx)
Dispose of a ThreadSafeContext.
LLVMErrorRef(* LLVMOrcIRTransformLayerTransformFunction)(void *Ctx, LLVMOrcThreadSafeModuleRef *ModInOut, LLVMOrcMaterializationResponsibilityRef MR)
A function for applying transformations as part of an transform layer.
Definition: Orc.h:436
struct LLVMOrcOpaqueSymbolStringPool * LLVMOrcSymbolStringPoolRef
A reference to an orc::SymbolStringPool.
Definition: Orc.h:98
void(* LLVMOrcMaterializationUnitDestroyFunction)(void *Ctx)
A MaterializationUnit destruction callback.
Definition: Orc.h:303
LLVMOrcDumpObjectsRef LLVMOrcCreateDumpObjects(const char *DumpDir, const char *IdentifierOverride)
Create a DumpObjects instance.
struct LLVMOrcOpaqueResourceTracker * LLVMOrcResourceTrackerRef
A reference to an orc::ResourceTracker instance.
Definition: Orc.h:308
void LLVMOrcObjectLayerEmit(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcMaterializationResponsibilityRef R, LLVMMemoryBufferRef ObjBuffer)
Emit an object buffer to an ObjectLayer.
void LLVMOrcExecutionSessionSetErrorReporter(LLVMOrcExecutionSessionRef ES, LLVMOrcErrorReporterFunction ReportError, void *Ctx)
Attach a custom error reporter function to the ExecutionSession.
void LLVMOrcRetainSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)
Increments the ref-count for a SymbolStringPool entry.
LLVMErrorRef LLVMOrcMaterializationResponsibilityDelegate(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols, LLVMOrcMaterializationResponsibilityRef *Result)
Delegates responsibility for the given symbols to the returned materialization responsibility.
LLVMErrorRef LLVMOrcDumpObjects_CallOperator(LLVMOrcDumpObjectsRef DumpObjects, LLVMMemoryBufferRef *ObjBuffer)
Dump the contents of the given MemoryBuffer.
LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(LLVMOrcDefinitionGeneratorRef *Result, char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx)
Get a DynamicLibrarySearchGenerator that will reflect process symbols into the JITDylib.
LLVMOrcIndirectStubsManagerRef LLVMOrcCreateLocalIndirectStubsManager(const char *TargetTriple)
Create a LocalIndirectStubsManager from the given target triple.
void LLVMOrcJITTargetMachineBuilderSetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple)
Sets the target triple for the given JITTargetMachineBuilder to the given string.
void LLVMOrcJITDylibAddGenerator(LLVMOrcJITDylibRef JD, LLVMOrcDefinitionGeneratorRef DG)
Add a DefinitionGenerator to the given JITDylib.
LLVMOrcJITTargetMachineBuilderRef LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(LLVMTargetMachineRef TM)
Create a JITTargetMachineBuilder from the given TargetMachine template.
LLVMOrcJITDylibRef LLVMOrcExecutionSessionGetJITDylibByName(LLVMOrcExecutionSessionRef ES, const char *Name)
Returns the JITDylib with the given name, or NULL if no such JITDylib exists.
const char * LLVMOrcSymbolStringPoolEntryStr(LLVMOrcSymbolStringPoolEntryRef S)
Return the c-string for the given symbol.
LLVMErrorRef LLVMOrcJITDylibDefine(LLVMOrcJITDylibRef JD, LLVMOrcMaterializationUnitRef MU)
Add the given MaterializationUnit to the given JITDylib.
struct LLVMOrcOpaqueObjectLayer * LLVMOrcObjectLayerRef
A reference to an orc::ObjectLayer instance.
Definition: Orc.h:409
void LLVMOrcMaterializationResponsibilityFailMaterialization(LLVMOrcMaterializationResponsibilityRef MR)
Notify all not-yet-emitted covered by this MaterializationResponsibility instance that an error has o...
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...
LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContext(void)
Create a ThreadSafeContext containing a new LLVMContext.
int(* LLVMOrcSymbolPredicate)(void *Ctx, LLVMOrcSymbolStringPoolEntryRef Sym)
Predicate function for SymbolStringPoolEntries.
Definition: Orc.h:380
struct LLVMOrcOpaqueDefinitionGenerator * LLVMOrcDefinitionGeneratorRef
A reference to an orc::DefinitionGenerator.
Definition: Orc.h:313
struct LLVMOrcOpaqueSymbolStringPoolEntry * LLVMOrcSymbolStringPoolEntryRef
A reference to an orc::SymbolStringPool table entry.
Definition: Orc.h:103
LLVMOrcSymbolLookupFlags
Symbol lookup flags for lookup sets.
Definition: Orc.h:235
LLVMOrcSymbolStringPoolEntryRef LLVMOrcExecutionSessionIntern(LLVMOrcExecutionSessionRef ES, const char *Name)
Intern a string in the ExecutionSession's SymbolStringPool and return a reference to it.
void LLVMOrcDisposeIndirectStubsManager(LLVMOrcIndirectStubsManagerRef ISM)
Dispose of an IndirectStubsManager.
LLVMErrorRef LLVMOrcMaterializationResponsibilityDefineMaterializing(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms)
Attempt to claim responsibility for new definitions.
LLVMErrorRef LLVMOrcObjectLayerAddObjectFile(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcJITDylibRef JD, LLVMMemoryBufferRef ObjBuffer)
Add an object to an ObjectLayer to the given JITDylib.
LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyResolved(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolMapPairs Symbols, size_t NumSymbols)
Notifies the target JITDylib that the given symbols have been resolved.
void(* LLVMOrcMaterializationUnitDiscardFunction)(void *Ctx, LLVMOrcJITDylibRef JD, LLVMOrcSymbolStringPoolEntryRef Symbol)
A MaterializationUnit discard callback.
Definition: Orc.h:293
void(* LLVMOrcMaterializationUnitMaterializeFunction)(void *Ctx, LLVMOrcMaterializationResponsibilityRef MR)
A MaterializationUnit materialize callback.
Definition: Orc.h:284
void LLVMOrcDisposeDumpObjects(LLVMOrcDumpObjectsRef DumpObjects)
Dispose of a DumpObjects instance.
char * LLVMOrcJITTargetMachineBuilderGetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB)
Returns the target triple for the given JITTargetMachineBuilder as a string.
struct LLVMOrcOpaqueDumpObjects * LLVMOrcDumpObjectsRef
A reference to an orc::DumpObjects object.
Definition: Orc.h:480
LLVMErrorRef LLVMOrcJITDylibClear(LLVMOrcJITDylibRef JD)
Calls remove on all trackers associated with this JITDylib, see JITDylib::clear().
void LLVMOrcDisposeLazyCallThroughManager(LLVMOrcLazyCallThroughManagerRef LCM)
Dispose of an LazyCallThroughManager.
LLVMOrcJITDylibRef LLVMOrcExecutionSessionCreateBareJITDylib(LLVMOrcExecutionSessionRef ES, const char *Name)
Create a "bare" JITDylib.
struct LLVMOrcOpaqueIRTransformLayer * LLVMOrcIRTransformLayerRef
A reference to an orc::IRTransformLayer instance.
Definition: Orc.h:419
struct LLVMOrcOpaqueLookupState * LLVMOrcLookupStateRef
An opaque lookup state object.
Definition: Orc.h:328
void LLVMOrcDisposeSymbols(LLVMOrcSymbolStringPoolEntryRef *Symbols)
Disposes of the passed LLVMOrcSymbolStringPoolEntryRef* .
LLVMOrcDefinitionGeneratorRef LLVMOrcCreateCustomCAPIDefinitionGenerator(LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction F, void *Ctx, LLVMOrcDisposeCAPIDefinitionGeneratorFunction Dispose)
Create a custom generator.
LLVMErrorRef LLVMOrcExecutionSessionCreateJITDylib(LLVMOrcExecutionSessionRef ES, LLVMOrcJITDylibRef *Result, const char *Name)
Create a JITDylib.
LLVMContextRef LLVMOrcThreadSafeContextGetContext(LLVMOrcThreadSafeContextRef TSCtx)
Get a reference to the wrapped LLVMContext.
void LLVMOrcReleaseSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)
Reduces the ref-count for of a SymbolStringPool entry.
struct LLVMOrcOpaqueMaterializationUnit * LLVMOrcMaterializationUnitRef
A reference to a uniquely owned orc::MaterializationUnit instance.
Definition: Orc.h:264
struct LLVMOrcOpaqueJITDylib * LLVMOrcJITDylibRef
A reference to an orc::JITDylib instance.
Definition: Orc.h:159
struct LLVMOrcOpaqueThreadSafeContext * LLVMOrcThreadSafeContextRef
A reference to an orc::ThreadSafeContext instance.
Definition: Orc.h:386
void LLVMOrcIRTransformLayerSetTransform(LLVMOrcIRTransformLayerRef IRTransformLayer, LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx)
Set the transform function of the provided transform layer, passing through a pointer to user provide...
LLVMOrcJITDylibLookupFlags
JITDylib lookup flags.
Definition: Orc.h:210
void LLVMOrcResourceTrackerTransferTo(LLVMOrcResourceTrackerRef SrcRT, LLVMOrcResourceTrackerRef DstRT)
Transfers tracking of all resources associated with resource tracker SrcRT to resource tracker DstRT.
LLVMOrcMaterializationUnitRef LLVMOrcLazyReexports(LLVMOrcLazyCallThroughManagerRef LCTM, LLVMOrcIndirectStubsManagerRef ISM, LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases, size_t NumPairs)
Create a MaterializationUnit to define lazy re-expots.
void LLVMOrcDisposeJITTargetMachineBuilder(LLVMOrcJITTargetMachineBuilderRef JTMB)
Dispose of a JITTargetMachineBuilder.
@ LLVMOrcLookupKindDLSym
Definition: Orc.h:201
@ LLVMOrcLookupKindStatic
Definition: Orc.h:200
@ LLVMJITSymbolGenericFlagsWeak
Definition: Orc.h:59
@ LLVMJITSymbolGenericFlagsExported
Definition: Orc.h:58
@ LLVMJITSymbolGenericFlagsCallable
Definition: Orc.h:60
@ LLVMJITSymbolGenericFlagsMaterializationSideEffectsOnly
Definition: Orc.h:61
@ LLVMOrcSymbolLookupFlagsRequiredSymbol
Definition: Orc.h:236
@ LLVMOrcSymbolLookupFlagsWeaklyReferencedSymbol
Definition: Orc.h:237
@ LLVMOrcJITDylibLookupFlagsMatchAllSymbols
Definition: Orc.h:212
@ LLVMOrcJITDylibLookupFlagsMatchExportedSymbolsOnly
Definition: Orc.h:211
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:35
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:162
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
Definition: Core.h:791
IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP
Definition: Core.h:50
SymbolLookupFlags
Lookup flags that apply to each symbol in a lookup.
Definition: Core.h:145
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
Definition: Core.h:135
std::function< std::unique_ptr< IndirectStubsManager >()> createLocalIndirectStubsManagerBuilder(const Triple &T)
Create a local indirect stubs manager builder.
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, IndirectStubsManager &ISManager, 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:157
RegisterDependenciesFunction NoDependenciesToRegister
This can be used as the value for a RegisterDependenciesFunction if there are no dependants to regist...
Definition: Core.cpp:37
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:303
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:1858
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:298
void replace(Container &Cont, typename Container::iterator ContIt, typename Container::iterator ContEnd, RandomAccessIterator ValIt, RandomAccessIterator ValEnd)
Given a sequence container Cont, replace the range [ContIt, ContEnd) with the range [ValIt,...
Definition: STLExtras.h:2097
Implement std::hash so that hash_code can be used in STL containers.
Definition: BitVector.h:858
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:860
Represents an evaluated symbol address and flags.
Definition: Orc.h:80
Represents the linkage flags for a symbol definition.
Definition: Orc.h:72
Represents a pair of a JITDylib and LLVMOrcCSymbolsList.
Definition: Orc.h:173
LLVMOrcCSymbolsList Names
Definition: Orc.h:175
An element type for a JITDylib search order.
Definition: Orc.h:218
An element type for a symbol lookup set.
Definition: Orc.h:243
Represents a pair of a symbol name and SymbolAliasMapEntry.
Definition: Orc.h:145
A set of symbols that share dependencies.
Definition: Orc.h:187
Represents a pair of a symbol name and LLVMJITSymbolFlags.
Definition: Orc.h:109
Represents a pair of a symbol name and an evaluated symbol.
Definition: Orc.h:123
Represents a list of LLVMOrcSymbolStringPoolEntryRef and the associated length.
Definition: Orc.h:165
LLVMOrcSymbolStringPoolEntryRef * Symbols
Definition: Orc.h:166
size_t Length
Definition: Orc.h:167
A set of symbols and the their dependencies.
Definition: Core.h:543