LLVM  16.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"
12 #include "llvm-c/TargetMachine.h"
13 
19 
20 using namespace llvm;
21 using namespace llvm::orc;
22 
23 namespace llvm {
24 namespace orc {
25 
27 
29 public:
32 
33  // Move from SymbolStringPtr to PoolEntryPtr (no change in ref count).
35  PoolEntryPtr Result = nullptr;
36  std::swap(Result, S.S);
37  return Result;
38  }
39 
40  // Move from a PoolEntryPtr to a SymbolStringPtr (no change in ref count).
43  S.S = P;
44  return S;
45  }
46 
47  // Copy a pool entry to a SymbolStringPtr (increments ref count).
49  return SymbolStringPtr(P);
50  }
51 
53  return S.S;
54  }
55 
58  S.S = nullptr;
59  }
60 
63  S.S = P;
64  }
65 
67  return LS.IPLS.release();
68  }
69 
71  return LS.reset(IPLS);
72  }
73 };
74 
75 } // namespace orc
76 } // namespace llvm
77 
108 
109 namespace {
110 
111 class OrcCAPIMaterializationUnit : public llvm::orc::MaterializationUnit {
112 public:
113  OrcCAPIMaterializationUnit(
114  std::string Name, SymbolFlagsMap InitialSymbolFlags,
115  SymbolStringPtr InitSymbol, void *Ctx,
120  Interface(std::move(InitialSymbolFlags), std::move(InitSymbol))),
121  Name(std::move(Name)), Ctx(Ctx), Materialize(Materialize),
122  Discard(Discard), Destroy(Destroy) {}
123 
124  ~OrcCAPIMaterializationUnit() {
125  if (Ctx)
126  Destroy(Ctx);
127  }
128 
129  StringRef getName() const override { return Name; }
130 
131  void materialize(std::unique_ptr<MaterializationResponsibility> R) override {
132  void *Tmp = Ctx;
133  Ctx = nullptr;
134  Materialize(Tmp, wrap(R.release()));
135  }
136 
137 private:
138  void discard(const JITDylib &JD, const SymbolStringPtr &Name) override {
139  Discard(Ctx, wrap(&JD), wrap(OrcV2CAPIHelper::getRawPoolEntryPtr(Name)));
140  }
141 
142  std::string Name;
143  void *Ctx = nullptr;
144  LLVMOrcMaterializationUnitMaterializeFunction Materialize = nullptr;
147 };
148 
149 static JITSymbolFlags toJITSymbolFlags(LLVMJITSymbolFlags F) {
150 
151  JITSymbolFlags JSF;
152 
153  if (F.GenericFlags & LLVMJITSymbolGenericFlagsExported)
155  if (F.GenericFlags & LLVMJITSymbolGenericFlagsWeak)
156  JSF |= JITSymbolFlags::Weak;
157  if (F.GenericFlags & LLVMJITSymbolGenericFlagsCallable)
161 
162  JSF.getTargetFlags() = F.TargetFlags;
163 
164  return JSF;
165 }
166 
167 static LLVMJITSymbolFlags fromJITSymbolFlags(JITSymbolFlags JSF) {
168  LLVMJITSymbolFlags F = {0, 0};
169  if (JSF & JITSymbolFlags::Exported)
170  F.GenericFlags |= LLVMJITSymbolGenericFlagsExported;
171  if (JSF & JITSymbolFlags::Weak)
172  F.GenericFlags |= LLVMJITSymbolGenericFlagsWeak;
173  if (JSF & JITSymbolFlags::Callable)
174  F.GenericFlags |= LLVMJITSymbolGenericFlagsCallable;
177 
178  F.TargetFlags = JSF.getTargetFlags();
179 
180  return F;
181 }
182 
183 static SymbolMap toSymbolMap(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs) {
184  SymbolMap SM;
185  for (size_t I = 0; I != NumPairs; ++I) {
186  JITSymbolFlags Flags = toJITSymbolFlags(Syms[I].Sym.Flags);
188  JITEvaluatedSymbol(Syms[I].Sym.Address, Flags);
189  }
190  return SM;
191 }
192 
193 static SymbolDependenceMap
194 toSymbolDependenceMap(LLVMOrcCDependenceMapPairs Pairs, size_t NumPairs) {
196  for (size_t I = 0; I != NumPairs; ++I) {
197  JITDylib *JD = unwrap(Pairs[I].JD);
198  SymbolNameSet Names;
199 
200  for (size_t J = 0; J != Pairs[I].Names.Length; ++J) {
201  auto Sym = Pairs[I].Names.Symbols[J];
203  }
204  SDM[JD] = Names;
205  }
206  return SDM;
207 }
208 
209 static LookupKind toLookupKind(LLVMOrcLookupKind K) {
210  switch (K) {
212  return LookupKind::Static;
214  return LookupKind::DLSym;
215  }
216  llvm_unreachable("unrecognized LLVMOrcLookupKind value");
217 }
218 
219 static LLVMOrcLookupKind fromLookupKind(LookupKind K) {
220  switch (K) {
221  case LookupKind::Static:
223  case LookupKind::DLSym:
224  return LLVMOrcLookupKindDLSym;
225  }
226  llvm_unreachable("unrecognized LookupKind value");
227 }
228 
229 static JITDylibLookupFlags
230 toJITDylibLookupFlags(LLVMOrcJITDylibLookupFlags LF) {
231  switch (LF) {
236  }
237  llvm_unreachable("unrecognized LLVMOrcJITDylibLookupFlags value");
238 }
239 
241 fromJITDylibLookupFlags(JITDylibLookupFlags LF) {
242  switch (LF) {
247  }
248  llvm_unreachable("unrecognized JITDylibLookupFlags value");
249 }
250 
251 static SymbolLookupFlags toSymbolLookupFlags(LLVMOrcSymbolLookupFlags SLF) {
252  switch (SLF) {
257  }
258  llvm_unreachable("unrecognized LLVMOrcSymbolLookupFlags value");
259 }
260 
261 static LLVMOrcSymbolLookupFlags fromSymbolLookupFlags(SymbolLookupFlags SLF) {
262  switch (SLF) {
267  }
268  llvm_unreachable("unrecognized SymbolLookupFlags value");
269 }
270 
272 fromJITEvaluatedSymbol(const JITEvaluatedSymbol &S) {
273  return {S.getAddress(), fromJITSymbolFlags(S.getFlags())};
274 }
275 
276 } // end anonymous namespace
277 
278 namespace llvm {
279 namespace orc {
280 
282 public:
286  : Dispose(Dispose), Ctx(Ctx), TryToGenerate(TryToGenerate) {}
287 
289  if (Dispose)
290  Dispose(Ctx);
291  }
292 
294  JITDylibLookupFlags JDLookupFlags,
295  const SymbolLookupSet &LookupSet) override {
296 
297  // Take the lookup state.
299 
300  // Translate the lookup kind.
301  LLVMOrcLookupKind CLookupKind = fromLookupKind(K);
302 
303  // Translate the JITDylibLookupFlags.
304  LLVMOrcJITDylibLookupFlags CJDLookupFlags =
305  fromJITDylibLookupFlags(JDLookupFlags);
306 
307  // Translate the lookup set.
308  std::vector<LLVMOrcCLookupSetElement> CLookupSet;
309  CLookupSet.reserve(LookupSet.size());
310  for (auto &KV : LookupSet) {
313  LLVMOrcSymbolLookupFlags SLF = fromSymbolLookupFlags(KV.second);
314  CLookupSet.push_back({Name, SLF});
315  }
316 
317  // Run the C TryToGenerate function.
318  auto Err = unwrap(TryToGenerate(::wrap(this), Ctx, &LSR, CLookupKind,
319  ::wrap(&JD), CJDLookupFlags,
320  CLookupSet.data(), CLookupSet.size()));
321 
322  // Restore the lookup state.
324 
325  return Err;
326  }
327 
328 private:
330  void *Ctx;
332 };
333 
334 } // end namespace orc
335 } // end namespace llvm
336 
339  void *Ctx) {
340  unwrap(ES)->setErrorReporter(
341  [=](Error Err) { ReportError(Ctx, wrap(std::move(Err))); });
342 }
343 
346  return wrap(
347  unwrap(ES)->getExecutorProcessControl().getSymbolStringPool().get());
348 }
349 
351  unwrap(SSP)->clearDeadEntries();
352 }
353 
356  return wrap(
358 }
359 
362  LLVMOrcCJITDylibSearchOrder SearchOrder, size_t SearchOrderSize,
363  LLVMOrcCLookupSet Symbols, size_t SymbolsSize,
364  LLVMOrcExecutionSessionLookupHandleResultFunction HandleResult, void *Ctx) {
365  assert(ES && "ES cannot be null");
366  assert(SearchOrder && "SearchOrder cannot be null");
367  assert(Symbols && "Symbols cannot be null");
368  assert(HandleResult && "HandleResult cannot be null");
369 
371  for (size_t I = 0; I != SearchOrderSize; ++I)
372  SO.push_back({unwrap(SearchOrder[I].JD),
373  toJITDylibLookupFlags(SearchOrder[I].JDLookupFlags)});
374 
375  SymbolLookupSet SLS;
376  for (size_t I = 0; I != SymbolsSize; ++I)
378  toSymbolLookupFlags(Symbols[I].LookupFlags));
379 
380  unwrap(ES)->lookup(
381  toLookupKind(K), SO, std::move(SLS), SymbolState::Ready,
382  [HandleResult, Ctx](Expected<SymbolMap> Result) {
383  if (Result) {
385  for (auto &KV : *Result)
386  CResult.push_back(LLVMOrcCSymbolMapPair{
387  wrap(OrcV2CAPIHelper::getRawPoolEntryPtr(KV.first)),
388  fromJITEvaluatedSymbol(KV.second)});
389  HandleResult(LLVMErrorSuccess, CResult.data(), CResult.size(), Ctx);
390  } else
391  HandleResult(wrap(Result.takeError()), nullptr, 0, Ctx);
392  },
394 }
395 
398 }
399 
402 }
403 
405  return unwrap(S)->getKey().data();
406 }
407 
410  auto RT = unwrap(JD)->createResourceTracker();
411  // Retain the pointer for the C API client.
412  RT->Retain();
413  return wrap(RT.get());
414 }
415 
418  auto RT = unwrap(JD)->getDefaultResourceTracker();
419  // Retain the pointer for the C API client.
420  return wrap(RT.get());
421 }
422 
424  ResourceTrackerSP TmpRT(unwrap(RT));
425  TmpRT->Release();
426 }
427 
430  ResourceTrackerSP TmpRT(unwrap(SrcRT));
431  TmpRT->transferTo(*unwrap(DstRT));
432 }
433 
435  ResourceTrackerSP TmpRT(unwrap(RT));
436  return wrap(TmpRT->remove());
437 }
438 
440  std::unique_ptr<DefinitionGenerator> TmpDG(unwrap(DG));
441 }
442 
444  std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
445 }
446 
448  const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms,
449  size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym,
453  SymbolFlagsMap SFM;
454  for (size_t I = 0; I != NumSyms; ++I)
456  toJITSymbolFlags(Syms[I].Flags);
457 
459 
460  return wrap(new OrcCAPIMaterializationUnit(
461  Name, std::move(SFM), std::move(IS), Ctx, Materialize, Discard, Destroy));
462 }
463 
466  SymbolMap SM = toSymbolMap(Syms, NumPairs);
467  return wrap(absoluteSymbols(std::move(SM)).release());
468 }
469 
472  LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases,
473  size_t NumPairs) {
474 
475  SymbolAliasMap SAM;
476  for (size_t I = 0; I != NumPairs; ++I) {
477  auto pair = CallableAliases[I];
478  JITSymbolFlags Flags = toJITSymbolFlags(pair.Entry.Flags);
482  SymbolAliasMapEntry(Name, Flags);
483  }
484 
485  return wrap(lazyReexports(*unwrap(LCTM), *unwrap(ISM), *unwrap(SourceJD),
486  std::move(SAM))
487  .release());
488 }
489 
492  std::unique_ptr<MaterializationResponsibility> TmpMR(unwrap(MR));
493 }
494 
497  return wrap(&unwrap(MR)->getTargetJITDylib());
498 }
499 
503  return wrap(&unwrap(MR)->getExecutionSession());
504 }
505 
507  LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs) {
508 
509  auto Symbols = unwrap(MR)->getSymbols();
511  safe_malloc(Symbols.size() * sizeof(LLVMOrcCSymbolFlagsMapPair)));
512  size_t I = 0;
513  for (auto const &pair : Symbols) {
514  auto Name = wrap(OrcV2CAPIHelper::getRawPoolEntryPtr(pair.first));
515  auto Flags = pair.second;
516  Result[I] = {Name, fromJITSymbolFlags(Flags)};
517  I++;
518  }
519  *NumPairs = Symbols.size();
520  return Result;
521 }
522 
524  free(Pairs);
525 }
526 
530  auto Sym = unwrap(MR)->getInitializerSymbol();
532 }
533 
536  LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols) {
537 
538  auto Symbols = unwrap(MR)->getRequestedSymbols();
541  Symbols.size() * sizeof(LLVMOrcSymbolStringPoolEntryRef)));
542  size_t I = 0;
543  for (auto &Name : Symbols) {
545  I++;
546  }
547  *NumSymbols = Symbols.size();
548  return Result;
549 }
550 
552  free(Symbols);
553 }
554 
557  size_t NumPairs) {
558  SymbolMap SM = toSymbolMap(Symbols, NumPairs);
559  return wrap(unwrap(MR)->notifyResolved(std::move(SM)));
560 }
561 
564  return wrap(unwrap(MR)->notifyEmitted());
565 }
566 
569  LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms) {
570  SymbolFlagsMap SFM;
571  for (size_t I = 0; I != NumSyms; ++I)
573  toJITSymbolFlags(Syms[I].Flags);
574 
575  return wrap(unwrap(MR)->defineMaterializing(std::move(SFM)));
576 }
577 
581  std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
582  return wrap(unwrap(MR)->replace(std::move(TmpMU)));
583 }
584 
587  LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols,
589  SymbolNameSet Syms;
590  for (size_t I = 0; I != NumSymbols; I++) {
592  }
593  auto OtherMR = unwrap(MR)->delegate(Syms);
594 
595  if (!OtherMR) {
596  return wrap(OtherMR.takeError());
597  }
598  *Result = wrap(OtherMR->release());
599  return LLVMErrorSuccess;
600 }
601 
605  LLVMOrcCDependenceMapPairs Dependencies, size_t NumPairs) {
606 
607  SymbolDependenceMap SDM = toSymbolDependenceMap(Dependencies, NumPairs);
609  unwrap(MR)->addDependencies(Sym, SDM);
610 }
611 
614  LLVMOrcCDependenceMapPairs Dependencies, size_t NumPairs) {
615 
616  SymbolDependenceMap SDM = toSymbolDependenceMap(Dependencies, NumPairs);
617  unwrap(MR)->addDependenciesForAll(SDM);
618 }
619 
622  unwrap(MR)->failMaterialization();
623 }
624 
628  std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
629  unwrap(IRLayer)->emit(
630  std::unique_ptr<MaterializationResponsibility>(unwrap(MR)),
631  std::move(*TmpTSM));
632 }
633 
636  const char *Name) {
637  return wrap(&unwrap(ES)->createBareJITDylib(Name));
638 }
639 
642  LLVMOrcJITDylibRef *Result,
643  const char *Name) {
644  auto JD = unwrap(ES)->createJITDylib(Name);
645  if (!JD)
646  return wrap(JD.takeError());
647  *Result = wrap(&*JD);
648  return LLVMErrorSuccess;
649 }
650 
653  const char *Name) {
654  return wrap(unwrap(ES)->getJITDylibByName(Name));
655 }
656 
659  std::unique_ptr<MaterializationUnit> TmpMU(unwrap(MU));
660 
661  if (auto Err = unwrap(JD)->define(TmpMU)) {
662  TmpMU.release();
663  return wrap(std::move(Err));
664  }
665  return LLVMErrorSuccess;
666 }
667 
669  return wrap(unwrap(JD)->clear());
670 }
671 
674  unwrap(JD)->addGenerator(std::unique_ptr<DefinitionGenerator>(unwrap(DG)));
675 }
676 
680  auto DG = std::make_unique<CAPIDefinitionGenerator>(Dispose, Ctx, F);
681  return wrap(DG.release());
682 }
683 
685  LLVMErrorRef Err) {
686  LookupState LS;
688  LS.continueLookup(unwrap(Err));
689 }
690 
693  LLVMOrcSymbolPredicate Filter, void *FilterCtx) {
694  assert(Result && "Result can not be null");
695  assert((Filter || !FilterCtx) &&
696  "if Filter is null then FilterCtx must also be null");
697 
699  if (Filter)
700  Pred = [=](const SymbolStringPtr &Name) -> bool {
702  };
703 
704  auto ProcessSymsGenerator =
706 
707  if (!ProcessSymsGenerator) {
708  *Result = nullptr;
709  return wrap(ProcessSymsGenerator.takeError());
710  }
711 
712  *Result = wrap(ProcessSymsGenerator->release());
713  return LLVMErrorSuccess;
714 }
715 
717  LLVMOrcDefinitionGeneratorRef *Result, const char *FileName,
718  char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx) {
719  assert(Result && "Result can not be null");
720  assert(FileName && "FileName can not be null");
721  assert((Filter || !FilterCtx) &&
722  "if Filter is null then FilterCtx must also be null");
723 
725  if (Filter)
726  Pred = [=](const SymbolStringPtr &Name) -> bool {
728  };
729 
730  auto LibrarySymsGenerator =
732 
733  if (!LibrarySymsGenerator) {
734  *Result = nullptr;
735  return wrap(LibrarySymsGenerator.takeError());
736  }
737 
738  *Result = wrap(LibrarySymsGenerator->release());
739  return LLVMErrorSuccess;
740 }
741 
744  const char *FileName, const char *TargetTriple) {
745  assert(Result && "Result can not be null");
746  assert(FileName && "Filename can not be null");
747  assert(ObjLayer && "ObjectLayer can not be null");
748 
749  if (TargetTriple) {
750  auto TT = Triple(TargetTriple);
751  auto LibrarySymsGenerator =
752  StaticLibraryDefinitionGenerator::Load(*unwrap(ObjLayer), FileName, TT);
753  if (!LibrarySymsGenerator) {
754  *Result = nullptr;
755  return wrap(LibrarySymsGenerator.takeError());
756  }
757  *Result = wrap(LibrarySymsGenerator->release());
758  return LLVMErrorSuccess;
759  } else {
760  auto LibrarySymsGenerator =
761  StaticLibraryDefinitionGenerator::Load(*unwrap(ObjLayer), FileName);
762  if (!LibrarySymsGenerator) {
763  *Result = nullptr;
764  return wrap(LibrarySymsGenerator.takeError());
765  }
766  *Result = wrap(LibrarySymsGenerator->release());
767  return LLVMErrorSuccess;
768  }
769 }
770 
772  return wrap(new ThreadSafeContext(std::make_unique<LLVMContext>()));
773 }
774 
777  return wrap(unwrap(TSCtx)->getContext());
778 }
779 
781  delete unwrap(TSCtx);
782 }
783 
787  void *Ctx) {
788  return wrap(unwrap(TSM)->withModuleDo(
789  [&](Module &M) { return unwrap(F(Ctx, wrap(&M))); }));
790 }
791 
795  return wrap(
796  new ThreadSafeModule(std::unique_ptr<Module>(unwrap(M)), *unwrap(TSCtx)));
797 }
798 
800  delete unwrap(TSM);
801 }
802 
805  assert(Result && "Result can not be null");
806 
808  if (!JTMB) {
809  Result = nullptr;
810  return wrap(JTMB.takeError());
811  }
812 
813  *Result = wrap(new JITTargetMachineBuilder(std::move(*JTMB)));
814  return LLVMErrorSuccess;
815 }
816 
819  auto *TemplateTM = unwrap(TM);
820 
821  auto JTMB =
822  std::make_unique<JITTargetMachineBuilder>(TemplateTM->getTargetTriple());
823 
824  (*JTMB)
825  .setCPU(TemplateTM->getTargetCPU().str())
826  .setRelocationModel(TemplateTM->getRelocationModel())
827  .setCodeModel(TemplateTM->getCodeModel())
828  .setCodeGenOptLevel(TemplateTM->getOptLevel())
829  .setFeatures(TemplateTM->getTargetFeatureString())
830  .setOptions(TemplateTM->Options);
831 
833 
834  return wrap(JTMB.release());
835 }
836 
839  delete unwrap(JTMB);
840 }
841 
844  auto Tmp = unwrap(JTMB)->getTargetTriple().str();
845  char *TargetTriple = (char *)malloc(Tmp.size() + 1);
846  strcpy(TargetTriple, Tmp.c_str());
847  return TargetTriple;
848 }
849 
851  LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple) {
852  unwrap(JTMB)->getTargetTriple() = Triple(TargetTriple);
853 }
854 
857  LLVMMemoryBufferRef ObjBuffer) {
858  return wrap(unwrap(ObjLayer)->add(
859  *unwrap(JD), std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
860 }
861 
864  LLVMMemoryBufferRef ObjBuffer) {
865  return wrap(
866  unwrap(ObjLayer)->add(ResourceTrackerSP(unwrap(RT)),
867  std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
868 }
869 
872  LLVMMemoryBufferRef ObjBuffer) {
873  unwrap(ObjLayer)->emit(
874  std::unique_ptr<MaterializationResponsibility>(unwrap(R)),
875  std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer)));
876 }
877 
879  delete unwrap(ObjLayer);
880 }
881 
884  LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx) {
886  ->setTransform(
887  [=](ThreadSafeModule TSM,
890  wrap(new ThreadSafeModule(std::move(TSM)));
891  if (LLVMErrorRef Err = TransformFunction(Ctx, &TSMRef, wrap(&R))) {
892  assert(!TSMRef && "TSMRef was not reset to null on error");
893  return unwrap(Err);
894  }
895  assert(TSMRef && "Transform succeeded, but TSMRef was set to null");
896  ThreadSafeModule Result = std::move(*unwrap(TSMRef));
898  return std::move(Result);
899  });
900 }
901 
903  LLVMOrcObjectTransformLayerRef ObjTransformLayer,
904  LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx) {
905  unwrap(ObjTransformLayer)
906  ->setTransform([TransformFunction, Ctx](std::unique_ptr<MemoryBuffer> Obj)
907  -> Expected<std::unique_ptr<MemoryBuffer>> {
908  LLVMMemoryBufferRef ObjBuffer = wrap(Obj.release());
909  if (LLVMErrorRef Err = TransformFunction(Ctx, &ObjBuffer)) {
910  assert(!ObjBuffer && "ObjBuffer was not reset to null on error");
911  return unwrap(Err);
912  }
913  return std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer));
914  });
915 }
916 
918  const char *IdentifierOverride) {
919  assert(DumpDir && "DumpDir should not be null");
920  assert(IdentifierOverride && "IdentifierOverride should not be null");
921  return wrap(new DumpObjects(DumpDir, IdentifierOverride));
922 }
923 
925  delete unwrap(DumpObjects);
926 }
927 
929  LLVMMemoryBufferRef *ObjBuffer) {
930  std::unique_ptr<MemoryBuffer> OB(unwrap(*ObjBuffer));
931  if (auto Result = (*unwrap(DumpObjects))(std::move(OB))) {
932  *ObjBuffer = wrap(Result->release());
933  return LLVMErrorSuccess;
934  } else {
935  *ObjBuffer = nullptr;
936  return wrap(Result.takeError());
937  }
938 }
939 
941  return wrap(new LLJITBuilder());
942 }
943 
945  delete unwrap(Builder);
946 }
947 
950  unwrap(Builder)->setJITTargetMachineBuilder(std::move(*unwrap(JTMB)));
952 }
953 
957  unwrap(Builder)->setObjectLinkingLayerCreator(
958  [=](ExecutionSession &ES, const Triple &TT) {
959  auto TTStr = TT.str();
960  return std::unique_ptr<ObjectLayer>(
961  unwrap(F(Ctx, wrap(&ES), TTStr.c_str())));
962  });
963 }
964 
967  assert(Result && "Result can not be null");
968 
969  if (!Builder)
971 
972  auto J = unwrap(Builder)->create();
974 
975  if (!J) {
976  Result = nullptr;
977  return wrap(J.takeError());
978  }
979 
980  *Result = wrap(J->release());
981  return LLVMErrorSuccess;
982 }
983 
985  delete unwrap(J);
986  return LLVMErrorSuccess;
987 }
988 
990  return wrap(&unwrap(J)->getExecutionSession());
991 }
992 
994  return wrap(&unwrap(J)->getMainJITDylib());
995 }
996 
998  return unwrap(J)->getTargetTriple().str().c_str();
999 }
1000 
1002  return unwrap(J)->getDataLayout().getGlobalPrefix();
1003 }
1004 
1006 LLVMOrcLLJITMangleAndIntern(LLVMOrcLLJITRef J, const char *UnmangledName) {
1008  unwrap(J)->mangleAndIntern(UnmangledName)));
1009 }
1010 
1012  LLVMMemoryBufferRef ObjBuffer) {
1013  return wrap(unwrap(J)->addObjectFile(
1014  *unwrap(JD), std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
1015 }
1016 
1019  LLVMMemoryBufferRef ObjBuffer) {
1020  return wrap(unwrap(J)->addObjectFile(
1022  std::unique_ptr<MemoryBuffer>(unwrap(ObjBuffer))));
1023 }
1024 
1026  LLVMOrcJITDylibRef JD,
1028  std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
1029  return wrap(unwrap(J)->addIRModule(*unwrap(JD), std::move(*TmpTSM)));
1030 }
1031 
1035  std::unique_ptr<ThreadSafeModule> TmpTSM(unwrap(TSM));
1036  return wrap(unwrap(J)->addIRModule(ResourceTrackerSP(unwrap(RT)),
1037  std::move(*TmpTSM)));
1038 }
1039 
1041  LLVMOrcJITTargetAddress *Result,
1042  const char *Name) {
1043  assert(Result && "Result can not be null");
1044 
1045  auto Sym = unwrap(J)->lookup(Name);
1046  if (!Sym) {
1047  *Result = 0;
1048  return wrap(Sym.takeError());
1049  }
1050 
1051  *Result = Sym->getValue();
1052  return LLVMErrorSuccess;
1053 }
1054 
1056  return wrap(&unwrap(J)->getObjLinkingLayer());
1057 }
1058 
1061  return wrap(&unwrap(J)->getObjTransformLayer());
1062 }
1063 
1067  assert(ES && "ES must not be null");
1068  return wrap(new RTDyldObjectLinkingLayer(
1069  *unwrap(ES), [] { return std::make_unique<SectionMemoryManager>(); }));
1070 }
1071 
1073  LLVMOrcObjectLayerRef RTDyldObjLinkingLayer,
1074  LLVMJITEventListenerRef Listener) {
1075  assert(RTDyldObjLinkingLayer && "RTDyldObjLinkingLayer must not be null");
1076  assert(Listener && "Listener must not be null");
1077  reinterpret_cast<RTDyldObjectLinkingLayer *>(unwrap(RTDyldObjLinkingLayer))
1078  ->registerJITEventListener(*unwrap(Listener));
1079 }
1080 
1082  return wrap(&unwrap(J)->getIRTransformLayer());
1083 }
1084 
1086  return unwrap(J)->getDataLayout().getStringRepresentation().c_str();
1087 }
1088 
1090 LLVMOrcCreateLocalIndirectStubsManager(const char *TargetTriple) {
1092  return wrap(builder().release());
1093 }
1094 
1096  std::unique_ptr<IndirectStubsManager> TmpISM(unwrap(ISM));
1097 }
1098 
1100  const char *TargetTriple, LLVMOrcExecutionSessionRef ES,
1101  LLVMOrcJITTargetAddress ErrorHandlerAddr,
1103  auto LCTM = createLocalLazyCallThroughManager(Triple(TargetTriple),
1104  *unwrap(ES), ErrorHandlerAddr);
1105 
1106  if (!LCTM)
1107  return wrap(LCTM.takeError());
1108  *Result = wrap(LCTM->release());
1109  return LLVMErrorSuccess;
1110 }
1111 
1114  std::unique_ptr<LazyCallThroughManager> TmpLCM(unwrap(LCM));
1115 }
LLVMOrcCLookupSetElement
An element type for a symbol lookup set.
Definition: Orc.h:234
LLVMJITSymbolGenericFlagsMaterializationSideEffectsOnly
@ LLVMJITSymbolGenericFlagsMaterializationSideEffectsOnly
Definition: Orc.h:61
LLVMOrcDisposeLLJIT
LLVMErrorRef LLVMOrcDisposeLLJIT(LLVMOrcLLJITRef J)
Dispose of an LLJIT instance.
Definition: OrcV2CBindings.cpp:984
LLVMOrcLookupStateRef
struct LLVMOrcOpaqueLookupState * LLVMOrcLookupStateRef
An opaque lookup state object.
Definition: Orc.h:319
LLVMOrcMaterializationResponsibilityGetRequestedSymbols
LLVMOrcSymbolStringPoolEntryRef * LLVMOrcMaterializationResponsibilityGetRequestedSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols)
Returns the names of any symbols covered by this MaterializationResponsibility object that have queri...
Definition: OrcV2CBindings.cpp:535
LLVMOrcDisposeJITTargetMachineBuilder
void LLVMOrcDisposeJITTargetMachineBuilder(LLVMOrcJITTargetMachineBuilderRef JTMB)
Dispose of a JITTargetMachineBuilder.
Definition: OrcV2CBindings.cpp:837
LLVMOrcDisposeThreadSafeModule
void LLVMOrcDisposeThreadSafeModule(LLVMOrcThreadSafeModuleRef TSM)
Dispose of a ThreadSafeModule.
Definition: OrcV2CBindings.cpp:799
llvm::orc::MaterializationResponsibility
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition: Core.h:519
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:42
LLVMOrcCDependenceMapPair
Represents a pair of a JITDylib and LLVMOrcCSymbolsList.
Definition: Orc.h:173
LLVMOrcObjectLayerRef
struct LLVMOrcOpaqueObjectLayer * LLVMOrcObjectLayerRef
A reference to an orc::ObjectLayer instance.
Definition: Orc.h:400
llvm::orc::JITTargetMachineBuilder
A utility class for building TargetMachines for JITs.
Definition: JITTargetMachineBuilder.h:34
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::orc::JITDylib
Represents a JIT'd dynamic library.
Definition: Core.h:946
LLVMOrcMaterializationResponsibilityAddDependenciesForAll
void LLVMOrcMaterializationResponsibilityAddDependenciesForAll(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCDependenceMapPairs Dependencies, size_t NumPairs)
Adds dependencies to all symbols that the MaterializationResponsibility is responsible for.
Definition: OrcV2CBindings.cpp:612
LLVMContextRef
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
Definition: Types.h:53
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
LLVMOrcCreateDynamicLibrarySearchGeneratorForPath
LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForPath(LLVMOrcDefinitionGeneratorRef *Result, const char *FileName, char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx)
Get a LLVMOrcCreateDynamicLibararySearchGeneratorForPath that will reflect library symbols into the J...
Definition: OrcV2CBindings.cpp:716
llvm::orc::RTDyldObjectLinkingLayer
Definition: RTDyldObjectLinkingLayer.h:37
llvm::orc::OrcV2CAPIHelper::retainPoolEntry
static void retainPoolEntry(PoolEntryPtr P)
Definition: OrcV2CBindings.cpp:56
llvm::StringMapEntry
StringMapEntry - This is used to represent one value that is inserted into a StringMap.
Definition: StringMapEntry.h:101
LLVMOrcCSymbolsList::Symbols
LLVMOrcSymbolStringPoolEntryRef * Symbols
Definition: Orc.h:166
LLVMOrcSymbolPredicate
int(* LLVMOrcSymbolPredicate)(void *Ctx, LLVMOrcSymbolStringPoolEntryRef Sym)
Predicate function for SymbolStringPoolEntries.
Definition: Orc.h:371
llvm::orc::InProgressLookupState
Definition: Core.cpp:510
LLVMOrcIRTransformLayerRef
struct LLVMOrcOpaqueIRTransformLayer * LLVMOrcIRTransformLayerRef
A reference to an orc::IRTransformLayer instance.
Definition: Orc.h:410
LLVMOrcLLJITGetExecutionSession
LLVMOrcExecutionSessionRef LLVMOrcLLJITGetExecutionSession(LLVMOrcLLJITRef J)
Get a reference to the ExecutionSession for this LLJIT instance.
Definition: OrcV2CBindings.cpp:989
llvm::orc::LLJITBuilder
Constructs LLJIT instances.
Definition: LLJIT.h:392
LLVMOrcJITDylibClear
LLVMErrorRef LLVMOrcJITDylibClear(LLVMOrcJITDylibRef JD)
Calls remove on all trackers associated with this JITDylib, see JITDylib::clear().
Definition: OrcV2CBindings.cpp:668
LLVMOrcSymbolStringPoolRef
struct LLVMOrcOpaqueSymbolStringPool * LLVMOrcSymbolStringPoolRef
A reference to an orc::SymbolStringPool.
Definition: Orc.h:98
P
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Definition: README-SSE.txt:411
LLVMOrcCreateCustomCAPIDefinitionGenerator
LLVMOrcDefinitionGeneratorRef LLVMOrcCreateCustomCAPIDefinitionGenerator(LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction F, void *Ctx, LLVMOrcDisposeCAPIDefinitionGeneratorFunction Dispose)
Create a custom generator.
Definition: OrcV2CBindings.cpp:677
LLVMOrcIndirectStubsManagerRef
struct LLVMOrcOpaqueIndirectStubsManager * LLVMOrcIndirectStubsManagerRef
A reference to an orc::IndirectStubsManager instance.
Definition: Orc.h:456
LLVMOrcJITTargetMachineBuilderDetectHost
LLVMErrorRef LLVMOrcJITTargetMachineBuilderDetectHost(LLVMOrcJITTargetMachineBuilderRef *Result)
Create a JITTargetMachineBuilder by detecting the host.
Definition: OrcV2CBindings.cpp:803
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1182
llvm::orc::IndirectStubsManager
Base class for managing collections of named indirect stubs.
Definition: IndirectionUtils.h:282
llvm::orc::SymbolLookupSet
A set of symbols to look up, each associated with a SymbolLookupFlags value.
Definition: Core.h:175
llvm::orc::LookupKind::Static
@ Static
llvm::orc::SymbolStringPtr
Pointer to a pooled string representing a symbol name.
Definition: SymbolStringPool.h:57
builder
assume builder
Definition: AssumeBundleBuilder.cpp:650
llvm::orc::OrcV2CAPIHelper::releasePoolEntry
static void releasePoolEntry(PoolEntryPtr P)
Definition: OrcV2CBindings.cpp:61
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
LLJIT.h
GlobalPrefix
@ GlobalPrefix
Definition: AsmWriter.cpp:348
llvm::orc::LazyCallThroughManager
Manages a set of 'lazy call-through' trampolines.
Definition: LazyReexports.h:38
llvm::orc::OrcV2CAPIHelper::moveFromSymbolStringPtr
static PoolEntryPtr moveFromSymbolStringPtr(SymbolStringPtr S)
Definition: OrcV2CBindings.cpp:34
LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction
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:354
LLVMOrcObjectTransformLayerSetTransform
void LLVMOrcObjectTransformLayerSetTransform(LLVMOrcObjectTransformLayerRef ObjTransformLayer, LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx)
Set the transform function on an LLVMOrcObjectTransformLayer.
Definition: OrcV2CBindings.cpp:902
LLVMOrcLookupKindDLSym
@ LLVMOrcLookupKindDLSym
Definition: Orc.h:192
llvm::AtomicOrderingCABI::release
@ release
LLVMOrcDisposeLazyCallThroughManager
void LLVMOrcDisposeLazyCallThroughManager(LLVMOrcLazyCallThroughManagerRef LCM)
Dispose of an LazyCallThroughManager.
Definition: OrcV2CBindings.cpp:1112
LLVMOrcThreadSafeModuleWithModuleDo
LLVMErrorRef LLVMOrcThreadSafeModuleWithModuleDo(LLVMOrcThreadSafeModuleRef TSM, LLVMOrcGenericIRModuleOperationFunction F, void *Ctx)
Apply the given function to the module contained in this ThreadSafeModule.
Definition: OrcV2CBindings.cpp:785
llvm::orc::ResourceTracker
API to remove / transfer ownership of JIT resources.
Definition: Core.h:53
LLVMErrorSuccess
return LLVMErrorSuccess
Definition: PassBuilderBindings.cpp:79
llvm::orc::LLJIT
A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.
Definition: LLJIT.h:37
LLVMOrcLookupKind
LLVMOrcLookupKind
Lookup kind.
Definition: Orc.h:190
LLVMOrcMaterializationUnitDiscardFunction
void(* LLVMOrcMaterializationUnitDiscardFunction)(void *Ctx, LLVMOrcJITDylibRef JD, LLVMOrcSymbolStringPoolEntryRef Symbol)
A MaterializationUnit discard callback.
Definition: Orc.h:284
llvm::orc::lazyReexports
std::unique_ptr< LazyReexportsMaterializationUnit > lazyReexports(LazyCallThroughManager &LCTManager, IndirectStubsManager &ISManager, JITDylib &SourceJD, SymbolAliasMap CallableAliases, ImplSymbolMap *SrcJDLoc=nullptr)
Define lazy-reexports based on the given SymbolAliasMap.
Definition: LazyReexports.h:168
ObjectTransformLayer.h
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:41
LLVMOrcMaterializationResponsibilityRef
struct LLVMOrcOpaqueMaterializationResponsibility * LLVMOrcMaterializationResponsibilityRef
A reference to a uniquely owned orc::MaterializationResponsibility instance.
Definition: Orc.h:262
LLVMOrcLLJITAddLLVMIRModuleWithRT
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModuleWithRT(LLVMOrcLLJITRef J, LLVMOrcResourceTrackerRef RT, LLVMOrcThreadSafeModuleRef TSM)
Add an IR module to the given ResourceTracker's JITDylib in the given LLJIT instance.
Definition: OrcV2CBindings.cpp:1032
LLVMOrcExecutionSessionGetSymbolStringPool
LLVMOrcSymbolStringPoolRef LLVMOrcExecutionSessionGetSymbolStringPool(LLVMOrcExecutionSessionRef ES)
Return a reference to the SymbolStringPool for an ExecutionSession.
Definition: OrcV2CBindings.cpp:345
llvm::orc::LookupKind
LookupKind
Describes the kind of lookup being performed.
Definition: Core.h:149
llvm::detail::DenseSetImpl::insert
std::pair< iterator, bool > insert(const ValueT &V)
Definition: DenseSet.h:206
LLVMOrcMaterializationResponsibilityNotifyEmitted
LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyEmitted(LLVMOrcMaterializationResponsibilityRef MR)
Notifies the target JITDylib (and any pending queries on that JITDylib) that all symbols covered by t...
Definition: OrcV2CBindings.cpp:562
LLVMOrcJITDylibLookupFlagsMatchAllSymbols
@ LLVMOrcJITDylibLookupFlagsMatchAllSymbols
Definition: Orc.h:203
llvm::JITSymbolFlags
Flags for symbols in the JIT.
Definition: JITSymbol.h:74
LLVMOrcLookupStateContinueLookup
void LLVMOrcLookupStateContinueLookup(LLVMOrcLookupStateRef S, LLVMErrorRef Err)
Continue a lookup that was suspended in a generator (see LLVMOrcCAPIDefinitionGeneratorTryToGenerateF...
Definition: OrcV2CBindings.cpp:684
llvm::orc::MaterializationUnit
A MaterializationUnit represents a set of symbol definitions that can be materialized as a group,...
Definition: Core.h:665
llvm::JITEvaluatedSymbol
Represents a symbol that has been evaluated to an address already.
Definition: JITSymbol.h:229
F
#define F(x, y, z)
Definition: MD5.cpp:55
LLVMOrcIRTransformLayerEmit
void LLVMOrcIRTransformLayerEmit(LLVMOrcIRTransformLayerRef IRLayer, LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcThreadSafeModuleRef TSM)
Definition: OrcV2CBindings.cpp:625
LLVMOrcCSymbolFlagsMapPair
Represents a pair of a symbol name and LLVMJITSymbolFlags.
Definition: Orc.h:109
LLVMOrcExecutionSessionLookup
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.
Definition: OrcV2CBindings.cpp:360
llvm::X86II::OB
@ OB
Definition: X86BaseInfo.h:801
LLVMOrcLazyReexports
LLVMOrcMaterializationUnitRef LLVMOrcLazyReexports(LLVMOrcLazyCallThroughManagerRef LCTM, LLVMOrcIndirectStubsManagerRef ISM, LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases, size_t NumPairs)
Create a MaterializationUnit to define lazy re-expots.
Definition: OrcV2CBindings.cpp:470
clear
static void clear(coro::Shape &Shape)
Definition: Coroutines.cpp:149
LLVMOrcJITDylibGetDefaultResourceTracker
LLVMOrcResourceTrackerRef LLVMOrcJITDylibGetDefaultResourceTracker(LLVMOrcJITDylibRef JD)
Return a reference to the default resource tracker for the given JITDylib.
Definition: OrcV2CBindings.cpp:417
LLVMOrcJITDylibLookupFlags
LLVMOrcJITDylibLookupFlags
JITDylib lookup flags.
Definition: Orc.h:201
LLVMOrcDisposeCSymbolFlagsMap
void LLVMOrcDisposeCSymbolFlagsMap(LLVMOrcCSymbolFlagsMapPairs Pairs)
Disposes of the passed LLVMOrcCSymbolFlagsMap.
Definition: OrcV2CBindings.cpp:523
LLVMOrcCSymbolMapPair
Represents a pair of a symbol name and an evaluated symbol.
Definition: Orc.h:123
LLVMOrcCreateCustomMaterializationUnit
LLVMOrcMaterializationUnitRef LLVMOrcCreateCustomMaterializationUnit(const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym, LLVMOrcMaterializationUnitMaterializeFunction Materialize, LLVMOrcMaterializationUnitDiscardFunction Discard, LLVMOrcMaterializationUnitDestroyFunction Destroy)
Create a custom MaterializationUnit.
Definition: OrcV2CBindings.cpp:447
LLVMOrcSymbolStringPoolEntryRef
struct LLVMOrcOpaqueSymbolStringPoolEntry * LLVMOrcSymbolStringPoolEntryRef
A reference to an orc::SymbolStringPool table entry.
Definition: Orc.h:103
LLVMOrcIRTransformLayerSetTransform
void LLVMOrcIRTransformLayerSetTransform(LLVMOrcIRTransformLayerRef IRTransformLayer, LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx)
Set the transform function of the provided transform layer, passing through a pointer to user provide...
Definition: OrcV2CBindings.cpp:882
llvm::orc::SymbolLookupFlags
SymbolLookupFlags
Lookup flags that apply to each symbol in a lookup.
Definition: Core.h:137
llvm::JITSymbolFlags::getTargetFlags
TargetFlagsType & getTargetFlags()
Return a reference to the target-specific flags.
Definition: JITSymbol.h:172
LLVMOrcDumpObjects_CallOperator
LLVMErrorRef LLVMOrcDumpObjects_CallOperator(LLVMOrcDumpObjectsRef DumpObjects, LLVMMemoryBufferRef *ObjBuffer)
Dump the contents of the given MemoryBuffer.
Definition: OrcV2CBindings.cpp:928
LLVMOrcLookupKindStatic
@ LLVMOrcLookupKindStatic
Definition: Orc.h:191
llvm::JITSymbolFlags::MaterializationSideEffectsOnly
@ MaterializationSideEffectsOnly
Definition: JITSymbol.h:87
LLVMJITEvaluatedSymbol
Represents an evaluated symbol address and flags.
Definition: Orc.h:80
llvm::orc::SymbolStringPool
String pool for symbol names used by the JIT.
Definition: SymbolStringPool.h:30
LLVMOrcMaterializationUnitRef
struct LLVMOrcOpaqueMaterializationUnit * LLVMOrcMaterializationUnitRef
A reference to a uniquely owned orc::MaterializationUnit instance.
Definition: Orc.h:255
LLVMOrcExecutionSessionCreateBareJITDylib
LLVMOrcJITDylibRef LLVMOrcExecutionSessionCreateBareJITDylib(LLVMOrcExecutionSessionRef ES, const char *Name)
Create a "bare" JITDylib.
Definition: OrcV2CBindings.cpp:635
llvm::orc
Definition: COFFPlatform.h:30
llvm::orc::NoDependenciesToRegister
RegisterDependenciesFunction NoDependenciesToRegister
This can be used as the value for a RegisterDependenciesFunction if there are no dependants to regist...
Definition: Core.cpp:34
LLVMOrcThreadSafeModuleRef
struct LLVMOrcOpaqueThreadSafeModule * LLVMOrcThreadSafeModuleRef
A reference to an orc::ThreadSafeModule instance.
Definition: Orc.h:382
llvm::replace
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:1825
LLVMJITSymbolGenericFlagsCallable
@ LLVMJITSymbolGenericFlagsCallable
Definition: Orc.h:60
llvm::orc::CAPIDefinitionGenerator::CAPIDefinitionGenerator
CAPIDefinitionGenerator(LLVMOrcDisposeCAPIDefinitionGeneratorFunction Dispose, void *Ctx, LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction TryToGenerate)
Definition: OrcV2CBindings.cpp:283
LLVMOrcLazyCallThroughManagerRef
struct LLVMOrcOpaqueLazyCallThroughManager * LLVMOrcLazyCallThroughManagerRef
A reference to an orc::LazyCallThroughManager instance.
Definition: Orc.h:462
llvm::AArch64_AM::LSR
@ LSR
Definition: AArch64AddressingModes.h:36
LLVMOrcLLJITLookup
LLVMErrorRef LLVMOrcLLJITLookup(LLVMOrcLLJITRef J, LLVMOrcJITTargetAddress *Result, const char *Name)
Look up the given symbol in the main JITDylib of the given LLJIT instance.
Definition: OrcV2CBindings.cpp:1040
llvm::unwrap
Attribute unwrap(LLVMAttributeRef Attr)
Definition: Attributes.h:280
llvm::orc::ObjectLayer
Interface for Layers that accept object files.
Definition: Layer.h:133
LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager
LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(LLVMOrcExecutionSessionRef ES)
Create a RTDyldObjectLinkingLayer instance using the standard SectionMemoryManager for memory managem...
Definition: OrcV2CBindings.cpp:1065
llvm::orc::LookupKind::DLSym
@ DLSym
LLVMOrcDisposeDumpObjects
void LLVMOrcDisposeDumpObjects(LLVMOrcDumpObjectsRef DumpObjects)
Dispose of a DumpObjects instance.
Definition: OrcV2CBindings.cpp:924
LLVMJITSymbolGenericFlagsExported
@ LLVMJITSymbolGenericFlagsExported
Definition: Orc.h:58
llvm::orc::SymbolLookupSet::add
SymbolLookupSet & add(SymbolStringPtr Name, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)
Add an element to the set.
Definition: Core.h:236
LLVMOrcThreadSafeContextGetContext
LLVMContextRef LLVMOrcThreadSafeContextGetContext(LLVMOrcThreadSafeContextRef TSCtx)
Get a reference to the wrapped LLVMContext.
Definition: OrcV2CBindings.cpp:776
LLVMOrcObjectTransformLayerRef
struct LLVMOrcOpaqueObjectTransformLayer * LLVMOrcObjectTransformLayerRef
A reference to an orc::ObjectTransformLayer instance.
Definition: Orc.h:434
LLVMOrcMaterializationResponsibilityAddDependencies
void LLVMOrcMaterializationResponsibilityAddDependencies(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcSymbolStringPoolEntryRef Name, LLVMOrcCDependenceMapPairs Dependencies, size_t NumPairs)
Adds dependencies to a symbol that the MaterializationResponsibility is responsible for.
Definition: OrcV2CBindings.cpp:602
LLVMOrcCSymbolsList::Length
size_t Length
Definition: Orc.h:167
Orc.h
LLVMOrcMaterializationUnitMaterializeFunction
void(* LLVMOrcMaterializationUnitMaterializeFunction)(void *Ctx, LLVMOrcMaterializationResponsibilityRef MR)
A MaterializationUnit materialize callback.
Definition: Orc.h:275
llvm::orc::JITTargetMachineBuilder::detectHost
static Expected< JITTargetMachineBuilder > detectHost()
Create a JITTargetMachineBuilder for the host system.
Definition: JITTargetMachineBuilder.cpp:25
LLVMOrcMaterializationResponsibilityGetSymbols
LLVMOrcCSymbolFlagsMapPairs LLVMOrcMaterializationResponsibilityGetSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs)
Returns the symbol flags map for this responsibility instance.
Definition: OrcV2CBindings.cpp:506
LLVMOrcLLJITMangleAndIntern
LLVMOrcSymbolStringPoolEntryRef LLVMOrcLLJITMangleAndIntern(LLVMOrcLLJITRef J, const char *UnmangledName)
Mangles the given string according to the LLJIT instance's DataLayout, then interns the result in the...
Definition: OrcV2CBindings.cpp:1006
LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction
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
LLVMOrcMaterializationResponsibilityGetTargetDylib
LLVMOrcJITDylibRef LLVMOrcMaterializationResponsibilityGetTargetDylib(LLVMOrcMaterializationResponsibilityRef MR)
Returns the target JITDylib that these symbols are being materialized into.
Definition: OrcV2CBindings.cpp:495
llvm::orc::SymbolLookupFlags::WeaklyReferencedSymbol
@ WeaklyReferencedSymbol
RTDyldObjectLinkingLayer.h
llvm::orc::OrcV2CAPIHelper::extractLookupState
static InProgressLookupState * extractLookupState(LookupState &LS)
Definition: OrcV2CBindings.cpp:66
LLVMOrcJITTargetMachineBuilderGetTargetTriple
char * LLVMOrcJITTargetMachineBuilderGetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB)
Returns the target triple for the given JITTargetMachineBuilder as a string.
Definition: OrcV2CBindings.cpp:842
llvm::orc::CAPIDefinitionGenerator::tryToGenerate
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.
Definition: OrcV2CBindings.cpp:293
llvm::orc::SymbolLookupSet::size
UnderlyingVector::size_type size() const
Definition: Core.h:251
LLVMOrcErrorReporterFunction
void(* LLVMOrcErrorReporterFunction)(void *Ctx, LLVMErrorRef Err)
Error reporter function.
Definition: Orc.h:93
LLVMOrcObjectLayerEmit
void LLVMOrcObjectLayerEmit(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcMaterializationResponsibilityRef R, LLVMMemoryBufferRef ObjBuffer)
Emit an object buffer to an ObjectLayer.
Definition: OrcV2CBindings.cpp:870
LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine
LLVMOrcJITTargetMachineBuilderRef LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(LLVMTargetMachineRef TM)
Create a JITTargetMachineBuilder from the given TargetMachine template.
Definition: OrcV2CBindings.cpp:818
LLVMOrcLLJITGetObjTransformLayer
LLVMOrcObjectTransformLayerRef LLVMOrcLLJITGetObjTransformLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's object linking layer.
Definition: OrcV2CBindings.cpp:1060
LLVMOrcJITDylibRef
struct LLVMOrcOpaqueJITDylib * LLVMOrcJITDylibRef
A reference to an orc::JITDylib instance.
Definition: Orc.h:159
llvm::DenseSet< SymbolStringPtr >
LLVMOrcDisposeIndirectStubsManager
void LLVMOrcDisposeIndirectStubsManager(LLVMOrcIndirectStubsManagerRef ISM)
Dispose of an IndirectStubsManager.
Definition: OrcV2CBindings.cpp:1095
llvm::ClrHandlerType::Filter
@ Filter
LLVMOrcResourceTrackerRef
struct LLVMOrcOpaqueResourceTracker * LLVMOrcResourceTrackerRef
A reference to an orc::ResourceTracker instance.
Definition: Orc.h:299
LLVMJITSymbolGenericFlagsWeak
@ LLVMJITSymbolGenericFlagsWeak
Definition: Orc.h:59
LLVMOrcCreateNewThreadSafeModule
LLVMOrcThreadSafeModuleRef LLVMOrcCreateNewThreadSafeModule(LLVMModuleRef M, LLVMOrcThreadSafeContextRef TSCtx)
Create a ThreadSafeModule wrapper around the given LLVM module.
Definition: OrcV2CBindings.cpp:793
LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess
LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(LLVMOrcDefinitionGeneratorRef *Result, char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx)
Get a DynamicLibrarySearchGenerator that will reflect process symbols into the JITDylib.
Definition: OrcV2CBindings.cpp:691
LLVMOrcExecutionSessionRef
struct LLVMOrcOpaqueExecutionSession * LLVMOrcExecutionSessionRef
A reference to an orc::ExecutionSession instance.
Definition: Orc.h:88
llvm::orc::createLocalIndirectStubsManagerBuilder
std::function< std::unique_ptr< IndirectStubsManager >)> createLocalIndirectStubsManagerBuilder(const Triple &T)
Create a local indriect stubs manager builder.
Definition: IndirectionUtils.cpp:174
llvm::ARM_AM::add
@ add
Definition: ARMAddressingModes.h:39
LLVMOrcReleaseSymbolStringPoolEntry
void LLVMOrcReleaseSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)
Reduces the ref-count for of a SymbolStringPool entry.
Definition: OrcV2CBindings.cpp:400
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
llvm::DenseMap< SymbolStringPtr, JITSymbolFlags >
LLVMOrcCreateLLJITBuilder
LLVMOrcLLJITBuilderRef LLVMOrcCreateLLJITBuilder(void)
Create an LLVMOrcLLJITBuilder.
Definition: OrcV2CBindings.cpp:940
I
#define I(x, y, z)
Definition: MD5.cpp:58
LLVMOrcMaterializationResponsibilityNotifyResolved
LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyResolved(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolMapPairs Symbols, size_t NumPairs)
Notifies the target JITDylib that the given symbols have been resolved.
Definition: OrcV2CBindings.cpp:555
LLVMOrcSymbolLookupFlagsRequiredSymbol
@ LLVMOrcSymbolLookupFlagsRequiredSymbol
Definition: Orc.h:227
llvm::JITSymbolFlags::Callable
@ Callable
Definition: JITSymbol.h:86
LLVMOrcLLJITGetDataLayoutStr
const char * LLVMOrcLLJITGetDataLayoutStr(LLVMOrcLLJITRef J)
Get the LLJIT instance's default data layout string.
Definition: OrcV2CBindings.cpp:1085
LLVMOrcMaterializationResponsibilityDelegate
LLVMErrorRef LLVMOrcMaterializationResponsibilityDelegate(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols, LLVMOrcMaterializationResponsibilityRef *Result)
Delegates responsibility for the given symbols to the returned materialization responsibility.
Definition: OrcV2CBindings.cpp:585
LLVMOrcMaterializationResponsibilityReplace
LLVMErrorRef LLVMOrcMaterializationResponsibilityReplace(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcMaterializationUnitRef MU)
Transfers responsibility to the given MaterializationUnit for all symbols defined by that Materializa...
Definition: OrcV2CBindings.cpp:578
LLVMOrcLLJITRef
struct LLVMOrcOpaqueLLJIT * LLVMOrcLLJITRef
A reference to an orc::LLJIT instance.
Definition: LLJIT.h:66
llvm::orc::ResourceTrackerSP
uint8_t IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP
Definition: Core.h:47
LLVMOrcExecutionSessionCreateJITDylib
LLVMErrorRef LLVMOrcExecutionSessionCreateJITDylib(LLVMOrcExecutionSessionRef ES, LLVMOrcJITDylibRef *Result, const char *Name)
Create a JITDylib.
Definition: OrcV2CBindings.cpp:641
LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener
void LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(LLVMOrcObjectLayerRef RTDyldObjLinkingLayer, LLVMJITEventListenerRef Listener)
Add the given listener to the given RTDyldObjectLinkingLayer.
Definition: OrcV2CBindings.cpp:1072
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
LLVMOrcExecutionSessionLookupHandleResultFunction
void(* LLVMOrcExecutionSessionLookupHandleResultFunction)(LLVMErrorRef Err, LLVMOrcCSymbolMapPairs Result, size_t NumPairs, void *Ctx)
Callback type for ExecutionSession lookups.
Definition: Orc.h:536
LLVMOrcSymbolLookupFlags
LLVMOrcSymbolLookupFlags
Symbol lookup flags for lookup sets.
Definition: Orc.h:226
std::swap
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:853
LLVMOrcCreateDumpObjects
LLVMOrcDumpObjectsRef LLVMOrcCreateDumpObjects(const char *DumpDir, const char *IdentifierOverride)
Create a DumpObjects instance.
Definition: OrcV2CBindings.cpp:917
LLVMOrcExecutionSessionIntern
LLVMOrcSymbolStringPoolEntryRef LLVMOrcExecutionSessionIntern(LLVMOrcExecutionSessionRef ES, const char *Name)
Intern a string in the ExecutionSession's SymbolStringPool and return a reference to it.
Definition: OrcV2CBindings.cpp:355
llvm::orc::OrcV2CAPIHelper::resetLookupState
static void resetLookupState(LookupState &LS, InProgressLookupState *IPLS)
Definition: OrcV2CBindings.cpp:70
llvm::orc::ThreadSafeContext
An LLVMContext together with an associated mutex that can be used to lock the context to prevent conc...
Definition: ThreadSafeModule.h:29
LLVMOrcJITDylibDefine
LLVMErrorRef LLVMOrcJITDylibDefine(LLVMOrcJITDylibRef JD, LLVMOrcMaterializationUnitRef MU)
Add the given MaterializationUnit to the given JITDylib.
Definition: OrcV2CBindings.cpp:657
LLVMOrcSymbolStringPoolClearDeadEntries
void LLVMOrcSymbolStringPoolClearDeadEntries(LLVMOrcSymbolStringPoolRef SSP)
Clear all unreferenced symbol string pool entries.
Definition: OrcV2CBindings.cpp:350
LLVMOrcObjectLayerAddObjectFile
LLVMErrorRef LLVMOrcObjectLayerAddObjectFile(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcJITDylibRef JD, LLVMMemoryBufferRef ObjBuffer)
Add an object to an ObjectLayer to the given JITDylib.
Definition: OrcV2CBindings.cpp:855
LLVMOrcDisposeObjectLayer
void LLVMOrcDisposeObjectLayer(LLVMOrcObjectLayerRef ObjLayer)
Dispose of an ObjectLayer.
Definition: OrcV2CBindings.cpp:878
LLVMOrcAbsoluteSymbols
LLVMOrcMaterializationUnitRef LLVMOrcAbsoluteSymbols(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs)
Create a MaterializationUnit to define the given symbols as pointing to the corresponding raw address...
Definition: OrcV2CBindings.cpp:465
llvm::orc::JITDylibSearchOrder
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:154
LLVMOrcExecutionSessionSetErrorReporter
void LLVMOrcExecutionSessionSetErrorReporter(LLVMOrcExecutionSessionRef ES, LLVMOrcErrorReporterFunction ReportError, void *Ctx)
Attach a custom error reporter function to the ExecutionSession.
Definition: OrcV2CBindings.cpp:337
llvm::orc::DumpObjects
A function object that can be used as an ObjectTransformLayer transform to dump object files to disk ...
Definition: DebugUtils.h:100
llvm::orc::DefinitionGenerator
Definition generators can be attached to JITDylibs to generate new definitions for otherwise unresolv...
Definition: Core.h:911
LLVMOrcDisposeMaterializationUnit
void LLVMOrcDisposeMaterializationUnit(LLVMOrcMaterializationUnitRef MU)
Dispose of a MaterializationUnit.
Definition: OrcV2CBindings.cpp:443
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
LLVMOrcCSymbolAliasMapPair
Represents a pair of a symbol name and SymbolAliasMapEntry.
Definition: Orc.h:145
LLVMOrcLLJITBuilderRef
struct LLVMOrcOpaqueLLJITBuilder * LLVMOrcLLJITBuilderRef
A reference to an orc::LLJITBuilder instance.
Definition: LLJIT.h:61
Builder
assume Assume Builder
Definition: AssumeBundleBuilder.cpp:651
llvm::wrap
LLVMAttributeRef wrap(Attribute Attr)
Definition: Attributes.h:275
LLVMDisposeTargetMachine
void LLVMDisposeTargetMachine(LLVMTargetMachineRef T)
Dispose the LLVMTargetMachineRef instance generated by LLVMCreateTargetMachine.
Definition: TargetMachineC.cpp:150
LLVMOrcCreateLLJIT
LLVMErrorRef LLVMOrcCreateLLJIT(LLVMOrcLLJITRef *Result, LLVMOrcLLJITBuilderRef Builder)
Create an LLJIT instance from an LLJITBuilder.
Definition: OrcV2CBindings.cpp:965
llvm::JITSymbolFlags::Weak
@ Weak
Definition: JITSymbol.h:82
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm::orc::OrcV2CAPIHelper::moveToSymbolStringPtr
static SymbolStringPtr moveToSymbolStringPtr(PoolEntryPtr P)
Definition: OrcV2CBindings.cpp:41
llvm::orc::SymbolState::Ready
@ Ready
Emitted to memory, but waiting on transitive dependencies.
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
LLVMOrcCreateNewThreadSafeContext
LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContext(void)
Create a ThreadSafeContext containing a new LLVMContext.
Definition: OrcV2CBindings.cpp:771
llvm::orc::createLocalLazyCallThroughManager
Expected< std::unique_ptr< LazyCallThroughManager > > createLocalLazyCallThroughManager(const Triple &T, ExecutionSession &ES, JITTargetAddress ErrorHandlerAddr)
Create a LocalLazyCallThroughManager from the given triple and execution session.
Definition: LazyReexports.cpp:106
LLJIT.h
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
LLVMJITSymbolFlags
Represents the linkage flags for a symbol definition.
Definition: Orc.h:72
llvm::orc::LookupState
Wraps state for a lookup-in-progress.
Definition: Core.h:886
LLVMOrcJITDylibAddGenerator
void LLVMOrcJITDylibAddGenerator(LLVMOrcJITDylibRef JD, LLVMOrcDefinitionGeneratorRef DG)
Add a DefinitionGenerator to the given JITDylib.
Definition: OrcV2CBindings.cpp:672
llvm::orc::StaticLibraryDefinitionGenerator::Load
static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Load(ObjectLayer &L, const char *FileName, GetObjectFileInterface GetObjFileInterface=GetObjectFileInterface())
Try to create a StaticLibraryDefinitionGenerator from the given path.
Definition: ExecutionUtils.cpp:274
LLVMOrcDisposeThreadSafeContext
void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx)
Dispose of a ThreadSafeContext.
Definition: OrcV2CBindings.cpp:780
llvm::orc::SymbolAliasMapEntry
Definition: Core.h:378
LLVMOrcLLJITGetTripleString
const char * LLVMOrcLLJITGetTripleString(LLVMOrcLLJITRef J)
Return the target triple for this LLJIT instance.
Definition: OrcV2CBindings.cpp:997
LLVMOrcObjectTransformLayerTransformFunction
LLVMErrorRef(* LLVMOrcObjectTransformLayerTransformFunction)(void *Ctx, LLVMMemoryBufferRef *ObjInOut)
A function for applying transformations to an object file buffer.
Definition: Orc.h:450
LLVMOrcDisposeCAPIDefinitionGeneratorFunction
void(* LLVMOrcDisposeCAPIDefinitionGeneratorFunction)(void *Ctx)
Disposer for a custom generator.
Definition: Orc.h:366
LLVMOrcDisposeLLJITBuilder
void LLVMOrcDisposeLLJITBuilder(LLVMOrcLLJITBuilderRef Builder)
Dispose of an LLVMOrcLLJITBuilderRef.
Definition: OrcV2CBindings.cpp:944
LLVMOrcMaterializationUnitDestroyFunction
void(* LLVMOrcMaterializationUnitDestroyFunction)(void *Ctx)
A MaterializationUnit destruction callback.
Definition: Orc.h:294
LLVMOrcMaterializationResponsibilityDefineMaterializing
LLVMErrorRef LLVMOrcMaterializationResponsibilityDefineMaterializing(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms)
Attempt to claim responsibility for new definitions.
Definition: OrcV2CBindings.cpp:567
llvm::orc::DynamicLibrarySearchGenerator::GetForCurrentProcess
static Expected< std::unique_ptr< DynamicLibrarySearchGenerator > > GetForCurrentProcess(char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate())
Creates a DynamicLibrarySearchGenerator that searches for symbols in the current process.
Definition: ExecutionUtils.h:240
llvm::orc::OrcV2CAPIHelper::copyToSymbolStringPtr
static SymbolStringPtr copyToSymbolStringPtr(PoolEntryPtr P)
Definition: OrcV2CBindings.cpp:48
LLVMOrcReleaseResourceTracker
void LLVMOrcReleaseResourceTracker(LLVMOrcResourceTrackerRef RT)
Reduces the ref-count of a ResourceTracker.
Definition: OrcV2CBindings.cpp:423
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
TargetMachine.h
LLVMOrcCDependenceMapPair::Names
LLVMOrcCSymbolsList Names
Definition: Orc.h:175
get
Should compile to something r4 addze r3 instead we get
Definition: README.txt:24
llvm::orc::OrcV2CAPIHelper
Definition: OrcV2CBindings.cpp:28
LLVMOrcDumpObjectsRef
struct LLVMOrcOpaqueDumpObjects * LLVMOrcDumpObjectsRef
A reference to an orc::DumpObjects object.
Definition: Orc.h:471
LLVMOrcGenericIRModuleOperationFunction
LLVMErrorRef(* LLVMOrcGenericIRModuleOperationFunction)(void *Ctx, LLVMModuleRef M)
A function for inspecting/mutating IR modules, suitable for use with LLVMOrcThreadSafeModuleWithModul...
Definition: Orc.h:388
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition: Core.h:1358
llvm::orc::JITDylibLookupFlags::MatchExportedSymbolsOnly
@ MatchExportedSymbolsOnly
llvm::AArch64CC::LS
@ LS
Definition: AArch64BaseInfo.h:264
LLVMOrcDisposeMaterializationResponsibility
void LLVMOrcDisposeMaterializationResponsibility(LLVMOrcMaterializationResponsibilityRef MR)
Disposes of the passed MaterializationResponsibility object.
Definition: OrcV2CBindings.cpp:490
llvm::orc::CAPIDefinitionGenerator
Definition: OrcV2CBindings.cpp:281
LLVMOrcLLJITGetIRTransformLayer
LLVMOrcIRTransformLayerRef LLVMOrcLLJITGetIRTransformLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's IR transform layer.
Definition: OrcV2CBindings.cpp:1081
DEFINE_SIMPLE_CONVERSION_FUNCTIONS
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(OrcV2CAPIHelper::PoolEntry, LLVMOrcSymbolStringPoolEntryRef) DEFINE_SIMPLE_CONVERSION_FUNCTIONS(MaterializationUnit
LLVMOrcLLJITBuilderSetJITTargetMachineBuilder
void LLVMOrcLLJITBuilderSetJITTargetMachineBuilder(LLVMOrcLLJITBuilderRef Builder, LLVMOrcJITTargetMachineBuilderRef JTMB)
Set the JITTargetMachineBuilder to be used when constructing the LLJIT instance.
Definition: OrcV2CBindings.cpp:948
llvm::orc::absoluteSymbols
std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)
Create an AbsoluteSymbolsMaterializationUnit with the given symbols.
Definition: Core.h:756
LLVMOrcSymbolStringPoolEntryStr
const char * LLVMOrcSymbolStringPoolEntryStr(LLVMOrcSymbolStringPoolEntryRef S)
Return the c-string for the given symbol.
Definition: OrcV2CBindings.cpp:404
LLVMOrcDefinitionGeneratorRef
struct LLVMOrcOpaqueDefinitionGenerator * LLVMOrcDefinitionGeneratorRef
A reference to an orc::DefinitionGenerator.
Definition: Orc.h:304
LLVMOrcResourceTrackerTransferTo
void LLVMOrcResourceTrackerTransferTo(LLVMOrcResourceTrackerRef SrcRT, LLVMOrcResourceTrackerRef DstRT)
Transfers tracking of all resources associated with resource tracker SrcRT to resource tracker DstRT.
Definition: OrcV2CBindings.cpp:428
LLVMOrcJITDylibCreateResourceTracker
LLVMOrcResourceTrackerRef LLVMOrcJITDylibCreateResourceTracker(LLVMOrcJITDylibRef JD)
Return a reference to a newly created resource tracker associated with JD.
Definition: OrcV2CBindings.cpp:409
LLVMOrcMaterializationResponsibilityGetExecutionSession
LLVMOrcExecutionSessionRef LLVMOrcMaterializationResponsibilityGetExecutionSession(LLVMOrcMaterializationResponsibilityRef MR)
Returns the ExecutionSession for this MaterializationResponsibility.
Definition: OrcV2CBindings.cpp:501
LLVMOrcSymbolLookupFlagsWeaklyReferencedSymbol
@ LLVMOrcSymbolLookupFlagsWeaklyReferencedSymbol
Definition: Orc.h:228
llvm::orc::IRTransformLayer
A layer that applies a transform to emitted modules.
Definition: IRTransformLayer.h:27
LLVMOrcJITTargetMachineBuilderSetTargetTriple
void LLVMOrcJITTargetMachineBuilderSetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple)
Sets the target triple for the given JITTargetMachineBuilder to the given string.
Definition: OrcV2CBindings.cpp:850
llvm::orc::OrcV2CAPIHelper::getRawPoolEntryPtr
static PoolEntryPtr getRawPoolEntryPtr(const SymbolStringPtr &S)
Definition: OrcV2CBindings.cpp:52
LLVMOrcDisposeDefinitionGenerator
void LLVMOrcDisposeDefinitionGenerator(LLVMOrcDefinitionGeneratorRef DG)
Dispose of a JITDylib::DefinitionGenerator.
Definition: OrcV2CBindings.cpp:439
LLVMOrcCreateLocalIndirectStubsManager
LLVMOrcIndirectStubsManagerRef LLVMOrcCreateLocalIndirectStubsManager(const char *TargetTriple)
Create a LocalIndirectStubsManager from the given target triple.
Definition: OrcV2CBindings.cpp:1090
llvm::orc::DynamicLibrarySearchGenerator::SymbolPredicate
std::function< bool(const SymbolStringPtr &)> SymbolPredicate
Definition: ExecutionUtils.h:219
LLVMOrcLLJITAddObjectFile
LLVMErrorRef LLVMOrcLLJITAddObjectFile(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, LLVMMemoryBufferRef ObjBuffer)
Add a buffer representing an object file to the given JITDylib in the given LLJIT instance.
Definition: OrcV2CBindings.cpp:1011
OrcEE.h
SectionMemoryManager.h
LLVMErrorRef
struct LLVMOpaqueError * LLVMErrorRef
Opaque reference to an error instance.
Definition: Error.h:33
llvm::orc::DynamicLibrarySearchGenerator::Load
static Expected< std::unique_ptr< DynamicLibrarySearchGenerator > > Load(const char *FileName, char GlobalPrefix, SymbolPredicate Allow=SymbolPredicate())
Permanently loads the library at the given path and, on success, returns a DynamicLibrarySearchGenera...
Definition: ExecutionUtils.cpp:229
LLVMOrcJITTargetMachineBuilderRef
struct LLVMOrcOpaqueJITTargetMachineBuilder * LLVMOrcJITTargetMachineBuilderRef
A reference to an orc::JITTargetMachineBuilder instance.
Definition: Orc.h:394
LLVMOrcJITDylibLookupFlagsMatchExportedSymbolsOnly
@ LLVMOrcJITDylibLookupFlagsMatchExportedSymbolsOnly
Definition: Orc.h:202
llvm::orc::ObjectTransformLayer
Definition: ObjectTransformLayer.h:24
LLVMOrcCreateStaticLibrarySearchGeneratorForPath
LLVMErrorRef LLVMOrcCreateStaticLibrarySearchGeneratorForPath(LLVMOrcDefinitionGeneratorRef *Result, LLVMOrcObjectLayerRef ObjLayer, const char *FileName, const char *TargetTriple)
Get a LLVMOrcCreateStaticLibrarySearchGeneratorForPath that will reflect static library symbols into ...
Definition: OrcV2CBindings.cpp:742
LLVMOrcIRTransformLayerTransformFunction
LLVMErrorRef(* LLVMOrcIRTransformLayerTransformFunction)(void *Ctx, LLVMOrcThreadSafeModuleRef *ModInOut, LLVMOrcMaterializationResponsibilityRef MR)
A function for applying transformations as part of an transform layer.
Definition: Orc.h:427
LLVMOrcExecutionSessionGetJITDylibByName
LLVMOrcJITDylibRef LLVMOrcExecutionSessionGetJITDylibByName(LLVMOrcExecutionSessionRef ES, const char *Name)
Returns the JITDylib with the given name, or NULL if no such JITDylib exists.
Definition: OrcV2CBindings.cpp:652
LLVMMemoryBufferRef
struct LLVMOpaqueMemoryBuffer * LLVMMemoryBufferRef
LLVM uses a polymorphic type hierarchy which C cannot represent, therefore parameters must be passed ...
Definition: Types.h:48
llvm::orc::ThreadSafeModule
An LLVM Module together with a shared ThreadSafeContext.
Definition: ThreadSafeModule.h:77
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
LLVMOrcMaterializationResponsibilityFailMaterialization
void LLVMOrcMaterializationResponsibilityFailMaterialization(LLVMOrcMaterializationResponsibilityRef MR)
Notify all not-yet-emitted covered by this MaterializationResponsibility instance that an error has o...
Definition: OrcV2CBindings.cpp:620
llvm::orc::JITDylibLookupFlags
JITDylibLookupFlags
Lookup flags that apply to each dylib in the search order for a lookup.
Definition: Core.h:127
LLVMOrcLLJITAddLLVMIRModule
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModule(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, LLVMOrcThreadSafeModuleRef TSM)
Add an IR module to the given JITDylib in the given LLJIT instance.
Definition: OrcV2CBindings.cpp:1025
LLVMOrcRetainSymbolStringPoolEntry
void LLVMOrcRetainSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)
Increments the ref-count for a SymbolStringPool entry.
Definition: OrcV2CBindings.cpp:396
LLVMOrcDisposeSymbols
void LLVMOrcDisposeSymbols(LLVMOrcSymbolStringPoolEntryRef *Symbols)
Disposes of the passed LLVMOrcSymbolStringPoolEntryRef* .
Definition: OrcV2CBindings.cpp:551
llvm::orc::CAPIDefinitionGenerator::~CAPIDefinitionGenerator
~CAPIDefinitionGenerator()
Definition: OrcV2CBindings.cpp:288
LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator
void LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator(LLVMOrcLLJITBuilderRef Builder, LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction F, void *Ctx)
Set an ObjectLinkingLayer creator function for this LLJIT instance.
Definition: OrcV2CBindings.cpp:954
llvm::orc::JITDylibLookupFlags::MatchAllSymbols
@ MatchAllSymbols
LLVMOrcResourceTrackerRemove
LLVMErrorRef LLVMOrcResourceTrackerRemove(LLVMOrcResourceTrackerRef RT)
Remove all resources associated with the given tracker.
Definition: OrcV2CBindings.cpp:434
llvm::orc::SymbolLookupFlags::RequiredSymbol
@ RequiredSymbol
LLVMOrcThreadSafeContextRef
struct LLVMOrcOpaqueThreadSafeContext * LLVMOrcThreadSafeContextRef
A reference to an orc::ThreadSafeContext instance.
Definition: Orc.h:377
LLVMOrcMaterializationResponsibilityGetInitializerSymbol
LLVMOrcSymbolStringPoolEntryRef LLVMOrcMaterializationResponsibilityGetInitializerSymbol(LLVMOrcMaterializationResponsibilityRef MR)
Returns the initialization pseudo-symbol, if any.
Definition: OrcV2CBindings.cpp:528
llvm::orc::IRLayer
Interface for layers that accept LLVM IR.
Definition: Layer.h:67
LLVMOrcCJITDylibSearchOrderElement
An element type for a JITDylib search order.
Definition: Orc.h:209
LLVMJITEventListenerRef
struct LLVMOpaqueJITEventListener * LLVMJITEventListenerRef
Definition: Types.h:163
LLVMOrcLLJITAddObjectFileWithRT
LLVMErrorRef LLVMOrcLLJITAddObjectFileWithRT(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcResourceTrackerRef RT, LLVMMemoryBufferRef ObjBuffer)
Definition: OrcV2CBindings.cpp:862
JITTargetMachineBuilder.h
llvm::safe_malloc
LLVM_ATTRIBUTE_RETURNS_NONNULL void * safe_malloc(size_t Sz)
Definition: MemAlloc.h:25
LLVMTargetMachineRef
struct LLVMOpaqueTargetMachine * LLVMTargetMachineRef
Definition: TargetMachine.h:34
LLVMOrcLLJITGetObjLinkingLayer
LLVMOrcObjectLayerRef LLVMOrcLLJITGetObjLinkingLayer(LLVMOrcLLJITRef J)
Returns a non-owning reference to the LLJIT instance's object linking layer.
Definition: OrcV2CBindings.cpp:1055
LLVMOrcLLJITGetMainJITDylib
LLVMOrcJITDylibRef LLVMOrcLLJITGetMainJITDylib(LLVMOrcLLJITRef J)
Return a reference to the Main JITDylib.
Definition: OrcV2CBindings.cpp:993
LLVMOrcLLJITGetGlobalPrefix
char LLVMOrcLLJITGetGlobalPrefix(LLVMOrcLLJITRef J)
Returns the global prefix character according to the LLJIT's DataLayout.
Definition: OrcV2CBindings.cpp:1001
LLVMOrcJITTargetAddress
uint64_t LLVMOrcJITTargetAddress
Represents an address in the executor process.
Definition: Orc.h:46
LLVMModuleRef
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
Definition: Types.h:61
llvm::JITSymbolFlags::Exported
@ Exported
Definition: JITSymbol.h:85
LLVMOrcCreateLocalLazyCallThroughManager
LLVMErrorRef LLVMOrcCreateLocalLazyCallThroughManager(const char *TargetTriple, LLVMOrcExecutionSessionRef ES, LLVMOrcJITTargetAddress ErrorHandlerAddr, LLVMOrcLazyCallThroughManagerRef *Result)
Definition: OrcV2CBindings.cpp:1099