abla/llvm/orc

Generated from source.

Import with import "abla/llvm/orc".

Source: abla/llvm/orc/entry.ab

LLVMInitializeX86TargetInfo (extern)

noescape extern:"c" fun LLVMInitializeX86TargetInfo(): void

Registers the LLVM x86 target information.

LLVMInitializeX86Target (extern)

noescape extern:"c" fun LLVMInitializeX86Target(): void

Registers the LLVM x86 code generation target.

LLVMInitializeX86TargetMC (extern)

noescape extern:"c" fun LLVMInitializeX86TargetMC(): void

Registers the LLVM x86 machine-code layer.

LLVMInitializeX86AsmPrinter (extern)

noescape extern:"c" fun LLVMInitializeX86AsmPrinter(): void

Registers the LLVM x86 assembly printer.

LLVMInitializeX86AsmParser (extern)

noescape extern:"c" fun LLVMInitializeX86AsmParser(): void

Registers the LLVM x86 assembly parser.

LLVMInitializeAArch64TargetInfo (extern)

noescape extern:"c" fun LLVMInitializeAArch64TargetInfo(): void

Registers the LLVM AArch64 target information.

LLVMInitializeAArch64Target (extern)

noescape extern:"c" fun LLVMInitializeAArch64Target(): void

Registers the LLVM AArch64 code generation target.

LLVMInitializeAArch64TargetMC (extern)

noescape extern:"c" fun LLVMInitializeAArch64TargetMC(): void

Registers the LLVM AArch64 machine-code layer.

LLVMInitializeAArch64AsmPrinter (extern)

noescape extern:"c" fun LLVMInitializeAArch64AsmPrinter(): void

Registers the LLVM AArch64 assembly printer.

LLVMInitializeAArch64AsmParser (extern)

noescape extern:"c" fun LLVMInitializeAArch64AsmParser(): void

Registers the LLVM AArch64 assembly parser.

LLVMGetDefaultTargetTriple (extern)

noescape extern:"c" fun LLVMGetDefaultTargetTriple(): i64*

Returns an LLVM-owned string containing the default target triple.

LLVMGetVersion (extern)

noescape extern:"c" fun LLVMGetVersion(major: i64*, minor: i64*, patch: i64*): void

Writes the linked LLVM library's major, minor and patch version numbers.

LLVMContextCreate (extern)

noescape extern:"c" fun LLVMContextCreate(): i64*

Creates an LLVM context owned by the caller.

LLVMContextDispose (extern)

noescape extern:"c" fun LLVMContextDispose(context: i64*): void

Destroys the caller-owned LLVM context.

LLVMDisposeModule (extern)

noescape extern:"c" fun LLVMDisposeModule(module: i64*): void

Destroys an LLVM module still owned by the caller.

LLVMCreateMemoryBufferWithContentsOfFile (extern)

noescape extern:"c" fun LLVMCreateMemoryBufferWithContentsOfFile(
    path: cstring,
    outputBuffer: i64*,
    outputMessage: i64*
): i32

Loads a file into an LLVM buffer and returns zero on success or an owned diagnostic on failure.

LLVMCreateMemoryBufferWithMemoryRangeCopy (extern)

noescape extern:"c" fun LLVMCreateMemoryBufferWithMemoryRangeCopy(
    data: cstring,
    length: int,
    name: cstring
): i64*

Returns an LLVM buffer holding a copy of the supplied bytes and the given name.

LLVMDisposeMemoryBuffer (extern)

noescape extern:"c" fun LLVMDisposeMemoryBuffer(buffer: i64*): void

Destroys an LLVM buffer owned by the caller.

LLVMDisposeMessage (extern)

noescape extern:"c" fun LLVMDisposeMessage(message: i64*): void

Releases a message string allocated by LLVM.

LLVMCreatePassBuilderOptions (extern)

noescape extern:"c" fun LLVMCreatePassBuilderOptions(): i64*

Allocates default options for the LLVM pass builder.

LLVMDisposePassBuilderOptions (extern)

noescape extern:"c" fun LLVMDisposePassBuilderOptions(options: i64*): void

