Compare commits

..

10 Commits

Author SHA1 Message Date
David Mak 3c0b5eb1b6 meta: Improve documentation for various modified classes 2023-09-25 11:55:56 +08:00
David Mak bbc74c0170 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-25 11:55:56 +08:00
David Mak 92998add6e standalone: Add ability to execute via lli 2023-09-25 11:55:39 +08:00
David Mak 4534b20b88 core: Fix missing changes for codegen tests
Apparently the changes were dropped after rebasing.
2023-09-25 11:55:39 +08:00
David Mak fc93fc2f0e core: Move bitcode verification error message into panic message 2023-09-22 17:16:29 +08:00
David Mak dd42022633 core: Minor refactor allocate_list 2023-09-22 17:16:29 +08:00
David Mak 6dfc43c8b0 core: Add name to build_gep_and_load 2023-09-22 17:16:29 +08:00
David Mak ab2360d7a0 core: Remove emit_llvm from CodeGenLLVMOptions
We instead output an LLVM bitcode file when the option is specified on
the command-line.
2023-09-22 17:16:29 +08:00
David Mak ee1ee4ab3b core: Replace deprecated _ExtInt with _BitInt 2023-09-22 17:16:29 +08:00
David Mak 3e430b9b40 core: Fix missing changes for codegen tests
Apparently the changes were dropped after rebasing.
2023-09-22 17:16:21 +08:00
2 changed files with 6 additions and 2 deletions

View File

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

View File

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