LLVM: lib/ExecutionEngine/Orc/OrcV2CBindings.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

13

22

23using namespace llvm;

25

26namespace llvm {

27namespace orc {

28

30

32public:

34 return LS.IPLS.release();

35 }

36

38 return LS.reset(IPLS);

39 }

40};

41

42}

43}

44

48

52

81

82namespace {

83

85public:

94 Name(std::move(Name)), Ctx(Ctx), Materialize(Materialize),

95 Discard(Discard), Destroy(Destroy) {}

96

98 if (Ctx)

99 Destroy(Ctx);

100 }

101

103

104 void materialize(std::unique_ptr R) override {

105 void *Tmp = Ctx;

106 Ctx = nullptr;

107 Materialize(Tmp, wrap(R.release()));

108 }

109

110private:

113 }

114

115 std::string Name;

116 void *Ctx = nullptr;

120};

121

123

125

134

136

137 return JSF;

138}

139

150

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());

162}

163

166 for (size_t I = 0; I != NumPairs; ++I) {

168 SM[unwrap(Syms[I].Name).moveToSymbolStringPtr()] = {

170 }

171 return SM;

172}

173

177 for (size_t I = 0; I != NumPairs; ++I) {

180

181 for (size_t J = 0; J != Pairs[I].Names.Length; ++J) {

183 Names.insert(unwrap(Sym).moveToSymbolStringPtr());

184 }

185 SDM[JD] = Names;

186 }

187 return SDM;

188}

189

191 switch (K) {

196 }

198}

199

201 switch (K) {

206 }

208}

209

212 switch (LF) {

217 }

218 llvm_unreachable("unrecognized LLVMOrcJITDylibLookupFlags value");

219}

220

223 switch (LF) {

228 }

230}

231

233 switch (SLF) {

238 }

239 llvm_unreachable("unrecognized LLVMOrcSymbolLookupFlags value");

240}

241

243 switch (SLF) {

248 }

250}

251

256

257}

258

259namespace llvm {

260namespace orc {

261

263public:

267 : Dispose(Dispose), Ctx(Ctx), TryToGenerate(TryToGenerate) {}

268

270 if (Dispose)

271 Dispose(Ctx);

272 }

273

277

278

280

281

283

284

285 LLVMOrcJITDylibLookupFlags CJDLookupFlags =

286 fromJITDylibLookupFlags(JDLookupFlags);

287

288

289 std::vector 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

299 auto Err = unwrap(TryToGenerate(::wrap(this), Ctx, &LSR, CLookupKind,

300 ::wrap(&JD), CJDLookupFlags,

301 CLookupSet.data(), CLookupSet.size()));

302

303

305

306 return Err;

307 }

308

309private:

311 void *Ctx;

313};

314

315}

316}

317

320 void *Ctx) {

321 unwrap(ES)->setErrorReporter(

322 [=](Error Err) { ReportError(Ctx, wrap(std::move(Err))); });

323}

324

328 unwrap(ES)->getExecutorProcessControl().getSymbolStringPool().get());

329}

330

332 unwrap(SSP)->clearDeadEntries();

333}

334

339

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

356 for (size_t I = 0; I != SymbolsSize; ++I)

357 SLS.add(unwrap(Symbols[I].Name).moveToSymbolStringPtr(),

358 toSymbolLookupFlags(Symbols[I].LookupFlags));

359

365 for (auto &KV : *Result)

368 fromExecutorSymbolDef(KV.second)});

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

392 RT->Retain();

393 return wrap(RT.get());

394}

395

398 auto RT = unwrap(JD)->getDefaultResourceTracker();

399

400 return wrap(RT.get());

401}

402

407

413

418

420 std::unique_ptr TmpDG(unwrap(DG));

421}

422

424 std::unique_ptr TmpMU(unwrap(MU));

425}

426

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);

448}

449

453 size_t NumPairs) {

454

456 for (size_t I = 0; I != NumPairs; ++I) {

457 auto pair = CallableAliases[I];

458 JITSymbolFlags Flags = toJITSymbolFlags(pair.Entry.Flags);

460 SAM[unwrap(pair.Name).moveToSymbolStringPtr()] =

462 }

463

465 std::move(SAM))

467}

468

471 std::unique_ptr TmpMR(unwrap(MR));

472}

473

476 return wrap(&unwrap(MR)->getTargetJITDylib());

477}

478

482 return wrap(&unwrap(MR)->getExecutionSession());

483}

484

487

488 auto Symbols = unwrap(MR)->getSymbols();

491 size_t I = 0;

492 for (auto const &pair : Symbols) {

494 auto Flags = pair.second;

495 Result[I] = {Name, fromJITSymbolFlags(Flags)};

496 I++;

497 }

498 *NumPairs = Symbols.size();

500}

501

505

509 auto Sym = unwrap(MR)->getInitializerSymbol();

511}

512

516

517 auto Symbols = unwrap(MR)->getRequestedSymbols();

521 size_t I = 0;

522 for (auto &Name : Symbols) {

524 I++;

525 }

526 *NumSymbols = Symbols.size();

528}

529

533

536 size_t NumSymbols) {

537 SymbolMap SM = toSymbolMap(Symbols, NumSymbols);

538 return wrap(unwrap(MR)->notifyResolved(std::move(SM)));

539}

540

544 std::vector SDGs;

545 SDGs.reserve(NumSymbolDepGroups);

546 for (size_t I = 0; I != NumSymbolDepGroups; ++I) {

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

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 TmpMU(unwrap(MU));

572}

573

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 }

589}

590

593 unwrap(MR)->failMaterialization();

594}

595

599 std::unique_ptr TmpTSM(unwrap(TSM));

601 std::unique_ptr(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());

620}

621

624 const char *Name) {

625 return wrap(unwrap(ES)->getJITDylibByName(Name));

626}

627

630 std::unique_ptr TmpMU(unwrap(MU));

631

632 if (auto Err = unwrap(JD)->define(TmpMU)) {

633 TmpMU.release();

634 return wrap(std::move(Err));

635 }

637}

638

642

