Compare commits

..

11 Commits

Author SHA1 Message Date
David Mak 49660c4e6f core: Fix restoration of loop target in try statement
I am not sure why this occurs either, it only appears that after the
assignment, `old_loop_target` and `loop_target` are both referencing the
same variable, causing the next line to set both variables as None.
2023-09-21 16:17:29 +08:00
David Mak 025fb089c9 meta: Respect opt flags when performing whole-module optimization 2023-09-21 15:34:05 +08:00
David Mak e8b7d19b47 standalone: Update demos
- Add `newline` parameter to all output_* functions
- Add `output_str` for printing a string
- Add demo_test.py to test interop
2023-09-21 15:30:03 +08:00
David Mak f1664e7158 core: Fix passing structure arguments to extern functions
All parameters with a structure type in extern functions are marked as
`byref` instead of `byval`, as most ABIs require the first several
arguments to be passed in registers before spilling into the stack.

`byval` breaks this contract by explicitly requiring all arguments to be
 passed in the stack, breaking interop with libraries written in other
 languages.
2023-09-21 15:25:24 +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

@ -64,8 +64,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,