diff options
| author | Baitinq <[email protected]> | 2025-06-06 00:30:22 +0200 |
|---|---|---|
| committer | Baitinq <[email protected]> | 2025-06-06 00:30:22 +0200 |
| commit | abc13761fc76de30203b72e13aa8fa0764a673b8 (patch) | |
| tree | b88d091261d60d5468576686abad518899bc1883 | |
| parent | Feature: Support declaring type aliases (diff) | |
| download | interpreter-abc13761fc76de30203b72e13aa8fa0764a673b8.tar.gz interpreter-abc13761fc76de30203b72e13aa8fa0764a673b8.tar.bz2 interpreter-abc13761fc76de30203b72e13aa8fa0764a673b8.zip | |
Bootstrap: Codegen: Create bindings for llvm types
| -rw-r--r-- | src/bootstrap/codegen.src | 8 | ||||
| -rw-r--r-- | src/bootstrap/llvm.src | 28 |
2 files changed, 21 insertions, 15 deletions
diff --git a/src/bootstrap/codegen.src b/src/bootstrap/codegen.src index 5a08369..f9ab478 100644 --- a/src/bootstrap/codegen.src +++ b/src/bootstrap/codegen.src @@ -1,9 +1,9 @@ import "llvm.src"; let codegen = struct { - llvm_module: *void, - llvm_context: *void, - builder: *void, + llvm_module: LLVMModuleRef, + llvm_context: LLVMContextRef, + builder: LLVMBuilderRef, arena: *arena, }; @@ -71,7 +71,7 @@ let codegen_compile = (c: *codegen) => i64 { /* Generate code */ let triple = LLVMGetDefaultTargetTriple(); - let target_ref = cast(**void, arena_alloc((*c).arena, sizeof(**void))); + let target_ref = cast(*LLVMTargetRef, arena_alloc((*c).arena, sizeof(*LLVMTargetRef))); let message = cast(**i8, null); let result = LLVMGetTargetFromTriple(triple, target_ref, message); if result != 0 { diff --git a/src/bootstrap/llvm.src b/src/bootstrap/llvm.src index 65c36c2..42f1a5b 100644 --- a/src/bootstrap/llvm.src +++ b/src/bootstrap/llvm.src @@ -258,28 +258,34 @@ let LLVMInitializeAllDisassemblers = () => void { return; }; -extern LLVMModuleCreateWithName = (*i8) => *void; -extern LLVMGetGlobalContext = () => *void; -extern LLVMCreateBuilder = () => *void; /* TODO: Create types */ -extern LLVMDisposeModule = (*void) => void; +let LLVMBuilderRef = newtype *void; +let LLVMModuleRef = newtype *void; +let LLVMTargetMachineRef = newtype *void; +let LLVMContextRef = newtype *void; +let LLVMTargetRef = newtype *void; + +extern LLVMModuleCreateWithName = (*i8) => LLVMModuleRef; +extern LLVMGetGlobalContext = () => LLVMContextRef; +extern LLVMCreateBuilder = () => LLVMBuilderRef; /* TODO: Create types */ +extern LLVMDisposeModule = (LLVMModuleRef) => void; extern LLVMShutdown = () => void; -extern LLVMDisposeBuilder = (*void) => void; +extern LLVMDisposeBuilder = (LLVMBuilderRef) => void; -extern LLVMDumpModule = (*void) => void; +extern LLVMDumpModule = (LLVMModuleRef) => void; extern LLVMGetDefaultTargetTriple = () => *i8; -extern LLVMGetTargetFromTriple = (*i8, **void, **i8) => i64; +extern LLVMGetTargetFromTriple = (*i8, *LLVMTargetRef, **i8) => i64; extern LLVMDisposeMessage = (*i8) => void; -extern LLVMCreateTargetMachine = (*void, *i8, *i8, *i8, i64, i64, i64) => *void; -extern LLVMDisposeTargetMachine = (*void) => void; +extern LLVMCreateTargetMachine = (LLVMTargetRef, *i8, *i8, *i8, i64, i64, i64) => LLVMTargetMachineRef; +extern LLVMDisposeTargetMachine = (LLVMTargetMachineRef) => void; let LLVMCodeGenLevelDefault = 2; let LLVMRelocDefault = 0; let LLVMCodeModelDefault = 0; -extern LLVMVerifyModule = (*void, i64, **i8) => i64; +extern LLVMVerifyModule = (LLVMModuleRef, i64, **i8) => i64; let LLVMAbortProcessAction = 0; -extern LLVMTargetMachineEmitToFile = (*void, *void, *i8, i64, **i8) => i64; +extern LLVMTargetMachineEmitToFile = (LLVMTargetMachineRef, LLVMModuleRef, *i8, i64, **i8) => i64; let LLVMObjectFile = 1; |