Compare commits

..

9 Commits

Author SHA1 Message Date
David Mak 899c0d8cd3 meta: Improve documentation for various modified classes 2023-09-21 16:37:38 +08:00
David Mak 49743995b3 core: Use i8 for boolean variable allocation
In LLVM, i1 represents a 1-byte integer with a single valid bit; The
rest of the 7 upper bits are undefined. This causes problems when
using these variables in memory operations (e.g. memcpy/memmove as
needed by List slicing and assignment).

We fix this by treating all local boolean variables as i8 so that they
are well-defined for memory operations. Function ABIs will continue to
use i1, as memory operations cannot be directly performed on function
arguments or return types, instead they are always converted back into
local boolean variables (which are i8s anyways).

Fixes #315.
2023-09-21 16:37:38 +08:00
David Mak 8bef0ab8f2 core: Move bitcode verification error message into panic message 2023-09-21 12:09:28 +08:00
David Mak 806f65815f core: Minor refactor allocate_list 2023-09-21 12:09:28 +08:00
David Mak 2e6a64a1de core: Add name to build_gep_and_load 2023-09-21 12:09:27 +08:00
David Mak 20aa094b1f core: Remove emit_llvm from CodeGenLLVMOptions
We instead output an LLVM bitcode file when the option is specified on
the command-line.
2023-09-21 12:06:56 +08:00
David Mak 5ab8d751ed standalone: Add ability to execute via lli 2023-09-21 12:06:56 +08:00
David Mak c7d5d75014 core: Replace deprecated _ExtInt with _BitInt 2023-09-21 12:06:56 +08:00
David Mak 72570fbb16 core: Fix missing changes for codegen tests
Apparently the changes were dropped after rebasing.
2023-09-21 12:06:56 +08:00
2 changed files with 2 additions and 6 deletions

View File

@ -67,8 +67,7 @@ impl<'ctx, 'a> CodeGenContext<'ctx, 'a> {
index: &[IntValue<'ctx>],
name: Option<&str>,
) -> BasicValueEnum<'ctx> {
let gep = unsafe { self.builder.build_gep(ptr, index, "") };
self.builder.build_load(gep, name.unwrap_or_default())
unsafe { self.builder.build_load(self.builder.build_gep(ptr, index, ""), name.unwrap_or_default()) }
}
fn get_subst_key(

View File

@ -13,10 +13,7 @@ use crate::{
},
};
use indoc::indoc;
use inkwell::{
targets::{InitializationConfig, Target},
OptimizationLevel
};
use inkwell::OptimizationLevel;
use nac3parser::{
ast::{fold::Fold, StrRef},
parser::parse_program,