645 unwrap(JD)->addGenerator(std::unique_ptr(unwrap(DG)));

646}

647

651 auto DG = std::make_unique(Dispose, Ctx, F);

652 return wrap(DG.release());

653}

654

659 LS.continueLookup(unwrap(Err));

660}

661

667 "if Filter is null then FilterCtx must also be null");

668

673 };

674

675 auto ProcessSymsGenerator =

677

678 if (!ProcessSymsGenerator) {

680 return wrap(ProcessSymsGenerator.takeError());

681 }

682

683 *Result = wrap(ProcessSymsGenerator->release());

685}

686

691 assert(FileName && "FileName can not be null");

693 "if Filter is null then FilterCtx must also be null");

694

699 };

700

701 auto LibrarySymsGenerator =

703

704 if (!LibrarySymsGenerator) {

706 return wrap(LibrarySymsGenerator.takeError());

707 }

708

709 *Result = wrap(LibrarySymsGenerator->release());

711}

712

715 const char *FileName) {

717 assert(FileName && "Filename can not be null");

718 assert(ObjLayer && "ObjectLayer can not be null");

719

720 auto LibrarySymsGenerator =

722 if (!LibrarySymsGenerator) {

724 return wrap(LibrarySymsGenerator.takeError());

725 }

726 *Result = wrap(LibrarySymsGenerator->release());

728}

729

733

738

740 delete unwrap(TSCtx);

741}

742

746 void *Ctx) {

747 return wrap(unwrap(TSM)->withModuleDo(

749}

750

757

761

765

767 if (!JTMB) {

769 return wrap(JTMB.takeError());

770 }

771

774}

775

778 auto *TemplateTM = unwrap(TM);

779

780 auto JTMB =

781 std::make_unique(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

811 unwrap(JTMB)->getTargetTriple() = Triple(TargetTriple);

812}

813

818 *unwrap(JD), std::unique_ptr(unwrap(ObjBuffer))));

819}

820

826 std::unique_ptr(unwrap(ObjBuffer))));

827}

828

832 unwrap(ObjLayer)->emit(

833 std::unique_ptr(unwrap(R)),

834 std::unique_ptr(unwrap(ObjBuffer)));

835}

836

838 delete unwrap(ObjLayer);

839}

840

845 ->setTransform(

850 if (LLVMErrorRef Err = TransformFunction(Ctx, &TSMRef, wrap(&R))) {

851 assert(!TSMRef && "TSMRef was not reset to null on error");

853 }

854 assert(TSMRef && "Transform succeeded, but TSMRef was set to null");

857 return std::move(Result);

858 });

859}

860

864 unwrap(ObjTransformLayer)

865 ->setTransform([TransformFunction, Ctx](std::unique_ptr Obj)

866 -> Expected<std::unique_ptr> {

868 if (LLVMErrorRef Err = TransformFunction(Ctx, &ObjBuffer)) {

869 assert(!ObjBuffer && "ObjBuffer was not reset to null on error");

871 }

872 return std::unique_ptr(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

889 std::unique_ptr OB(unwrap(*ObjBuffer));

891 *ObjBuffer = wrap(Result->release());

893 } else {

894 *ObjBuffer = nullptr;

896 }

897}

898

902

904 delete unwrap(Builder);

905}

906

909 unwrap(Builder)->setJITTargetMachineBuilder(std::move(*unwrap(JTMB)));

911}

912

918 return std::unique_ptr(

919 unwrap(F(Ctx, wrap(&ES), TTStr.c_str())));

920 });

921}

922

926

927 if (!Builder)

929

930 auto J = unwrap(Builder)->create();

932

933 if (!J) {

935 return wrap(J.takeError());

936 }

937

940}

941

946

948 return wrap(&unwrap(J)->getExecutionSession());

949}

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

966 unwrap(J)->mangleAndIntern(UnmangledName)));

967}

968

971 return wrap(unwrap(J)->addObjectFile(

972 *unwrap(JD), std::unique_ptr(unwrap(ObjBuffer))));

973}

974

978 return wrap(unwrap(J)->addObjectFile(

980 std::unique_ptr(unwrap(ObjBuffer))));

981}

982

986 std::unique_ptr TmpTSM(unwrap(TSM));

987 return wrap(unwrap(J)->addIRModule(*unwrap(JD), std::move(*TmpTSM)));

988}

989

993 std::unique_ptr TmpTSM(unwrap(TSM));

995 std::move(*TmpTSM)));

996}

997

1000 const char *Name) {

1002

1003 auto Sym = unwrap(J)->lookup(Name);

1004 if (!Sym) {

1006 return wrap(Sym.takeError());

1007 }

1008

1009 *Result = Sym->getValue();

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());

1031}

1032

1036 assert(ES && "ES must not be null");

1037 return wrap(

1039 return std::make_unique();

1040 }));

1041}

1042

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);

1072 std::swap(NotifyTerminating, Other.NotifyTerminating);

1073 std::swap(AllocateCodeSection, Other.AllocateCodeSection);

1074 std::swap(AllocateDataSection, Other.AllocateDataSection);

1077 }

1078

1079 ~MCJITMemoryManagerLikeCallbacks() {

1080 if (NotifyTerminating)

1081 NotifyTerminating(CreateContextCtx);

1082 }

1083

1084 void *CreateContextCtx = 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

1103 unsigned SectionID,

1105 return CBs.AllocateCodeSection(Opaque, Size, Alignment, SectionID,

1107 }

1108

1111 bool isReadOnly) override {

1112 return CBs.AllocateDataSection(Opaque, Size, Alignment, SectionID,

1114 }

1115

1117 char *ErrMsgCString = nullptr;

1118 bool Result = CBs.FinalizeMemory(Opaque, &ErrMsgCString);

1120 "Did not expect an error message if FinalizeMemory succeeded");

1121 if (ErrMsgCString) {

1122 if (ErrMsg)

1123 *ErrMsg = ErrMsgCString;

1124 free(ErrMsgCString);

1125 }

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

1148 return std::make_unique(CBs);

1149 }));

1150

1151 return nullptr;

1152}

1153

