mirror of
https://github.com/edg-l/edlang.git
synced 2024-11-22 16:08:24 +00:00
rename
This commit is contained in:
parent
0d7ab09531
commit
49a48995d5
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -325,7 +325,7 @@ dependencies = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "edlang_codegen_mlir"
|
name = "edlang_codegen_llvm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bumpalo",
|
"bumpalo",
|
||||||
|
@ -348,7 +348,7 @@ dependencies = [
|
||||||
"color-eyre",
|
"color-eyre",
|
||||||
"edlang_ast",
|
"edlang_ast",
|
||||||
"edlang_check",
|
"edlang_check",
|
||||||
"edlang_codegen_mlir",
|
"edlang_codegen_llvm",
|
||||||
"edlang_ir",
|
"edlang_ir",
|
||||||
"edlang_lowering",
|
"edlang_lowering",
|
||||||
"edlang_parser",
|
"edlang_parser",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
members = [ "bin/edlang", "lib/edlang_ast", "lib/edlang_check", "lib/edlang_codegen_mlir", "lib/edlang_driver", "lib/edlang_ir", "lib/edlang_lowering","lib/edlang_parser", "lib/edlang_session", "lib/edlang_span"]
|
members = [ "bin/edlang", "lib/edlang_ast", "lib/edlang_check", "lib/edlang_codegen_llvm", "lib/edlang_driver", "lib/edlang_ir", "lib/edlang_lowering","lib/edlang_parser", "lib/edlang_session", "lib/edlang_span"]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
[package]
|
[package]
|
||||||
name = "edlang_codegen_mlir"
|
name = "edlang_codegen_llvm"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Edgar Luque <edgar@edgarluque.com>"]
|
authors = ["Edgar Luque <edgar@edgarluque.com>"]
|
||||||
description = "edlang MLIR codegen"
|
description = "edlang LLVM codegen"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
keywords = ["llvm", "compiler"]
|
keywords = ["llvm", "compiler"]
|
||||||
license = "AGPL-3.0-only"
|
license = "AGPL-3.0-only"
|
|
@ -8,8 +8,7 @@ use inkwell::{
|
||||||
builder::{Builder, BuilderError},
|
builder::{Builder, BuilderError},
|
||||||
context::Context,
|
context::Context,
|
||||||
debug_info::{
|
debug_info::{
|
||||||
AsDIScope, DICompileUnit, DIFile, DIFlagsConstants, DILexicalBlock, DILocation, DIScope,
|
AsDIScope, DICompileUnit, DIFlagsConstants, DILocation, DIScope, DIType, DebugInfoBuilder,
|
||||||
DISubprogram, DIType, DebugInfoBuilder,
|
|
||||||
},
|
},
|
||||||
module::Module,
|
module::Module,
|
||||||
targets::{InitializationConfig, Target, TargetData, TargetMachine},
|
targets::{InitializationConfig, Target, TargetData, TargetMachine},
|
|
@ -1,16 +0,0 @@
|
||||||
use std::env::var;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let mlir_path = var("MLIR_SYS_170_PREFIX").expect("MLIR path should be set.");
|
|
||||||
|
|
||||||
cc::Build::new()
|
|
||||||
.cpp(true)
|
|
||||||
.flag("-std=c++17")
|
|
||||||
.flag_if_supported("-Wno-unused-parameter")
|
|
||||||
.flag_if_supported("-Wno-comment")
|
|
||||||
.include(&format!("{mlir_path}/include"))
|
|
||||||
.file("src/wrappers.cpp")
|
|
||||||
.compile("ffi");
|
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed=src/wrappers.cpp");
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
#include <llvm-c/Support.h>
|
|
||||||
#include <llvm/IR/LLVMContext.h>
|
|
||||||
#include <llvm/IR/Module.h>
|
|
||||||
#include <mlir/CAPI/IR.h>
|
|
||||||
#include <mlir/CAPI/Support.h>
|
|
||||||
#include <mlir/CAPI/Wrap.h>
|
|
||||||
#include <mlir/Dialect/LLVMIR/LLVMTypes.h>
|
|
||||||
#include <mlir/IR/Types.h>
|
|
||||||
#include <mlir/Target/LLVMIR/ModuleTranslation.h>
|
|
||||||
|
|
||||||
extern "C" LLVMModuleRef mlirTranslateModuleToLLVMIR(MlirOperation module,
|
|
||||||
LLVMContextRef context) {
|
|
||||||
mlir::Operation *moduleOp = unwrap(module);
|
|
||||||
|
|
||||||
llvm::LLVMContext *ctx = llvm::unwrap(context);
|
|
||||||
|
|
||||||
std::unique_ptr<llvm::Module> llvmModule = mlir::translateModuleToLLVMIR(
|
|
||||||
moduleOp, *ctx);
|
|
||||||
|
|
||||||
LLVMModuleRef moduleRef = llvm::wrap(llvmModule.release());
|
|
||||||
|
|
||||||
return moduleRef;
|
|
||||||
}
|
|
|
@ -16,7 +16,7 @@ clap = { version = "4.4.16", features = ["derive"] }
|
||||||
color-eyre = "0.6.2"
|
color-eyre = "0.6.2"
|
||||||
edlang_ast = { version = "0.1.0", path = "../edlang_ast" }
|
edlang_ast = { version = "0.1.0", path = "../edlang_ast" }
|
||||||
edlang_check = { version = "0.1.0", path = "../edlang_check" }
|
edlang_check = { version = "0.1.0", path = "../edlang_check" }
|
||||||
edlang_codegen_mlir = { version = "0.1.0", path = "../edlang_codegen_mlir" }
|
edlang_codegen_llvm = { version = "0.1.0", path = "../edlang_codegen_llvm" }
|
||||||
edlang_ir = { version = "0.1.0", path = "../edlang_ir" }
|
edlang_ir = { version = "0.1.0", path = "../edlang_ir" }
|
||||||
edlang_lowering = { version = "0.1.0", path = "../edlang_lowering" }
|
edlang_lowering = { version = "0.1.0", path = "../edlang_lowering" }
|
||||||
edlang_parser = { version = "0.1.0", path = "../edlang_parser" }
|
edlang_parser = { version = "0.1.0", path = "../edlang_parser" }
|
||||||
|
|
|
@ -2,7 +2,7 @@ use std::{error::Error, path::PathBuf, time::Instant};
|
||||||
|
|
||||||
use ariadne::Source;
|
use ariadne::Source;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use edlang_codegen_mlir::linker::{link_binary, link_shared_lib};
|
use edlang_codegen_llvm::linker::{link_binary, link_shared_lib};
|
||||||
use edlang_lowering::lower_modules;
|
use edlang_lowering::lower_modules;
|
||||||
use edlang_session::{DebugInfo, OptLevel, Session};
|
use edlang_session::{DebugInfo, OptLevel, Session};
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ pub fn main() -> Result<(), Box<dyn Error>> {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let object_path = edlang_codegen_mlir::compile(&session, &program_ir)?;
|
let object_path = edlang_codegen_llvm::compile(&session, &program_ir)?;
|
||||||
|
|
||||||
if session.library {
|
if session.library {
|
||||||
link_shared_lib(&object_path, &session.output_file.with_extension("so"))?;
|
link_shared_lib(&object_path, &session.output_file.with_extension("so"))?;
|
||||||
|
|
Loading…
Reference in a new issue