1
0
forked from M-Labs/nac3

fix previous commit

This commit is contained in:
Sebastien Bourdeauducq 2024-09-06 11:32:08 +08:00
parent 668ccb1c95
commit 6098b1b853
2 changed files with 8 additions and 9 deletions

View File

@ -556,7 +556,7 @@ impl Nac3 {
.unwrap(); .unwrap();
// Process IRRT // Process IRRT
let context = inkwell::context::Context::create(); let context = Context::create();
let irrt = load_irrt(&context, resolver.as_ref()); let irrt = load_irrt(&context, resolver.as_ref());
let fun_signature = let fun_signature =
@ -687,7 +687,7 @@ impl Nac3 {
let buffer = buffer.as_slice().into(); let buffer = buffer.as_slice().into();
membuffer.lock().push(buffer); membuffer.lock().push(buffer);
}))); })));
let size_t = Context::create() let size_t = context
.ptr_sized_int_type(&self.get_llvm_target_machine().get_target_data(), None) .ptr_sized_int_type(&self.get_llvm_target_machine().get_target_data(), None)
.get_bit_width(); .get_bit_width();
let num_threads = if is_multithreaded() { 4 } else { 1 }; let num_threads = if is_multithreaded() { 4 } else { 1 };
@ -706,7 +706,7 @@ impl Nac3 {
let mut generator = let mut generator =
ArtiqCodeGenerator::new("attributes_writeback".to_string(), size_t, self.time_fns); ArtiqCodeGenerator::new("attributes_writeback".to_string(), size_t, self.time_fns);
let context = inkwell::context::Context::create(); let context = Context::create();
let module = context.create_module("attributes_writeback"); let module = context.create_module("attributes_writeback");
let target_machine = self.llvm_options.create_target_machine().unwrap(); let target_machine = self.llvm_options.create_target_machine().unwrap();
module.set_data_layout(&target_machine.get_target_data().get_data_layout()); module.set_data_layout(&target_machine.get_target_data().get_data_layout());

View File

@ -9,10 +9,9 @@
#![allow(clippy::too_many_lines, clippy::wildcard_imports)] #![allow(clippy::too_many_lines, clippy::wildcard_imports)]
use clap::Parser; use clap::Parser;
use nac3core::inkwell::context::Context;
use nac3core::inkwell::{ use nac3core::inkwell::{
memory_buffer::MemoryBuffer, passes::PassBuilderOptions, support::is_multithreaded, targets::*, memory_buffer::MemoryBuffer, passes::PassBuilderOptions, support::is_multithreaded, targets::*,
OptimizationLevel, OptimizationLevel, module::Linkage
}; };
use nac3core::{ use nac3core::{
codegen::{ codegen::{
@ -281,7 +280,9 @@ fn main() {
..host_target_machine ..host_target_machine
}; };
let size_t = Context::create() let context = nac3core::inkwell::context::Context::create();
let size_t = context
.ptr_sized_int_type( .ptr_sized_int_type(
&target_machine_options &target_machine_options
.create_target_machine(opt_level) .create_target_machine(opt_level)
@ -313,8 +314,6 @@ fn main() {
let resolver = let resolver =
Arc::new(Resolver(internal_resolver.clone())) as Arc<dyn SymbolResolver + Send + Sync>; Arc::new(Resolver(internal_resolver.clone())) as Arc<dyn SymbolResolver + Send + Sync>;
let context = inkwell::context::Context::create();
// Process IRRT // Process IRRT
let irrt = load_irrt(&context, resolver.as_ref()); let irrt = load_irrt(&context, resolver.as_ref());
if emit_llvm { if emit_llvm {
@ -453,7 +452,7 @@ fn main() {
let mut function_iter = main.get_first_function(); let mut function_iter = main.get_first_function();
while let Some(func) = function_iter { while let Some(func) = function_iter {
if func.count_basic_blocks() > 0 && func.get_name().to_str().unwrap() != "run" { if func.count_basic_blocks() > 0 && func.get_name().to_str().unwrap() != "run" {
func.set_linkage(inkwell::module::Linkage::Private); func.set_linkage(Linkage::Private);
} }
function_iter = func.get_next_function(); function_iter = func.get_next_function();
} }