1157 assert(RTDyldObjLinkingLayer && "RTDyldObjLinkingLayer must not be null");

1158 assert(Listener && "Listener must not be null");

1160 ->registerJITEventListener(*unwrap(Listener));

1161}

1162

1164 return wrap(&unwrap(J)->getIRTransformLayer());

1165}

1166

1168 return unwrap(J)->getDataLayout().getStringRepresentation().c_str();

1169}

1170

1176

1178 std::unique_ptr TmpISM(unwrap(ISM));

1179}

1180

1187

1188 if (!LCTM)

1189 return wrap(LCTM.takeError());

1192}

1193

1196 std::unique_ptr TmpLCM(unwrap(LCM));

1197}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)

LLVM_C_EXTERN_C_BEGIN typedef void *(* LLVMMemoryManagerCreateContextCallback)(void *CtxCtx)

void(* LLVMMemoryManagerNotifyTerminatingCallback)(void *CtxCtx)

StringRef getName() const override

Return the name of this materialization unit.

Definition OrcV2CBindings.cpp:102

~OrcCAPIMaterializationUnit() override

Definition OrcV2CBindings.cpp:97

void materialize(std::unique_ptr< MaterializationResponsibility > R) override

Implementations of this method should materialize all symbols in the materialzation unit,...

Definition OrcV2CBindings.cpp:104

OrcCAPIMaterializationUnit(std::string Name, SymbolFlagsMap InitialSymbolFlags, SymbolStringPtr InitSymbol, void *Ctx, LLVMOrcMaterializationUnitMaterializeFunction Materialize, LLVMOrcMaterializationUnitDiscardFunction Discard, LLVMOrcMaterializationUnitDestroyFunction Destroy)

Definition OrcV2CBindings.cpp:86

Lightweight error class with error context and mandatory checking.

Tagged union holding either a T or a Error.

Flags for symbols in the JIT.

TargetFlagsType & getTargetFlags()

Return a reference to the target-specific flags.

@ MaterializationSideEffectsOnly

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.

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.

Primary interface to the complete machine description for the target machine.

Triple - Helper class for working with autoconf configuration names.

const std::string & str() const

std::pair< iterator, bool > insert(const ValueT &V)

static Expected< std::unique_ptr< InProcessMemoryManager > > Create()

Attempts to auto-detect the host page size.

~CAPIDefinitionGenerator() override

Definition OrcV2CBindings.cpp:269

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:274

CAPIDefinitionGenerator(LLVMOrcDisposeCAPIDefinitionGeneratorFunction Dispose, void *Ctx, LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction TryToGenerate)

Definition OrcV2CBindings.cpp:264

Definition generators can be attached to JITDylibs to generate new definitions for otherwise unresolv...

A function object that can be used as an ObjectTransformLayer transform to dump object files to disk ...

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.

const Triple & getTargetTriple() const

Return the triple for the executor.

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.

A layer that applies a transform to emitted modules.

Base class for managing collections of named indirect stubs.

Represents a JIT'd dynamic library.

A utility class for building TargetMachines for JITs.

static LLVM_ABI Expected< JITTargetMachineBuilder > detectHost()

Create a JITTargetMachineBuilder for the host system.

Constructs LLJIT instances.

A pre-fabricated ORC JIT stack that can serve as an alternative to MCJIT.

Manages a set of 'lazy call-through' trampolines.

Wraps state for a lookup-in-progress.

Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...

A MaterializationUnit represents a set of symbol definitions that can be materialized as a group,...

MaterializationUnit(Interface I)

SymbolStringPtr InitSymbol

Interface for Layers that accept object files.

An ObjectLayer implementation built on JITLink.

Definition OrcV2CBindings.cpp:31

static InProgressLookupState * extractLookupState(LookupState &LS)

Definition OrcV2CBindings.cpp:33

static void resetLookupState(LookupState &LS, InProgressLookupState *IPLS)

Definition OrcV2CBindings.cpp:37

API to remove / transfer ownership of JIT resources.

LLVM_ABI void transferTo(ResourceTracker &DstRT)

Transfer all resources associated with this key to the given tracker, which must target the same JITD...

LLVM_ABI Error remove()

Remove all resources associated with this key.

static Expected< std::unique_ptr< StaticLibraryDefinitionGenerator > > Load(ObjectLayer &L, const char *FileName, VisitMembersFunction VisitMembers=VisitMembersFunction(), GetObjectFileInterface GetObjFileInterface=GetObjectFileInterface())

Try to create a StaticLibraryDefinitionGenerator from the given path.

A set of symbols to look up, each associated with a SymbolLookupFlags value.

UnderlyingVector::size_type size() const

SymbolLookupSet & add(SymbolStringPtr Name, SymbolLookupFlags Flags=SymbolLookupFlags::RequiredSymbol)

Add an element to the set.

Provides unsafe access to ownership operations on SymbolStringPtr.

SymbolStringPool::PoolMapEntry PoolEntry

static SymbolStringPoolEntryUnsafe from(const SymbolStringPtrBase &S)

Create an unsafe pool entry ref without changing the ref-count.

static SymbolStringPoolEntryUnsafe take(SymbolStringPtr &&S)

Consumes the given SymbolStringPtr without releasing the pool entry.

String pool for symbol names used by the JIT.

Pointer to a pooled string representing a symbol name.

An LLVMContext together with an associated mutex that can be used to lock the context to prevent conc...

An LLVM Module together with a shared ThreadSafeContext.

struct LLVMOpaqueError * LLVMErrorRef

Opaque reference to an error instance.

void LLVMOrcDisposeLLJITBuilder(LLVMOrcLLJITBuilderRef Builder)

Dispose of an LLVMOrcLLJITBuilderRef.

Definition OrcV2CBindings.cpp:903

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:969

LLVMOrcIRTransformLayerRef LLVMOrcLLJITGetIRTransformLayer(LLVMOrcLLJITRef J)

Returns a non-owning reference to the LLJIT instance's IR transform layer.

Definition OrcV2CBindings.cpp:1163

struct LLVMOrcOpaqueLLJIT * LLVMOrcLLJITRef