Frees the LLVM pass builder options.

LLVMRunPasses (extern)

noescape extern:"c" fun LLVMRunPasses(
    module: i64*,
    passes: cstring,
    machine: i64*,
    options: i64*
): i64*

Runs the named pass pipeline and returns a null error on success.

LLVMParseIRInContext (extern)

noescape extern:"c" fun LLVMParseIRInContext(
    context: i64*,
    buffer: i64*,
    outputModule: i64*,
    outputMessage: i64*
): i32

Parses IR in the supplied context, taking the buffer and returning zero on success or an owned diagnostic on failure.

LLVMOrcCreateNewThreadSafeContextFromLLVMContext (extern)

noescape extern:"c" fun LLVMOrcCreateNewThreadSafeContextFromLLVMContext(
    context: i64*
): i64*

Wraps the supplied LLVM context in a shared thread-safe context.

LLVMOrcDisposeThreadSafeContext (extern)

noescape extern:"c" fun LLVMOrcDisposeThreadSafeContext(context: i64*): void

Releases the caller's reference to the thread-safe context.

LLVMOrcCreateNewThreadSafeModule (extern)

noescape extern:"c" fun LLVMOrcCreateNewThreadSafeModule(
    module: i64*,
    context: i64*
): i64*

Wraps a module in a thread-safe context and transfers ownership of the module.

LLVMOrcDisposeThreadSafeModule (extern)

noescape extern:"c" fun LLVMOrcDisposeThreadSafeModule(module: i64*): void

Disposes a thread-safe module still owned by the caller.

LLVMOrcCreateLLJIT (extern)

noescape extern:"c" fun LLVMOrcCreateLLJIT(
    outputJit: i64*,
    builder: i64*
): i64*

Creates an LLJIT instance and returns a null error on success.

LLVMOrcDisposeLLJIT (extern)

noescape extern:"c" fun LLVMOrcDisposeLLJIT(jit: i64*): i64*

Destroys the JIT and its managed resources and returns a null error on success.

LLVMOrcLLJITGetMainJITDylib (extern)

noescape extern:"c" fun LLVMOrcLLJITGetMainJITDylib(jit: i64*): i64*

Returns the main dylib borrowed from the LLJIT instance.

LLVMOrcLLJITGetGlobalPrefix (extern)

noescape extern:"c" fun LLVMOrcLLJITGetGlobalPrefix(jit: i64*): i8

Returns the target's global symbol prefix character or zero for no prefix.

LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess (extern)

noescape extern:"c" fun LLVMOrcCreateDynamicLibrarySearchGeneratorForProcess(
    outputGenerator: i64*,
    globalPrefix: i8,
    filter: i64*,
    filterContext: i64*
): i64*

Creates a search generator for host process symbols and returns a null error on success.

LLVMOrcJITDylibAddGenerator (extern)

noescape extern:"c" fun LLVMOrcJITDylibAddGenerator(
    dylib: i64*,
    symbolGenerator: i64*
): void

Transfers the search generator to the JIT dylib for symbol resolution.

LLVMOrcLLJITAddLLVMIRModule (extern)

noescape extern:"c" fun LLVMOrcLLJITAddLLVMIRModule(
    jit: i64*,
    dylib: i64*,
    module: i64*
): i64*

Transfers a thread-safe module to the JIT dylib and returns a null error on success.

LLVMOrcJITDylibCreateResourceTracker (extern)

noescape extern:"c" fun LLVMOrcJITDylibCreateResourceTracker(
    dylib: i64*
): i64*

Returns a retained tracker for a group of resources in the dylib.

LLVMOrcReleaseResourceTracker (extern)

noescape extern:"c" fun LLVMOrcReleaseResourceTracker(tracker: i64*): void

Releases the caller's reference to an ORC tracker.

LLVMOrcResourceTrackerRemove (extern)

noescape extern:"c" fun LLVMOrcResourceTrackerRemove(tracker: i64*): i64*

Removes resources grouped under the tracker and returns a null error on success.

LLVMOrcLLJITAddLLVMIRModuleWithRT (extern)

