Compare commits

..

13 Commits

Author SHA1 Message Date
David Mak e07cc64a95 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-25 11:54:33 +08:00
David Mak c1a001ec88 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-25 11:54:33 +08:00
David Mak 37d2e78df5 standalone: Add ability to execute via lli 2023-09-25 11:53:58 +08:00
David Mak 607414c369 core: Fix missing changes for codegen tests
Apparently the changes were dropped after rebasing.
2023-09-25 11:53:58 +08:00
David Mak 8dd545b265 meta: Respect opt flags when performing whole-module optimization 2023-09-25 11:49:03 +08:00
David Mak c86c9988a9 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-25 11:49:01 +08:00
David Mak b8e9af2e2b 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-25 11:48:59 +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

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