A reference to an orc::LLJIT instance.

LLVMOrcObjectLayerRef(* LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction)(void *Ctx, LLVMOrcExecutionSessionRef ES, const char *Triple)

A function for constructing an ObjectLinkingLayer instance to be used by an LLJIT instance.

LLVMOrcObjectLayerRef LLVMOrcLLJITGetObjLinkingLayer(LLVMOrcLLJITRef J)

Returns a non-owning reference to the LLJIT instance's object linking layer.

Definition OrcV2CBindings.cpp:1013

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:990

void LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator(LLVMOrcLLJITBuilderRef Builder, LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction F, void *Ctx)

Set an ObjectLinkingLayer creator function for this LLJIT instance.

Definition OrcV2CBindings.cpp:913

const char * LLVMOrcLLJITGetTripleString(LLVMOrcLLJITRef J)

Return the target triple for this LLJIT instance.

Definition OrcV2CBindings.cpp:955

const char * LLVMOrcLLJITGetDataLayoutStr(LLVMOrcLLJITRef J)

Get the LLJIT instance's default data layout string.

Definition OrcV2CBindings.cpp:1167

LLVMOrcJITDylibRef LLVMOrcLLJITGetMainJITDylib(LLVMOrcLLJITRef J)

Return a reference to the Main JITDylib.

Definition OrcV2CBindings.cpp:951

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:998

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:964

LLVMErrorRef LLVMOrcLLJITAddLLVMIRModule(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD, LLVMOrcThreadSafeModuleRef TSM)

Add an IR module to the given JITDylib in the given LLJIT instance.

Definition OrcV2CBindings.cpp:983

struct LLVMOrcOpaqueLLJITBuilder * LLVMOrcLLJITBuilderRef

A reference to an orc::LLJITBuilder instance.

LLVMErrorRef LLVMOrcDisposeLLJIT(LLVMOrcLLJITRef J)

Dispose of an LLJIT instance.

Definition OrcV2CBindings.cpp:942

char LLVMOrcLLJITGetGlobalPrefix(LLVMOrcLLJITRef J)

Returns the global prefix character according to the LLJIT's DataLayout.

Definition OrcV2CBindings.cpp:959

void LLVMOrcLLJITBuilderSetJITTargetMachineBuilder(LLVMOrcLLJITBuilderRef Builder, LLVMOrcJITTargetMachineBuilderRef JTMB)

Set the JITTargetMachineBuilder to be used when constructing the LLJIT instance.

Definition OrcV2CBindings.cpp:907

LLVMOrcLLJITBuilderRef LLVMOrcCreateLLJITBuilder(void)

Create an LLVMOrcLLJITBuilder.

Definition OrcV2CBindings.cpp:899

LLVMErrorRef LLVMOrcCreateLLJIT(LLVMOrcLLJITRef *Result, LLVMOrcLLJITBuilderRef Builder)

Create an LLJIT instance from an LLJITBuilder.

Definition OrcV2CBindings.cpp:923

LLVMOrcExecutionSessionRef LLVMOrcLLJITGetExecutionSession(LLVMOrcLLJITRef J)

Get a reference to the ExecutionSession for this LLJIT instance.

Definition OrcV2CBindings.cpp:947

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...

Definition OrcV2CBindings.cpp:975

LLVMOrcObjectTransformLayerRef LLVMOrcLLJITGetObjTransformLayer(LLVMOrcLLJITRef J)

Returns a non-owning reference to the LLJIT instance's object linking layer.

Definition OrcV2CBindings.cpp:1018

void LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(LLVMOrcObjectLayerRef RTDyldObjLinkingLayer, LLVMJITEventListenerRef Listener)

Add the given listener to the given RTDyldObjectLinkingLayer.

Definition OrcV2CBindings.cpp:1154

LLVMErrorRef LLVMOrcCreateObjectLinkingLayerWithInProcessMemoryManager(LLVMOrcObjectLayerRef *Result, LLVMOrcExecutionSessionRef ES)

Create a ObjectLinkingLayer instance using the standard JITLink InProcessMemoryManager for memory man...

Definition OrcV2CBindings.cpp:1022

LLVMOrcObjectLayerRef LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(LLVMOrcExecutionSessionRef ES)

Create a RTDyldObjectLinkingLayer instance using the standard SectionMemoryManager for memory managem...

Definition OrcV2CBindings.cpp:1034

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.

Definition OrcV2CBindings.cpp:1044

uint64_t LLVMOrcJITTargetAddress

Represents an address in the executor process.

void LLVMOrcObjectTransformLayerSetTransform(LLVMOrcObjectTransformLayerRef ObjTransformLayer, LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx)

Set the transform function on an LLVMOrcObjectTransformLayer.

Definition OrcV2CBindings.cpp:861

void LLVMOrcDisposeDefinitionGenerator(LLVMOrcDefinitionGeneratorRef DG)

Dispose of a JITDylib::DefinitionGenerator.

Definition OrcV2CBindings.cpp:419

LLVMErrorRef(* LLVMOrcGenericIRModuleOperationFunction)(void *Ctx, LLVMModuleRef M)

A function for inspecting/mutating IR modules, suitable for use with LLVMOrcThreadSafeModuleWithModul...

LLVMErrorRef LLVMOrcCreateStaticLibrarySearchGeneratorForPath(LLVMOrcDefinitionGeneratorRef *Result, LLVMOrcObjectLayerRef ObjLayer, const char *FileName)

Get a LLVMOrcCreateStaticLibrarySearchGeneratorForPath that will reflect static library symbols into ...

Definition OrcV2CBindings.cpp:713

void LLVMOrcDisposeSymbols(LLVMOrcSymbolStringPoolEntryRef *Symbols)

Disposes of the passed LLVMOrcSymbolStringPoolEntryRef* .

Definition OrcV2CBindings.cpp:530

LLVMOrcLookupKind

Lookup kind.

void LLVMOrcDisposeLazyCallThroughManager(LLVMOrcLazyCallThroughManagerRef LCM)

Dispose of an LazyCallThroughManager.

