rocm.bindings.llvm.c.cyexecutionengine#
2026-09-24
8 min read time
Applies to Linux and Windows
Advanced Micro Devices, Inc.
Cython declarations for the C-level interface. Use
cimport rocm.bindings.llvm.c.cyexecutionengine from your Cython code to access
these declarations directly.
See also
The high-level Python API is documented at rocm.bindings.llvm.c.executionengine.
# MIT License
#
# Copyright (c) 2021-2026 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This file has been autogenerated, do not modify.
from libc.stdint cimport *
ctypedef bint _Bool # bool is not a reserved keyword in C, _Bool is
from rocm.bindings.llvm.c.cytarget cimport *
from rocm.bindings.llvm.c.cytargetmachine cimport *
from rocm.bindings.llvm.c.cytypes cimport *
from rocm.bindings.llvm.c.cyvisibility cimport *
#
# Empty function used to force the linker to link MCJIT.
# Has no effect when called on a pre-built library (dylib interface).
cdef void LLVMLinkInMCJIT() noexcept nogil
#
# Empty function used to force the linker to link the LLVM interpreter.
# Has no effect when called on a pre-built library (dylib interface).
cdef void LLVMLinkInInterpreter() noexcept nogil
cdef extern from "llvm-c/ExecutionEngine.h":
cdef struct LLVMOpaqueGenericValue:
pass
ctypedef LLVMOpaqueGenericValue * LLVMGenericValueRef
cdef struct LLVMOpaqueExecutionEngine:
pass
ctypedef LLVMOpaqueExecutionEngine * LLVMExecutionEngineRef
cdef struct LLVMOpaqueMCJITMemoryManager:
pass
ctypedef LLVMOpaqueMCJITMemoryManager * LLVMMCJITMemoryManagerRef
cdef struct LLVMMCJITCompilerOptions:
unsigned int OptLevel
LLVMCodeModel CodeModel
int NoFramePointerElim
int EnableFastISel
LLVMMCJITMemoryManagerRef MCJMM
cdef LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty,unsigned long long N,int IsSigned) except? NULL nogil
cdef LLVMGenericValueRef LLVMCreateGenericValueOfPointer(void * P) except? NULL nogil
cdef LLVMGenericValueRef LLVMCreateGenericValueOfFloat(LLVMTypeRef Ty,double N) except? NULL nogil
cdef unsigned int LLVMGenericValueIntWidth(LLVMGenericValueRef GenValRef) except? -1 nogil
cdef unsigned long long LLVMGenericValueToInt(LLVMGenericValueRef GenVal,int IsSigned) except? -1 nogil
cdef void * LLVMGenericValueToPointer(LLVMGenericValueRef GenVal) except? NULL nogil
cdef double LLVMGenericValueToFloat(LLVMTypeRef TyRef,LLVMGenericValueRef GenVal) noexcept nogil
cdef void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal) noexcept nogil
cdef int LLVMCreateExecutionEngineForModule(LLVMExecutionEngineRef * OutEE,LLVMModuleRef M,char ** OutError) except? -1 nogil
cdef int LLVMCreateInterpreterForModule(LLVMExecutionEngineRef * OutInterp,LLVMModuleRef M,char ** OutError) except? -1 nogil
cdef int LLVMCreateJITCompilerForModule(LLVMExecutionEngineRef * OutJIT,LLVMModuleRef M,unsigned int OptLevel,char ** OutError) except? -1 nogil
cdef void LLVMInitializeMCJITCompilerOptions(LLVMMCJITCompilerOptions * Options,size_t SizeOfOptions) noexcept nogil
#
# Create an MCJIT execution engine for a module, with the given options. It is
# the responsibility of the caller to ensure that all fields in Options up to
# the given SizeOfOptions are initialized. It is correct to pass a smaller
# value of SizeOfOptions that omits some fields. The canonical way of using
# this is:
#
# LLVMMCJITCompilerOptions options;
# LLVMInitializeMCJITCompilerOptions(&options, sizeof(options));
# ... fill in those options you care about
# LLVMCreateMCJITCompilerForModule(&jit, mod, &options, sizeof(options),
# &error);
#
# Note that this is also correct, though possibly suboptimal:
#
# LLVMCreateMCJITCompilerForModule(&jit, mod, 0, 0, &error);
cdef int LLVMCreateMCJITCompilerForModule(LLVMExecutionEngineRef * OutJIT,LLVMModuleRef M,LLVMMCJITCompilerOptions * Options,size_t SizeOfOptions,char ** OutError) except? -1 nogil
cdef void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE) noexcept nogil
cdef void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE) noexcept nogil
cdef void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE) noexcept nogil
cdef int LLVMRunFunctionAsMain(LLVMExecutionEngineRef EE,LLVMValueRef F,unsigned int ArgC,const char *const * ArgV,const char *const * EnvP) except? -1 nogil
cdef LLVMGenericValueRef LLVMRunFunction(LLVMExecutionEngineRef EE,LLVMValueRef F,unsigned int NumArgs,LLVMGenericValueRef * Args) except? NULL nogil
cdef void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE,LLVMValueRef F) noexcept nogil
cdef void LLVMAddModule(LLVMExecutionEngineRef EE,LLVMModuleRef M) noexcept nogil
cdef int LLVMRemoveModule(LLVMExecutionEngineRef EE,LLVMModuleRef M,LLVMModuleRef * OutMod,char ** OutError) except? -1 nogil
cdef int LLVMFindFunction(LLVMExecutionEngineRef EE,const char * Name,LLVMValueRef * OutFn) except? -1 nogil
cdef void * LLVMRecompileAndRelinkFunction(LLVMExecutionEngineRef EE,LLVMValueRef Fn) except? NULL nogil
cdef LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE) except? NULL nogil
cdef LLVMTargetMachineRef LLVMGetExecutionEngineTargetMachine(LLVMExecutionEngineRef EE) except? NULL nogil
cdef void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE,LLVMValueRef Global,void * Addr) noexcept nogil
cdef void * LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE,LLVMValueRef Global) except? NULL nogil
cdef uint64_t LLVMGetGlobalValueAddress(LLVMExecutionEngineRef EE,const char * Name) except? -1 nogil
cdef uint64_t LLVMGetFunctionAddress(LLVMExecutionEngineRef EE,const char * Name) except? -1 nogil
# Returns true on error, false on success. If true is returned then the error
# message is copied to OutStr and cleared in the ExecutionEngine instance.
cdef int LLVMExecutionEngineGetErrMsg(LLVMExecutionEngineRef EE,char ** OutError) except? -1 nogil
cdef extern from "llvm-c/ExecutionEngine.h":
ctypedef uint8_t * (*LLVMMemoryManagerAllocateCodeSectionCallback) (void *,uintptr_t,unsigned int,unsigned int,const char *)
ctypedef uint8_t * (*LLVMMemoryManagerAllocateDataSectionCallback) (void *,uintptr_t,unsigned int,unsigned int,const char *,int)
ctypedef LLVMBool (*LLVMMemoryManagerFinalizeMemoryCallback) (void *,char **)
ctypedef void (*LLVMMemoryManagerDestroyCallback) (void *)
#
# Create a simple custom MCJIT memory manager. This memory manager can
# intercept allocations in a module-oblivious way. This will return NULL
# if any of the passed functions are NULL.
#
# @param Opaque An opaque client object to pass back to the callbacks.
# @param AllocateCodeSection Allocate a block of memory for executable code.
# @param AllocateDataSection Allocate a block of memory for data.
# @param FinalizeMemory Set page permissions and flush cache. Return 0 on
# success, 1 on error.
cdef LLVMMCJITMemoryManagerRef LLVMCreateSimpleMCJITMemoryManager(void * Opaque,LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection,LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection,LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory,LLVMMemoryManagerDestroyCallback Destroy)
cdef void LLVMDisposeMCJITMemoryManager(LLVMMCJITMemoryManagerRef MM) noexcept nogil
cdef LLVMJITEventListenerRef LLVMCreateGDBRegistrationListener() except? NULL nogil
cdef LLVMJITEventListenerRef LLVMCreateIntelJITEventListener() except? NULL nogil
cdef LLVMJITEventListenerRef LLVMCreateOProfileJITEventListener() except? NULL nogil
cdef LLVMJITEventListenerRef LLVMCreatePerfJITEventListener() except? NULL nogil
cdef bint __executionengine_has_symbol(const char* name) noexcept nogil