This commit is contained in:
Edgar 2024-01-18 07:33:47 +01:00
parent bfad93ac5a
commit 54950fc2ad
No known key found for this signature in database
GPG key ID: 70ADAE8F35904387
5 changed files with 24 additions and 32 deletions

40
Cargo.lock generated
View file

@ -28,9 +28,9 @@ dependencies = [
[[package]] [[package]]
name = "anstream" name = "anstream"
version = "0.6.7" version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd2405b3ac1faab2990b74d728624cd9fd115651fcecc7c2d8daf01376275ba" checksum = "3fde6067df7359f2d6335ec1a50c1f8f825801687d10da0cc4c6b08e3f6afd15"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"anstyle-parse", "anstyle-parse",
@ -148,7 +148,7 @@ version = "0.66.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7"
dependencies = [ dependencies = [
"bitflags 2.4.1", "bitflags 2.4.2",
"cexpr", "cexpr",
"clang-sys", "clang-sys",
"lazy_static", "lazy_static",
@ -171,7 +171,7 @@ version = "0.68.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078"
dependencies = [ dependencies = [
"bitflags 2.4.1", "bitflags 2.4.2",
"cexpr", "cexpr",
"clang-sys", "clang-sys",
"lazy_static", "lazy_static",
@ -211,9 +211,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "2.4.1" version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]] [[package]]
name = "bumpalo" name = "bumpalo"
@ -258,9 +258,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.4.16" version = "4.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58e54881c004cec7895b0068a0a954cd5d62da01aef83fa35b1e594497bf5445" checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@ -268,9 +268,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.4.16" version = "4.4.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59cb82d7f531603d2fd1f507441cdd35184fa81beff7bd489570de7f773460bb" checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@ -702,9 +702,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.3.3" version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f"
[[package]] [[package]]
name = "home" name = "home"
@ -838,7 +838,7 @@ version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8"
dependencies = [ dependencies = [
"bitflags 2.4.1", "bitflags 2.4.2",
"libc", "libc",
"redox_syscall", "redox_syscall",
] ]
@ -860,9 +860,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
version = "0.4.12" version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
[[package]] [[package]]
name = "llvm-sys" name = "llvm-sys"
@ -937,9 +937,9 @@ dependencies = [
[[package]] [[package]]
name = "melior" name = "melior"
version = "0.15.0" version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "634f33663d2bcac794409829caf83a08967249e5429f34ec20c92230a85c025a" checksum = "878012ddccd6fdd099a4d98cebdecbaed9bc5eb325d0778ab9d4f4a52c67c18e"
dependencies = [ dependencies = [
"dashmap", "dashmap",
"melior-macro", "melior-macro",
@ -1137,9 +1137,9 @@ checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
version = "0.3.28" version = "0.3.29"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb"
[[package]] [[package]]
name = "plist" name = "plist"
@ -1298,7 +1298,7 @@ version = "0.38.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca"
dependencies = [ dependencies = [
"bitflags 2.4.1", "bitflags 2.4.2",
"errno", "errno",
"libc", "libc",
"linux-raw-sys", "linux-raw-sys",

View file

@ -16,7 +16,7 @@ edlang_ast = { version = "0.1.0", path = "../edlang_ast" }
edlang_parser = { version = "0.1.0", path = "../edlang_parser" } edlang_parser = { version = "0.1.0", path = "../edlang_parser" }
edlang_session = { version = "0.1.0", path = "../edlang_session" } edlang_session = { version = "0.1.0", path = "../edlang_session" }
llvm-sys = "170.0.1" llvm-sys = "170.0.1"
melior = { version = "0.15.0", features = ["ods-dialects"] } melior = { version = "0.15.2", features = ["ods-dialects"] }
mlir-sys = "0.2.1" mlir-sys = "0.2.1"
tracing = { workspace = true } tracing = { workspace = true }

View file

@ -14,13 +14,12 @@ use melior::{
ir::{ ir::{
attribute::{FlatSymbolRefAttribute, IntegerAttribute, StringAttribute, TypeAttribute}, attribute::{FlatSymbolRefAttribute, IntegerAttribute, StringAttribute, TypeAttribute},
r#type::{FunctionType, IntegerType, MemRefType}, r#type::{FunctionType, IntegerType, MemRefType},
Attribute, Block, BlockRef, Location, Module as MeliorModule, Region, Type, TypeLike, Attribute, Block, BlockRef, Location, Module as MeliorModule, Region, Type, Value,
Value, ValueLike, ValueLike,
}, },
Context as MeliorContext, Context as MeliorContext,
}; };
use crate::util::call_site;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct LocalVar<'ctx, 'parent: 'ctx> { pub struct LocalVar<'ctx, 'parent: 'ctx> {
pub ast_type: edlang_ast::Type, pub ast_type: edlang_ast::Type,
@ -645,7 +644,7 @@ fn compile_fn_call<'ctx, 'parent: 'ctx>(
&info.name.name, &info.name.name,
get_location(context, session, scope_ctx.function.unwrap().span.lo), get_location(context, session, scope_ctx.function.unwrap().span.lo),
); );
let location = call_site(location_callee, location_caller); let location = Location::call_site(location_callee, location_caller);
let target_fn = scope_ctx let target_fn = scope_ctx
.functions .functions

View file

@ -32,7 +32,6 @@ pub mod codegen;
mod context; mod context;
mod ffi; mod ffi;
pub mod linker; pub mod linker;
mod util;
pub fn compile(session: &Session, program: &Module) -> Result<PathBuf, Box<dyn std::error::Error>> { pub fn compile(session: &Session, program: &Module) -> Result<PathBuf, Box<dyn std::error::Error>> {
let context = Context::new(); let context = Context::new();

View file

@ -1,6 +0,0 @@
use melior::{ir::Location, Context};
use mlir_sys::mlirLocationCallSiteGet;
pub fn call_site<'c>(callee: Location<'c>, caller: Location<'c>) -> Location<'c> {
unsafe { Location::from_raw(mlirLocationCallSiteGet(callee.to_raw(), caller.to_raw())) }
}