packages /
llvm 0.1.0
Bindings to LLVM's C API (LLVM 23), for the Auk compiler's back end: build IR, verify and print it, optimize it, emit object files and bitcode, link modules,...
// Generated by packages/llvm/gen/gen.py from gen/bind.txt and the LLVM 23.1.4 C headers; don't edit.
/// Memory buffers, bitcode reading and writing, and the module linker.
extern fn c_create_memory_buffer_with_memory_range_copy(
input_data: [int],
input_data_length: int,
buffer_name: str,
): llvm.MemoryBuffer = "LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData, size_t InputDataLength, const char *BufferName)"
pub fn create_memory_buffer_with_memory_range_copy(
input_data: [int],
buffer_name: str,
): llvm.MemoryBuffer uses ffi =
c_create_memory_buffer_with_memory_range_copy(input_data, input_data.len(), buffer_name)
pub extern fn dispose_memory_buffer(
mem_buf: llvm.MemoryBuffer,
) = "void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)"
pub extern fn get_buffer_size(
mem_buf: llvm.MemoryBuffer,
): int = "size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf)"
pub extern fn get_buffer_start(
mem_buf: llvm.MemoryBuffer,
): ffi.Ptr = "const char *LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf)"
pub extern fn link_modules2(
dest: llvm.Module,
src: llvm.Module,
): int = "int LLVMLinkModules2(LLVMModuleRef Dest, LLVMModuleRef Src)"
pub extern fn parse_bitcode_in_context2(
context_ref: llvm.Context,
mem_buf: llvm.MemoryBuffer,
out_module: var llvm.Module?,
): int = "int LLVMParseBitcodeInContext2(LLVMContextRef ContextRef, LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule)"
pub extern fn write_bitcode_to_file(
m: llvm.Module,
path: str,
): int = "int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path)"
pub extern fn write_bitcode_to_memory_buffer(
m: llvm.Module,
): llvm.MemoryBuffer = "LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M)"