cranelift_codegen_meta/
isle.rs#[derive(Clone, Debug)]
pub struct IsleCompilations {
pub items: Vec<IsleCompilation>,
}
impl IsleCompilations {
pub fn lookup(&self, name: &str) -> Option<&IsleCompilation> {
for compilation in &self.items {
if compilation.name == name {
return Some(compilation);
}
}
None
}
}
#[derive(Clone, Debug)]
pub struct IsleCompilation {
pub name: String,
pub output: std::path::PathBuf,
pub inputs: Vec<std::path::PathBuf>,
pub untracked_inputs: Vec<std::path::PathBuf>,
}
impl IsleCompilation {
pub fn inputs(&self) -> Vec<std::path::PathBuf> {
self.inputs
.iter()
.chain(self.untracked_inputs.iter())
.cloned()
.collect()
}
}
pub fn shared_isle_lower_paths(codegen_crate_dir: &std::path::Path) -> Vec<std::path::PathBuf> {
let inst_specs_isle = codegen_crate_dir.join("src").join("inst_specs.isle");
let prelude_isle = codegen_crate_dir.join("src").join("prelude.isle");
let prelude_lower_isle = codegen_crate_dir.join("src").join("prelude_lower.isle");
vec![
inst_specs_isle.clone(),
prelude_isle.clone(),
prelude_lower_isle.clone(),
]
}
pub fn get_isle_compilations(
codegen_crate_dir: &std::path::Path,
gen_dir: &std::path::Path,
) -> IsleCompilations {
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_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 src_opts = codegen_crate_dir.join("src").join("opts");
let src_isa_x64 = codegen_crate_dir.join("src").join("isa").join("x64");
let src_isa_aarch64 = codegen_crate_dir.join("src").join("isa").join("aarch64");
let src_isa_s390x = codegen_crate_dir.join("src").join("isa").join("s390x");
let src_isa_risc_v = codegen_crate_dir.join("src").join("isa").join("riscv64");
let src_isa_pulley_shared = codegen_crate_dir
.join("src")
.join("isa")
.join("pulley_shared");
IsleCompilations {
items: vec![
IsleCompilation {
name: "opt".to_string(),
output: gen_dir.join("isle_opt.rs"),
inputs: vec![
prelude_isle.clone(),
prelude_opt_isle,
src_opts.join("arithmetic.isle"),
src_opts.join("bitops.isle"),
src_opts.join("cprop.isle"),
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],
},
IsleCompilation {
name: "x64".to_string(),
output: gen_dir.join("isle_x64.rs"),
inputs: vec![
prelude_isle.clone(),
prelude_lower_isle.clone(),
src_isa_x64.join("inst.isle"),
src_isa_x64.join("lower.isle"),
],
untracked_inputs: vec![clif_lower_isle.clone()],
},
IsleCompilation {
name: "aarch64".to_string(),
output: gen_dir.join("isle_aarch64.rs"),
inputs: vec![
prelude_isle.clone(),
prelude_lower_isle.clone(),
src_isa_aarch64.join("inst.isle"),
src_isa_aarch64.join("inst_neon.isle"),
src_isa_aarch64.join("lower.isle"),
src_isa_aarch64.join("lower_dynamic_neon.isle"),
],
untracked_inputs: vec![clif_lower_isle.clone()],
},
IsleCompilation {
name: "s390x".to_string(),
output: gen_dir.join("isle_s390x.rs"),
inputs: vec![
prelude_isle.clone(),
prelude_lower_isle.clone(),
src_isa_s390x.join("inst.isle"),
src_isa_s390x.join("lower.isle"),
],
untracked_inputs: vec![clif_lower_isle.clone()],
},
IsleCompilation {
name: "riscv64".to_string(),
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()],
},
IsleCompilation {
name: "pulley".to_string(),
output: gen_dir.join("isle_pulley_shared.rs"),
inputs: vec![
prelude_isle.clone(),
prelude_lower_isle.clone(),
src_isa_pulley_shared.join("inst.isle"),
src_isa_pulley_shared.join("lower.isle"),
],
untracked_inputs: vec![clif_lower_isle.clone()],
},
],
}
}