[build] Implement registers code generation in the Rust meta crate;
This commit is contained in:
committed by
Dan Gohman
parent
4f2d7dd54f
commit
b7f2acf0ea
@@ -24,7 +24,11 @@ use meta::isa::Isa;
|
||||
use std::env;
|
||||
use std::process;
|
||||
|
||||
use std::time::Instant;
|
||||
|
||||
fn main() {
|
||||
let start_time = Instant::now();
|
||||
|
||||
let out_dir = env::var("OUT_DIR").expect("The OUT_DIR environment variable must be set");
|
||||
let target_triple = env::var("TARGET").expect("The TARGET environment variable must be set");
|
||||
let cranelift_targets = env::var("CRANELIFT_TARGETS").ok();
|
||||
@@ -35,7 +39,7 @@ fn main() {
|
||||
match isa_targets(cranelift_targets, &target_triple) {
|
||||
Ok(isa_targets) => {
|
||||
for isa in &isa_targets {
|
||||
println!("cargo:rustc-cfg=build_{}", isa.name());
|
||||
println!("cargo:rustc-cfg=build_{}", isa.to_string());
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
@@ -44,8 +48,6 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
println!("Build script generating files in {}", out_dir);
|
||||
|
||||
let cur_dir = env::current_dir().expect("Can't access current working directory");
|
||||
let crate_dir = cur_dir.as_path();
|
||||
|
||||
@@ -81,10 +83,28 @@ fn main() {
|
||||
// Now that the Python build process is complete, generate files that are
|
||||
// emitted by the `meta` crate.
|
||||
// ------------------------------------------------------------------------
|
||||
let isas = meta::isa::define_all();
|
||||
|
||||
if let Err(err) = meta::gen_types::generate("types.rs", &out_dir) {
|
||||
eprintln!("Error: {}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
for isa in isas {
|
||||
if let Err(err) = meta::gen_registers::generate(isa, "new_registers", &out_dir) {
|
||||
eprintln!("Error: {}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
println!(
|
||||
"cargo:warning=Cranelift meta-build step took {:?}",
|
||||
Instant::now() - start_time
|
||||
);
|
||||
println!(
|
||||
"cargo:warning=Meta-build script generated files in {}",
|
||||
out_dir
|
||||
);
|
||||
}
|
||||
|
||||
fn identify_python() -> &'static str {
|
||||
|
||||
Reference in New Issue
Block a user