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
22
23using namespace llvm;
24using namespace llvm::orc;
25
26namespace llvm {
27namespace orc {
28
30
32public:
34 return LS.IPLS.release();
35 }
36
38 return LS.reset(IPLS);
39 }
40};
41
42} // namespace orc
43} // namespace llvm
44
48
52
81
82namespace {
83
85public:
87 std::string Name, SymbolFlagsMap InitialSymbolFlags,
88 SymbolStringPtr InitSymbol, void *Ctx,
93 Interface(std::move(InitialSymbolFlags), std::move(InitSymbol))),
94 Name(std::move(Name)), Ctx(Ctx), Materialize(Materialize),
95 Discard(Discard), Destroy(Destroy) {}
96
98 if (Ctx)
99 Destroy(Ctx);
100 }
101
102 StringRef getName() const override { return Name; }
103
104 void materialize(std::unique_ptr<MaterializationResponsibility> R) override {
105 void *Tmp = Ctx;
106 Ctx = nullptr;
107 Materialize(Tmp, wrap(R.release()));
108 }
109
110private:
111 void discard(const JITDylib &JD, const SymbolStringPtr &Name) override {
112 Discard(Ctx, wrap(&JD), wrap(SymbolStringPoolEntryUnsafe::from(Name)));
113 }
114
115 std::string Name;
116 void *Ctx = nullptr;
120};
121
123
124 JITSymbolFlags JSF;
125
126 if (F.GenericFlags & LLVMJITSymbolGenericFlagsExported)
128 if (F.GenericFlags & LLVMJITSymbolGenericFlagsWeak)
130 if (F.GenericFlags & LLVMJITSymbolGenericFlagsCallable)
134
135 JSF.getTargetFlags() = F.TargetFlags;
136
137 return JSF;
138}
139
141 LLVMJITSymbolFlags F = {0, 0};
142 if (JSF & JITSymbolFlags::Exported)
143 F.GenericFlags |= LLVMJITSymbolGenericFlagsExported;
144 if (JSF & JITSymbolFlags::Weak)
145 F.GenericFlags |= LLVMJITSymbolGenericFlagsWeak;
146 if (JSF & JITSymbolFlags::Callable)
147 F.GenericFlags |= LLVMJITSymbolGenericFlagsCallable;
150
151 F.TargetFlags = JSF.getTargetFlags();
152
153 return F;
154}
155
158 Result.reserve(Symbols.Length);
159 for (size_t I = 0; I != Symbols.Length; ++I)
160 Result.insert(unwrap(Symbols.Symbols[I]).moveToSymbolStringPtr());
161 return Result;
162}
163
164static SymbolMap toSymbolMap(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs) {
165 SymbolMap SM;
166 for (size_t I = 0; I != NumPairs; ++I) {
167 JITSymbolFlags Flags = toJITSymbolFlags(Syms[I].Sym.Flags);
168 SM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] = {
169 ExecutorAddr(Syms[I].Sym.Address), Flags};
170 }
171 return SM;
172}
173
177 for (size_t I = 0; I != NumPairs; ++I) {
178 JITDylib *JD = unwrap(Pairs[I].JD);
179 SymbolNameSet Names;
180
181 for (size_t J = 0; J != Pairs[I].Names.Length; ++J) {
182 auto Sym = Pairs[I].Names.Symbols[J];
183 Names.insert(unwrap(Sym).moveToSymbolStringPtr());
184 }
185 SDM[JD] = Names;
186 }
187 return SDM;
188}
189
191 switch (K) {
193 return LookupKind::Static;
195 return LookupKind::DLSym;
196 }
197 llvm_unreachable("unrecognized LLVMOrcLookupKind value");
198}
199
201 switch (K) {
206 }
207 llvm_unreachable("unrecognized LookupKind value");
208}
209
211toJITDylibLookupFlags(LLVMOrcJITDylibLookupFlags LF) {
212 switch (LF) {
217 }
218 llvm_unreachable("unrecognized LLVMOrcJITDylibLookupFlags value");
219}
220
231
232static SymbolLookupFlags toSymbolLookupFlags(LLVMOrcSymbolLookupFlags SLF) {
233 switch (SLF) {
238 }
239 llvm_unreachable("unrecognized LLVMOrcSymbolLookupFlags value");
240}
241
242static LLVMOrcSymbolLookupFlags fromSymbolLookupFlags(SymbolLookupFlags SLF) {
243 switch (SLF) {
248 }
249 llvm_unreachable("unrecognized SymbolLookupFlags value");
250}
251
256
257} // end anonymous namespace
258
259namespace llvm {
260namespace orc {
261
263public:
267 : Dispose(Dispose), Ctx(Ctx), TryToGenerate(TryToGenerate) {}
268
270 if (Dispose)
271 Dispose(Ctx);
272 }
273
275 JITDylibLookupFlags JDLookupFlags,
276 const SymbolLookupSet &LookupSet) override {
277
278 // Take the lookup state.
280
281 // Translate the lookup kind.
282 LLVMOrcLookupKind CLookupKind = fromLookupKind(K);
283
284 // Translate the JITDylibLookupFlags.
285 LLVMOrcJITDylibLookupFlags CJDLookupFlags =
286 fromJITDylibLookupFlags(JDLookupFlags);
287
288 // Translate the lookup set.
289 std::vector<LLVMOrcCLookupSetElement> CLookupSet;
290 CLookupSet.reserve(LookupSet.size());
291 for (auto &KV : LookupSet) {
294 LLVMOrcSymbolLookupFlags SLF = fromSymbolLookupFlags(KV.second);
295 CLookupSet.push_back({Name, SLF});
296 }
297
298 // Run the C TryToGenerate function.
299 auto Err = unwrap(TryToGenerate(::wrap(this), Ctx, &LSR, CLookupKind,
300 ::wrap(&JD), CJDLookupFlags,
301 CLookupSet.data(), CLookupSet.size()));
302
303 // Restore the lookup state.
305
306 return Err;
307 }
308
309private:
311 void *Ctx;
313};
314
315} // end namespace orc
316} // end namespace llvm
317
320 void *Ctx) {
321 unwrap(ES)->setErrorReporter(
322 [=](Error Err) { ReportError(Ctx, wrap(std::move(Err))); });
323}
324
327 return wrap(
328 unwrap(ES)->getExecutorProcessControl().getSymbolStringPool().get());
329}
330
332 unwrap(SSP)->clearDeadEntries();
333}
334
339
342 LLVMOrcCJITDylibSearchOrder SearchOrder, size_t SearchOrderSize,
343 LLVMOrcCLookupSet Symbols, size_t SymbolsSize,
345 assert(ES && "ES cannot be null");
346 assert(SearchOrder && "SearchOrder cannot be null");
347 assert(Symbols && "Symbols cannot be null");
348 assert(HandleResult && "HandleResult cannot be null");
349
351 for (size_t I = 0; I != SearchOrderSize; ++I)
352 SO.push_back({unwrap(SearchOrder[I].JD),
353 toJITDylibLookupFlags(SearchOrder[I].JDLookupFlags)});
354
355 SymbolLookupSet SLS;
356 for (size_t I = 0; I != SymbolsSize; ++I)
357 SLS.add(unwrap(Symbols[I].Name).moveToSymbolStringPtr(),
358 toSymbolLookupFlags(Symbols[I].LookupFlags));
359
360 unwrap(ES)->lookup(
361 toLookupKind(K), SO, std::move(SLS), SymbolState::Ready,
362 [HandleResult, Ctx](Expected<SymbolMap> Result) {
363 if (Result) {
365 for (auto &KV : *Result)
368 fromExecutorSymbolDef(KV.second)});
369 HandleResult(LLVMErrorSuccess, CResult.data(), CResult.size(), Ctx);
370 } else
371 HandleResult(wrap(Result.takeError()), nullptr, 0, Ctx);
372 },
374}
375
379
383
385 return unwrap(S).rawPtr()->getKey().data();
386}
387
390 auto RT = unwrap(JD)->createResourceTracker();
391 // Retain the pointer for the C API client.
392 RT->Retain();
393 return wrap(RT.get());
394}
395
398 auto RT = unwrap(JD)->getDefaultResourceTracker();
399 // Retain the pointer for the C API client.
400 return wrap(RT.get());
401}
402
407
413
418
420 std::unique_ptr<DefinitionGenerator> TmpDG(unwrap(DG));
421}
422
424 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
425}
426
428 const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms,
429 size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym,
433 SymbolFlagsMap SFM;
434 for (size_t I = 0; I != NumSyms; ++I)
435 SFM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] =
436 toJITSymbolFlags(Syms[I].Flags);
437
438 auto IS = unwrap(InitSym).moveToSymbolStringPtr();
439
440 return wrap(new OrcCAPIMaterializationUnit(
441 Name, std::move(SFM), std::move(IS), Ctx, Materialize, Discard, Destroy));
442}
443
446 SymbolMap SM = toSymbolMap(Syms, NumPairs);
447 return wrap(absoluteSymbols(std::move(SM)).release());
448}
449
452 LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases,
453 size_t NumPairs) {
454
455 SymbolAliasMap SAM;
456 for (size_t I = 0; I != NumPairs; ++I) {
457 auto pair = CallableAliases[I];
458 JITSymbolFlags Flags = toJITSymbolFlags(pair.Entry.Flags);
459 SymbolStringPtr Name = unwrap(pair.Entry.Name).moveToSymbolStringPtr();
460 SAM[unwrap(pair.Name).moveToSymbolStringPtr()] =
461 SymbolAliasMapEntry(Name, Flags);
462 }
463
464 return wrap(lazyReexports(*unwrap(LCTM), *unwrap(ISM), *unwrap(SourceJD),
465 std::move(SAM))
466 .release());
467}
468
471 std::unique_ptr<MaterializationResponsibility> TmpMR(unwrap(MR));
472}
473
478
484
486 LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs) {
487
488 auto Symbols = unwrap(MR)->getSymbols();
490 safe_malloc(Symbols.size() * sizeof(LLVMOrcCSymbolFlagsMapPair)));
491 size_t I = 0;
492 for (auto const &pair : Symbols) {
493 auto Name = wrap(SymbolStringPoolEntryUnsafe::from(pair.first));
494 auto Flags = pair.second;
495 Result[I] = {Name, fromJITSymbolFlags(Flags)};
496 I++;
497 }
498 *NumPairs = Symbols.size();
499 return Result;
500}
501
505
512
515 LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols) {
516
517 auto Symbols = unwrap(MR)->getRequestedSymbols();
520 Symbols.size() * sizeof(LLVMOrcSymbolStringPoolEntryRef)));
521 size_t I = 0;
522 for (auto &Name : Symbols) {
524 I++;
525 }
526 *NumSymbols = Symbols.size();
527 return Result;
528}
529
531 free(Symbols);
532}
533
536 size_t NumSymbols) {
537 SymbolMap SM = toSymbolMap(Symbols, NumSymbols);
538 return wrap(unwrap(MR)->notifyResolved(std::move(SM)));
539}
540
543 LLVMOrcCSymbolDependenceGroup *SymbolDepGroups, size_t NumSymbolDepGroups) {
544 std::vector<SymbolDependenceGroup> SDGs;
545 SDGs.reserve(NumSymbolDepGroups);
546 for (size_t I = 0; I != NumSymbolDepGroups; ++I) {
547 SDGs.push_back(SymbolDependenceGroup());
548 auto &SDG = SDGs.back();
549 SDG.Symbols = toSymbolNameSet(SymbolDepGroups[I].Symbols);
550 SDG.Dependencies = toSymbolDependenceMap(
551 SymbolDepGroups[I].Dependencies, SymbolDepGroups[I].NumDependencies);
552 }
553 return wrap(unwrap(MR)->notifyEmitted(SDGs));
554}
555
558 LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms) {
559 SymbolFlagsMap SFM;
560 for (size_t I = 0; I != NumSyms; ++I)
561 SFM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] =
562 toJITSymbolFlags(Syms[I].Flags);
563
564 return wrap(unwrap(MR)->defineMaterializing(std::move(SFM)));
565}
566
570 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
571 return wrap(unwrap(MR)->replace(std::move(TmpMU)));
572}
573
576 LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols,
578 SymbolNameSet Syms;
579 for (size_t I = 0; I != NumSymbols; I++) {
580 Syms.insert(unwrap(Symbols[I]).moveToSymbolStringPtr());
581 }
582 auto OtherMR = unwrap(MR)->delegate(Syms);
583
584 if (!OtherMR) {
585 return wrap(OtherMR.takeError());
586 }
587 *Result = wrap(OtherMR->release());
588 return LLVMErrorSuccess;
589}
590
595
599 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
600 unwrap(IRLayer)->emit(
601 std::unique_ptr<MaterializationResponsibility>(unwrap(MR)),
602 std::move(*TmpTSM));
603}
604
607 const char *Name) {
608 return wrap(&unwrap(ES)->createBareJITDylib(Name));
609}
610
614 const char *Name) {
615 auto JD = unwrap(ES)->createJITDylib(Name);
616 if (!JD)
617 return wrap(JD.takeError());
618 *Result = wrap(&*JD);
619 return LLVMErrorSuccess;
620}
621
624 const char *Name) {
625 return wrap(unwrap(ES)->getJITDylibByName(Name));
626}
627
630 std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
631
632 if (auto Err = unwrap(JD)->define(TmpMU)) {
633 TmpMU.release();
634 return wrap(std::move(Err));
635 }
636 return LLVMErrorSuccess;
637}
638
642
645 unwrap(JD)->addGenerator(std::unique_ptr<DefinitionGenerator>(unwrap(DG)));
646}
647
651 auto DG = std::make_unique<CAPIDefinitionGenerator>(Dispose, Ctx, F);
652 return wrap(DG.release());
653}
654
661
664 LLVMOrcSymbolPredicate Filter, void *FilterCtx) {
665 assert(Result && "Result can not be null");
666 assert((Filter || !FilterCtx) &&
667 "if Filter is null then FilterCtx must also be null");
668
670 if (Filter)
671 Pred = [=](const SymbolStringPtr &Name) -> bool {
672 return Filter(FilterCtx, wrap(SymbolStringPoolEntryUnsafe::from(Name)));
673 };
674
675 auto ProcessSymsGenerator =
677
678 if (!ProcessSymsGenerator) {
679 *Result = nullptr;
680 return wrap(ProcessSymsGenerator.takeError());
681 }
682
683 *Result = wrap(ProcessSymsGenerator->release());
684 return LLVMErrorSuccess;
685}
686
688 LLVMOrcDefinitionGeneratorRef *Result, const char *FileName,
689 char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx) {
690 assert(Result && "Result can not be null");
691 assert(FileName && "FileName can not be null");
692 assert((Filter || !FilterCtx) &&
693 "if Filter is null then FilterCtx must also be null");
694
696 if (Filter)
697 Pred = [=](const SymbolStringPtr &Name) -> bool {
698 return Filter(FilterCtx, wrap(SymbolStringPoolEntryUnsafe::from(Name)));
699 };
700
701 auto LibrarySymsGenerator =
703
704 if (!LibrarySymsGenerator) {
705 *Result = nullptr;
706 return wrap(LibrarySymsGenerator.takeError());
707 }
708
709 *Result = wrap(LibrarySymsGenerator->release());
710 return LLVMErrorSuccess;
711}
712
715 const char *FileName) {
716 assert(Result && "Result can not be null");
717 assert(FileName && "Filename can not be null");
718 assert(ObjLayer && "ObjectLayer can not be null");
719
720 auto LibrarySymsGenerator =
722 if (!LibrarySymsGenerator) {
723 *Result = nullptr;
724 return wrap(LibrarySymsGenerator.takeError());
725 }
726 *Result = wrap(LibrarySymsGenerator->release());
727 return LLVMErrorSuccess;
728}
729
731 return wrap(new ThreadSafeContext(std::make_unique<LLVMContext>()));
732}
733
736 return wrap(new ThreadSafeContext(std::unique_ptr<LLVMContext>(unwrap(Ctx))));
737}
738
742
746 void *Ctx) {
747 return wrap(unwrap(TSM)->withModuleDo(
748 [&](Module &M) { return unwrap(F(Ctx, wrap(&M))); }));
749}
750
754 return wrap(
755 new ThreadSafeModule(std::unique_ptr<Module>(unwrap(M)), *unwrap(TSCtx)));
756}
757
761
764 assert(Result && "Result can not be null");
765
767 if (!JTMB) {
768 Result = nullptr;
769 return wrap(JTMB.takeError());
770 }
771
772 *Result = wrap(new JITTargetMachineBuilder(std::move(*JTMB)));
773 return LLVMErrorSuccess;
774}
775
778 auto *TemplateTM = unwrap(TM);
779
780 auto JTMB =
781 std::make_unique<JITTargetMachineBuilder>(TemplateTM->getTargetTriple());
782
783 (*JTMB)
784 .setCPU(TemplateTM->getTargetCPU().str())
785 .setRelocationModel(TemplateTM->getRelocationModel())
786 .setCodeModel(TemplateTM->getCodeModel())
787 .setCodeGenOptLevel(TemplateTM->getOptLevel())
788 .setFeatures(TemplateTM->getTargetFeatureString())
789 .setOptions(TemplateTM->Options);
790
792
793 return wrap(JTMB.release());
794}
795
800
803 auto Tmp = unwrap(JTMB)->getTargetTriple().str();
804 char *TargetTriple = (char *)malloc(Tmp.size() + 1);
805 strcpy(TargetTriple, Tmp.c_str());
806 return TargetTriple;
807}
808
810 LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple) {
811 unwrap(JTMB)->getTargetTriple() = Triple(TargetTriple);
812}
813
816 LLVMMemoryBufferRef ObjBuffer) {
817 return wrap(unwrap(ObjLayer)->add(
818 *unwrap(JD), std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
819}
820
823 LLVMMemoryBufferRef ObjBuffer) {
824 return wrap(
825 unwrap(ObjLayer)->add(ResourceTrackerSP(unwrap(RT)),
826 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
827}
828
831 LLVMMemoryBufferRef ObjBuffer) {
832 unwrap(ObjLayer)->emit(
833 std::unique_ptr<MaterializationResponsibility>(unwrap(R)),
834 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer)));
835}
836
838 delete unwrap(ObjLayer);
839}
840
843 LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx) {
845 ->setTransform(
846 [=](ThreadSafeModule TSM,
849 wrap(new ThreadSafeModule(std::move(TSM)));
850 if (LLVMErrorRef Err = TransformFunction(Ctx, &TSMRef, wrap(&R))) {
851 assert(!TSMRef && "TSMRef was not reset to null on error");
852 return unwrap(Err);
853 }
854 assert(TSMRef && "Transform succeeded, but TSMRef was set to null");
855 ThreadSafeModule Result = std::move(*unwrap(TSMRef));
857 return std::move(Result);
858 });
859}
860
862 LLVMOrcObjectTransformLayerRef ObjTransformLayer,
863 LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx) {
864 unwrap(ObjTransformLayer)
865 ->setTransform([TransformFunction, Ctx](std::unique_ptr<MemoryBuffer> Obj)
866 -> Expected<std::unique_ptr<MemoryBuffer>> {
867 LLVMMemoryBufferRef ObjBuffer = wrap(Obj.release());
868 if (LLVMErrorRef Err = TransformFunction(Ctx, &ObjBuffer)) {
869 assert(!ObjBuffer && "ObjBuffer was not reset to null on error");
870 return unwrap(Err);
871 }
872 return std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer));
873 });
874}
875
877 const char *IdentifierOverride) {
878 assert(DumpDir && "DumpDir should not be null");
879 assert(IdentifierOverride && "IdentifierOverride should not be null");
880 return wrap(new DumpObjects(DumpDir, IdentifierOverride));
881}
882
886
888 LLVMMemoryBufferRef *ObjBuffer) {
889 std::unique_ptr<MemoryBuffer> OB(unwrap(*ObjBuffer));
890 if (auto Result = (*unwrap(DumpObjects))(std::move(OB))) {
891 *ObjBuffer = wrap(Result->release());
892 return LLVMErrorSuccess;
893 } else {
894 *ObjBuffer = nullptr;
895 return wrap(Result.takeError());
896 }
897}
898
902
904 delete unwrap(Builder);
905}
906
909 unwrap(Builder)->setJITTargetMachineBuilder(std::move(*unwrap(JTMB)));
911}
912
916 unwrap(Builder)->setObjectLinkingLayerCreator([=](ExecutionSession &ES) {
917 auto TTStr = ES.getTargetTriple().str();
918 return std::unique_ptr<ObjectLayer>(
919 unwrap(F(Ctx, wrap(&ES), TTStr.c_str())));
920 });
921}
922
924 LLVMOrcLLJITBuilderRef Builder) {
925 assert(Result && "Result can not be null");
926
927 if (!Builder)
928 Builder = LLVMOrcCreateLLJITBuilder();
929
930 auto J = unwrap(Builder)->create();
932
933 if (!J) {
934 Result = nullptr;
935 return wrap(J.takeError());
936 }
937
938 *Result = wrap(J->release());
939 return LLVMErrorSuccess;
940}
941
946
950
952 return wrap(&unwrap(J)->getMainJITDylib());
953}
954
956 return unwrap(J)->getTargetTriple().str().c_str();
957}
958
960 return unwrap(J)->getDataLayout().getGlobalPrefix();
961}
962
964LLVMOrcLLJITMangleAndIntern(LLVMOrcLLJITRef J, const char *UnmangledName) {
966 unwrap(J)->mangleAndIntern(UnmangledName)));
967}
968
970 LLVMMemoryBufferRef ObjBuffer) {
971 return wrap(unwrap(J)->addObjectFile(
972 *unwrap(JD), std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
973}
974
977 LLVMMemoryBufferRef ObjBuffer) {
978 return wrap(unwrap(J)->addObjectFile(
980 std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
981}
982
986 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
987 return wrap(unwrap(J)->addIRModule(*unwrap(JD), std::move(*TmpTSM)));
988}
989
993 std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
994 return wrap(unwrap(J)->addIRModule(ResourceTrackerSP(unwrap(RT)),
995 std::move(*TmpTSM)));
996}
997
1000 const char *Name) {
1001 assert(Result && "Result can not be null");
1002
1003 auto Sym = unwrap(J)->lookup(Name);
1004 if (!Sym) {
1005 *Result = 0;
1006 return wrap(Sym.takeError());
1007 }
1008
1009 *Result = Sym->getValue();
1010 return LLVMErrorSuccess;
1011}
1012
1014 return wrap(&unwrap(J)->getObjLinkingLayer());
1015}
1016
1019 return wrap(&unwrap(J)->getObjTransformLayer());
1020}
1021
1024 assert(Result && "Result must not be null");
1025 assert(ES && "ES must not be null");
1027 if (!MM)
1028 return wrap(MM.takeError());
1029 *Result = wrap(new ObjectLinkingLayer(*unwrap(ES), std::move(*MM)));
1030 return LLVMErrorSuccess;
1031}
1032
1036 assert(ES && "ES must not be null");
1037 return wrap(
1038 new RTDyldObjectLinkingLayer(*unwrap(ES), [](const MemoryBuffer &) {
1039 return std::make_unique<SectionMemoryManager>();
1040 }));
1041}
1042
1045 LLVMOrcExecutionSessionRef ES, void *CreateContextCtx,
1052
1053 struct MCJITMemoryManagerLikeCallbacks {
1054 MCJITMemoryManagerLikeCallbacks() = default;
1055 MCJITMemoryManagerLikeCallbacks(
1056 void *CreateContextCtx,
1063 : CreateContextCtx(CreateContextCtx), CreateContext(CreateContext),
1064 NotifyTerminating(NotifyTerminating),
1065 AllocateCodeSection(AllocateCodeSection),
1066 AllocateDataSection(AllocateDataSection),
1067 FinalizeMemory(FinalizeMemory), Destroy(Destroy) {}
1068
1069 MCJITMemoryManagerLikeCallbacks(MCJITMemoryManagerLikeCallbacks &&Other) {
1070 std::swap(CreateContextCtx, Other.CreateContextCtx);
1071 std::swap(CreateContext, Other.CreateContext);
1072 std::swap(NotifyTerminating, Other.NotifyTerminating);
1073 std::swap(AllocateCodeSection, Other.AllocateCodeSection);
1074 std::swap(AllocateDataSection, Other.AllocateDataSection);
1075 std::swap(FinalizeMemory, Other.FinalizeMemory);
1076 std::swap(Destroy, Other.Destroy);
1077 }
1078
1079 ~MCJITMemoryManagerLikeCallbacks() {
1080 if (NotifyTerminating)
1081 NotifyTerminating(CreateContextCtx);
1082 }
1083
1084 void *CreateContextCtx = nullptr;
1085 LLVMMemoryManagerCreateContextCallback CreateContext = nullptr;
1086 LLVMMemoryManagerNotifyTerminatingCallback NotifyTerminating = nullptr;
1087 LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection = nullptr;
1088 LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection = nullptr;
1089 LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory = nullptr;
1090 LLVMMemoryManagerDestroyCallback Destroy = nullptr;
1091 };
1092
1093 class MCJITMemoryManagerLikeCallbacksMemMgr : public RTDyldMemoryManager {
1094 public:
1095 MCJITMemoryManagerLikeCallbacksMemMgr(
1096 const MCJITMemoryManagerLikeCallbacks &CBs)
1097 : CBs(CBs) {
1098 Opaque = CBs.CreateContext(CBs.CreateContextCtx);
1099 }
1100 ~MCJITMemoryManagerLikeCallbacksMemMgr() override { CBs.Destroy(Opaque); }
1101
1102 uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
1103 unsigned SectionID,
1104 StringRef SectionName) override {
1105 return CBs.AllocateCodeSection(Opaque, Size, Alignment, SectionID,
1106 SectionName.str().c_str());
1107 }
1108
1109 uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
1110 unsigned SectionID, StringRef SectionName,
1111 bool isReadOnly) override {
1112 return CBs.AllocateDataSection(Opaque, Size, Alignment, SectionID,
1113 SectionName.str().c_str(), isReadOnly);
1114 }
1115
1116 bool finalizeMemory(std::string *ErrMsg) override {
1117 char *ErrMsgCString = nullptr;
1118 bool Result = CBs.FinalizeMemory(Opaque, &ErrMsgCString);
1119 assert((Result || !ErrMsgCString) &&
1120 "Did not expect an error message if FinalizeMemory succeeded");
1121 if (ErrMsgCString) {
1122 if (ErrMsg)
1123 *ErrMsg = ErrMsgCString;
1124 free(ErrMsgCString);
1125 }
1126 return Result;
1127 }
1128
1129 private:
1130 const MCJITMemoryManagerLikeCallbacks &CBs;
1131 void *Opaque = nullptr;
1132 };
1133
1134 assert(ES && "ES must not be null");
1135 assert(CreateContext && "CreateContext must not be null");
1136 assert(NotifyTerminating && "NotifyTerminating must not be null");
1137 assert(AllocateCodeSection && "AllocateCodeSection must not be null");
1138 assert(AllocateDataSection && "AllocateDataSection must not be null");
1139 assert(FinalizeMemory && "FinalizeMemory must not be null");
1140 assert(Destroy && "Destroy must not be null");
1141
1142 MCJITMemoryManagerLikeCallbacks CBs(
1143 CreateContextCtx, CreateContext, NotifyTerminating, AllocateCodeSection,
1144 AllocateDataSection, FinalizeMemory, Destroy);
1145
1146 return wrap(new RTDyldObjectLinkingLayer(
1147 *unwrap(ES), [CBs = std::move(CBs)](const MemoryBuffer &) {
1148 return std::make_unique<MCJITMemoryManagerLikeCallbacksMemMgr>(CBs);
1149 }));
1150
1151 return nullptr;
1152}
1153
1155 LLVMOrcObjectLayerRef RTDyldObjLinkingLayer,
1156 LLVMJITEventListenerRef Listener) {
1157 assert(RTDyldObjLinkingLayer && "RTDyldObjLinkingLayer must not be null");
1158 assert(Listener && "Listener must not be null");
1159 reinterpret_cast<RTDyldObjectLinkingLayer *>(unwrap(RTDyldObjLinkingLayer))
1160 ->registerJITEventListener(*unwrap(Listener));
1161}
1162
1166
1168 return unwrap(J)->getDataLayout().getStringRepresentation().c_str();
1169}
1170
1173 auto builder = createLocalIndirectStubsManagerBuilder(Triple(TargetTriple));
1174 return wrap(builder().release());
1175}
1176
1178 std::unique_ptr<IndirectStubsManager> TmpISM(unwrap(ISM));
1179}
1180
1182 const char *TargetTriple, LLVMOrcExecutionSessionRef ES,
1183 LLVMOrcJITTargetAddress ErrorHandlerAddr,
1186 Triple(TargetTriple), *unwrap(ES), ExecutorAddr(ErrorHandlerAddr));
1187
1188 if (!LCTM)
1189 return wrap(LCTM.takeError());
1190 *Result = wrap(LCTM->release());
1191 return LLVMErrorSuccess;
1192}
1193
1196 std::unique_ptr<LazyCallThroughManager> TmpLCM(unwrap(LCM));
1197}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
@ GlobalPrefix
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
#define F(x, y, z)
Definition MD5.cpp:54
#define I(x, y, z)
Definition MD5.cpp:57
LLVM_C_EXTERN_C_BEGIN typedef void *(* LLVMMemoryManagerCreateContextCallback)(void *CtxCtx)
Definition OrcEE.h:36
void(* LLVMMemoryManagerNotifyTerminatingCallback)(void *CtxCtx)
Definition OrcEE.h:37
StringRef getName() const override
Return the name of this materialization unit.
void materialize(std::unique_ptr< MaterializationResponsibility > R) override
Implementations of this method should materialize all symbols in the materialzation unit,...
OrcCAPIMaterializationUnit(std::string Name, SymbolFlagsMap InitialSymbolFlags, SymbolStringPtr InitSymbol, void *Ctx, LLVMOrcMaterializationUnitMaterializeFunction Materialize, LLVMOrcMaterializationUnitDiscardFunction Discard, LLVMOrcMaterializationUnitDestroyFunction Destroy)
Lightweight error class with error context and mandatory checking.
Definition Error.h:159
Tagged union holding either a T or a Error.
Definition Error.h:485
Flags for symbols in the JIT.
Definition JITSymbol.h:75
TargetFlagsType & getTargetFlags()
Return a reference to the target-specific flags.
Definition JITSymbol.h:173
This interface provides simple read-only access to a block of memory, and provides simple methods for...
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h: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.
void push_back(const T &Elt)
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Primary interface to the complete machine description for the target machine.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
const std::string & str() const
Definition Triple.h:480
std::pair< iterator, bool > insert(const ValueT &V)
Definition DenseSet.h:202
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:863
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:1342
const Triple & getTargetTriple() const
Return the triple for the executor.
Definition Core.h:1385
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:906
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.
Wraps state for a lookup-in-progress.
Definition Core.h:838
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition Core.h:580
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
An ObjectLayer implementation built on JITLink.
static InProgressLookupState * extractLookupState(LookupState &LS)
static void resetLookupState(LookupState &LS, InProgressLookupState *IPLS)
API to remove / transfer ownership of JIT resources.
Definition Core.h:82
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:199
UnderlyingVector::size_type size() const
Definition Core.h:280
SymbolLookupSet & add(SymbolStringPtr Name, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
Add an element to the set.
Definition Core.h:265
Provides unsafe access to ownership operations on SymbolStringPtr.
SymbolStringPool::PoolMapEntry PoolEntry
static SymbolStringPoolEntryUnsafe from(const SymbolStringPtrBase &S)
Create an unsafe pool entry ref without changing the ref-count.
static SymbolStringPoolEntryUnsafe take(SymbolStringPtr &&S)
Consumes the given SymbolStringPtr without releasing the pool entry.
String pool for symbol names used by the JIT.
Pointer to a pooled string representing a symbol name.
An LLVMContext together with an associated mutex that can be used to lock the context to prevent conc...
An LLVM Module together with a shared ThreadSafeContext.
#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.
LLVMErrorRef LLVMOrcCreateObjectLinkingLayerWithInProcessMemoryManager(LLVMOrcObjectLayerRef *Result, LLVMOrcExecutionSessionRef ES)
Create a ObjectLinkingLayer instance using the standard JITLink InProcessMemoryManager for memory man...
LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(LLVMOrcExecutionSessionRef ES)
Create a RTDyldObjectLinkingLayer instance using the standard SectionMemoryManager for memory managem...
LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithMCJITMemoryManagerLikeCallbacks(LLVMOrcExecutionSessionRef ES, void *CreateContextCtx, LLVMMemoryManagerCreateContextCallback CreateContext, LLVMMemoryManagerNotifyTerminatingCallback NotifyTerminating, LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection, LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection, LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory, LLVMMemoryManagerDestroyCallback Destroy)
Create a RTDyldObjectLinkingLayer instance using MCJIT-memory-manager-like callbacks.
uint64_t LLVMOrcJITTargetAddress
Represents an address in the executor process.
Definition Orc.h:47
void LLVMOrcObjectTransformLayerSetTransform(LLVMOrcObjectTransformLayerRef ObjTransformLayer, LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx)
Set the transform function on an LLVMOrcObjectTransformLayer.
void LLVMOrcDisposeDefinitionGenerator(LLVMOrcDefinitionGeneratorRef DG)
Dispose of a JITDylib::DefinitionGenerator.
LLVMErrorRef(* LLVMOrcGenericIRModuleOperationFunction)(void *Ctx, LLVMModuleRef M)
A function for inspecting/mutating IR modules, suitable for use with LLVMOrcThreadSafeModuleWithModul...
Definition Orc.h:398
LLVMErrorRef LLVMOrcCreateStaticLibrarySearchGeneratorForPath(LLVMOrcDefinitionGeneratorRef *Result, LLVMOrcObjectLayerRef ObjLayer, const char *FileName)
Get a LLVMOrcCreateStaticLibrarySearchGeneratorForPath that will reflect static library symbols into ...
void LLVMOrcDisposeSymbols(LLVMOrcSymbolStringPoolEntryRef *Symbols)
Disposes of the passed LLVMOrcSymbolStringPoolEntryRef* .
LLVMOrcLookupKind
Lookup kind.
Definition Orc.h:200
void LLVMOrcDisposeLazyCallThroughManager(LLVMOrcLazyCallThroughManagerRef LCM)
Dispose of an LazyCallThroughManager.
struct LLVMOrcOpaqueObjectTransformLayer * LLVMOrcObjectTransformLayerRef
A reference to an orc::ObjectTransformLayer instance.
Definition Orc.h:444
LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForPath(LLVMOrcDefinitionGeneratorRef *Result, const char *FileName, char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx)
Get a LLVMOrcCreateDynamicLibararySearchGeneratorForPath that will reflect library symbols into the J...
void LLVMOrcDisposeThreadSafeModule(LLVMOrcThreadSafeModuleRef TSM)
Dispose of a ThreadSafeModule.
LLVMOrcDumpObjectsRef LLVMOrcCreateDumpObjects(const char *DumpDir, const char *IdentifierOverride)
Create a DumpObjects instance.
LLVMErrorRef LLVMOrcJITDylibDefine(LLVMOrcJITDylibRef JD, LLVMOrcMaterializationUnitRef MU)
Add the given MaterializationUnit to the given JITDylib.
LLVMErrorRef(* LLVMOrcObjectTransformLayerTransformFunction)(void *Ctx, LLVMMemoryBufferRef *ObjInOut)
A function for applying transformations to an object file buffer.
Definition Orc.h:460
LLVMOrcSymbolStringPoolEntryRef LLVMOrcMaterializationResponsibilityGetInitializerSymbol(LLVMOrcMaterializationResponsibilityRef MR)
Returns the initialization pseudo-symbol, if any.
void LLVMOrcReleaseSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)
Reduces the ref-count for of a SymbolStringPool entry.
LLVMOrcCSymbolFlagsMapPair * LLVMOrcCSymbolFlagsMapPairs
Represents a list of (SymbolStringPtr, JITSymbolFlags) pairs that can be used to construct a SymbolFl...
Definition Orc.h:119
void LLVMOrcDisposeIndirectStubsManager(LLVMOrcIndirectStubsManagerRef ISM)
Dispose of an IndirectStubsManager.
void LLVMOrcResourceTrackerTransferTo(LLVMOrcResourceTrackerRef SrcRT, LLVMOrcResourceTrackerRef DstRT)
Transfers tracking of all resources associated with resource tracker SrcRT to resource tracker DstRT.
LLVMOrcMaterializationUnitRef LLVMOrcCreateCustomMaterializationUnit(const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym, LLVMOrcMaterializationUnitMaterializeFunction Materialize, LLVMOrcMaterializationUnitDiscardFunction Discard, LLVMOrcMaterializationUnitDestroyFunction Destroy)
Create a custom MaterializationUnit.
LLVMOrcMaterializationUnitRef LLVMOrcLazyReexports(LLVMOrcLazyCallThroughManagerRef LCTM, LLVMOrcIndirectStubsManagerRef ISM, LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases, size_t NumPairs)
Create a MaterializationUnit to define lazy re-expots.
LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyEmitted(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolDependenceGroup *SymbolDepGroups, size_t NumSymbolDepGroups)
Notifies the target JITDylib (and any pending queries on that JITDylib) that all symbols covered by t...
LLVMOrcCSymbolAliasMapPair * LLVMOrcCSymbolAliasMapPairs
Represents a list of (SymbolStringPtr, (SymbolStringPtr, JITSymbolFlags)) pairs that can be used to c...
Definition Orc.h:155
LLVMOrcCSymbolMapPair * LLVMOrcCSymbolMapPairs
Represents a list of (SymbolStringPtr, JITEvaluatedSymbol) pairs that can be used to construct a Symb...
Definition Orc.h:133
void LLVMOrcJITDylibAddGenerator(LLVMOrcJITDylibRef JD, LLVMOrcDefinitionGeneratorRef DG)
Add a DefinitionGenerator to the given JITDylib.
LLVMErrorRef LLVMOrcExecutionSessionCreateJITDylib(LLVMOrcExecutionSessionRef ES, LLVMOrcJITDylibRef *Result, const char *Name)
Create a JITDylib.
struct LLVMOrcOpaqueJITTargetMachineBuilder * LLVMOrcJITTargetMachineBuilderRef
A reference to an orc::JITTargetMachineBuilder instance.
Definition Orc.h:404
LLVMOrcJITDylibRef LLVMOrcMaterializationResponsibilityGetTargetDylib(LLVMOrcMaterializationResponsibilityRef MR)
Returns the target JITDylib that these symbols are being materialized into.
void LLVMOrcRetainSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)
Increments the ref-count for a SymbolStringPool entry.
LLVMErrorRef LLVMOrcMaterializationResponsibilityReplace(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcMaterializationUnitRef MU)
Transfers responsibility to the given MaterializationUnit for all symbols defined by that Materializa...
void LLVMOrcObjectLayerEmit(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcMaterializationResponsibilityRef R, LLVMMemoryBufferRef ObjBuffer)
Emit an object buffer to an ObjectLayer.
LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContextFromLLVMContext(LLVMContextRef Ctx)
Create a ThreadSafeContextRef from a given LLVMContext, which must not be associated with any existin...
char * LLVMOrcJITTargetMachineBuilderGetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB)
Returns the target triple for the given JITTargetMachineBuilder as a string.
void LLVMOrcLookupStateContinueLookup(LLVMOrcLookupStateRef S, LLVMErrorRef Err)
Continue a lookup that was suspended in a generator (see LLVMOrcCAPIDefinitionGeneratorTryToGenerateF...
LLVMErrorRef LLVMOrcObjectLayerAddObjectFileWithRT(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcResourceTrackerRef RT, LLVMMemoryBufferRef ObjBuffer)
Add an object to an ObjectLayer using the given ResourceTracker.
void(* LLVMOrcErrorReporterFunction)(void *Ctx, LLVMErrorRef Err)
Error reporter function.
Definition Orc.h:94
void LLVMOrcDisposeObjectLayer(LLVMOrcObjectLayerRef ObjLayer)
Dispose of an ObjectLayer.
void LLVMOrcExecutionSessionLookup(LLVMOrcExecutionSessionRef ES, LLVMOrcLookupKind K, LLVMOrcCJITDylibSearchOrder SearchOrder, size_t SearchOrderSize, LLVMOrcCLookupSet Symbols, size_t SymbolsSize, LLVMOrcExecutionSessionLookupHandleResultFunction HandleResult, void *Ctx)
Look up symbols in an execution session.
struct LLVMOrcOpaqueMaterializationResponsibility * LLVMOrcMaterializationResponsibilityRef
A reference to a uniquely owned orc::MaterializationResponsibility instance.
Definition Orc.h:272
void LLVMOrcDisposeMaterializationResponsibility(LLVMOrcMaterializationResponsibilityRef MR)
Disposes of the passed MaterializationResponsibility object.
LLVMOrcCSymbolFlagsMapPairs LLVMOrcMaterializationResponsibilityGetSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs)
Returns the symbol flags map for this responsibility instance.
LLVMOrcJITTargetMachineBuilderRef LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(LLVMTargetMachineRef TM)
Create a JITTargetMachineBuilder from the given TargetMachine template.
void(* LLVMOrcDisposeCAPIDefinitionGeneratorFunction)(void *Ctx)
Disposer for a custom generator.
Definition Orc.h:376
struct LLVMOrcOpaqueThreadSafeModule * LLVMOrcThreadSafeModuleRef
A reference to an orc::ThreadSafeModule instance.
Definition Orc.h:392
struct LLVMOrcOpaqueExecutionSession * LLVMOrcExecutionSessionRef
A reference to an orc::ExecutionSession instance.
Definition Orc.h:89
LLVMOrcMaterializationUnitRef LLVMOrcAbsoluteSymbols(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs)
Create a MaterializationUnit to define the given symbols as pointing to the corresponding raw address...
struct LLVMOrcOpaqueIndirectStubsManager * LLVMOrcIndirectStubsManagerRef
A reference to an orc::IndirectStubsManager instance.
Definition Orc.h:466
void(* LLVMOrcExecutionSessionLookupHandleResultFunction)(LLVMErrorRef Err, LLVMOrcCSymbolMapPairs Result, size_t NumPairs, void *Ctx)
Callback type for ExecutionSession lookups.
Definition Orc.h:547
LLVMErrorRef LLVMOrcJITDylibClear(LLVMOrcJITDylibRef JD)
Calls remove on all trackers associated with this JITDylib, see JITDylib::clear().
LLVMOrcThreadSafeModuleRef LLVMOrcCreateNewThreadSafeModule(LLVMModuleRef M, LLVMOrcThreadSafeContextRef TSCtx)
Create a ThreadSafeModule wrapper around the given LLVM module.
void LLVMOrcReleaseResourceTracker(LLVMOrcResourceTrackerRef RT)
Reduces the ref-count of a ResourceTracker.
LLVMOrcSymbolStringPoolRef LLVMOrcExecutionSessionGetSymbolStringPool(LLVMOrcExecutionSessionRef ES)
Return a reference to the SymbolStringPool for an ExecutionSession.
void LLVMOrcSymbolStringPoolClearDeadEntries(LLVMOrcSymbolStringPoolRef SSP)
Clear all unreferenced symbol string pool entries.
LLVMOrcExecutionSessionRef LLVMOrcMaterializationResponsibilityGetExecutionSession(LLVMOrcMaterializationResponsibilityRef MR)
Returns the ExecutionSession for this MaterializationResponsibility.
LLVMOrcIndirectStubsManagerRef LLVMOrcCreateLocalIndirectStubsManager(const char *TargetTriple)
Create a LocalIndirectStubsManager from the given target triple.
LLVMErrorRef LLVMOrcJITTargetMachineBuilderDetectHost(LLVMOrcJITTargetMachineBuilderRef *Result)
Create a JITTargetMachineBuilder by detecting the host.
LLVMErrorRef(* LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction)(LLVMOrcDefinitionGeneratorRef GeneratorObj, void *Ctx, LLVMOrcLookupStateRef *LookupState, LLVMOrcLookupKind Kind, LLVMOrcJITDylibRef JD, LLVMOrcJITDylibLookupFlags JDLookupFlags, LLVMOrcCLookupSet LookupSet, size_t LookupSetSize)
A custom generator function.
Definition Orc.h:364
void LLVMOrcIRTransformLayerEmit(LLVMOrcIRTransformLayerRef IRLayer, LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcThreadSafeModuleRef TSM)
LLVMOrcCJITDylibSearchOrderElement * LLVMOrcCJITDylibSearchOrder
A JITDylib search order.
Definition Orc.h:230
LLVMErrorRef(* LLVMOrcIRTransformLayerTransformFunction)(void *Ctx, LLVMOrcThreadSafeModuleRef *ModInOut, LLVMOrcMaterializationResponsibilityRef MR)
A function for applying transformations as part of an transform layer.
Definition Orc.h:437
struct LLVMOrcOpaqueSymbolStringPool * LLVMOrcSymbolStringPoolRef
A reference to an orc::SymbolStringPool.
Definition Orc.h:99
void(* LLVMOrcMaterializationUnitDestroyFunction)(void *Ctx)
A MaterializationUnit destruction callback.
Definition Orc.h:304
void LLVMOrcDisposeDumpObjects(LLVMOrcDumpObjectsRef DumpObjects)
Dispose of a DumpObjects instance.
struct LLVMOrcOpaqueResourceTracker * LLVMOrcResourceTrackerRef
A reference to an orc::ResourceTracker instance.
Definition Orc.h:309
void LLVMOrcIRTransformLayerSetTransform(LLVMOrcIRTransformLayerRef IRTransformLayer, LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx)
Set the transform function of the provided transform layer, passing through a pointer to user provide...
void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx)
Dispose of a ThreadSafeContext.
LLVMOrcCDependenceMapPair * LLVMOrcCDependenceMapPairs
Represents a list of (JITDylibRef, (LLVMOrcSymbolStringPoolEntryRef*, size_t)) pairs that can be used...
Definition Orc.h:183
const char * LLVMOrcSymbolStringPoolEntryStr(LLVMOrcSymbolStringPoolEntryRef S)
Return the c-string for the given symbol.
LLVMErrorRef LLVMOrcThreadSafeModuleWithModuleDo(LLVMOrcThreadSafeModuleRef TSM, LLVMOrcGenericIRModuleOperationFunction F, void *Ctx)
Apply the given function to the module contained in this ThreadSafeModule.
LLVMErrorRef LLVMOrcObjectLayerAddObjectFile(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcJITDylibRef JD, LLVMMemoryBufferRef ObjBuffer)
Add an object to an ObjectLayer to the given JITDylib.
LLVMErrorRef LLVMOrcMaterializationResponsibilityDelegate(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols, LLVMOrcMaterializationResponsibilityRef *Result)
Delegates responsibility for the given symbols to the returned materialization responsibility.
LLVMOrcCLookupSetElement * LLVMOrcCLookupSet
A set of symbols to look up / generate.
Definition Orc.h:260
LLVMOrcResourceTrackerRef LLVMOrcJITDylibCreateResourceTracker(LLVMOrcJITDylibRef JD)
Return a reference to a newly created resource tracker associated with JD.
struct LLVMOrcOpaqueObjectLayer * LLVMOrcObjectLayerRef
A reference to an orc::ObjectLayer instance.
Definition Orc.h:410
int(* LLVMOrcSymbolPredicate)(void *Ctx, LLVMOrcSymbolStringPoolEntryRef Sym)
Predicate function for SymbolStringPoolEntries.
Definition Orc.h:381
void LLVMOrcDisposeJITTargetMachineBuilder(LLVMOrcJITTargetMachineBuilderRef JTMB)
Dispose of a JITTargetMachineBuilder.
void LLVMOrcJITTargetMachineBuilderSetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple)
Sets the target triple for the given JITTargetMachineBuilder to the given string.
struct LLVMOrcOpaqueDefinitionGenerator * LLVMOrcDefinitionGeneratorRef
A reference to an orc::DefinitionGenerator.
Definition Orc.h:314
LLVMOrcJITDylibRef LLVMOrcExecutionSessionGetJITDylibByName(LLVMOrcExecutionSessionRef ES, const char *Name)
Returns the JITDylib with the given name, or NULL if no such JITDylib exists.
void LLVMOrcMaterializationResponsibilityFailMaterialization(LLVMOrcMaterializationResponsibilityRef MR)
Notify all not-yet-emitted covered by this MaterializationResponsibility instance that an error has o...
struct LLVMOrcOpaqueSymbolStringPoolEntry * LLVMOrcSymbolStringPoolEntryRef
A reference to an orc::SymbolStringPool table entry.
Definition Orc.h:104
void LLVMOrcDisposeCSymbolFlagsMap(LLVMOrcCSymbolFlagsMapPairs Pairs)
Disposes of the passed LLVMOrcCSymbolFlagsMap.
LLVMErrorRef LLVMOrcMaterializationResponsibilityDefineMaterializing(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms)
Attempt to claim responsibility for new definitions.
LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContext(void)
Create a ThreadSafeContextRef containing a new LLVMContext.
void(* LLVMOrcMaterializationUnitDiscardFunction)(void *Ctx, LLVMOrcJITDylibRef JD, LLVMOrcSymbolStringPoolEntryRef Symbol)
A MaterializationUnit discard callback.
Definition Orc.h:294
LLVMOrcResourceTrackerRef LLVMOrcJITDylibGetDefaultResourceTracker(LLVMOrcJITDylibRef JD)
Return a reference to the default resource tracker for the given JITDylib.
LLVMOrcSymbolStringPoolEntryRef * LLVMOrcMaterializationResponsibilityGetRequestedSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols)
Returns the names of any symbols covered by this MaterializationResponsibility object that have queri...
void(* LLVMOrcMaterializationUnitMaterializeFunction)(void *Ctx, LLVMOrcMaterializationResponsibilityRef MR)
A MaterializationUnit materialize callback.
Definition Orc.h:285
struct LLVMOrcOpaqueDumpObjects * LLVMOrcDumpObjectsRef
A reference to an orc::DumpObjects object.
Definition Orc.h:481
LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(LLVMOrcDefinitionGeneratorRef *Result, char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx)
Get a DynamicLibrarySearchGenerator that will reflect process symbols into the JITDylib.
struct LLVMOrcOpaqueIRTransformLayer * LLVMOrcIRTransformLayerRef
A reference to an orc::IRTransformLayer instance.
Definition Orc.h:420
struct LLVMOrcOpaqueLookupState * LLVMOrcLookupStateRef
An opaque lookup state object.
Definition Orc.h:329
LLVMOrcDefinitionGeneratorRef LLVMOrcCreateCustomCAPIDefinitionGenerator(LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction F, void *Ctx, LLVMOrcDisposeCAPIDefinitionGeneratorFunction Dispose)
Create a custom generator.
LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyResolved(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolMapPairs Symbols, size_t NumSymbols)
Notifies the target JITDylib that the given symbols have been resolved.
LLVMErrorRef LLVMOrcCreateLocalLazyCallThroughManager(const char *TargetTriple, LLVMOrcExecutionSessionRef ES, LLVMOrcJITTargetAddress ErrorHandlerAddr, LLVMOrcLazyCallThroughManagerRef *Result)
void LLVMOrcDisposeMaterializationUnit(LLVMOrcMaterializationUnitRef MU)
Dispose of a MaterializationUnit.
LLVMErrorRef LLVMOrcResourceTrackerRemove(LLVMOrcResourceTrackerRef RT)
Remove all resources associated with the given tracker.
struct LLVMOrcOpaqueMaterializationUnit * LLVMOrcMaterializationUnitRef
A reference to a uniquely owned orc::MaterializationUnit instance.
Definition Orc.h:265
LLVMOrcJITDylibRef LLVMOrcExecutionSessionCreateBareJITDylib(LLVMOrcExecutionSessionRef ES, const char *Name)
Create a "bare" JITDylib.
LLVMOrcSymbolStringPoolEntryRef LLVMOrcExecutionSessionIntern(LLVMOrcExecutionSessionRef ES, const char *Name)
Intern a string in the ExecutionSession's SymbolStringPool and return a reference to it.
void LLVMOrcExecutionSessionSetErrorReporter(LLVMOrcExecutionSessionRef ES, LLVMOrcErrorReporterFunction ReportError, void *Ctx)
Attach a custom error reporter function to the ExecutionSession.
LLVMErrorRef LLVMOrcDumpObjects_CallOperator(LLVMOrcDumpObjectsRef DumpObjects, LLVMMemoryBufferRef *ObjBuffer)
Dump the contents of the given MemoryBuffer.
struct LLVMOrcOpaqueJITDylib * LLVMOrcJITDylibRef
A reference to an orc::JITDylib instance.
Definition Orc.h:160
struct LLVMOrcOpaqueThreadSafeContext * LLVMOrcThreadSafeContextRef
A reference to an orc::ThreadSafeContext instance.
Definition Orc.h:387
LLVMOrcJITDylibLookupFlags
JITDylib lookup flags.
Definition Orc.h:211
@ LLVMOrcLookupKindDLSym
Definition Orc.h:202
@ LLVMOrcLookupKindStatic
Definition Orc.h:201
@ LLVMJITSymbolGenericFlagsWeak
Definition Orc.h:60
@ LLVMJITSymbolGenericFlagsExported
Definition Orc.h:59
@ LLVMJITSymbolGenericFlagsCallable
Definition Orc.h:61
@ LLVMJITSymbolGenericFlagsMaterializationSideEffectsOnly
Definition Orc.h:62
@ LLVMOrcSymbolLookupFlagsRequiredSymbol
Definition Orc.h:237
@ LLVMOrcSymbolLookupFlagsWeaklyReferencedSymbol
Definition Orc.h:238
@ LLVMOrcJITDylibLookupFlagsMatchAllSymbols
Definition Orc.h:213
@ LLVMOrcJITDylibLookupFlagsMatchExportedSymbolsOnly
Definition Orc.h:212
void(* LLVMMemoryManagerDestroyCallback)(void *Opaque)
LLVMBool(* LLVMMemoryManagerFinalizeMemoryCallback)(void *Opaque, char **ErrMsg)
uint8_t *(* LLVMMemoryManagerAllocateDataSectionCallback)(void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID, const char *SectionName, LLVMBool IsReadOnly)
uint8_t *(* LLVMMemoryManagerAllocateCodeSectionCallback)(void *Opaque, uintptr_t Size, unsigned Alignment, unsigned SectionID, const char *SectionName)
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
Definition Types.h:48
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
Definition Types.h:53
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
Definition Types.h:61
struct LLVMOpaqueJITEventListener * LLVMJITEventListenerRef
Definition Types.h:165
struct LLVMOpaqueTargetMachine * LLVMTargetMachineRef
LLVM_C_ABI void LLVMDisposeTargetMachine(LLVMTargetMachineRef T)
Dispose the LLVMTargetMachineRef instance generated by LLVMCreateTargetMachine.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
static LLVMJITEvaluatedSymbol fromExecutorSymbolDef(const ExecutorSymbolDef &S)
static JITSymbolFlags toJITSymbolFlags(LLVMJITSymbolFlags F)
static SymbolNameSet toSymbolNameSet(LLVMOrcCSymbolsList Symbols)
static JITDylibLookupFlags toJITDylibLookupFlags(LLVMOrcJITDylibLookupFlags LF)
static LLVMOrcSymbolLookupFlags fromSymbolLookupFlags(SymbolLookupFlags SLF)
static SymbolMap toSymbolMap(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs)
static LLVMOrcLookupKind fromLookupKind(LookupKind K)
static LLVMOrcJITDylibLookupFlags fromJITDylibLookupFlags(JITDylibLookupFlags LF)
static SymbolDependenceMap toSymbolDependenceMap(LLVMOrcCDependenceMapPairs Pairs, size_t NumPairs)
static LookupKind toLookupKind(LLVMOrcLookupKind K)
static SymbolLookupFlags toSymbolLookupFlags(LLVMOrcSymbolLookupFlags SLF)
static LLVMJITSymbolFlags fromJITSymbolFlags(JITSymbolFlags JSF)
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:177
IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP
Definition Core.h:56
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
SymbolLookupFlags
Lookup flags that apply to each symbol in a lookup.
Definition Core.h:161
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
Definition Core.h:151
DenseMap< SymbolStringPtr, ExecutorSymbolDef > SymbolMap
A map from symbol names (as SymbolStringPtrs) to JITSymbols (address/flags pairs).
LLVM_ABI std::function< std::unique_ptr< IndirectStubsManager >()> createLocalIndirectStubsManagerBuilder(const Triple &T)
Create a local indirect stubs manager builder.
LLVM_ABI Expected< std::unique_ptr< LazyCallThroughManager > > createLocalLazyCallThroughManager(const Triple &T, ExecutionSession &ES, ExecutorAddr ErrorHandlerAddr)
Create a LocalLazyCallThroughManager from the given triple and execution session.
std::unique_ptr< LazyReexportsMaterializationUnit > lazyReexports(LazyCallThroughManager &LCTManager, RedirectableSymbolManager &RSManager, JITDylib &SourceJD, SymbolAliasMap CallableAliases, ImplSymbolMap *SrcJDLoc=nullptr)
Define lazy-reexports based on the given SymbolAliasMap.
LookupKind
Describes the kind of lookup being performed.
Definition Core.h:173
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
DenseMap< JITDylib *, SymbolNameSet > SymbolDependenceMap
A map from JITDylibs to sets of symbols.
DenseSet< SymbolStringPtr > SymbolNameSet
A set of symbol names (represented by SymbolStringPtrs for.
@ Ready
Emitted to memory, but waiting on transitive dependencies.
Definition Core.h:782
DenseMap< SymbolStringPtr, SymbolAliasMapEntry > SymbolAliasMap
A map of Symbols to (Symbol, Flags) pairs.
Definition Core.h:417
DenseMap< SymbolStringPtr, JITSymbolFlags > SymbolFlagsMap
A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) get(const PointerIntPair< PointerTy, IntBits, IntType, PtrTraits, Info > &Pair)
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
Definition MemAlloc.h:25
@ Other
Any other memory.
Definition ModRef.h:68
Attribute unwrap(LLVMAttributeRef Attr)
Definition Attributes.h: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:1872
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:1879
LLVMAttributeRef wrap(Attribute Attr)
Definition Attributes.h:346
Implement std::hash so that hash_code can be used in STL containers.
Definition BitVector.h:867
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition BitVector.h:869
Represents an evaluated symbol address and flags.
Definition Orc.h:81
Represents the linkage flags for a symbol definition.
Definition Orc.h:73
LLVMOrcCSymbolsList Names
Definition Orc.h:176
A set of symbols that share dependencies.
Definition Orc.h:188
Represents a pair of a symbol name and LLVMJITSymbolFlags.
Definition Orc.h:110
Represents a pair of a symbol name and an evaluated symbol.
Definition Orc.h:124
Represents a list of LLVMOrcSymbolStringPoolEntryRef and the associated length.
Definition Orc.h:166
LLVMOrcSymbolStringPoolEntryRef * Symbols
Definition Orc.h:167
size_t Length
Definition Orc.h:168
A set of symbols and the their dependencies.
Definition Core.h:568