1 /*===---------------- llvm-c/Orc.h - OrcV2 C bindings -----------*- C++ -*-===*\
2 |*                                                                            *|
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
4 |* Exceptions.                                                                *|
5 |* See https://llvm.org/LICENSE.txt for license information.                  *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
7 |*                                                                            *|
8 |*===----------------------------------------------------------------------===*|
9 |*                                                                            *|
10 |* This header declares the C interface to libLLVMOrcJIT.a, which implements  *|
11 |* JIT compilation of LLVM IR. Minimal documentation of C API specific issues *|
12 |* (especially memory ownership rules) is provided. Core Orc concepts are     *|
13 |* documented in llvm/docs/ORCv2.rst and APIs are documented in the C++       *|
14 |* headers                                                                    *|
15 |*                                                                            *|
16 |* Many exotic languages can interoperate with C code but have a harder time  *|
17 |* with C++ due to name mangling. So in addition to C, this interface enables *|
18 |* tools written in such languages.                                           *|
19 |*                                                                            *|
20 |* Note: This interface is experimental. It is *NOT* stable, and may be       *|
21 |*       changed without warning. Only C API usage documentation is           *|
22 |*       provided. See the C++ documentation for all higher level ORC API     *|
23 |*       details.                                                             *|
24 |*                                                                            *|
25 \*===----------------------------------------------------------------------===*/
26 
27 #ifndef LLVM_C_ORC_H
28 #define LLVM_C_ORC_H
29 
30 #include "llvm-c/Error.h"
31 #include "llvm-c/TargetMachine.h"
32 #include "llvm-c/Types.h"
33 
34 LLVM_C_EXTERN_C_BEGIN
35 
36 /**
37  * Represents an address in the executor process.
38  */
39 typedef uint64_t LLVMOrcJITTargetAddress;
40 
41 /**
42  * Represents an address in the executor process.
43  */
44 typedef uint64_t LLVMOrcExecutorAddress;
45 
46 /**
47  * Represents generic linkage flags for a symbol definition.
48  */
49 typedef enum {
50   LLVMJITSymbolGenericFlagsExported = 1U << 0,
51   LLVMJITSymbolGenericFlagsWeak = 1U << 1,
52   LLVMJITSymbolGenericFlagsCallable = 1U << 2,
53   LLVMJITSymbolGenericFlagsMaterializationSideEffectsOnly = 1U << 3
54 } LLVMJITSymbolGenericFlags;
55 
56 /**
57  * Represents target specific flags for a symbol definition.
58  */
59 typedef uint8_t LLVMJITSymbolTargetFlags;
60 
61 /**
62  * Represents the linkage flags for a symbol definition.
63  */
64 typedef struct {
65   uint8_t GenericFlags;
66   uint8_t TargetFlags;
67 } LLVMJITSymbolFlags;
68 
69 /**
70  * Represents an evaluated symbol address and flags.
71  */
72 typedef struct {
73   LLVMOrcExecutorAddress Address;
74   LLVMJITSymbolFlags Flags;
75 } LLVMJITEvaluatedSymbol;
76 
77 /**
78  * A reference to an orc::ExecutionSession instance.
79  */
80 typedef struct LLVMOrcOpaqueExecutionSession *LLVMOrcExecutionSessionRef;
81 
82 /**
83  * Error reporter function.
84  */
85 typedef void (*LLVMOrcErrorReporterFunction)(void *Ctx, LLVMErrorRef Err);
86 
87 /**
88  * A reference to an orc::SymbolStringPool.
89  */
90 typedef struct LLVMOrcOpaqueSymbolStringPool *LLVMOrcSymbolStringPoolRef;
91 
92 /**
93  * A reference to an orc::SymbolStringPool table entry.
94  */
95 typedef struct LLVMOrcOpaqueSymbolStringPoolEntry
96     *LLVMOrcSymbolStringPoolEntryRef;
97 
98 /**
99  * Represents a pair of a symbol name and LLVMJITSymbolFlags.
100  */
101 typedef struct {
102   LLVMOrcSymbolStringPoolEntryRef Name;
103   LLVMJITSymbolFlags Flags;
104 } LLVMOrcCSymbolFlagsMapPair;
105 
106 /**
107  * Represents a list of (SymbolStringPtr, JITSymbolFlags) pairs that can be used
108  * to construct a SymbolFlagsMap.
109  */
110 typedef LLVMOrcCSymbolFlagsMapPair *LLVMOrcCSymbolFlagsMapPairs;
111 
112 /**
113  * Represents a pair of a symbol name and an evaluated symbol.
114  */
115 typedef struct {
116   LLVMOrcSymbolStringPoolEntryRef Name;
117   LLVMJITEvaluatedSymbol Sym;
118 } LLVMJITCSymbolMapPair;
119 
120 /**
121  * Represents a list of (SymbolStringPtr, JITEvaluatedSymbol) pairs that can be
122  * used to construct a SymbolMap.
123  */
124 typedef LLVMJITCSymbolMapPair *LLVMOrcCSymbolMapPairs;
125 
126 /**
127  * Represents a SymbolAliasMapEntry
128  */
129 typedef struct {
130   LLVMOrcSymbolStringPoolEntryRef Name;
131   LLVMJITSymbolFlags Flags;
132 } LLVMOrcCSymbolAliasMapEntry;
133 
134 /**
135  * Represents a pair of a symbol name and SymbolAliasMapEntry.
136  */
137 typedef struct {
138   LLVMOrcSymbolStringPoolEntryRef Name;
139   LLVMOrcCSymbolAliasMapEntry Entry;
140 } LLVMOrcCSymbolAliasMapPair;
141 
142 /**
143  * Represents a list of (SymbolStringPtr, (SymbolStringPtr, JITSymbolFlags))
144  * pairs that can be used to construct a SymbolFlagsMap.
145  */
146 typedef LLVMOrcCSymbolAliasMapPair *LLVMOrcCSymbolAliasMapPairs;
147 
148 /**
149  * A reference to an orc::JITDylib instance.
150  */
151 typedef struct LLVMOrcOpaqueJITDylib *LLVMOrcJITDylibRef;
152 
153 /**
154  * Represents a list of LLVMOrcSymbolStringPoolEntryRef and the associated
155  * length.
156  */
157 typedef struct {
158   LLVMOrcSymbolStringPoolEntryRef *Symbols;
159   size_t Length;
160 } LLVMOrcCSymbolsList;
161 
162 /**
163  * Represents a pair of a JITDylib and LLVMOrcCSymbolsList.
164  */
165 typedef struct {
166   LLVMOrcJITDylibRef JD;
167   LLVMOrcCSymbolsList Names;
168 } LLVMOrcCDependenceMapPair;
169 
170 /**
171  * Represents a list of (JITDylibRef, (LLVMOrcSymbolStringPoolEntryRef*,
172  * size_t)) pairs that can be used to construct a SymbolDependenceMap.
173  */
174 typedef LLVMOrcCDependenceMapPair *LLVMOrcCDependenceMapPairs;
175 
176 /**
177  * Lookup kind. This can be used by definition generators when deciding whether
178  * to produce a definition for a requested symbol.
179  *
180  * This enum should be kept in sync with llvm::orc::LookupKind.
181  */
182 typedef enum {
183   LLVMOrcLookupKindStatic,
184   LLVMOrcLookupKindDLSym
185 } LLVMOrcLookupKind;
186 
187 /**
188  * JITDylib lookup flags. This can be used by definition generators when
189  * deciding whether to produce a definition for a requested symbol.
190  *
191  * This enum should be kept in sync with llvm::orc::JITDylibLookupFlags.
192  */
193 typedef enum {
194   LLVMOrcJITDylibLookupFlagsMatchExportedSymbolsOnly,
195   LLVMOrcJITDylibLookupFlagsMatchAllSymbols
196 } LLVMOrcJITDylibLookupFlags;
197 
198 /**
199  * Symbol lookup flags for lookup sets. This should be kept in sync with
200  * llvm::orc::SymbolLookupFlags.
201  */
202 typedef enum {
203   LLVMOrcSymbolLookupFlagsRequiredSymbol,
204   LLVMOrcSymbolLookupFlagsWeaklyReferencedSymbol
205 } LLVMOrcSymbolLookupFlags;
206 
207 /**
208  * An element type for a symbol lookup set.
209  */
210 typedef struct {
211   LLVMOrcSymbolStringPoolEntryRef Name;
212   LLVMOrcSymbolLookupFlags LookupFlags;
213 } LLVMOrcCLookupSetElement;
214 
215 /**
216  * A set of symbols to look up / generate.
217  *
218  * The list is terminated with an element containing a null pointer for the
219  * Name field.
220  *
221  * If a client creates an instance of this type then they are responsible for
222  * freeing it, and for ensuring that all strings have been retained over the
223  * course of its life. Clients receiving a copy from a callback are not
224  * responsible for managing lifetime or retain counts.
225  */
226 typedef LLVMOrcCLookupSetElement *LLVMOrcCLookupSet;
227 
228 /**
229  * A reference to a uniquely owned orc::MaterializationUnit instance.
230  */
231 typedef struct LLVMOrcOpaqueMaterializationUnit *LLVMOrcMaterializationUnitRef;
232 
233 /**
234  * A reference to a uniquely owned orc::MaterializationResponsibility instance.
235  *
236  * Ownership must be passed to a lower-level layer in a JIT stack.
237  */
238 typedef struct LLVMOrcOpaqueMaterializationResponsibility
239     *LLVMOrcMaterializationResponsibilityRef;
240 
241 /**
242  * A MaterializationUnit materialize callback.
243  *
244  * Ownership of the Ctx and MR arguments passes to the callback which must
245  * adhere to the LLVMOrcMaterializationResponsibilityRef contract (see comment
246  * for that type).
247  *
248  * If this callback is called then the LLVMOrcMaterializationUnitDestroy
249  * callback will NOT be called.
250  */
251 typedef void (*LLVMOrcMaterializationUnitMaterializeFunction)(
252     void *Ctx, LLVMOrcMaterializationResponsibilityRef MR);
253 
254 /**
255  * A MaterializationUnit discard callback.
256  *
257  * Ownership of JD and Symbol remain with the caller: These arguments should
258  * not be disposed of or released.
259  */
260 typedef void (*LLVMOrcMaterializationUnitDiscardFunction)(
261     void *Ctx, LLVMOrcJITDylibRef JD, LLVMOrcSymbolStringPoolEntryRef Symbol);
262 
263 /**
264  * A MaterializationUnit destruction callback.
265  *
266  * If a custom MaterializationUnit is destroyed before its Materialize
267  * function is called then this function will be called to provide an
268  * opportunity for the underlying program representation to be destroyed.
269  */
270 typedef void (*LLVMOrcMaterializationUnitDestroyFunction)(void *Ctx);
271 
272 /**
273  * A reference to an orc::ResourceTracker instance.
274  */
275 typedef struct LLVMOrcOpaqueResourceTracker *LLVMOrcResourceTrackerRef;
276 
277 /**
278  * A reference to an orc::DefinitionGenerator.
279  */
280 typedef struct LLVMOrcOpaqueDefinitionGenerator
281     *LLVMOrcDefinitionGeneratorRef;
282 
283 /**
284  * An opaque lookup state object. Instances of this type can be captured to
285  * suspend a lookup while a custom generator function attempts to produce a
286  * definition.
287  *
288  * If a client captures a lookup state object then they must eventually call
289  * LLVMOrcLookupStateContinueLookup to restart the lookup. This is required
290  * in order to release memory allocated for the lookup state, even if errors
291  * have occurred while the lookup was suspended (if these errors have made the
292  * lookup impossible to complete then it will issue its own error before
293  * destruction).
294  */
295 typedef struct LLVMOrcOpaqueLookupState *LLVMOrcLookupStateRef;
296 
297 /**
298  * A custom generator function. This can be used to create a custom generator
299  * object using LLVMOrcCreateCustomCAPIDefinitionGenerator. The resulting
300  * object can be attached to a JITDylib, via LLVMOrcJITDylibAddGenerator, to
301  * receive callbacks when lookups fail to match existing definitions.
302  *
303  * GeneratorObj will contain the address of the custom generator object.
304  *
305  * Ctx will contain the context object passed to
306  * LLVMOrcCreateCustomCAPIDefinitionGenerator.
307  *
308  * LookupState will contain a pointer to an LLVMOrcLookupStateRef object. This
309  * can optionally be modified to make the definition generation process
310  * asynchronous: If the LookupStateRef value is copied, and the original
311  * LLVMOrcLookupStateRef set to null, the lookup will be suspended. Once the
312  * asynchronous definition process has been completed clients must call
313  * LLVMOrcLookupStateContinueLookup to continue the lookup (this should be
314  * done unconditionally, even if errors have occurred in the mean time, to
315  * free the lookup state memory and notify the query object of the failures).
316  * If LookupState is captured this function must return LLVMErrorSuccess.
317  *
318  * The Kind argument can be inspected to determine the lookup kind (e.g.
319  * as-if-during-static-link, or as-if-during-dlsym).
320  *
321  * The JD argument specifies which JITDylib the definitions should be generated
322  * into.
323  *
324  * The JDLookupFlags argument can be inspected to determine whether the original
325  * lookup included non-exported symobls.
326  *
327  * Finally, the LookupSet argument contains the set of symbols that could not
328  * be found in JD already (the set of generation candidates).
329  */
330 typedef LLVMErrorRef (*LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction)(
331     LLVMOrcDefinitionGeneratorRef GeneratorObj, void *Ctx,
332     LLVMOrcLookupStateRef *LookupState, LLVMOrcLookupKind Kind,
333     LLVMOrcJITDylibRef JD, LLVMOrcJITDylibLookupFlags JDLookupFlags,
334     LLVMOrcCLookupSet LookupSet, size_t LookupSetSize);
335 
336 /**
337  * Predicate function for SymbolStringPoolEntries.
338  */
339 typedef int (*LLVMOrcSymbolPredicate)(void *Ctx,
340                                       LLVMOrcSymbolStringPoolEntryRef Sym);
341 
342 /**
343  * A reference to an orc::ThreadSafeContext instance.
344  */
345 typedef struct LLVMOrcOpaqueThreadSafeContext *LLVMOrcThreadSafeContextRef;
346 
347 /**
348  * A reference to an orc::ThreadSafeModule instance.
349  */
350 typedef struct LLVMOrcOpaqueThreadSafeModule *LLVMOrcThreadSafeModuleRef;
351 
352 /**
353  * A function for inspecting/mutating IR modules, suitable for use with
354  * LLVMOrcThreadSafeModuleWithModuleDo.
355  */
356 typedef LLVMErrorRef (*LLVMOrcGenericIRModuleOperationFunction)(
357     void *Ctx, LLVMModuleRef M);
358 
359 /**
360  * A reference to an orc::JITTargetMachineBuilder instance.
361  */
362 typedef struct LLVMOrcOpaqueJITTargetMachineBuilder
363     *LLVMOrcJITTargetMachineBuilderRef;
364 
365 /**
366  * A reference to an orc::ObjectLayer instance.
367  */
368 typedef struct LLVMOrcOpaqueObjectLayer *LLVMOrcObjectLayerRef;
369 
370 /**
371  * A reference to an orc::ObjectLinkingLayer instance.
372  */
373 typedef struct LLVMOrcOpaqueObjectLinkingLayer *LLVMOrcObjectLinkingLayerRef;
374 
375 /**
376  * A reference to an orc::IRTransformLayer instance.
377  */
378 typedef struct LLVMOrcOpaqueIRTransformLayer *LLVMOrcIRTransformLayerRef;
379 
380 /**
381  * A function for applying transformations as part of an transform layer.
382  *
383  * Implementations of this type are responsible for managing the lifetime
384  * of the Module pointed to by ModInOut: If the LLVMModuleRef value is
385  * overwritten then the function is responsible for disposing of the incoming
386  * module. If the module is simply accessed/mutated in-place then ownership
387  * returns to the caller and the function does not need to do any lifetime
388  * management.
389  *
390  * Clients can call LLVMOrcLLJITGetIRTransformLayer to obtain the transform
391  * layer of a LLJIT instance, and use LLVMOrcIRTransformLayerSetTransform
392  * to set the function. This can be used to override the default transform
393  * layer.
394  */
395 typedef LLVMErrorRef (*LLVMOrcIRTransformLayerTransformFunction)(
396     void *Ctx, LLVMOrcThreadSafeModuleRef *ModInOut,
397     LLVMOrcMaterializationResponsibilityRef MR);
398 
399 /**
400  * A reference to an orc::ObjectTransformLayer instance.
401  */
402 typedef struct LLVMOrcOpaqueObjectTransformLayer
403     *LLVMOrcObjectTransformLayerRef;
404 
405 /**
406  * A function for applying transformations to an object file buffer.
407  *
408  * Implementations of this type are responsible for managing the lifetime
409  * of the memory buffer pointed to by ObjInOut: If the LLVMMemoryBufferRef
410  * value is overwritten then the function is responsible for disposing of the
411  * incoming buffer. If the buffer is simply accessed/mutated in-place then
412  * ownership returns to the caller and the function does not need to do any
413  * lifetime management.
414  *
415  * The transform is allowed to return an error, in which case the ObjInOut
416  * buffer should be disposed of and set to null.
417  */
418 typedef LLVMErrorRef (*LLVMOrcObjectTransformLayerTransformFunction)(
419     void *Ctx, LLVMMemoryBufferRef *ObjInOut);
420 
421 /**
422  * A reference to an orc::IndirectStubsManager instance.
423  */
424 typedef struct LLVMOrcOpaqueIndirectStubsManager
425     *LLVMOrcIndirectStubsManagerRef;
426 
427 /**
428  * A reference to an orc::LazyCallThroughManager instance.
429  */
430 typedef struct LLVMOrcOpaqueLazyCallThroughManager
431     *LLVMOrcLazyCallThroughManagerRef;
432 
433 /**
434  * A reference to an orc::DumpObjects object.
435  *
436  * Can be used to dump object files to disk with unique names. Useful as an
437  * ObjectTransformLayer transform.
438  */
439 typedef struct LLVMOrcOpaqueDumpObjects *LLVMOrcDumpObjectsRef;
440 
441 /**
442  * Attach a custom error reporter function to the ExecutionSession.
443  *
444  * The error reporter will be called to deliver failure notices that can not be
445  * directly reported to a caller. For example, failure to resolve symbols in
446  * the JIT linker is typically reported via the error reporter (callers
447  * requesting definitions from the JIT will typically be delivered a
448  * FailureToMaterialize error instead).
449  */
450 void LLVMOrcExecutionSessionSetErrorReporter(
451     LLVMOrcExecutionSessionRef ES, LLVMOrcErrorReporterFunction ReportError,
452     void *Ctx);
453 
454 /**
455  * Return a reference to the SymbolStringPool for an ExecutionSession.
456  *
457  * Ownership of the pool remains with the ExecutionSession: The caller is
458  * not required to free the pool.
459  */
460 LLVMOrcSymbolStringPoolRef
461 LLVMOrcExecutionSessionGetSymbolStringPool(LLVMOrcExecutionSessionRef ES);
462 
463 /**
464  * Clear all unreferenced symbol string pool entries.
465  *
466  * This can be called at any time to release unused entries in the
467  * ExecutionSession's string pool. Since it locks the pool (preventing
468  * interning of any new strings) it is recommended that it only be called
469  * infrequently, ideally when the caller has reason to believe that some
470  * entries will have become unreferenced, e.g. after removing a module or
471  * closing a JITDylib.
472  */
473 void LLVMOrcSymbolStringPoolClearDeadEntries(LLVMOrcSymbolStringPoolRef SSP);
474 
475 /**
476  * Intern a string in the ExecutionSession's SymbolStringPool and return a
477  * reference to it. This increments the ref-count of the pool entry, and the
478  * returned value should be released once the client is done with it by
479  * calling LLVMOrReleaseSymbolStringPoolEntry.
480  *
481  * Since strings are uniqued within the SymbolStringPool
482  * LLVMOrcSymbolStringPoolEntryRefs can be compared by value to test string
483  * equality.
484  *
485  * Note that this function does not perform linker-mangling on the string.
486  */
487 LLVMOrcSymbolStringPoolEntryRef
488 LLVMOrcExecutionSessionIntern(LLVMOrcExecutionSessionRef ES, const char *Name);
489 
490 /**
491  * Increments the ref-count for a SymbolStringPool entry.
492  */
493 void LLVMOrcRetainSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S);
494 
495 /**
496  * Reduces the ref-count for of a SymbolStringPool entry.
497  */
498 void LLVMOrcReleaseSymbolStringPoolEntry(LLVMOrcSymbolStringPoolEntryRef S);
499 
500 const char *LLVMOrcSymbolStringPoolEntryStr(LLVMOrcSymbolStringPoolEntryRef S);
501 
502 /**
503  * Reduces the ref-count of a ResourceTracker.
504  */
505 void LLVMOrcReleaseResourceTracker(LLVMOrcResourceTrackerRef RT);
506 
507 /**
508  * Transfers tracking of all resources associated with resource tracker SrcRT
509  * to resource tracker DstRT.
510  */
511 void LLVMOrcResourceTrackerTransferTo(LLVMOrcResourceTrackerRef SrcRT,
512                                       LLVMOrcResourceTrackerRef DstRT);
513 
514 /**
515  * Remove all resources associated with the given tracker. See
516  * ResourceTracker::remove().
517  */
518 LLVMErrorRef LLVMOrcResourceTrackerRemove(LLVMOrcResourceTrackerRef RT);
519 
520 /**
521  * Dispose of a JITDylib::DefinitionGenerator. This should only be called if
522  * ownership has not been passed to a JITDylib (e.g. because some error
523  * prevented the client from calling LLVMOrcJITDylibAddGenerator).
524  */
525 void LLVMOrcDisposeDefinitionGenerator(LLVMOrcDefinitionGeneratorRef DG);
526 
527 /**
528  * Dispose of a MaterializationUnit.
529  */
530 void LLVMOrcDisposeMaterializationUnit(LLVMOrcMaterializationUnitRef MU);
531 
532 /**
533  * Create a custom MaterializationUnit.
534  *
535  * Name is a name for this MaterializationUnit to be used for identification
536  * and logging purposes (e.g. if this MaterializationUnit produces an
537  * object buffer then the name of that buffer will be derived from this name).
538  *
539  * The Syms list contains the names and linkages of the symbols provided by this
540  * unit. This function takes ownership of the elements of the Syms array. The
541  * Name fields of the array elements are taken to have been retained for this
542  * function. The client should *not* release the elements of the array, but is
543  * still responsible for destroyingthe array itself.
544  *
545  * The InitSym argument indicates whether or not this MaterializationUnit
546  * contains static initializers. If three are no static initializers (the common
547  * case) then this argument should be null. If there are static initializers
548  * then InitSym should be set to a unique name that also appears in the Syms
549  * list with the LLVMJITSymbolGenericFlagsMaterializationSideEffectsOnly flag
550  * set. This function takes ownership of the InitSym, which should have been
551  * retained twice on behalf of this function: once for the Syms entry and once
552  * for InitSym. If clients wish to use the InitSym value after this function
553  * returns they must retain it once more for themselves.
554  *
555  * If any of the symbols in the Syms list is looked up then the Materialize
556  * function will be called.
557  *
558  * If any of the symbols in the Syms list is overridden then the Discard
559  * function will be called.
560  *
561  * The caller owns the underling MaterializationUnit and is responsible for
562  * either passing it to a JITDylib (via LLVMOrcJITDylibDefine) or disposing
563  * of it by calling LLVMOrcDisposeMaterializationUnit.
564  */
565 LLVMOrcMaterializationUnitRef LLVMOrcCreateCustomMaterializationUnit(
566     const char *Name, void *Ctx, LLVMOrcCSymbolFlagsMapPairs Syms,
567     size_t NumSyms, LLVMOrcSymbolStringPoolEntryRef InitSym,
568     LLVMOrcMaterializationUnitMaterializeFunction Materialize,
569     LLVMOrcMaterializationUnitDiscardFunction Discard,
570     LLVMOrcMaterializationUnitDestroyFunction Destroy);
571 
572 /**
573  * Create a MaterializationUnit to define the given symbols as pointing to
574  * the corresponding raw addresses.
575  *
576  * This function takes ownership of the elements of the Syms array. The Name
577  * fields of the array elements are taken to have been retained for this
578  * function. This allows the following pattern...
579  *
580  *   size_t NumPairs;
581  *   LLVMOrcCSymbolMapPairs Sym;
582  *   -- Build Syms array --
583  *   LLVMOrcMaterializationUnitRef MU =
584  *       LLVMOrcAbsoluteSymbols(Syms, NumPairs);
585  *
586  * ... without requiring cleanup of the elements of the Sym array afterwards.
587  *
588  * The client is still responsible for deleting the Sym array itself.
589  *
590  * If a client wishes to reuse elements of the Sym array after this call they
591  * must explicitly retain each of the elements for themselves.
592  */
593 LLVMOrcMaterializationUnitRef
594 LLVMOrcAbsoluteSymbols(LLVMOrcCSymbolMapPairs Syms, size_t NumPairs);
595 
596 /**
597  * Create a MaterializationUnit to define lazy re-expots. These are callable
598  * entry points that call through to the given symbols.
599  *
600  * This function takes ownership of the CallableAliases array. The Name
601  * fields of the array elements are taken to have been retained for this
602  * function. This allows the following pattern...
603  *
604  *   size_t NumPairs;
605  *   LLVMOrcCSymbolAliasMapPairs CallableAliases;
606  *   -- Build CallableAliases array --
607  *   LLVMOrcMaterializationUnitRef MU =
608  *      LLVMOrcLazyReexports(LCTM, ISM, JD, CallableAliases, NumPairs);
609  *
610  * ... without requiring cleanup of the elements of the CallableAliases array afterwards.
611  *
612  * The client is still responsible for deleting the CallableAliases array itself.
613  *
614  * If a client wishes to reuse elements of the CallableAliases array after this call they
615  * must explicitly retain each of the elements for themselves.
616  */
617 LLVMOrcMaterializationUnitRef LLVMOrcLazyReexports(
618     LLVMOrcLazyCallThroughManagerRef LCTM, LLVMOrcIndirectStubsManagerRef ISM,
619     LLVMOrcJITDylibRef SourceRef, LLVMOrcCSymbolAliasMapPairs CallableAliases,
620     size_t NumPairs);
621 // TODO: ImplSymbolMad SrcJDLoc
622 
623 /**
624  * Disposes of the passed MaterializationResponsibility object.
625  *
626  * This should only be done after the symbols covered by the object have either
627  * been resolved and emitted (via
628  * LLVMOrcMaterializationResponsibilityNotifyResolved and
629  * LLVMOrcMaterializationResponsibilityNotifyEmitted) or failed (via
630  * LLVMOrcMaterializationResponsibilityFailMaterialization).
631  */
632 void LLVMOrcDisposeMaterializationResponsibility(
633     LLVMOrcMaterializationResponsibilityRef MR);
634 
635 /**
636  * Returns the target JITDylib that these symbols are being materialized into.
637  */
638 LLVMOrcJITDylibRef LLVMOrcMaterializationResponsibilityGetTargetDylib(
639     LLVMOrcMaterializationResponsibilityRef MR);
640 
641 /**
642  * Returns the ExecutionSession for this MaterializationResponsibility.
643  */
644 LLVMOrcExecutionSessionRef
645 LLVMOrcMaterializationResponsibilityGetExecutionSession(
646     LLVMOrcMaterializationResponsibilityRef MR);
647 
648 /**
649  * Returns the symbol flags map for this responsibility instance.
650  *
651  * The length of the array is returned in NumPairs and the caller is responsible
652  * for the returned memory and needs to call LLVMOrcDisposeCSymbolFlagsMap.
653  *
654  * To use the returned symbols beyond the livetime of the
655  * MaterializationResponsibility requires the caller to retain the symbols
656  * explicitly.
657  */
658 LLVMOrcCSymbolFlagsMapPairs LLVMOrcMaterializationResponsibilityGetSymbols(
659     LLVMOrcMaterializationResponsibilityRef MR, size_t *NumPairs);
660 
661 /**
662  * Disposes of the passed LLVMOrcCSymbolFlagsMap.
663  *
664  * Does not release the entries themselves.
665  */
666 void LLVMOrcDisposeCSymbolFlagsMap(LLVMOrcCSymbolFlagsMapPairs Pairs);
667 
668 /**
669  * Returns the initialization pseudo-symbol, if any. This symbol will also
670  * be present in the SymbolFlagsMap for this MaterializationResponsibility
671  * object.
672  *
673  * The returned symbol is not retained over any mutating operation of the
674  * MaterializationResponsbility or beyond the lifetime thereof.
675  */
676 LLVMOrcSymbolStringPoolEntryRef
677 LLVMOrcMaterializationResponsibilityGetInitializerSymbol(
678     LLVMOrcMaterializationResponsibilityRef MR);
679 
680 /**
681  * Returns the names of any symbols covered by this
682  * MaterializationResponsibility object that have queries pending. This
683  * information can be used to return responsibility for unrequested symbols
684  * back to the JITDylib via the delegate method.
685  */
686 LLVMOrcSymbolStringPoolEntryRef *
687 LLVMOrcMaterializationResponsibilityGetRequestedSymbols(
688     LLVMOrcMaterializationResponsibilityRef MR, size_t *NumSymbols);
689 
690 /**
691  * Disposes of the passed LLVMOrcSymbolStringPoolEntryRef* .
692  *
693  * Does not release the symbols themselves.
694  */
695 void LLVMOrcDisposeSymbols(LLVMOrcSymbolStringPoolEntryRef *Symbols);
696 
697 /*
698  * Notifies the target JITDylib that the given symbols have been resolved.
699  * This will update the given symbols' addresses in the JITDylib, and notify
700  * any pending queries on the given symbols of their resolution. The given
701  * symbols must be ones covered by this MaterializationResponsibility
702  * instance. Individual calls to this method may resolve a subset of the
703  * symbols, but all symbols must have been resolved prior to calling emit.
704  *
705  * This method will return an error if any symbols being resolved have been
706  * moved to the error state due to the failure of a dependency. If this
707  * method returns an error then clients should log it and call
708  * LLVMOrcMaterializationResponsibilityFailMaterialization. If no dependencies
709  * have been registered for the symbols covered by this
710  * MaterializationResponsibiility then this method is guaranteed to return
711  * LLVMErrorSuccess.
712  */
713 LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyResolved(
714     LLVMOrcMaterializationResponsibilityRef MR, LLVMOrcCSymbolMapPairs Symbols,
715     size_t NumPairs);
716 
717 /**
718  * Notifies the target JITDylib (and any pending queries on that JITDylib)
719  * that all symbols covered by this MaterializationResponsibility instance
720  * have been emitted.
721  *
722  * This method will return an error if any symbols being resolved have been
723  * moved to the error state due to the failure of a dependency. If this
724  * method returns an error then clients should log it and call
725  * LLVMOrcMaterializationResponsibilityFailMaterialization.
726  * If no dependencies have been registered for the symbols covered by this
727  * MaterializationResponsibiility then this method is guaranteed to return
728  * LLVMErrorSuccess.
729  */
730 LLVMErrorRef LLVMOrcMaterializationResponsibilityNotifyEmitted(
731     LLVMOrcMaterializationResponsibilityRef MR);
732 
733 /**
734  * Attempt to claim responsibility for new definitions. This method can be
735  * used to claim responsibility for symbols that are added to a
736  * materialization unit during the compilation process (e.g. literal pool
737  * symbols). Symbol linkage rules are the same as for symbols that are
738  * defined up front: duplicate strong definitions will result in errors.
739  * Duplicate weak definitions will be discarded (in which case they will
740  * not be added to this responsibility instance).
741  *
742  * This method can be used by materialization units that want to add
743  * additional symbols at materialization time (e.g. stubs, compile
744  * callbacks, metadata)
745  */
746 LLVMErrorRef LLVMOrcMaterializationResponsibilityDefineMaterializing(
747     LLVMOrcMaterializationResponsibilityRef MR,
748     LLVMOrcCSymbolFlagsMapPairs Pairs, size_t NumPairs);
749 
750 /**
751  * Notify all not-yet-emitted covered by this MaterializationResponsibility
752  * instance that an error has occurred.
753  * This will remove all symbols covered by this MaterializationResponsibilty
754  * from the target JITDylib, and send an error to any queries waiting on
755  * these symbols.
756  */
757 void LLVMOrcMaterializationResponsibilityFailMaterialization(
758     LLVMOrcMaterializationResponsibilityRef MR);
759 
760 /**
761  * Transfers responsibility to the given MaterializationUnit for all
762  * symbols defined by that MaterializationUnit. This allows
763  * materializers to break up work based on run-time information (e.g.
764  * by introspecting which symbols have actually been looked up and
765  * materializing only those).
766  */
767 LLVMErrorRef LLVMOrcMaterializationResponsibilityReplace(
768     LLVMOrcMaterializationResponsibilityRef MR,
769     LLVMOrcMaterializationUnitRef MU);
770 
771 /**
772  * Delegates responsibility for the given symbols to the returned
773  * materialization responsibility. Useful for breaking up work between
774  * threads, or different kinds of materialization processes.
775  *
776  * The caller retains responsibility of the the passed
777  * MaterializationResponsibility.
778  */
779 LLVMErrorRef LLVMOrcMaterializationResponsibilityDelegate(
780     LLVMOrcMaterializationResponsibilityRef MR,
781     LLVMOrcSymbolStringPoolEntryRef *Symbols, size_t NumSymbols,
782     LLVMOrcMaterializationResponsibilityRef *Result);
783 
784 /**
785  * Adds dependencies to a symbol that the MaterializationResponsibility is
786  * responsible for.
787  *
788  * This function takes ownership of Dependencies struct. The Names
789  * array have been retained for this function. This allows the following
790  * pattern...
791  *
792  *   LLVMOrcSymbolStringPoolEntryRef Names[] = {...};
793  *   LLVMOrcCDependenceMapPair Dependence = {JD, {Names, sizeof(Names)}}
794  *   LLVMOrcMaterializationResponsibilityAddDependencies(JD, Name, &Dependence,
795  * 1);
796  *
797  * ... without requiring cleanup of the elements of the Names array afterwards.
798  *
799  * The client is still responsible for deleting the Dependencies.Names array
800  * itself.
801  */
802 void LLVMOrcMaterializationResponsibilityAddDependencies(
803     LLVMOrcMaterializationResponsibilityRef MR,
804     LLVMOrcSymbolStringPoolEntryRef Name,
805     LLVMOrcCDependenceMapPairs Dependencies, size_t NumPairs);
806 
807 /**
808  * Adds dependencies to all symbols that the MaterializationResponsibility is
809  * responsible for. See LLVMOrcMaterializationResponsibilityAddDependencies for
810  * notes about memory responsibility.
811  */
812 void LLVMOrcMaterializationResponsibilityAddDependenciesForAll(
813     LLVMOrcMaterializationResponsibilityRef MR,
814     LLVMOrcCDependenceMapPairs Dependencies, size_t NumPairs);
815 
816 /**
817  * Create a "bare" JITDylib.
818  *
819  * The client is responsible for ensuring that the JITDylib's name is unique,
820  * e.g. by calling LLVMOrcExecutionSessionGetJTIDylibByName first.
821  *
822  * This call does not install any library code or symbols into the newly
823  * created JITDylib. The client is responsible for all configuration.
824  */
825 LLVMOrcJITDylibRef
826 LLVMOrcExecutionSessionCreateBareJITDylib(LLVMOrcExecutionSessionRef ES,
827                                           const char *Name);
828 
829 /**
830  * Create a JITDylib.
831  *
832  * The client is responsible for ensuring that the JITDylib's name is unique,
833  * e.g. by calling LLVMOrcExecutionSessionGetJTIDylibByName first.
834  *
835  * If a Platform is attached to the ExecutionSession then
836  * Platform::setupJITDylib will be called to install standard platform symbols
837  * (e.g. standard library interposes). If no Platform is installed then this
838  * call is equivalent to LLVMExecutionSessionRefCreateBareJITDylib and will
839  * always return success.
840  */
841 LLVMErrorRef
842 LLVMOrcExecutionSessionCreateJITDylib(LLVMOrcExecutionSessionRef ES,
843                                       LLVMOrcJITDylibRef *Result,
844                                       const char *Name);
845 
846 /**
847  * Returns the JITDylib with the given name, or NULL if no such JITDylib
848  * exists.
849  */
850 LLVMOrcJITDylibRef
851 LLVMOrcExecutionSessionGetJITDylibByName(LLVMOrcExecutionSessionRef ES,
852                                          const char *Name);
853 
854 /**
855  * Return a reference to a newly created resource tracker associated with JD.
856  * The tracker is returned with an initial ref-count of 1, and must be released
857  * with LLVMOrcReleaseResourceTracker when no longer needed.
858  */
859 LLVMOrcResourceTrackerRef
860 LLVMOrcJITDylibCreateResourceTracker(LLVMOrcJITDylibRef JD);
861 
862 /**
863  * Return a reference to the default resource tracker for the given JITDylib.
864  * This operation will increase the retain count of the tracker: Clients should
865  * call LLVMOrcReleaseResourceTracker when the result is no longer needed.
866  */
867 LLVMOrcResourceTrackerRef
868 LLVMOrcJITDylibGetDefaultResourceTracker(LLVMOrcJITDylibRef JD);
869 
870 /**
871  * Add the given MaterializationUnit to the given JITDylib.
872  *
873  * If this operation succeeds then JITDylib JD will take ownership of MU.
874  * If the operation fails then ownership remains with the caller who should
875  * call LLVMOrcDisposeMaterializationUnit to destroy it.
876  */
877 LLVMErrorRef LLVMOrcJITDylibDefine(LLVMOrcJITDylibRef JD,
878                                    LLVMOrcMaterializationUnitRef MU);
879 
880 /**
881  * Calls remove on all trackers associated with this JITDylib, see
882  * JITDylib::clear().
883  */
884 LLVMErrorRef LLVMOrcJITDylibClear(LLVMOrcJITDylibRef JD);
885 
886 /**
887  * Add a DefinitionGenerator to the given JITDylib.
888  *
889  * The JITDylib will take ownership of the given generator: The client is no
890  * longer responsible for managing its memory.
891  */
892 void LLVMOrcJITDylibAddGenerator(LLVMOrcJITDylibRef JD,
893                                  LLVMOrcDefinitionGeneratorRef DG);
894 
895 /**
896  * Create a custom generator.
897  */
898 LLVMOrcDefinitionGeneratorRef LLVMOrcCreateCustomCAPIDefinitionGenerator(
899     LLVMOrcCAPIDefinitionGeneratorTryToGenerateFunction F, void *Ctx);
900 
901 /**
902  * Get a DynamicLibrarySearchGenerator that will reflect process symbols into
903  * the JITDylib. On success the resulting generator is owned by the client.
904  * Ownership is typically transferred by adding the instance to a JITDylib
905  * using LLVMOrcJITDylibAddGenerator,
906  *
907  * The GlobalPrefix argument specifies the character that appears on the front
908  * of linker-mangled symbols for the target platform (e.g. '_' on MachO).
909  * If non-null, this character will be stripped from the start of all symbol
910  * strings before passing the remaining substring to dlsym.
911  *
912  * The optional Filter and Ctx arguments can be used to supply a symbol name
913  * filter: Only symbols for which the filter returns true will be visible to
914  * JIT'd code. If the Filter argument is null then all process symbols will
915  * be visible to JIT'd code. Note that the symbol name passed to the Filter
916  * function is the full mangled symbol: The client is responsible for stripping
917  * the global prefix if present.
918  */
919 LLVMErrorRef LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(
920     LLVMOrcDefinitionGeneratorRef *Result, char GlobalPrefx,
921     LLVMOrcSymbolPredicate Filter, void *FilterCtx);
922 
923 /**
924  * Create a ThreadSafeContext containing a new LLVMContext.
925  *
926  * Ownership of the underlying ThreadSafeContext data is shared: Clients
927  * can and should dispose of their ThreadSafeContext as soon as they no longer
928  * need to refer to it directly. Other references (e.g. from ThreadSafeModules)
929  * will keep the data alive as long as it is needed.
930  */
931 LLVMOrcThreadSafeContextRef LLVMOrcCreateNewThreadSafeContext(void);
932 
933 /**
934  * Get a reference to the wrapped LLVMContext.
935  */
936 LLVMContextRef
937 LLVMOrcThreadSafeContextGetContext(LLVMOrcThreadSafeContextRef TSCtx);
938 
939 /**
940  * Dispose of a ThreadSafeContext.
941  */
942 void LLVMOrcDisposeThreadSafeContext(LLVMOrcThreadSafeContextRef TSCtx);
943 
944 /**
945  * Create a ThreadSafeModule wrapper around the given LLVM module. This takes
946  * ownership of the M argument which should not be disposed of or referenced
947  * after this function returns.
948  *
949  * Ownership of the ThreadSafeModule is unique: If it is transferred to the JIT
950  * (e.g. by LLVMOrcLLJITAddLLVMIRModule) then the client is no longer
951  * responsible for it. If it is not transferred to the JIT then the client
952  * should call LLVMOrcDisposeThreadSafeModule to dispose of it.
953  */
954 LLVMOrcThreadSafeModuleRef
955 LLVMOrcCreateNewThreadSafeModule(LLVMModuleRef M,
956                                  LLVMOrcThreadSafeContextRef TSCtx);
957 
958 /**
959  * Dispose of a ThreadSafeModule. This should only be called if ownership has
960  * not been passed to LLJIT (e.g. because some error prevented the client from
961  * adding this to the JIT).
962  */
963 void LLVMOrcDisposeThreadSafeModule(LLVMOrcThreadSafeModuleRef TSM);
964 
965 /**
966  * Apply the given function to the module contained in this ThreadSafeModule.
967  */
968 LLVMErrorRef
969 LLVMOrcThreadSafeModuleWithModuleDo(LLVMOrcThreadSafeModuleRef TSM,
970                                     LLVMOrcGenericIRModuleOperationFunction F,
971                                     void *Ctx);
972 
973 /**
974  * Create a JITTargetMachineBuilder by detecting the host.
975  *
976  * On success the client owns the resulting JITTargetMachineBuilder. It must be
977  * passed to a consuming operation (e.g.
978  * LLVMOrcLLJITBuilderSetJITTargetMachineBuilder) or disposed of by calling
979  * LLVMOrcDisposeJITTargetMachineBuilder.
980  */
981 LLVMErrorRef LLVMOrcJITTargetMachineBuilderDetectHost(
982     LLVMOrcJITTargetMachineBuilderRef *Result);
983 
984 /**
985  * Create a JITTargetMachineBuilder from the given TargetMachine template.
986  *
987  * This operation takes ownership of the given TargetMachine and destroys it
988  * before returing. The resulting JITTargetMachineBuilder is owned by the client
989  * and must be passed to a consuming operation (e.g.
990  * LLVMOrcLLJITBuilderSetJITTargetMachineBuilder) or disposed of by calling
991  * LLVMOrcDisposeJITTargetMachineBuilder.
992  */
993 LLVMOrcJITTargetMachineBuilderRef
994 LLVMOrcJITTargetMachineBuilderCreateFromTargetMachine(LLVMTargetMachineRef TM);
995 
996 /**
997  * Dispose of a JITTargetMachineBuilder.
998  */
999 void LLVMOrcDisposeJITTargetMachineBuilder(
1000     LLVMOrcJITTargetMachineBuilderRef JTMB);
1001 
1002 /**
1003  * Returns the target triple for the given JITTargetMachineBuilder as a string.
1004  *
1005  * The caller owns the resulting string as must dispose of it by calling
1006  * LLVMDisposeMessage
1007  */
1008 char *LLVMOrcJITTargetMachineBuilderGetTargetTriple(
1009     LLVMOrcJITTargetMachineBuilderRef JTMB);
1010 
1011 /**
1012  * Sets the target triple for the given JITTargetMachineBuilder to the given
1013  * string.
1014  */
1015 void LLVMOrcJITTargetMachineBuilderSetTargetTriple(
1016     LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple);
1017 
1018 /**
1019  * Add an object to an ObjectLayer to the given JITDylib.
1020  *
1021  * Adds a buffer representing an object file to the given JITDylib using the
1022  * given ObjectLayer instance. This operation transfers ownership of the buffer
1023  * to the ObjectLayer instance. The buffer should not be disposed of or
1024  * referenced once this function returns.
1025  *
1026  * Resources associated with the given object will be tracked by the given
1027  * JITDylib's default ResourceTracker.
1028  */
1029 LLVMErrorRef LLVMOrcObjectLayerAddObjectFile(LLVMOrcObjectLayerRef ObjLayer,
1030                                              LLVMOrcJITDylibRef JD,
1031                                              LLVMMemoryBufferRef ObjBuffer);
1032 
1033 /**
1034  * Add an object to an ObjectLayer using the given ResourceTracker.
1035  *
1036  * Adds a buffer representing an object file to the given ResourceTracker's
1037  * JITDylib using the given ObjectLayer instance. This operation transfers
1038  * ownership of the buffer to the ObjectLayer instance. The buffer should not
1039  * be disposed of or referenced once this function returns.
1040  *
1041  * Resources associated with the given object will be tracked by
1042  * ResourceTracker RT.
1043  */
1044 LLVMErrorRef
1045 LLVMOrcObjectLayerAddObjectFileWithRT(LLVMOrcObjectLayerRef ObjLayer,
1046                                       LLVMOrcResourceTrackerRef RT,
1047                                       LLVMMemoryBufferRef ObjBuffer);
1048 
1049 /**
1050  * Emit an object buffer to an ObjectLayer.
1051  *
1052  * Ownership of the responsibility object and object buffer pass to this
1053  * function. The client is not responsible for cleanup.
1054  */
1055 void LLVMOrcObjectLayerEmit(LLVMOrcObjectLayerRef ObjLayer,
1056                             LLVMOrcMaterializationResponsibilityRef R,
1057                             LLVMMemoryBufferRef ObjBuffer);
1058 
1059 /**
1060  * Dispose of an ObjectLayer.
1061  */
1062 void LLVMOrcDisposeObjectLayer(LLVMOrcObjectLayerRef ObjLayer);
1063 
1064 void LLVMOrcIRTransformLayerEmit(LLVMOrcIRTransformLayerRef IRTransformLayer,
1065                                  LLVMOrcMaterializationResponsibilityRef MR,
1066                                  LLVMOrcThreadSafeModuleRef TSM);
1067 
1068 /**
1069  * Set the transform function of the provided transform layer, passing through a
1070  * pointer to user provided context.
1071  */
1072 void LLVMOrcIRTransformLayerSetTransform(
1073     LLVMOrcIRTransformLayerRef IRTransformLayer,
1074     LLVMOrcIRTransformLayerTransformFunction TransformFunction, void *Ctx);
1075 
1076 /**
1077  * Set the transform function on an LLVMOrcObjectTransformLayer.
1078  */
1079 void LLVMOrcObjectTransformLayerSetTransform(
1080     LLVMOrcObjectTransformLayerRef ObjTransformLayer,
1081     LLVMOrcObjectTransformLayerTransformFunction TransformFunction, void *Ctx);
1082 
1083 /**
1084  * Create a LocalIndirectStubsManager from the given target triple.
1085  *
1086  * The resulting IndirectStubsManager is owned by the client
1087  * and must be disposed of by calling LLVMOrcDisposeDisposeIndirectStubsManager.
1088  */
1089 LLVMOrcIndirectStubsManagerRef
1090 LLVMOrcCreateLocalIndirectStubsManager(const char *TargetTriple);
1091 
1092 /**
1093  * Dispose of an IndirectStubsManager.
1094  */
1095 void LLVMOrcDisposeIndirectStubsManager(LLVMOrcIndirectStubsManagerRef ISM);
1096 
1097 LLVMErrorRef LLVMOrcCreateLocalLazyCallThroughManager(
1098     const char *TargetTriple, LLVMOrcExecutionSessionRef ES,
1099     LLVMOrcJITTargetAddress ErrorHandlerAddr,
1100     LLVMOrcLazyCallThroughManagerRef *LCTM);
1101 
1102 /**
1103  * Dispose of an LazyCallThroughManager.
1104  */
1105 void LLVMOrcDisposeLazyCallThroughManager(
1106     LLVMOrcLazyCallThroughManagerRef LCTM);
1107 
1108 /**
1109  * Create a DumpObjects instance.
1110  *
1111  * DumpDir specifies the path to write dumped objects to. DumpDir may be empty
1112  * in which case files will be dumped to the working directory.
1113  *
1114  * IdentifierOverride specifies a file name stem to use when dumping objects.
1115  * If empty then each MemoryBuffer's identifier will be used (with a .o suffix
1116  * added if not already present). If an identifier override is supplied it will
1117  * be used instead, along with an incrementing counter (since all buffers will
1118  * use the same identifier, the resulting files will be named <ident>.o,
1119  * <ident>.2.o, <ident>.3.o, and so on). IdentifierOverride should not contain
1120  * an extension, as a .o suffix will be added by DumpObjects.
1121  */
1122 LLVMOrcDumpObjectsRef LLVMOrcCreateDumpObjects(const char *DumpDir,
1123                                                const char *IdentifierOverride);
1124 
1125 /**
1126  * Dispose of a DumpObjects instance.
1127  */
1128 void LLVMOrcDisposeDumpObjects(LLVMOrcDumpObjectsRef DumpObjects);
1129 
1130 /**
1131  * Dump the contents of the given MemoryBuffer.
1132  */
1133 LLVMErrorRef LLVMOrcDumpObjects_CallOperator(LLVMOrcDumpObjectsRef DumpObjects,
1134                                              LLVMMemoryBufferRef *ObjBuffer);
1135 
1136 LLVM_C_EXTERN_C_END
1137 
1138 #endif /* LLVM_C_ORC_H */
1139