Definition OrcV2CBindings.cpp:1194

struct LLVMOrcOpaqueObjectTransformLayer * LLVMOrcObjectTransformLayerRef

A reference to an orc::ObjectTransformLayer instance.

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:687

void LLVMOrcDisposeThreadSafeModule(LLVMOrcThreadSafeModuleRef TSM)

Dispose of a ThreadSafeModule.

Definition OrcV2CBindings.cpp:758

LLVMOrcDumpObjectsRef LLVMOrcCreateDumpObjects(const char *DumpDir, const char *IdentifierOverride)

Create a DumpObjects instance.

Definition OrcV2CBindings.cpp:876

LLVMErrorRef LLVMOrcJITDylibDefine(LLVMOrcJITDylibRef JD, LLVMOrcMaterializationUnitRef MU)

Add the given MaterializationUnit to the given JITDylib.

Definition OrcV2CBindings.cpp:628

LLVMErrorRef(* LLVMOrcObjectTransformLayerTransformFunction)(void *Ctx, LLVMMemoryBufferRef *ObjInOut)

A function for applying transformations to an object file buffer.

LLVMOrcSymbolStringPoolEntryRef LLVMOrcMaterializationResponsibilityGetInitializerSymbol(LLVMOrcMaterializationResponsibilityRef MR)

Returns the initialization pseudo-symbol, if any.

Definition OrcV2CBindings.cpp:507

void LLVMOrcReleaseSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)

Reduces the ref-count for of a SymbolStringPool entry.

Definition OrcV2CBindings.cpp:380

LLVMOrcCSymbolFlagsMapPair * LLVMOrcCSymbolFlagsMapPairs

Represents a list of (SymbolStringPtr, JITSymbolFlags) pairs that can be used to construct a SymbolFl...

void LLVMOrcDisposeIndirectStubsManager(LLVMOrcIndirectStubsManagerRef ISM)

Dispose of an IndirectStubsManager.

Definition OrcV2CBindings.cpp:1177

void LLVMOrcResourceTrackerTransferTo(LLVMOrcResourceTrackerRef SrcRT, LLVMOrcResourceTrackerRef DstRT)

Transfers tracking of all resources associated with resource tracker SrcRT to resource tracker DstRT.

Definition OrcV2CBindings.cpp:408

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:427

LLVMOrcMaterializationUnitRef LLVMOrcLazyReexports(LLVMOrcLazyCallThroughManagerRef LCTM, LLVMOrcIndirectStubsManagerRef ISM, LLVMOrcJITDylibRef SourceJD, LLVMOrcCSymbolAliasMapPairs CallableAliases, size_t NumPairs)

Create a MaterializationUnit to define lazy re-expots.

Definition OrcV2CBindings.cpp:450

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...

Definition OrcV2CBindings.cpp:541

LLVMOrcCSymbolAliasMapPair * LLVMOrcCSymbolAliasMapPairs

Represents a list of (SymbolStringPtr, (SymbolStringPtr, JITSymbolFlags)) pairs that can be used to c...

LLVMOrcCSymbolMapPair * LLVMOrcCSymbolMapPairs

Represents a list of (SymbolStringPtr, JITEvaluatedSymbol) pairs that can be used to construct a Symb...

void LLVMOrcJITDylibAddGenerator(LLVMOrcJITDylibRef JD, LLVMOrcDefinitionGeneratorRef DG)

Add a DefinitionGenerator to the given JITDylib.

Definition OrcV2CBindings.cpp:643

LLVMErrorRef LLVMOrcExecutionSessionCreateJITDylib(LLVMOrcExecutionSessionRef ES, LLVMOrcJITDylibRef *Result, const char *Name)

Create a JITDylib.

Definition OrcV2CBindings.cpp:612

struct LLVMOrcOpaqueJITTargetMachineBuilder * LLVMOrcJITTargetMachineBuilderRef

A reference to an orc::JITTargetMachineBuilder instance.

LLVMOrcJITDylibRef LLVMOrcMaterializationResponsibilityGetTargetDylib(LLVMOrcMaterializationResponsibilityRef MR)

Returns the target JITDylib that these symbols are being materialized into.

Definition OrcV2CBindings.cpp:474

void LLVMOrcRetainSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S)

Increments the ref-count for a SymbolStringPool entry.

Definition OrcV2CBindings.cpp:376

LLVMErrorRef LLVMOrcMaterializationResponsibilityReplace(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcMaterializationUnitRef MU)

Transfers responsibility to the given MaterializationUnit for all symbols defined by that Materializa...

Definition OrcV2CBindings.cpp:567

void LLVMOrcObjectLayerEmit(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcMaterializationResponsibilityRef R, LLVMMemoryBufferRef ObjBuffer)

Emit an object buffer to an ObjectLayer.

Definition OrcV2CBindings.cpp:829

LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContextFromLLVMContext(LLVMContextRef Ctx)

Create a ThreadSafeContextRef from a given LLVMContext, which must not be associated with any existin...

Definition OrcV2CBindings.cpp:735

char * LLVMOrcJITTargetMachineBuilderGetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB)

Returns the target triple for the given JITTargetMachineBuilder as a string.

Definition OrcV2CBindings.cpp:801

void LLVMOrcLookupStateContinueLookup(LLVMOrcLookupStateRef S, LLVMErrorRef Err)

Continue a lookup that was suspended in a generator (see LLVMOrcCAPIDefinitionGeneratorTryToGenerateF...

Definition OrcV2CBindings.cpp:655

LLVMErrorRef LLVMOrcObjectLayerAddObjectFileWithRT(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcResourceTrackerRef RT, LLVMMemoryBufferRef ObjBuffer)

Add an object to an ObjectLayer using the given ResourceTracker.

Definition OrcV2CBindings.cpp:821

void(* LLVMOrcErrorReporterFunction)(void *Ctx, LLVMErrorRef Err)

Error reporter function.

void LLVMOrcDisposeObjectLayer(LLVMOrcObjectLayerRef ObjLayer)

Dispose of an ObjectLayer.

Definition OrcV2CBindings.cpp:837

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:340

struct LLVMOrcOpaqueMaterializationResponsibility * LLVMOrcMaterializationResponsibilityRef

A reference to a uniquely owned orc::MaterializationResponsibility instance.

void LLVMOrcDisposeMaterializationResponsibility(LLVMOrcMaterializationResponsibilityRef MR)

Disposes of the passed MaterializationResponsibility object.

Definition OrcV2CBindings.cpp:469

LLVMOrcCSymbolFlagsMapPairs LLVMOrcMaterializationResponsibilityGetSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs)

