update inkwell. Closes #67

This commit is contained in:
Sebastien Bourdeauducq 2021-12-25 22:17:06 +08:00
parent 53f13b44cf
commit 9e3f75255e
11 changed files with 28 additions and 27 deletions

10
Cargo.lock generated
View File

@ -316,8 +316,9 @@ dependencies = [
[[package]] [[package]]
name = "inkwell" name = "inkwell"
version = "0.1.0" version = "0.1.0-beta.4"
source = "git+https://github.com/TheDan64/inkwell?branch=master#d018ee22e4b5241dec2bc32ca67f3d4caaecee47" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2223d0eba0ae6d40a3e4680c6a3209143471e1f38b41746ea309aa36dde9f90b"
dependencies = [ dependencies = [
"either", "either",
"inkwell_internals", "inkwell_internals",
@ -330,8 +331,9 @@ dependencies = [
[[package]] [[package]]
name = "inkwell_internals" name = "inkwell_internals"
version = "0.3.0" version = "0.5.0"
source = "git+https://github.com/TheDan64/inkwell?branch=master#d018ee22e4b5241dec2bc32ca67f3d4caaecee47" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c7090af3d300424caa81976b8c97bca41cd70e861272c072e188ae082fb49f9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View File

@ -10,4 +10,3 @@ members = [
[profile.release] [profile.release]
debug = true debug = true

View File

@ -16,7 +16,6 @@
}) })
]; ];
}; };
cargoSha256 = "sha256-otKLhr58HYMjVXAof6AdObNpggPnvK6qOl7I+4LWIP8=";
msys2-python-tar = pkgs.fetchurl { msys2-python-tar = pkgs.fetchurl {
url = "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-python-3.9.7-4-any.pkg.tar.zst"; url = "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-python-3.9.7-4-any.pkg.tar.zst";
sha256 = "0iwlgbk4b457yn9djwqswid55xhyyi35qymz1lfh42xwdpxdm47c"; sha256 = "0iwlgbk4b457yn9djwqswid55xhyyi35qymz1lfh42xwdpxdm47c";
@ -54,7 +53,9 @@
pkgs.rustPlatform.buildRustPackage { pkgs.rustPlatform.buildRustPackage {
name = "nac3artiq"; name = "nac3artiq";
src = self; src = self;
inherit cargoSha256; cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = [ pkgs.python3 llvm-nac3 ]; nativeBuildInputs = [ pkgs.python3 llvm-nac3 ];
buildInputs = [ pkgs.python3 llvm-nac3 ]; buildInputs = [ pkgs.python3 llvm-nac3 ];
cargoBuildFlags = [ "--package" "nac3artiq" ]; cargoBuildFlags = [ "--package" "nac3artiq" ];
@ -75,7 +76,9 @@
pkgs-mingw.rustPlatform.buildRustPackage { pkgs-mingw.rustPlatform.buildRustPackage {
name = "nac3artiq"; name = "nac3artiq";
src = self; src = self;
inherit cargoSha256; cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = [ pkgs.zip ]; nativeBuildInputs = [ pkgs.zip ];
buildInputs = [ pkgs-mingw.zlib ]; buildInputs = [ pkgs-mingw.zlib ];
configurePhase = configurePhase =

View File

@ -16,7 +16,6 @@ nac3parser = { path = "../nac3parser" }
nac3core = { path = "../nac3core" } nac3core = { path = "../nac3core" }
[dependencies.inkwell] [dependencies.inkwell]
git = "https://github.com/TheDan64/inkwell" version = "0.1.0-beta.4"
branch = "master"
default-features = false default-features = false
features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]

View File

@ -68,7 +68,7 @@ impl<'b> CodeGenerator for ArtiqCodeGenerator<'b> {
}); });
let max = ctx let max = ctx
.builder .builder
.build_call(smax, &[old_end, now], "smax") .build_call(smax, &[old_end.into(), now.into()], "smax")
.try_as_basic_value() .try_as_basic_value()
.left() .left()
.unwrap(); .unwrap();
@ -185,7 +185,7 @@ impl<'b> CodeGenerator for ArtiqCodeGenerator<'b> {
}); });
let max = ctx let max = ctx
.builder .builder
.build_call(smax, &[end_val, outer_end_val], "smax") .build_call(smax, &[end_val.into(), outer_end_val.into()], "smax")
.try_as_basic_value() .try_as_basic_value()
.left() .left()
.unwrap(); .unwrap();

View File

@ -332,7 +332,7 @@ impl TimeFns for ExternTimeFns {
.get_function("at_mu") .get_function("at_mu")
.unwrap_or_else(|| ctx.module.add_function("at_mu", ctx.ctx.void_type().fn_type(&[ctx.ctx.i64_type().into()], false), None)); .unwrap_or_else(|| ctx.module.add_function("at_mu", ctx.ctx.void_type().fn_type(&[ctx.ctx.i64_type().into()], false), None));
ctx.builder ctx.builder
.build_call(at_mu, &[t], "at_mu"); .build_call(at_mu, &[t.into()], "at_mu");
} }
fn emit_delay_mu<'ctx, 'a>(&self, ctx: &mut CodeGenContext<'ctx, 'a>, dt: BasicValueEnum<'ctx>) { fn emit_delay_mu<'ctx, 'a>(&self, ctx: &mut CodeGenContext<'ctx, 'a>, dt: BasicValueEnum<'ctx>) {
@ -341,7 +341,7 @@ impl TimeFns for ExternTimeFns {
.get_function("delay_mu") .get_function("delay_mu")
.unwrap_or_else(|| ctx.module.add_function("delay_mu", ctx.ctx.void_type().fn_type(&[ctx.ctx.i64_type().into()], false), None)); .unwrap_or_else(|| ctx.module.add_function("delay_mu", ctx.ctx.void_type().fn_type(&[ctx.ctx.i64_type().into()], false), None));
ctx.builder ctx.builder
.build_call(delay_mu, &[dt], "delay_mu"); .build_call(delay_mu, &[dt.into()], "delay_mu");
} }
} }

