Added initial Rust codegen-meta implementation. (#403)

* Added initial Rust codegen-meta implementation.

* Replace 'Cretonne' in comments.

* Prevent iterator overflow.

* 1.25.0 compatibility changes.

* Implemented debug traits for type variants.

* Added consistent comments.

* Cleaned up a loop via clippy fix.

* Added new license to codegen-meta Cargo.toml

* Edited lane type iterator `next` method.

* Removed functions that are not needed in Rust, and edited desc.

* Debug trait derived for valuetype.

* Added comments for iterator types in the base types submodule.

* Numbering is now handled in the cdsl/types.rs file.

* Moved type number logic into cdsl/types.

* Repeating the lane change cleanup.

* Removed codegen-meta crate from codegen deps.

* Typo fix.

* Addressing a patch note.

* Addressing patch note.

* Lowercase in vector names.

* Fixing a comment bug.

* Added a copy of the license file.

* Formatting changes.

* Cleaned up the vector type numbering.

* 1.25 compatibility.

* Fixed pattern match arms.
This commit is contained in:
data-pup
2018-07-19 12:56:23 -04:00
committed by Dan Gohman
parent 7b290cd900
commit 06319b415a
13 changed files with 1460 additions and 1 deletions

View File

@@ -18,6 +18,8 @@
// 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.
extern crate cranelift_codegen_meta as meta;
use std::env;
use std::process;
@@ -66,12 +68,35 @@ fn main() {
.arg("-B")
.arg(build_script)
.arg("--out-dir")
.arg(out_dir)
.arg(out_dir.clone())
.status()
.expect("Failed to launch second-level build script; is python installed?");
if !status.success() {
process::exit(status.code().unwrap());
}
// DEVELOPMENT:
// ------------------------------------------------------------------------
// Now that the Python build process is complete, generate files that are
// emitted by the `cretonne_codegen_meta` crate.
// ------------------------------------------------------------------------
// Identify the directory of the Rust codegen-meta external crate.
let rust_meta_dir = crate_dir
.parent()
.map(|d| d.join("codegen-meta"))
.unwrap_or_else(|| {
eprintln!("Error: Could not find path to lib/codegen-meta crate.");
process::exit(1);
});
if let Err(err) = meta::gen_types::generate("new_types.rs", &out_dir) {
eprintln!("Error: {}", err);
process::exit(1);
} else if let Err(err) = meta::gen_build_deps::generate(&rust_meta_dir) {
eprintln!("Error: {}", err);
process::exit(1);
}
}
fn identify_python() -> &'static str {