Returns the symbol flags map for this responsibility instance.

Definition OrcV2CBindings.cpp:485

LLVMOrcJITTargetMachineBuilderRef LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(LLVMTargetMachineRef TM)

Create a JITTargetMachineBuilder from the given TargetMachine template.

Definition OrcV2CBindings.cpp:777

void(* LLVMOrcDisposeCAPIDefinitionGeneratorFunction)(void *Ctx)

Disposer for a custom generator.

struct LLVMOrcOpaqueThreadSafeModule * LLVMOrcThreadSafeModuleRef

A reference to an orc::ThreadSafeModule instance.

struct LLVMOrcOpaqueExecutionSession * LLVMOrcExecutionSessionRef

A reference to an orc::ExecutionSession instance.

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:445

struct LLVMOrcOpaqueIndirectStubsManager * LLVMOrcIndirectStubsManagerRef

A reference to an orc::IndirectStubsManager instance.

void(* LLVMOrcExecutionSessionLookupHandleResultFunction)(LLVMErrorRef Err, LLVMOrcCSymbolMapPairs Result, size_t NumPairs, void *Ctx)

Callback type for ExecutionSession lookups.

LLVMErrorRef LLVMOrcJITDylibClear(LLVMOrcJITDylibRef JD)

Calls remove on all trackers associated with this JITDylib, see JITDylib::clear().

Definition OrcV2CBindings.cpp:639

LLVMOrcThreadSafeModuleRef LLVMOrcCreateNewThreadSafeModule(LLVMModuleRef M, LLVMOrcThreadSafeContextRef TSCtx)

Create a ThreadSafeModule wrapper around the given LLVM module.

Definition OrcV2CBindings.cpp:752

void LLVMOrcReleaseResourceTracker(LLVMOrcResourceTrackerRef RT)

Reduces the ref-count of a ResourceTracker.

Definition OrcV2CBindings.cpp:403

LLVMOrcSymbolStringPoolRef LLVMOrcExecutionSessionGetSymbolStringPool(LLVMOrcExecutionSessionRef ES)

Return a reference to the SymbolStringPool for an ExecutionSession.

Definition OrcV2CBindings.cpp:326

void LLVMOrcSymbolStringPoolClearDeadEntries(LLVMOrcSymbolStringPoolRef SSP)

Clear all unreferenced symbol string pool entries.

Definition OrcV2CBindings.cpp:331

LLVMOrcExecutionSessionRef LLVMOrcMaterializationResponsibilityGetExecutionSession(LLVMOrcMaterializationResponsibilityRef MR)

Returns the ExecutionSession for this MaterializationResponsibility.

Definition OrcV2CBindings.cpp:480

LLVMOrcIndirectStubsManagerRef LLVMOrcCreateLocalIndirectStubsManager(const char *TargetTriple)

Create a LocalIndirectStubsManager from the given target triple.

Definition OrcV2CBindings.cpp:1172

LLVMErrorRef LLVMOrcJITTargetMachineBuilderDetectHost(LLVMOrcJITTargetMachineBuilderRef *Result)

Create a JITTargetMachineBuilder by detecting the host.

Definition OrcV2CBindings.cpp:762

LLVMErrorRef(* LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction)(LLVMOrcDefinitionGeneratorRef GeneratorObj, void *Ctx, LLVMOrcLookupStateRef *LookupState, LLVMOrcLookupKind Kind, LLVMOrcJITDylibRef JD, LLVMOrcJITDylibLookupFlags JDLookupFlags, LLVMOrcCLookupSet LookupSet, size_t LookupSetSize)

A custom generator function.

void LLVMOrcIRTransformLayerEmit(LLVMOrcIRTransformLayerRef IRLayer, LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcThreadSafeModuleRef TSM)

Definition OrcV2CBindings.cpp:596

LLVMOrcCJITDylibSearchOrderElement * LLVMOrcCJITDylibSearchOrder

A JITDylib search order.

LLVMErrorRef(* LLVMOrcIRTransformLayerTransformFunction)(void *Ctx, LLVMOrcThreadSafeModuleRef *ModInOut, LLVMOrcMaterializationResponsibilityRef MR)

A function for applying transformations as part of an transform layer.

struct LLVMOrcOpaqueSymbolStringPool * LLVMOrcSymbolStringPoolRef

A reference to an orc::SymbolStringPool.

void(* LLVMOrcMaterializationUnitDestroyFunction)(void *Ctx)

A MaterializationUnit destruction callback.

void LLVMOrcDisposeDumpObjects(LLVMOrcDumpObjectsRef DumpObjects)

Dispose of a DumpObjects instance.

Definition OrcV2CBindings.cpp:883

struct LLVMOrcOpaqueResourceTracker * LLVMOrcResourceTrackerRef

A reference to an orc::ResourceTracker instance.

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:841

void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx)

Dispose of a ThreadSafeContext.

Definition OrcV2CBindings.cpp:739

LLVMOrcCDependenceMapPair * LLVMOrcCDependenceMapPairs

Represents a list of (JITDylibRef, (LLVMOrcSymbolStringPoolEntryRef*, size_t)) pairs that can be used...

const char * LLVMOrcSymbolStringPoolEntryStr(LLVMOrcSymbolStringPoolEntryRef S)

Return the c-string for the given symbol.

Definition OrcV2CBindings.cpp:384

LLVMErrorRef LLVMOrcThreadSafeModuleWithModuleDo(LLVMOrcThreadSafeModuleRef TSM, LLVMOrcGenericIRModuleOperationFunction F, void *Ctx)