View File

@ -14,8 +14,7 @@ rayon = "1.5.1"
nac3parser = { path = "../nac3parser" } nac3parser = { path = "../nac3parser" }
[dependencies.inkwell] [dependencies.inkwell]
git = "https://github.com/TheDan64/inkwell" version = "0.1.0-beta.4"
branch = "master"
default-features = false default-features = false
features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]

View File

@ -420,7 +420,7 @@ pub fn gen_call<'ctx, 'a, G: CodeGenerator>(
}; };
param_vals = real_params param_vals = real_params
.into_iter() .into_iter()
.map(|p| p.to_basic_value_enum(ctx, generator)) .map(|p| p.to_basic_value_enum(ctx, generator).into())
.collect_vec(); .collect_vec();
instance_to_symbol.get(&key).cloned() instance_to_symbol.get(&key).cloned()
} }
@ -437,7 +437,7 @@ pub fn gen_call<'ctx, 'a, G: CodeGenerator>(
if let Some(obj) = &obj { if let Some(obj) = &obj {
args.insert(0, FuncArg { name: "self".into(), ty: obj.0, default_value: None }); args.insert(0, FuncArg { name: "self".into(), ty: obj.0, default_value: None });
} }
let params = args.iter().map(|arg| ctx.get_llvm_type(generator, arg.ty)).collect_vec(); let params = args.iter().map(|arg| ctx.get_llvm_type(generator, arg.ty).into()).collect_vec();
let fun_ty = if ctx.unifier.unioned(fun.0.ret, ctx.primitives.none) { let fun_ty = if ctx.unifier.unioned(fun.0.ret, ctx.primitives.none) {
ctx.ctx.void_type().fn_type(&params, false) ctx.ctx.void_type().fn_type(&params, false)
} else { } else {

View File

@ -352,7 +352,7 @@ pub fn gen_func<'ctx, G: CodeGenerator>(
let params = args let params = args
.iter() .iter()
.map(|arg| { .map(|arg| {
get_llvm_type(context, generator, &mut unifier, top_level_ctx.as_ref(), &mut type_cache, arg.ty) get_llvm_type(context, generator, &mut unifier, top_level_ctx.as_ref(), &mut type_cache, arg.ty).into()
}) })
.collect_vec(); .collect_vec();

View File

@ -214,7 +214,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo {
}); });
let val = ctx let val = ctx
.builder .builder
.build_call(round_intrinsic, &[arg], "round") .build_call(round_intrinsic, &[arg.into()], "round")
.try_as_basic_value() .try_as_basic_value()
.left() .left()
.unwrap(); .unwrap();
@ -251,7 +251,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo {
}); });
let val = ctx let val = ctx
.builder .builder
.build_call(round_intrinsic, &[arg], "round") .build_call(round_intrinsic, &[arg.into()], "round")
.try_as_basic_value() .try_as_basic_value()
.left() .left()
.unwrap(); .unwrap();
@ -431,7 +431,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo {
}); });
let val = ctx let val = ctx
.builder .builder
.build_call(floor_intrinsic, &[arg], "floor") .build_call(floor_intrinsic, &[arg.into()], "floor")
.try_as_basic_value() .try_as_basic_value()
.left() .left()
.unwrap(); .unwrap();
@ -468,7 +468,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo {
}); });
let val = ctx let val = ctx
.builder .builder
.build_call(floor_intrinsic, &[arg], "floor") .build_call(floor_intrinsic, &[arg.into()], "floor")
.try_as_basic_value() .try_as_basic_value()
.left() .left()
.unwrap(); .unwrap();
@ -505,7 +505,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo {
}); });
let val = ctx let val = ctx
.builder .builder
.build_call(ceil_intrinsic, &[arg], "ceil") .build_call(ceil_intrinsic, &[arg.into()], "ceil")
.try_as_basic_value() .try_as_basic_value()
.left() .left()
.unwrap(); .unwrap();
@ -542,7 +542,7 @@ pub fn get_builtins(primitives: &mut (PrimitiveStore, Unifier)) -> BuiltinInfo {
}); });
let val = ctx let val = ctx
.builder .builder
.build_call(ceil_intrinsic, &[arg], "ceil") .build_call(ceil_intrinsic, &[arg.into()], "ceil")
.try_as_basic_value() .try_as_basic_value()
.left() .left()
.unwrap(); .unwrap();

View File

@ -10,7 +10,6 @@ nac3parser = { path = "../nac3parser" }
nac3core = { path = "../nac3core" } nac3core = { path = "../nac3core" }
[dependencies.inkwell] [dependencies.inkwell]
git = "https://github.com/TheDan64/inkwell" version = "0.1.0-beta.4"
branch = "master"
default-features = false default-features = false
features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"] features = ["llvm12-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]