From 92b14263a48ede02690e5a508d2c5ca171682b52 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Sat, 14 Jul 2018 11:59:42 +0200 Subject: [PATCH] Update to cranelift 0.14 --- Cargo.lock | 529 ++++++++------------------------------------- Cargo.toml | 10 +- build.sh | 4 +- src/base.rs | 18 +- src/common.rs | 20 +- src/lib.rs | 38 ++-- src/pretty_clif.rs | 34 +++ 7 files changed, 181 insertions(+), 472 deletions(-) create mode 100644 src/pretty_clif.rs diff --git a/Cargo.lock b/Cargo.lock index ac4d0c22320..d14ac70b2db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,36 +1,10 @@ -[[package]] -name = "aho-corasick" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "atty" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "backtrace" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -45,11 +19,6 @@ dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "bitflags" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "bitflags" version = "1.0.3" @@ -62,98 +31,71 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cfg-if" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "clap" -version = "2.31.2" +name = "cranelift" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-frontend 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "cretonne" -version = "0.12.0" +name = "cranelift-codegen" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cretonne-codegen 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cretonne-frontend 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cretonne-codegen" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cretonne-entity 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "cretonne-entity" -version = "0.12.0" +name = "cranelift-entity" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "cretonne-faerie" -version = "0.12.0" +name = "cranelift-frontend" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cretonne-codegen 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cretonne-module 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "faerie 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "goblin 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "cretonne-frontend" -version = "0.12.0" +name = "cranelift-module" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cretonne-codegen 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "cretonne-module" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cretonne-codegen 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cretonne-entity 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-entity 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "cretonne-native" -version = "0.12.0" +name = "cranelift-native" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cretonne-codegen 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "raw-cpuid 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "raw-cpuid 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "cretonne-simplejit" -version = "0.12.0" +name = "cranelift-simplejit" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cretonne-codegen 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cretonne-module 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cretonne-native 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "errno 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-codegen 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-module 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-native 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "region 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -165,43 +107,23 @@ name = "dtoa" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "env_logger" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "errno" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "faerie" -version = "0.4.2" +name = "errno-dragonfly" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "goblin 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)", - "indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "scroll 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "string-interner 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", - "target-lexicon 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -209,7 +131,7 @@ name = "failure" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -224,36 +146,8 @@ dependencies = [ ] [[package]] -name = "goblin" -version = "0.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "scroll 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "goblin" -version = "0.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "scroll 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "humantime" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "indexmap" -version = "1.0.1" +name = "gcc" +version = "0.3.54" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -261,41 +155,11 @@ name = "itoa" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lazy_static" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "libc" version = "0.2.42" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "log" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "mach" version = "0.1.2" @@ -304,19 +168,6 @@ dependencies = [ "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "memchr" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "plain" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "proc-macro2" version = "0.4.6" @@ -325,11 +176,6 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "quick-error" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "quote" version = "0.3.15" @@ -345,44 +191,14 @@ dependencies = [ [[package]] name = "raw-cpuid" -version = "3.1.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "redox_syscall" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "redox_termios" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "regex-syntax" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.68 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -391,7 +207,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "errno 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", "mach 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -404,95 +220,58 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "rustc_codegen_cretonne" +name = "rustc_codegen_cranelift" version = "0.1.0" dependencies = [ - "cretonne 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cretonne-faerie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cretonne-module 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cretonne-simplejit 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-module 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cranelift-simplejit 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "scroll" -version = "0.8.0" +name = "rustc_version" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "scroll_derive 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "scroll" +name = "semver" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "scroll_derive 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "scroll_derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "scroll_derive" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde" -version = "1.0.66" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde_json" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "string-interner" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "strsim" +name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "structopt" -version = "0.2.10" +name = "serde" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "structopt-derive" -version = "0.2.10" +name = "serde_derive" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "serde_json" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.68 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -507,7 +286,7 @@ dependencies = [ [[package]] name = "syn" -version = "0.14.2" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -539,54 +318,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "termcolor" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "termion" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "textwrap" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ucd-util" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-width" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-xid" version = "0.0.4" @@ -597,34 +331,6 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "unreachable" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "utf8-ranges" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "vec_map" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "winapi" version = "0.3.5" @@ -634,11 +340,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -649,93 +350,47 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "wincolor" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [metadata] -"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" -"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2fc4a1aa4c24c0718a250f0681885c1af91419d242f29eb8f2ab28502d80dbd1" -"checksum backtrace 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dbdd17cd962b570302f5297aea8648d5923e22e555c2ed2d8b2e34eca646bf6d" +"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" "checksum backtrace-sys 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)" = "bff67d0c06556c0b8e6b5f090f0eac52d950d9dfd1d35ba04e4ca3543eaf6a7e" -"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" "checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789" "checksum cc 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "49ec142f5768efb5b7622aebc3fdbdbb8950a4b9ba996393cb76ef7466e8747d" -"checksum cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18" -"checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536" -"checksum cretonne 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "03610d69c786a211347d0be3f7da59cb03b025ef2cd83f66ea98103728f42ecc" -"checksum cretonne-codegen 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e7e43ab7952e998ea8da4bcda3b53d398396b9b691df44a040be5486a4935ef" -"checksum cretonne-entity 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4109dcfc0c7b8e11ad92a702d3f5df435d2782012118aa75566d2d0db586da3a" -"checksum cretonne-faerie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e8d665b4ac93c254f79e861696db5a1297133c8c8603e5cd06b26250568a9cb0" -"checksum cretonne-frontend 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e0238865d537393f73598542a906dadfe85fcf070c293cdf882ece170d197455" -"checksum cretonne-module 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "232354804f19cb12bf2ac6f715d26df81a7242b3693a1a6cd2774ff89311e283" -"checksum cretonne-native 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "66d768de850f29bbb2cda9eeed168369c66263bee9068ca1b9af28000216116c" -"checksum cretonne-simplejit 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "54d9e73a7f5bb0529be747a86a164e087c96edfd89e30b6d6f92653b70fc9943" +"checksum cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efe5c877e17a9c717a0bf3613b2709f723202c4e4675cc8f12926ded29bcb17e" +"checksum cranelift 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8bd8d55e2609a5b03377e1fb0919d57e8eda4f7c29dc55b665d4c2f17e9f109" +"checksum cranelift-codegen 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01eb8fe68d2c0b98fef2ec1f618eaa6d73e691b0451a1b42d9f822924ebb7848" +"checksum cranelift-entity 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ae4f5796a9618786ddc8e8ec2c879a0e43e611b924657dc0929f475bf7efd6d4" +"checksum cranelift-frontend 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1ef7683f7517b08df0d0c90b615cb9be361bc394f03b6117d51f7be83db21c2" +"checksum cranelift-module 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05ac4232a9fac77aa7d29ae713ae7817e3efa730f007c0f528a279cd68a6824d" +"checksum cranelift-native 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb9bfdcca2c05a260408ca018846cd4b8ad87c5eea1623627f97d34cf82c2b31" +"checksum cranelift-simplejit 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01d1587398fde1c2970a1da7fe9ac687bdcad39bb398bea9ae08276153390c55" "checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab" -"checksum env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)" = "0e6e40ebb0e66918a37b38c7acab4e10d299e0463fe2af5d29b9cc86710cfd2a" -"checksum errno 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b2c858c42ac0b88532f48fca88b0ed947cad4f1f64d904bcd6c9f138f7b95d70" -"checksum faerie 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ffaaaa682748ec082a384edbf1d468ce10ad1b39dcfa3a8c3c0dbc5e6cff754c" +"checksum errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a071601ed01b988f896ab14b95e67335d1eeb50190932a1320f7fe3cadc84e" +"checksum errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" "checksum failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "934799b6c1de475a012a02dab0ace1ace43789ee4b99bcfbf1a2e3e8ced5de82" "checksum failure_derive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7cdda555bb90c9bb67a3b670a0f42de8e73f5981524123ad8578aafec8ddb8b" -"checksum goblin 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2a5fea7ad351be7398e08003ea92a16bbba9a23c2a0c95d4e37d178276508217" -"checksum goblin 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5e3ba9fec4dc9a09553388bff2724d3bf06bd64013539f2d3e1e3838eefb310a" -"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" -"checksum indexmap 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08173ba1e906efb6538785a8844dd496f5d34f0a2d88038e95195172fc667220" +"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb" "checksum itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c069bbec61e1ca5a596166e55dfe4773ff745c3d16b700013bcaff9a6df2c682" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e6412c5e2ad9584b0b8e979393122026cdd6d2a80b933f890dcd694ddbe73739" "checksum libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b685088df2b950fccadf07a7187c8ef846a959c142338a48f9dc0b94517eb5f1" -"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -"checksum log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6fddaa003a65722a7fb9e26b0ce95921fe4ba590542ced664d8ce2fa26f9f3ac" "checksum mach 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2fd13ee2dd61cc82833ba05ade5a30bb3d63f7ced605ef827063c63078302de9" -"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d" -"checksum plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" "checksum proc-macro2 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "effdb53b25cdad54f8f48843d67398f7ef2e14f12c1b4cb4effc549a6462a4d6" -"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035" -"checksum raw-cpuid 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "233ec1847057cf4d4591a0d76908aa12812140b11ea7d7d05b4c38cadb069c31" -"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" -"checksum regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75ecf88252dce580404a22444fc7d626c01815debba56a7f4f536772a5ff19d3" -"checksum regex-syntax 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05b06a75f5217880fc5e905952a42750bf44787e56a6c6d6852ed0992f5e1d54" +"checksum raw-cpuid 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "90e0d3209fac374e168cef2d8806dde7b31ef0ee82a965bcc0bec562c078a6f5" "checksum region 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3f9d3f2bb4b7085e6996e2765b56b783bd8f3a8a4ea5b95683063ca13cded993" "checksum rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "76d7ba1feafada44f2d38eed812bd2489a03c0f5abb975799251518b68848649" -"checksum scroll 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b13864e1e0b3ed661d7206d512b8d1c4970f7fd9de23ae4e9b4331f0c25559e8" -"checksum scroll 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "66f024a8cc5e456eb870f688dbd899c84f61190c82c7a911e40f926941969074" -"checksum scroll_derive 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2a67086db2a44e94311fc4c02ec3f4751bda0fca9d87fd4e1bfe1cef55e9411d" -"checksum scroll_derive 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f9a353f5dd99e42ff097d5a61db3257aa2c7127d76a3fa8287b642ef9ae0f7c5" -"checksum serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)" = "e9a2d9a9ac5120e0f768801ca2b58ad6eec929dc9d1d616c162f208869c2ce95" -"checksum serde_json 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "fc97cccc2959f39984524026d760c08ef0dd5f0f5948c8d31797dbfae458c875" -"checksum string-interner 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "abb38a0d8fe673c40b10b6b75abcb076a958cc10fb894f14993d9737c4c87000" -"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" -"checksum structopt 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8e9ad6a11096cbecdcca0cc6aa403fdfdbaeda2fb3323a39c98e6a166a1e45a" -"checksum structopt-derive 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4cbce8ccdc62166bd594c14396a3242bf94c337a51dbfa9be1076dd74b3db2af" +"checksum rustc_version 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a54aa04a10c68c1c4eacb4337fd883b435997ede17a9385784b990777686b09a" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum serde 1.0.68 (registry+https://github.com/rust-lang/crates.io-index)" = "429fcc4efa8a11341b5422c2ace724daba276c1748467e869478f53c0ba4562e" +"checksum serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)" = "3525a779832b08693031b8ecfb0de81cd71cfd3812088fafe9a7496789572124" +"checksum serde_json 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)" = "84b8035cabe9b35878adec8ac5fe03d5f6bc97ff6edd7ccb96b44c1276ba390e" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum syn 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c67da57e61ebc7b7b6fff56bb34440ca3a83db037320b0507af4c10368deda7d" +"checksum syn 0.14.4 (registry+https://github.com/rust-lang/crates.io-index)" = "2beff8ebc3658f07512a413866875adddd20f4fd47b2a4e6c9da65cd281baaea" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum synstructure 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a761d12e6d8dcb4dcf952a7a89b475e3a9d69e4a69307e01a470977642914bd" "checksum target-lexicon 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "71b0a95ba4eff593189d912039fba46ce6ca1876ea6c16830e15340919d0a250" -"checksum termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "adc4587ead41bf016f11af03e55a624c06568b5a19db4e90fde573d805074f83" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" -"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" -"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963" -"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122" -"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" -"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "773ef9dcc5f24b7d850d0ff101e542ff24c3b090a9768e03ff889fdef41f00fd" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767" diff --git a/Cargo.toml b/Cargo.toml index d1acda9c430..b2c212baedf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "rustc_codegen_cretonne" +name = "rustc_codegen_cranelift" version = "0.1.0" authors = ["bjorn3 "] @@ -7,7 +7,7 @@ authors = ["bjorn3 "] crate-type = ["dylib"] [dependencies] -cretonne = "0.12.0" -cretonne-module = "0.12.0" -cretonne-simplejit = "0.12.0" -cretonne-faerie = "0.12.0" +cranelift = "0.14.0" +cranelift-module = "0.14.0" +cranelift-simplejit = "0.14.0" +#cranelift-faerie = "0.14.0" diff --git a/build.sh b/build.sh index b4b58afbafe..8795292097e 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ cargo build || exit 1 -rustc -Zcodegen-backend=$(pwd)/target/debug/librustc_codegen_cretonne.so example.rs --crate-type lib -Og -rustc -Zcodegen-backend=$(pwd)/target/debug/librustc_codegen_cretonne.so ../rust/src/libcore/lib.rs --crate-type lib -Og +rustc -Zcodegen-backend=$(pwd)/target/debug/librustc_codegen_cranelift.dylib example.rs --crate-type lib -Og +rustc -Zcodegen-backend=$(pwd)/target/debug/librustc_codegen_cranelift.dylib ../rust_fork/src/libcore/lib.rs --crate-type lib -Og diff --git a/src/base.rs b/src/base.rs index 5b0aea73a63..29ec4c14d2c 100644 --- a/src/base.rs +++ b/src/base.rs @@ -27,17 +27,18 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend let mut f = Function::with_name_signature(ExternalName::user(0, func_id.index() as u32), sig); - ::base::trans_fn(cx, &mut f, inst); + let comments = ::base::trans_fn(cx, &mut f, inst); let mut cton = String::new(); - ::cretonne::codegen::write_function(&mut cton, &f, None).unwrap(); + ::cranelift::codegen::write_function(&mut cton, &f, None).unwrap(); tcx.sess.warn(&cton); let flags = settings::Flags::new(settings::builder()); - match ::cretonne::codegen::verify_function(&f, &flags) { + match ::cranelift::codegen::verify_function(&f, &flags) { Ok(_) => {} Err(err) => { - let pretty_error = ::cretonne::codegen::print_errors::pretty_verifier_error(&f, None, &err); + let writer = ::pretty_clif::CommentWriter(comments); + let pretty_error = ::cranelift::codegen::print_errors::pretty_verifier_error(&f, None, Some(Box::new(writer)), &err); tcx.sess.fatal(&format!("cretonne verify error:\n{}", pretty_error)); } } @@ -52,7 +53,7 @@ pub fn trans_mono_item<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend } } -pub fn trans_fn<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend>, f: &mut Function, instance: Instance<'tcx>) { +pub fn trans_fn<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend>, f: &mut Function, instance: Instance<'tcx>) -> HashMap { let mir = cx.tcx.optimized_mir(instance.def_id()); let mut func_ctx = FunctionBuilderContext::new(); let mut bcx: FunctionBuilder = FunctionBuilder::new(f, &mut func_ctx); @@ -77,6 +78,7 @@ pub fn trans_fn<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend>, f: & }, ebb_map, local_map: HashMap::new(), + comments: HashMap::new(), }; let fx = &mut fx; @@ -234,11 +236,13 @@ pub fn trans_fn<'a, 'tcx: 'a>(cx: &mut CodegenCx<'a, 'tcx, CurrentBackend>, f: & let mut terminator_head = "\n".to_string(); bb_data.terminator().kind.fmt_head(&mut terminator_head).unwrap(); - fx.bcx.func.comments[inst] = terminator_head; + fx.add_comment(inst, terminator_head); } fx.bcx.seal_all_blocks(); fx.bcx.finalize(); + + fx.comments.clone() } fn trans_stmt<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx>, stmt: &Statement<'tcx>) { @@ -426,7 +430,7 @@ fn trans_stmt<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx>, stmt: &Statement<'tcx let inst = fx.bcx.func.layout.next_inst(nop_inst).unwrap(); fx.bcx.func.layout.remove_inst(nop_inst); - fx.bcx.func.comments[inst] = format!("{:?}", stmt); + fx.add_comment(inst, format!("{:?}", stmt)); } fn trans_int_binop<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx>, bin_op: BinOp, lhs: Value, rhs: Value, ty: Ty<'tcx>, signed: bool, _checked: bool) -> CValue<'tcx> { diff --git a/src/common.rs b/src/common.rs index 2be8bf83751..ba922d16d30 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,13 +1,15 @@ extern crate rustc_target; +use std::borrow::Cow; + use syntax::ast::{IntTy, UintTy}; use self::rustc_target::spec::{HasTargetSpec, Target}; -use cretonne_module::{Module, Linkage, FuncId}; +use cranelift_module::{Module, Linkage, FuncId}; use prelude::*; -pub type CurrentBackend = ::cretonne_simplejit::SimpleJITBackend; +pub type CurrentBackend = ::cranelift_simplejit::SimpleJITBackend; #[derive(Debug, Copy, Clone, Eq, PartialEq)] pub struct Variable(Local); @@ -293,6 +295,7 @@ pub struct FunctionCx<'a, 'tcx: 'a> { pub bcx: FunctionBuilder<'a, Variable>, pub ebb_map: HashMap, pub local_map: HashMap>, + pub comments: HashMap, } impl<'a, 'tcx: 'a> LayoutOf for &'a FunctionCx<'a, 'tcx> { @@ -355,4 +358,17 @@ impl<'a, 'tcx: 'a> FunctionCx<'a, 'tcx> { }); module.declare_func_in_func(func_id, &mut self.bcx.func) } + + pub fn add_comment<'s, S: Into>>(&mut self, inst: Inst, comment: S) { + use std::collections::hash_map::Entry; + match self.comments.entry(inst) { + Entry::Occupied(mut occ) => { + occ.get_mut().push('\n'); + occ.get_mut().push_str(comment.into().as_ref()); + } + Entry::Vacant(vac) => { + vac.insert(comment.into().into_owned()); + } + } + } } diff --git a/src/lib.rs b/src/lib.rs index d37352b89e8..f1c47ddb7cf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,10 +9,10 @@ extern crate rustc_codegen_utils; extern crate rustc_incremental; extern crate rustc_data_structures; -extern crate cretonne; -extern crate cretonne_module; -extern crate cretonne_simplejit; -extern crate cretonne_faerie; +extern crate cranelift; +extern crate cranelift_module; +extern crate cranelift_simplejit; +//extern crate cranelift_faerie; use syntax::symbol::Symbol; use rustc::session::{ @@ -35,6 +35,7 @@ use std::io::Write; mod base; mod common; +mod pretty_clif; mod prelude { pub use std::any::Any; @@ -52,13 +53,13 @@ mod prelude { pub use rustc_data_structures::{indexed_vec::Idx, sync::Lrc}; pub use rustc_mir::monomorphize::{MonoItem, collector}; - pub use cretonne::codegen::ir::{ - condcodes::IntCC, function::Function, ExternalName, FuncRef, StackSlot, + pub use cranelift::codegen::ir::{ + condcodes::IntCC, function::Function, ExternalName, FuncRef, StackSlot, Inst }; - pub use cretonne::codegen::Context; - pub use cretonne::prelude::*; - pub use cretonne_module::{Module, Backend, FuncId, Linkage}; - pub use cretonne_simplejit::{SimpleJITBuilder, SimpleJITBackend}; + pub use cranelift::codegen::Context; + pub use cranelift::prelude::*; + pub use cranelift_module::{Module, Backend, FuncId, Linkage}; + pub use cranelift_simplejit::{SimpleJITBuilder, SimpleJITBackend}; pub use common::Variable; pub use common::*; @@ -74,21 +75,21 @@ pub struct CodegenCx<'a, 'tcx: 'a, B: Backend + 'a> { pub def_id_fn_id_map: &'a mut HashMap, FuncId>, } -struct CretonneCodegenBackend(()); +struct CraneliftCodegenBackend(()); struct OngoingCodegen { metadata: EncodedMetadata, - //translated_module: Module, + //translated_module: Module, crate_name: Symbol, } -impl CretonneCodegenBackend { +impl CraneliftCodegenBackend { fn new() -> Box { - Box::new(CretonneCodegenBackend(())) + Box::new(CraneliftCodegenBackend(())) } } -impl CodegenBackend for CretonneCodegenBackend { +impl CodegenBackend for CraneliftCodegenBackend { fn init(&self, sess: &Session) { for cty in sess.opts.crate_types.iter() { match *cty { @@ -118,7 +119,6 @@ impl CodegenBackend for CretonneCodegenBackend { }; providers.is_reachable_non_generic = |_tcx, _defid| true; providers.exported_symbols = |_tcx, _crate| Arc::new(Vec::new()); - providers.wasm_custom_sections = |_tcx, _crate| Lrc::new(Vec::new()); } fn provide_extern(&self, providers: &mut Providers) { providers.is_reachable_non_generic = |_tcx, _defid| true; @@ -213,7 +213,7 @@ impl CodegenBackend for CretonneCodegenBackend { Box::new(::OngoingCodegen { metadata: metadata, - //translated_module: Module::new(::cretonne_faerie::FaerieBuilder::new(, + //translated_module: Module::new(::cranelift_faerie::FaerieBuilder::new(, crate_name: tcx.crate_name(LOCAL_CRATE), }) } @@ -252,8 +252,8 @@ impl CodegenBackend for CretonneCodegenBackend { } } -/// This is the entrypoint for a hot plugged rustc_codegen_cretonne +/// This is the entrypoint for a hot plugged rustc_codegen_cranelift #[no_mangle] pub fn __rustc_codegen_backend() -> Box { - CretonneCodegenBackend::new() + CraneliftCodegenBackend::new() } diff --git a/src/pretty_clif.rs b/src/pretty_clif.rs new file mode 100644 index 00000000000..a3eb848f91a --- /dev/null +++ b/src/pretty_clif.rs @@ -0,0 +1,34 @@ +use std::collections::HashMap; +use std::fmt; + +use cranelift::codegen::{ + ir::{Function, Inst}, + FuncWriter, + PlainWriter, +}; +use cranelift::prelude::*; + +pub struct CommentWriter(pub HashMap); + +impl FuncWriter for CommentWriter { + fn write_instruction( + &mut self, + w: &mut dyn fmt::Write, + func: &Function, + isa: Option<&dyn isa::TargetIsa>, + inst: Inst, + indent: usize, + ) -> fmt::Result { + + PlainWriter.write_instruction(w, func, isa, inst, indent) + } + + fn write_preamble( + &mut self, + w: &mut dyn fmt::Write, + func: &Function, + reg_info: Option<&isa::RegInfo>, + ) -> Result { + PlainWriter.write_preamble(w, func, reg_info) + } +}