forked from M-Labs/nac3
1
0
Fork 0

nac3core: expose inkwell and nac3parser

This commit is contained in:
Sebastien Bourdeauducq 2024-09-06 11:06:26 +08:00
parent a3c624d69d
commit 668ccb1c95
10 changed files with 16 additions and 28 deletions

4
Cargo.lock generated
View File

@ -594,11 +594,9 @@ dependencies = [
name = "nac3artiq"
version = "0.1.0"
dependencies = [
"inkwell",
"itertools 0.13.0",
"nac3core",
"nac3ld",
"nac3parser",
"parking_lot",
"pyo3",
"tempfile",
@ -661,9 +659,7 @@ name = "nac3standalone"
version = "0.1.0"
dependencies = [
"clap",
"inkwell",
"nac3core",
"nac3parser",
"parking_lot",
]

View File

@ -13,15 +13,9 @@ itertools = "0.13"
pyo3 = { version = "0.21", features = ["extension-module", "gil-refs"] }
parking_lot = "0.12"
tempfile = "3.10"
nac3parser = { path = "../nac3parser" }
nac3core = { path = "../nac3core" }
nac3ld = { path = "../nac3ld" }
[dependencies.inkwell]
version = "0.4"
default-features = false
features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]
[features]
init-llvm-profile = []
no-escape-analysis = ["nac3core/no-escape-analysis"]

View File

@ -15,9 +15,9 @@ use nac3core::{
typecheck::typedef::{iter_type_vars, FunSignature, FuncArg, Type, TypeEnum, VarMap},
};
use nac3parser::ast::{Expr, ExprKind, Located, Stmt, StmtKind, StrRef};
use nac3core::nac3parser::ast::{Expr, ExprKind, Located, Stmt, StmtKind, StrRef};
use inkwell::{
use nac3core::inkwell::{
context::Context,
module::Linkage,
types::{BasicType, IntType},
@ -32,7 +32,7 @@ use pyo3::{
use crate::{symbol_resolver::InnerResolver, timeline::TimeFns};
use inkwell::values::IntValue;
use nac3core::inkwell::values::IntValue;
use itertools::Itertools;
use std::{
collections::{hash_map::DefaultHasher, HashMap},

View File

@ -23,7 +23,7 @@ use std::process::Command;
use std::rc::Rc;
use std::sync::Arc;
use inkwell::{
use nac3core::inkwell::{
context::Context,
memory_buffer::MemoryBuffer,
module::{Linkage, Module},
@ -36,7 +36,7 @@ use itertools::Itertools;
use nac3core::codegen::{gen_func_impl, CodeGenLLVMOptions, CodeGenTargetMachineOptions};
use nac3core::toplevel::builtins::get_exn_constructor;
use nac3core::typecheck::typedef::{into_var_map, TypeEnum, Unifier, VarMap};
use nac3parser::{
use nac3core::nac3parser::{
ast::{ExprKind, Stmt, StmtKind, StrRef},
parser::parse_program,
};

View File

@ -1,5 +1,5 @@
use crate::PrimitivePythonId;
use inkwell::{
use nac3core::inkwell::{
module::Linkage,
types::{BasicType, BasicTypeEnum},
values::BasicValueEnum,
@ -22,7 +22,7 @@ use nac3core::{
typedef::{into_var_map, iter_type_vars, Type, TypeEnum, TypeVar, Unifier, VarMap},
},
};
use nac3parser::ast::{self, StrRef};
use nac3core::nac3parser::ast::{self, StrRef};
use parking_lot::RwLock;
use pyo3::{
types::{PyDict, PyTuple},

View File

@ -1,4 +1,4 @@
use inkwell::{
use nac3core::inkwell::{
values::{BasicValueEnum, CallSiteValue},
AddressSpace, AtomicOrdering,
};

View File

@ -19,6 +19,10 @@
clippy::wildcard_imports
)]
// users of nac3core need to use the same version of these dependencies, so expose them as nac3core::*
pub use inkwell;
pub use nac3parser;
pub mod codegen;
pub mod symbol_resolver;
pub mod toplevel;

View File

@ -9,14 +9,8 @@ no-escape-analysis = ["nac3core/no-escape-analysis"]
[dependencies]
parking_lot = "0.12"
nac3parser = { path = "../nac3parser" }
nac3core = { path = "../nac3core" }
[dependencies.clap]
version = "4.5"
features = ["derive"]
[dependencies.inkwell]
version = "0.4"
default-features = false
features = ["llvm14-0", "target-x86", "target-arm", "target-riscv", "no-libffi-linking"]

View File

@ -7,7 +7,7 @@ use nac3core::{
typedef::{Type, Unifier},
},
};
use nac3parser::ast::{self, StrRef};
use nac3core::nac3parser::ast::{self, StrRef};
use parking_lot::{Mutex, RwLock};
use std::collections::HashSet;
use std::{collections::HashMap, sync::Arc};

View File

@ -9,8 +9,8 @@
#![allow(clippy::too_many_lines, clippy::wildcard_imports)]
use clap::Parser;
use inkwell::context::Context;
use inkwell::{
use nac3core::inkwell::context::Context;
use nac3core::inkwell::{
memory_buffer::MemoryBuffer, passes::PassBuilderOptions, support::is_multithreaded, targets::*,
OptimizationLevel,
};
@ -31,7 +31,7 @@ use nac3core::{
typedef::{FunSignature, Type, Unifier, VarMap},
},
};
use nac3parser::{
use nac3core::nac3parser::{
ast::{Constant, Expr, ExprKind, StmtKind, StrRef},
parser,
};