noescape extern:"c" fun LLVMOrcLLJITAddLLVMIRModuleWithRT(
    jit: i64*,
    tracker: i64*,
    module: i64*
): i64*

Transfers a thread-safe module to the JIT under the specified tracker and returns a null error on success.

LLVMOrcLLJITLookup (extern)

noescape extern:"c" fun LLVMOrcLLJITLookup(
    jit: i64*,
    outputAddress: i64*,
    name: cstring
): i64*

Resolves an unmangled name in the main dylib, writing its address and returning a null error on success.

LLVMConsumeError (extern)

noescape extern:"c" fun LLVMConsumeError(error: i64*): void

Disposes a non-null LLVM error without reporting its message.

LLVMOrcLLJITAddObjectFileWithRT (extern)

noescape extern:"c" fun LLVMOrcLLJITAddObjectFileWithRT(
    jit: i64*,
    tracker: i64*,
    buffer: i64*
): i64*

Transfers an object buffer to the JIT under the specified tracker and returns a null error on success.

LLVMOrcLLJITGetObjTransformLayer (extern)

noescape extern:"c" fun LLVMOrcLLJITGetObjTransformLayer(jit: i64*): i64*

Returns the object transform layer borrowed from the LLJIT instance.

LLVMOrcObjectTransformLayerSetTransform (extern)

noescape extern:"c" fun LLVMOrcObjectTransformLayerSetTransform(
    layer: i64*,
    transform: int,
    context: i64*
): void

Installs a callback and its context for objects passing through the transform layer.

LLVMGetBufferStart (extern)

noescape extern:"c" fun LLVMGetBufferStart(buffer: i64*): i64*

Returns the borrowed starting address of the buffer's bytes.

LLVMGetBufferSize (extern)

noescape extern:"c" fun LLVMGetBufferSize(buffer: i64*): int

Returns the byte size of the LLVM memory buffer.

LLVMGetHostCPUName (extern)

noescape extern:"c" fun LLVMGetHostCPUName(): i64*

Returns an LLVM-owned string naming the detected host CPU.

LLVMGetHostCPUFeatures (extern)

noescape extern:"c" fun LLVMGetHostCPUFeatures(): i64*

Returns an LLVM-owned string of host CPU feature overrides.

LLVMLoadLibraryPermanently (extern)

noescape extern:"c" fun LLVMLoadLibraryPermanently(path: cstring): i32

Loads a native library for the lifetime of the process and returns zero on success.

LLVMSearchForAddressOfSymbol (extern)

noescape extern:"c" fun LLVMSearchForAddressOfSymbol(name: cstring): i64*

Returns a native symbol address or null if it cannot be found.

LLVMOrcCreateDynamicLibrarySearchGeneratorForPath (extern)

noescape extern:"c" fun LLVMOrcCreateDynamicLibrarySearchGeneratorForPath(
    outputGenerator: i64*,
    path: cstring,
    globalPrefix: i8,
    filter: i64*,
    filterContext: i64*
): i64*

Creates a symbol search generator for the specified library and returns a null error on success.

llvmLoadLibraryPermanently (fun)

fun llvmLoadLibraryPermanently(path: string): int

Loads the named native library into LLVM's process symbol search and returns zero on success.

llvmSearchForAddressOfSymbol (fun)

trusted fun llvmSearchForAddressOfSymbol(name: string): int

The address of name in the process or in a library loaded permanently (0 when absent): what the JIT's process generator resolves it to.

llvmConsumeError (fun)

fun llvmConsumeError(error: i64*, status: int): int

Consumes an LLVM error and returns the supplied failure status, or zero for a null error.

llvmInitializeNativeTarget (fun)

fun llvmInitializeNativeTarget(): int

Registers LLVM's x86 and AArch64 targets and the native RISC-V target when applicable. Returns zero on success.

llvmLibraryVersion (fun)

trusted fun llvmLibraryVersion(): string

The linked LLVM library's "major.minor.patch" (LLVMGetVersion writes three unsigned 32-bit values).

llvmVersionPart (fun)