Apply the given function to the module contained in this ThreadSafeModule.

Definition OrcV2CBindings.cpp:744

LLVMErrorRef LLVMOrcObjectLayerAddObjectFile(LLVMOrcObjectLayerRef ObjLayer, LLVMOrcJITDylibRef JD, LLVMMemoryBufferRef ObjBuffer)

Add an object to an ObjectLayer to the given JITDylib.

Definition OrcV2CBindings.cpp:814

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:574

LLVMOrcCLookupSetElement * LLVMOrcCLookupSet

A set of symbols to look up / generate.

LLVMOrcResourceTrackerRef LLVMOrcJITDylibCreateResourceTracker(LLVMOrcJITDylibRef JD)

Return a reference to a newly created resource tracker associated with JD.

Definition OrcV2CBindings.cpp:389

struct LLVMOrcOpaqueObjectLayer * LLVMOrcObjectLayerRef

A reference to an orc::ObjectLayer instance.

int(* LLVMOrcSymbolPredicate)(void *Ctx, LLVMOrcSymbolStringPoolEntryRef Sym)

Predicate function for SymbolStringPoolEntries.

void LLVMOrcDisposeJITTargetMachineBuilder(LLVMOrcJITTargetMachineBuilderRef JTMB)

Dispose of a JITTargetMachineBuilder.

Definition OrcV2CBindings.cpp:796

void LLVMOrcJITTargetMachineBuilderSetTargetTriple(LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple)

Sets the target triple for the given JITTargetMachineBuilder to the given string.

Definition OrcV2CBindings.cpp:809

struct LLVMOrcOpaqueDefinitionGenerator * LLVMOrcDefinitionGeneratorRef

A reference to an orc::DefinitionGenerator.

LLVMOrcJITDylibRef LLVMOrcExecutionSessionGetJITDylibByName(LLVMOrcExecutionSessionRef ES, const char *Name)

Returns the JITDylib with the given name, or NULL if no such JITDylib exists.

Definition OrcV2CBindings.cpp:623

void LLVMOrcMaterializationResponsibilityFailMaterialization(LLVMOrcMaterializationResponsibilityRef MR)

Notify all not-yet-emitted covered by this MaterializationResponsibility instance that an error has o...

Definition OrcV2CBindings.cpp:591

struct LLVMOrcOpaqueSymbolStringPoolEntry * LLVMOrcSymbolStringPoolEntryRef

A reference to an orc::SymbolStringPool table entry.

void LLVMOrcDisposeCSymbolFlagsMap(LLVMOrcCSymbolFlagsMapPairs Pairs)

Disposes of the passed LLVMOrcCSymbolFlagsMap.

Definition OrcV2CBindings.cpp:502

LLVMErrorRef LLVMOrcMaterializationResponsibilityDefineMaterializing(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolFlagsMapPairs Syms, size_t NumSyms)

Attempt to claim responsibility for new definitions.

Definition OrcV2CBindings.cpp:556

LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContext(void)

Create a ThreadSafeContextRef containing a new LLVMContext.

Definition OrcV2CBindings.cpp:730

void(* LLVMOrcMaterializationUnitDiscardFunction)(void *Ctx, LLVMOrcJITDylibRef JD, LLVMOrcSymbolStringPoolEntryRef Symbol)

A MaterializationUnit discard callback.

LLVMOrcResourceTrackerRef LLVMOrcJITDylibGetDefaultResourceTracker(LLVMOrcJITDylibRef JD)

Return a reference to the default resource tracker for the given JITDylib.

Definition OrcV2CBindings.cpp:397

LLVMOrcSymbolStringPoolEntryRef * LLVMOrcMaterializationResponsibilityGetRequestedSymbols(LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols)

Returns the names of any symbols covered by this MaterializationResponsibility object that have queri...

Definition OrcV2CBindings.cpp:514

void(* LLVMOrcMaterializationUnitMaterializeFunction)(void *Ctx, LLVMOrcMaterializationResponsibilityRef MR)

A MaterializationUnit materialize callback.

struct LLVMOrcOpaqueDumpObjects * LLVMOrcDumpObjectsRef

A reference to an orc::DumpObjects object.

LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(LLVMOrcDefinitionGeneratorRef *Result, char GlobalPrefix, LLVMOrcSymbolPredicate Filter, void *FilterCtx)

Get a DynamicLibrarySearchGenerator that will reflect process symbols into the JITDylib.

Definition OrcV2CBindings.cpp:662

struct LLVMOrcOpaqueIRTransformLayer * LLVMOrcIRTransformLayerRef

A reference to an orc::IRTransformLayer instance.

struct LLVMOrcOpaqueLookupState * LLVMOrcLookupStateRef

An opaque lookup state object.

LLVMOrcDefinitionGeneratorRef LLVMOrcCreateCustomCAPIDefinitionGenerator(LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction F, void *Ctx, LLVMOrcDisposeCAPIDefinitionGeneratorFunction Dispose)

Create a custom generator.

Definition OrcV2CBindings.cpp:648

LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyResolved(LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolMapPairs Symbols, size_t NumSymbols)

Notifies the target JITDylib that the given symbols have been resolved.

Definition OrcV2CBindings.cpp:534

LLVMErrorRef LLVMOrcCreateLocalLazyCallThroughManager(const char *TargetTriple, LLVMOrcExecutionSessionRef ES, LLVMOrcJITTargetAddress ErrorHandlerAddr, LLVMOrcLazyCallThroughManagerRef *Result)

Definition OrcV2CBindings.cpp:1181

void LLVMOrcDisposeMaterializationUnit(LLVMOrcMaterializationUnitRef MU)

Dispose of a MaterializationUnit.

Definition OrcV2CBindings.cpp:423

LLVMErrorRef LLVMOrcResourceTrackerRemove(LLVMOrcResourceTrackerRef RT)

Remove all resources associated with the given tracker.

Definition OrcV2CBindings.cpp:414

struct LLVMOrcOpaqueMaterializationUnit * LLVMOrcMaterializationUnitRef

A reference to a uniquely owned orc::MaterializationUnit instance.

