forked from AbleOS/holey-bytes
removing some useless stuff
This commit is contained in:
parent
bfc92431ea
commit
7f3984ad9a
|
@ -14,7 +14,6 @@ target-lexicon = "0.12.16"
|
||||||
[features]
|
[features]
|
||||||
default = ["isle-errors"]
|
default = ["isle-errors"]
|
||||||
unwind = []
|
unwind = []
|
||||||
isle-in-source-tree = []
|
|
||||||
isle-errors = []
|
isle-errors = []
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
|
|
116
hbcb/build.rs
116
hbcb/build.rs
|
@ -1,19 +1,3 @@
|
||||||
// Build script.
|
|
||||||
//
|
|
||||||
// This program is run by Cargo when building cranelift-codegen. It is used to generate Rust code from
|
|
||||||
// the language definitions in the cranelift-codegen/meta directory.
|
|
||||||
//
|
|
||||||
// Environment:
|
|
||||||
//
|
|
||||||
// OUT_DIR
|
|
||||||
// Directory where generated files should be placed.
|
|
||||||
//
|
|
||||||
// TARGET
|
|
||||||
// Target triple provided by Cargo.
|
|
||||||
//
|
|
||||||
// The build script expects to be run from the directory where this build.rs file lives. The
|
|
||||||
// current directory is used to find the sources.
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
cranelift_codegen_meta::{self as meta, isle::IsleCompilations},
|
cranelift_codegen_meta::{self as meta, isle::IsleCompilations},
|
||||||
cranelift_isle::error::Errors,
|
cranelift_isle::error::Errors,
|
||||||
|
@ -26,49 +10,16 @@ fn main() {
|
||||||
|
|
||||||
let out_dir = env::var("OUT_DIR").expect("The OUT_DIR environment variable must be set");
|
let out_dir = env::var("OUT_DIR").expect("The OUT_DIR environment variable must be set");
|
||||||
let out_dir = std::path::Path::new(&out_dir);
|
let out_dir = std::path::Path::new(&out_dir);
|
||||||
//let target_triple = env::var("TARGET").expect("The TARGET environment variable must be set");
|
|
||||||
|
|
||||||
//let all_arch = env::var("CARGO_FEATURE_ALL_ARCH").is_ok();
|
|
||||||
//let all_native_arch = env::var("CARGO_FEATURE_ALL_NATIVE_ARCH").is_ok();
|
|
||||||
|
|
||||||
let isas = &[meta::isa::Isa::Riscv64];
|
let isas = &[meta::isa::Isa::Riscv64];
|
||||||
|
|
||||||
// let mut isas = meta::isa::Isa::all()
|
|
||||||
// .iter()
|
|
||||||
// .cloned()
|
|
||||||
// .filter(|isa| {
|
|
||||||
// let env_key = format!("CARGO_FEATURE_{}", isa.to_string().to_uppercase());
|
|
||||||
// all_arch || env::var(env_key).is_ok()
|
|
||||||
// })
|
|
||||||
// .collect::<Vec<_>>();
|
|
||||||
|
|
||||||
// Don't require host isa if under 'all-arch' feature.
|
|
||||||
//let host_isa = env::var("CARGO_FEATURE_HOST_ARCH").is_ok() && !all_native_arch;
|
|
||||||
|
|
||||||
//if isas.is_empty() || host_isa {
|
|
||||||
// // Try to match native target.
|
|
||||||
// let target_name = target_triple.split('-').next().unwrap();
|
|
||||||
// let isa = meta::isa_from_arch(target_name).expect("error when identifying target");
|
|
||||||
// println!("cargo:rustc-cfg=feature=\"{isa}\"");
|
|
||||||
// isas.push(isa);
|
|
||||||
//}
|
|
||||||
|
|
||||||
let cur_dir = env::current_dir().expect("Can't access current working directory");
|
let cur_dir = env::current_dir().expect("Can't access current working directory");
|
||||||
let crate_dir = cur_dir.as_path();
|
let crate_dir = cur_dir.as_path();
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed=build.rs");
|
println!("cargo:rerun-if-changed=build.rs");
|
||||||
|
|
||||||
let explicit_isle_dir = &crate_dir.join("isle_generated_code");
|
let explicit_isle_dir = &crate_dir.join("isle_generated_code");
|
||||||
#[cfg(feature = "isle-in-source-tree")]
|
|
||||||
let isle_dir = explicit_isle_dir;
|
|
||||||
#[cfg(not(feature = "isle-in-source-tree"))]
|
|
||||||
let isle_dir = &out_dir;
|
let isle_dir = &out_dir;
|
||||||
|
|
||||||
#[cfg(feature = "isle-in-source-tree")]
|
|
||||||
{
|
|
||||||
std::fs::create_dir_all(isle_dir).expect("Could not create ISLE source directory");
|
|
||||||
}
|
|
||||||
#[cfg(not(feature = "isle-in-source-tree"))]
|
|
||||||
{
|
{
|
||||||
if explicit_isle_dir.is_dir() {
|
if explicit_isle_dir.is_dir() {
|
||||||
eprintln!(concat!(
|
eprintln!(concat!(
|
||||||
|
@ -133,9 +84,6 @@ fn main() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Strip the current directory from the file paths, because `islec`
|
|
||||||
/// includes them in the generated source, and this helps us maintain
|
|
||||||
/// deterministic builds that don't include those local file paths.
|
|
||||||
fn make_isle_source_path_relative(
|
fn make_isle_source_path_relative(
|
||||||
cur_dir: &std::path::Path,
|
cur_dir: &std::path::Path,
|
||||||
filename: &std::path::Path,
|
filename: &std::path::Path,
|
||||||
|
@ -155,66 +103,24 @@ fn build_isle(
|
||||||
let codegen_crate_dir = &make_isle_source_path_relative(&cur_dir, crate_dir);
|
let codegen_crate_dir = &make_isle_source_path_relative(&cur_dir, crate_dir);
|
||||||
let gen_dir = &make_isle_source_path_relative(&cur_dir, isle_dir);
|
let gen_dir = &make_isle_source_path_relative(&cur_dir, isle_dir);
|
||||||
|
|
||||||
// Preludes.
|
|
||||||
let clif_lower_isle = gen_dir.join("clif_lower.isle");
|
let clif_lower_isle = gen_dir.join("clif_lower.isle");
|
||||||
//let clif_opt_isle = gen_dir.join("clif_opt.isle");
|
|
||||||
let prelude_isle = codegen_crate_dir.join("src").join("prelude.isle");
|
let prelude_isle = codegen_crate_dir.join("src").join("prelude.isle");
|
||||||
//let prelude_opt_isle = codegen_crate_dir.join("src").join("prelude_opt.isle");
|
|
||||||
let prelude_lower_isle = codegen_crate_dir.join("src").join("prelude_lower.isle");
|
let prelude_lower_isle = codegen_crate_dir.join("src").join("prelude_lower.isle");
|
||||||
|
|
||||||
// Directory for mid-end optimizations.
|
|
||||||
//let src_opts = codegen_crate_dir.join("src").join("opts");
|
|
||||||
|
|
||||||
let src_isa_risc_v = codegen_crate_dir.join("src");
|
let src_isa_risc_v = codegen_crate_dir.join("src");
|
||||||
|
|
||||||
// This is a set of ISLE compilation units.
|
|
||||||
//
|
|
||||||
// The format of each entry is:
|
|
||||||
//
|
|
||||||
// (output Rust code file, input ISLE source files)
|
|
||||||
//
|
|
||||||
// There should be one entry for each backend that uses ISLE for lowering,
|
|
||||||
// and if/when we replace our peephole optimization passes with ISLE, there
|
|
||||||
// should be an entry for each of those as well.
|
|
||||||
//
|
|
||||||
// N.B.: add any new compilation outputs to
|
|
||||||
// `scripts/force-rebuild-isle.sh` if they do not fit the pattern
|
|
||||||
// `cranelift/codegen/src/isa/*/lower/isle/generated_code.rs`!
|
|
||||||
let isle_compilations = IsleCompilations {
|
let isle_compilations = IsleCompilations {
|
||||||
items: vec![
|
items: vec![IsleCompilation {
|
||||||
// // The mid-end optimization rules.
|
output: gen_dir.join("isle_riscv64.rs"),
|
||||||
// IsleCompilation {
|
inputs: vec![
|
||||||
// output: gen_dir.join("isle_opt.rs"),
|
prelude_isle.clone(),
|
||||||
// inputs: vec![
|
prelude_lower_isle.clone(),
|
||||||
// prelude_isle.clone(),
|
src_isa_risc_v.join("inst.isle"),
|
||||||
// prelude_opt_isle,
|
src_isa_risc_v.join("inst_vector.isle"),
|
||||||
// src_opts.join("arithmetic.isle"),
|
src_isa_risc_v.join("lower.isle"),
|
||||||
// src_opts.join("bitops.isle"),
|
],
|
||||||
// src_opts.join("cprop.isle"),
|
untracked_inputs: vec![clif_lower_isle.clone()],
|
||||||
// src_opts.join("extends.isle"),
|
}],
|
||||||
// src_opts.join("icmp.isle"),
|
|
||||||
// src_opts.join("remat.isle"),
|
|
||||||
// src_opts.join("selects.isle"),
|
|
||||||
// src_opts.join("shifts.isle"),
|
|
||||||
// src_opts.join("spaceship.isle"),
|
|
||||||
// src_opts.join("spectre.isle"),
|
|
||||||
// src_opts.join("vector.isle"),
|
|
||||||
// ],
|
|
||||||
// untracked_inputs: vec![clif_opt_isle],
|
|
||||||
// },
|
|
||||||
// The risc-v instruction selector.
|
|
||||||
IsleCompilation {
|
|
||||||
output: gen_dir.join("isle_riscv64.rs"),
|
|
||||||
inputs: vec![
|
|
||||||
prelude_isle.clone(),
|
|
||||||
prelude_lower_isle.clone(),
|
|
||||||
src_isa_risc_v.join("inst.isle"),
|
|
||||||
src_isa_risc_v.join("inst_vector.isle"),
|
|
||||||
src_isa_risc_v.join("lower.isle"),
|
|
||||||
],
|
|
||||||
untracked_inputs: vec![clif_lower_isle.clone()],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut had_error = false;
|
let mut had_error = false;
|
||||||
|
|
Loading…
Reference in a new issue