trusted fun llvmVersionPart(parts: NativeByteBuffer, offset: int): int

Reads a 32-bit little-endian LLVM version component from the specified offset.

llvmHostCpuName (fun)

fun llvmHostCpuName(): string

The host CPU's name and its features, as LLJIT targets them.

llvmHostCpuFeatures (fun)

fun llvmHostCpuFeatures(): string

Returns an owned Abla string of the detected CPU feature overrides.

llvmDefaultTargetTriple (fun)

trusted fun llvmDefaultTargetTriple(): string

Returns an owned Abla string containing LLVM's default target triple.

LlvmOrcSession (class)

class LlvmOrcSession(
    val jit: i64*,
    val dylib: i64*,
    val status: int,
    var closed: bool
)

Holds the native JIT, its main dylib and the session lifecycle status.

LlvmOrcGeneration (class)

class LlvmOrcGeneration(
    val tracker: i64*,
    val status: int,
    var closed: bool
)

Tracks resources installed as one JIT generation and their lifetime.

LlvmOrcLookup (class)

class LlvmOrcLookup(
    val status: int,
    val address: int
)

Holds a JIT symbol address and the status of resolving it.

llvmOrcCreateSession (fun)

trusted fun llvmOrcCreateSession(): LlvmOrcSession

A session owns one LLJIT instance and its process symbol generator. Modules can be added and reclaimed independently through generation trackers.

llvmPassesBalanced (fun)

fun llvmPassesBalanced(): string