LLVMOrcJITDylibRef LLVMOrcExecutionSessionCreateBareJITDylib(LLVMOrcExecutionSessionRef ES, const char *Name)

Create a "bare" JITDylib.

Definition OrcV2CBindings.cpp:606

LLVMOrcSymbolStringPoolEntryRef LLVMOrcExecutionSessionIntern(LLVMOrcExecutionSessionRef ES, const char *Name)

Intern a string in the ExecutionSession's SymbolStringPool and return a reference to it.

Definition OrcV2CBindings.cpp:336

void LLVMOrcExecutionSessionSetErrorReporter(LLVMOrcExecutionSessionRef ES, LLVMOrcErrorReporterFunction ReportError, void *Ctx)

Attach a custom error reporter function to the ExecutionSession.

Definition OrcV2CBindings.cpp:318

LLVMErrorRef LLVMOrcDumpObjects_CallOperator(LLVMOrcDumpObjectsRef DumpObjects, LLVMMemoryBufferRef *ObjBuffer)

Dump the contents of the given MemoryBuffer.

Definition OrcV2CBindings.cpp:887

struct LLVMOrcOpaqueJITDylib * LLVMOrcJITDylibRef

A reference to an orc::JITDylib instance.

struct LLVMOrcOpaqueThreadSafeContext * LLVMOrcThreadSafeContextRef

A reference to an orc::ThreadSafeContext instance.

LLVMOrcJITDylibLookupFlags

JITDylib lookup flags.

@ LLVMOrcLookupKindStatic

@ LLVMJITSymbolGenericFlagsWeak

@ LLVMJITSymbolGenericFlagsExported

@ LLVMJITSymbolGenericFlagsCallable

@ LLVMJITSymbolGenericFlagsMaterializationSideEffectsOnly

@ LLVMOrcSymbolLookupFlagsRequiredSymbol

@ LLVMOrcSymbolLookupFlagsWeaklyReferencedSymbol

@ LLVMOrcJITDylibLookupFlagsMatchAllSymbols

@ LLVMOrcJITDylibLookupFlagsMatchExportedSymbolsOnly

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 ...

struct LLVMOpaqueContext * LLVMContextRef

The top-level container for all LLVM global data.

struct LLVMOpaqueModule * LLVMModuleRef

The top-level container for all other LLVM Intermediate Representation (IR) objects.

struct LLVMOpaqueJITEventListener * LLVMJITEventListenerRef

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.

Definition OrcV2CBindings.cpp:82

static LLVMJITEvaluatedSymbol fromExecutorSymbolDef(const ExecutorSymbolDef &S)

Definition OrcV2CBindings.cpp:253

static JITSymbolFlags toJITSymbolFlags(LLVMJITSymbolFlags F)

Definition OrcV2CBindings.cpp:122

static SymbolNameSet toSymbolNameSet(LLVMOrcCSymbolsList Symbols)

Definition OrcV2CBindings.cpp:156

static JITDylibLookupFlags toJITDylibLookupFlags(LLVMOrcJITDylibLookupFlags LF)

Definition OrcV2CBindings.cpp:211

static LLVMOrcSymbolLookupFlags fromSymbolLookupFlags(SymbolLookupFlags SLF)

Definition OrcV2CBindings.cpp:242

static SymbolMap toSymbolMap(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs)

Definition OrcV2CBindings.cpp:164

static LLVMOrcLookupKind fromLookupKind(LookupKind K)

Definition OrcV2CBindings.cpp:200

static LLVMOrcJITDylibLookupFlags fromJITDylibLookupFlags(JITDylibLookupFlags LF)

Definition OrcV2CBindings.cpp:222

static SymbolDependenceMap toSymbolDependenceMap(LLVMOrcCDependenceMapPairs Pairs, size_t NumPairs)

Definition OrcV2CBindings.cpp:175

static LookupKind toLookupKind(LLVMOrcLookupKind K)

Definition OrcV2CBindings.cpp:190

static SymbolLookupFlags toSymbolLookupFlags(LLVMOrcSymbolLookupFlags SLF)

Definition OrcV2CBindings.cpp:232

static LLVMJITSymbolFlags fromJITSymbolFlags(JITSymbolFlags JSF)

Definition OrcV2CBindings.cpp:140

std::vector< std::pair< JITDylib *, JITDylibLookupFlags > > JITDylibSearchOrder

A list of (JITDylib*, JITDylibLookupFlags) pairs to be used as a search order during symbol lookup.

IntrusiveRefCntPtr< ResourceTracker > ResourceTrackerSP

std::unique_ptr< AbsoluteSymbolsMaterializationUnit > absoluteSymbols(SymbolMap Symbols)

Create an AbsoluteSymbolsMaterializationUnit with the given symbols.

SymbolLookupFlags

Lookup flags that apply to each symbol in a lookup.

JITDylibLookupFlags

Lookup flags that apply to each dylib in the search order for a lookup.

@ MatchExportedSymbolsOnly

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.

LLVM_ABI RegisterDependenciesFunction NoDependenciesToRegister

This can be used as the value for a RegisterDependenciesFunction if there are no dependants to regist...

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.

DenseMap< SymbolStringPtr, SymbolAliasMapEntry > SymbolAliasMap

A map of Symbols to (Symbol, Flags) pairs.

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)

Attribute unwrap(LLVMAttributeRef Attr)

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.

OutputIt move(R &&Range, OutputIt Out)

Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.

LLVMAttributeRef wrap(Attribute Attr)

Implement std::hash so that hash_code can be used in STL containers.

void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)

Implement std::swap in terms of BitVector swap.

Represents an evaluated symbol address and flags.

Represents the linkage flags for a symbol definition.

LLVMOrcCSymbolsList Names

A set of symbols that share dependencies.

Represents a pair of a symbol name and LLVMJITSymbolFlags.

Represents a pair of a symbol name and an evaluated symbol.

Represents a list of LLVMOrcSymbolStringPoolEntryRef and the associated length.

LLVMOrcSymbolStringPoolEntryRef * Symbols

A set of symbols and the their dependencies.