The IR pipelines of the middle profile (--o1: scalar promotion, the inliner and local cleanup, without O2's loop and global passes) and of the fast one (scalar promotion and CFG cleanup). The ahead-of-time profiles and the JIT (ablac run) share them.

llvmBalancedAotInlineThreshold (fun)

fun llvmBalancedAotInlineThreshold(): int

AOT builds amortize this higher threshold over the program's execution. The JIT keeps LLVM's default threshold to preserve cold run latency.

llvmPassesFast (fun)

fun llvmPassesFast(): string

Returns the short LLVM pipeline used for fast JIT compilation.

LlvmOrcSession.addFile (extension fun)

fun LlvmOrcSession.addFile(path: string, passes: string = ""): LlvmOrcGeneration

Adds the module in path, after running the IR pipeline passes on it (none when empty: the frontend's IR as it is).

LlvmOrcSession.addText (extension fun)

fun LlvmOrcSession.addText(
    name: string,
    ir: string,
    passes: string = ""
): LlvmOrcGeneration

Adds the textual IR module ir (name in LLVM's messages), after running the IR pipeline passes on it.

LlvmOrcSession.addBuffer (extension fun)

fun LlvmOrcSession.addBuffer(
    source: i64*,
    initialStatus: int,
    passes: string
): LlvmOrcGeneration

Parses the memory buffer source (consumed; initialStatus says how creating it went) and adds its module through a new generation tracker.

LlvmOrcSession.addModule (extension fun)

fun LlvmOrcSession.addModule(
    context: i64*,
    module: i64*,
    passes: string = ""
): LlvmOrcGeneration

Adds an in-memory module (as the backend keeps it: bootstrapLlvmHoldModule) after running the IR pipeline passes on it (none when empty). The session takes ownership of context and module whatever the outcome.

LlvmOrcSession.addObjectBuffer (extension fun)

fun LlvmOrcSession.addObjectBuffer(buffer: i64*): LlvmOrcGeneration

Adds an object file's contents (buffer, which the call consumes) as a generation of its own.

LlvmOrcSession.addObjectFiles (extension fun)

fun LlvmOrcSession.addObjectFiles(paths: array<string>): LlvmOrcGeneration

Adds the object files at paths as one generation (one resource tracker, so remove takes them all): the parts of a module generated elsewhere, which link to each other. Status 120 when one cannot be read; on any failure none stays added.

LlvmOrcSession.addObjectFilesWith (extension fun)

fun LlvmOrcSession.addObjectFilesWith(paths: array<string>, context: i64*, module: i64*): LlvmOrcGeneration

addObjectFiles, with the IR module (of context, both consumed; none when null) in the same generation: the part of a module generated elsewhere that LLJIT generates itself (code with thread-locals, which it emulates).

LlvmOrcSession.addObjectFile (extension fun)

fun LlvmOrcSession.addObjectFile(path: string): LlvmOrcGeneration

Adds the object file at path (one lookupCapturing wrote, say) without compiling anything: status 120 when it cannot be read.

llvmOrcCaptureObject (fun)

trusted fun llvmOrcCaptureObject(context: i64, objectInOut: i64): i64

The transform's C signature, LLVMErrorRef (void *, LLVMMemoryBufferRef *), as addresses (nativeFunctionAddress takes scalar signatures): no error, ever.

LlvmOrcSession.lookupCapturing (extension fun)

fun LlvmOrcSession.lookupCapturing(name: string, objectPath: string): LlvmOrcCapture

Looks name up like lookup, keeping the machine code that generating it took: when exactly one module was compiled for it, its object is published at objectPath (written beside it, then renamed) for a later addObjectFile, and captured is true. Nothing is published when nothing (or more than one module) was compiled, or the object cannot be written.

LlvmOrcSession.lookupMeasuring (extension fun)

fun LlvmOrcSession.lookupMeasuring(name: string): LlvmOrcMeasured

As lookup, also counting the bytes of the objects the lookup had compiled (code and data of what it linked): how much a live reload adds to the session (src/live_reload.ab).

LlvmOrcMeasured (class)

class LlvmOrcMeasured(val status: int, val address: int, val bytes: int)

Reports a lookup status, symbol address and the number of generated object bytes.

LlvmOrcCapture (class)

class LlvmOrcCapture(
    val status: int,
    val address: int,
    val captured: bool
)

Reports a lookup status and symbol address with whether an object was captured.

LlvmOrcSession.lookup (extension fun)

fun LlvmOrcSession.lookup(name: string): LlvmOrcLookup

Returns a resolved symbol's address or a nonzero lookup status.

LlvmOrcSession.installThreadEnd (extension fun)

trusted fun LlvmOrcSession.installThreadEnd(): void

A JIT-compiled program has its own runtime, with its own thread-end hook (abla/runtime/self): the compiler's emutlsThreadEnd is stored there, so that the program's threads free their emulated thread-locals when they end (abla/runtime/emutls). A program without threads has no hook to find: nothing happens.

LlvmOrcGeneration.remove (extension fun)

fun LlvmOrcGeneration.remove(): int

Releases the generation's code and tracker, returning zero on success or 127 on removal failure.

LlvmOrcSession.close (extension fun)

fun LlvmOrcSession.close(): int

Destroys an open JIT and returns zero on success or 126 on disposal failure.

LlvmOrcMainCall (class)

resource class LlvmOrcMainCall(val address: int, val count: int, val vector: int)

main's address, its argument count and the address of its argv block, for the thread that runs it.

LlvmOrcMainDone (class)

resource class LlvmOrcMainDone(var done: bool)

Whether main returned, set by the thread that ran it.

LlvmOrcSession.runMain (extension fun)

fun LlvmOrcSession.runMain(program: string, arguments: array<string>): int

Runs the main this session holds (the JIT's own symbol, found by a lookup here), as a program started with program and arguments, and returns its result. A program is run only through its session: no address of a caller's is called.

LlvmOrcSession.runMainWatched (extension fun)

fun LlvmOrcSession.runMainWatched(program: string, arguments: array<string>, step: () -> void): int

As runMain, with main on a thread of its own and step called while it runs (see llvmOrcCallMainWatched).

llvmOrcRunFile (fun)

fun llvmOrcRunFile(
    path: string,
    program: string = "",
    arguments: array<string> = [],
    passes: string = ""
): int

Returns the JIT-compiled program's main result. Infrastructure failures use 120-129 (129: the IR pipeline failed), keeping them distinct from normal compiler diagnostics. arguments reach the program as processArgument(0…), with program (default: path) as its argv[0]. passes is the IR pipeline the module gets first (none when empty).

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.