Bug 1522173: Bump Cranelift to 0.28; r=sunfish

--HG--
extra : rebase_source : 0f772aa20c592a46cfdbc83a64b218a4568ff28d
extra : histedit_source : 7148969780d2ba4fb5aeecdcb413855a4babef33
This commit is contained in:
Benjamin Bouvier 2019-01-24 10:51:17 +01:00
Родитель 1e3c548cb8
Коммит 97cb21c541
206 изменённых файлов: 1951 добавлений и 1781 удалений

138
Cargo.lock сгенерированный
Просмотреть файл

@ -93,7 +93,7 @@ dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
@ -113,7 +113,7 @@ dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-uds 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -129,7 +129,7 @@ dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-uds 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -161,10 +161,10 @@ name = "baldrdash"
version = "0.1.0"
dependencies = [
"bindgen 0.43.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-codegen 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-wasm 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-wasm 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"target-lexicon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -197,7 +197,7 @@ dependencies = [
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"webidl 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -236,7 +236,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"Inflector 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"webidl 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -485,62 +485,62 @@ dependencies = [
[[package]]
name = "cranelift-bforest"
version = "0.26.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cranelift-entity 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cranelift-codegen"
version = "0.26.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cranelift-bforest 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-codegen-meta 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-entity 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-bforest 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-codegen-meta 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"target-lexicon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cranelift-codegen-meta"
version = "0.26.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cranelift-entity 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cranelift-entity"
version = "0.26.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cranelift-frontend"
version = "0.26.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cranelift-codegen 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"target-lexicon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cranelift-wasm"
version = "0.26.0"
version = "0.28.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-codegen 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-entity 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-frontend 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-frontend 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmparser 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -840,7 +840,7 @@ name = "ena"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -876,7 +876,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"atty 0.2.11 (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.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1030,7 +1030,7 @@ dependencies = [
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mozprofile 0.4.0",
"mozrunner 0.8.0",
"mozversion 0.1.3",
@ -1051,7 +1051,7 @@ dependencies = [
"cssparser 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"nsstring 0.1.0",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1114,7 +1114,7 @@ dependencies = [
"env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"geckoservo 0.0.1",
"jsrust_shared 0.1.0",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mozurl 0.0.1",
"mp4parse_capi 0.11.2",
"netwerk_helper 0.0.1",
@ -1136,7 +1136,7 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"khronos_api 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1158,7 +1158,7 @@ name = "goblin"
version = "0.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (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.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1174,7 +1174,7 @@ dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.10 (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.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1223,7 +1223,7 @@ dependencies = [
"httparse 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1287,7 +1287,7 @@ dependencies = [
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mozjs_sys 0.0.0",
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1469,12 +1469,12 @@ name = "log"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "log"
version = "0.4.5"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1583,7 +1583,7 @@ dependencies = [
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1619,7 +1619,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
name = "mozilla-central-workspace-hack"
version = "0.1.0"
dependencies = [
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1651,7 +1651,7 @@ name = "mozrunner"
version = "0.8.0"
dependencies = [
"dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mozprofile 0.4.0",
"winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1681,7 +1681,7 @@ version = "0.11.2"
dependencies = [
"bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mp4parse_fallible 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1695,7 +1695,7 @@ name = "mp4parse_capi"
version = "0.11.2"
dependencies = [
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mp4parse 0.11.2",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1949,7 +1949,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -2164,7 +2164,7 @@ dependencies = [
name = "rsdparsa"
version = "0.1.0"
dependencies = [
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.80 (git+https://github.com/servo/serde?branch=deserialize_from_enums9)",
]
@ -2174,7 +2174,7 @@ name = "rsdparsa_capi"
version = "0.1.0"
dependencies = [
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"nserror 0.1.0",
"rsdparsa 0.1.0",
]
@ -2257,7 +2257,7 @@ dependencies = [
"cssparser 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)",
"derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2462,7 +2462,7 @@ dependencies = [
"itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2529,7 +2529,7 @@ dependencies = [
"env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"geckoservo 0.0.1",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of 0.0.1",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2717,7 +2717,7 @@ dependencies = [
"bytes 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"scoped-tls 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2752,7 +2752,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -2761,7 +2761,7 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-executor 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2788,7 +2788,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"crossbeam-deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-executor 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2810,7 +2810,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bytes 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-codec 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2861,7 +2861,7 @@ dependencies = [
"devd-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"libudev 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)",
"runloop 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (git+https://github.com/froydnj/winapi-rs?branch=aarch64)",
@ -2970,13 +2970,13 @@ version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"futures 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasmparser"
version = "0.22.0"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -2989,7 +2989,7 @@ dependencies = [
"http 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.80 (git+https://github.com/servo/serde?branch=deserialize_from_enums9)",
@ -3027,7 +3027,7 @@ dependencies = [
"gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"plane-split 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3076,7 +3076,7 @@ dependencies = [
"foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"nsstring 0.1.0",
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"thread_profiler 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3266,12 +3266,12 @@ dependencies = [
"checksum core-text 13.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f3f46450d6f2397261af420b4ccce23807add2e45fa206410a03d66fb7f050ae"
"checksum cose 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "72fa26cb151d3ae4b70f63d67d0fed57ce04220feafafbae7f503bef7aae590d"
"checksum cose-c 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "49726015ab0ca765144fcca61e4a7a543a16b795a777fa53f554da2fffff9a94"
"checksum cranelift-bforest 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "40f8ff24e9a6c89b8a846b14df9a34d2cac17cea7bdb5c81ed6b4744ee0e38bf"
"checksum cranelift-codegen 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "42f5b809bd885c368e01aeec8fe04f21dcb07569834b907d75b4a7bed8d067eb"
"checksum cranelift-codegen-meta 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "014c23ed3ebdc8377d41540af638245207dd169f421df042dfccc867465734ed"
"checksum cranelift-entity 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4df40e26c0cf7b4d86919cb995bb412ee3001cc18e4f3c83a903f30b7007d8b"
"checksum cranelift-frontend 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "789907218eeebebcea8122c2053d71affac91c96ce72cea35ebfdbbf547e82af"
"checksum cranelift-wasm 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49723365dab9a48b354bdc24cb6d9d5719bc1d3b858ffd2ea179d0d7d885804a"
"checksum cranelift-bforest 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c88db0c2fc38b2cedee1b94ee2dc7bf80e4ce31467c8005743f485af66e240d8"
"checksum cranelift-codegen 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ce2e412970cfda0fa11806758d79a46c02b8fa1b91c35a8d3e2b4c947ce0c35"
"checksum cranelift-codegen-meta 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "43131e662da7e0243cff28edfbc094a62968a4b57849f77a6c1e3685e9e6e1e6"
"checksum cranelift-entity 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c4ccc3743848cbb53e58b62685703dc12ea553c3bc8f21db76f23c68054eb69a"
"checksum cranelift-frontend 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "89ecc8b49d4ab98f2c121832fee365da88b7b0ffad77d4e328015b1fd1f7f4b1"
"checksum cranelift-wasm 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7eccd196ecd01a2394ce05e2259afe5704874816b058541c7cce7794f0e835e"
"checksum crc 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd5d02c0aac6bd68393ed69e00bbc2457f3e89075c6349db7189618dc4ddc1d7"
"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
"checksum crossbeam-deque 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fe8153ef04a7594ded05b427ffad46ddeaf22e63fd48d42b3e1e3bb4db07cae7"
@ -3357,7 +3357,7 @@ dependencies = [
"checksum lmdb-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d5b392838cfe8858e86fac37cf97a0e8c55cc60ba0a18365cadc33092f128ce9"
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
"checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f"
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
"checksum malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "35adee9ed962cf7d07d62cb58bc45029f3227f5b5b86246caa8632f06c187bc3"
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"
@ -3501,7 +3501,7 @@ dependencies = [
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum walkdir 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "63636bd0eb3d00ccb8b9036381b526efac53caf112b7783b730ab3f8e44da369"
"checksum want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "797464475f30ddb8830cc529aaaae648d581f99e2036a928877dfde027ddf6b3"
"checksum wasmparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1b4e0f66e314a8e63ff5c3cc5103f7d0a3de9ee98bb61a960adcf7f1d9debd2f"
"checksum wasmparser 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5e01c420bc7d36e778bd242e1167b079562ba8b34087122cc9057187026d060"
"checksum webidl 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0f807f7488d680893f7188aa09d7672a3a0a8461975a098a2edf0a52e3fee29"
"checksum which 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4be6cfa54dab45266e98b5d7be2f8ce959ddd49abd141a05d52dce4b07f803bb"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"

Просмотреть файл

@ -8,10 +8,10 @@ crate-type = ["rlib"]
name = "baldrdash"
[dependencies]
cranelift-codegen = "0.26.0"
cranelift-wasm = "0.26.0"
cranelift-codegen = "0.28.0"
cranelift-wasm = "0.28.0"
target-lexicon = "0.2.0"
log = { version = "0.4.5", default-features = false, features = ["release_max_level_info"] }
log = { version = "0.4.6", default-features = false, features = ["release_max_level_info"] }
env_logger = "0.5.6"
[build-dependencies]

Просмотреть файл

@ -345,7 +345,7 @@ impl<'a, 'b> BatchCompiler<'a, 'b> {
ir::TrapCode::IntegerDivisionByZero => bd::Trap::IntegerDivideByZero,
ir::TrapCode::BadConversionToInteger => bd::Trap::InvalidConversionToInteger,
ir::TrapCode::Interrupt => bd::Trap::CheckInterrupt,
ir::TrapCode::User(0) => bd::Trap::Unreachable,
ir::TrapCode::UnreachableCodeReached => bd::Trap::Unreachable,
ir::TrapCode::User(_) => panic!("Uncovered trap code {}", code),
};

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"591c2da0dad7eafa9aff626400b38e0b08927df674292ca6774f60e2bc02ac32","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"af367c67340fa7f6fb9a35b0aa637dcf303957f7ae7427a5f4f6356801c8bb04","src/lib.rs":"eb691a3bc63c3ed8a64d564cf656fdc56c62ade8b7882efd7b987353acc627bd","src/map.rs":"77eb9fd2ffdaafaf4daea609602a0c775c5012efae21c03547f63653271da163","src/node.rs":"309609acc70f1ce6be2f3c964430d23c0680bd7a647afab837a2aedc06235531","src/path.rs":"25326bacbb99189e873cb70e770f21c13fdef0fb2cd20f484830386fc4c75c6a","src/pool.rs":"196216124922dc42708a3aa944e98b6a57ef9bb770dab7e01f154b6382cab021","src/set.rs":"d4ff99fe51de9eefb4c774e919259d952ab5dde4dd3b99bd9974e4eedbb28938"},"package":"40f8ff24e9a6c89b8a846b14df9a34d2cac17cea7bdb5c81ed6b4744ee0e38bf"}
{"files":{"Cargo.toml":"71b82e879926d62dea538644a84ae5e6274f5a57dd7ef3edfc5ae95e2a804986","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"af367c67340fa7f6fb9a35b0aa637dcf303957f7ae7427a5f4f6356801c8bb04","src/lib.rs":"1b23abbfe5850a4cd77ae6ae5dcfc2f678ef36b4032fd7496f2b333c51e63301","src/map.rs":"5d891d62814941e19dfc88ff36538efa3da5479f3f97de8219a6f610c9a1ee32","src/node.rs":"e620c64e78488035f11723b14892c7986c06ad37dc5b115a35a453ff1ae66ca3","src/path.rs":"4868e59ff67db1c504747e4b7e202dd20c9da4cbd73d9fa82d53e5f3406dbb78","src/pool.rs":"6090f8c0e0da16ebee0e31bca66392d0075b3aff529d30d4e716fa20cd0aef99","src/set.rs":"b411158f813a310c7a6c337d4ada3bf0a021088c443875dc25233415dcbe0633"},"package":"c88db0c2fc38b2cedee1b94ee2dc7bf80e4ce31467c8005743f485af66e240d8"}

Просмотреть файл

@ -11,8 +11,9 @@
# will likely look very different (and much more reasonable)
[package]
edition = "2018"
name = "cranelift-bforest"
version = "0.26.0"
version = "0.28.0"
authors = ["The Cranelift Project Developers"]
description = "A forest of B+-trees"
documentation = "https://cranelift.readthedocs.io/"
@ -22,10 +23,11 @@ categories = ["no-std"]
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/CraneStation/cranelift"
[dependencies.cranelift-entity]
version = "0.26.0"
version = "0.28.0"
default-features = false
[features]
core = []
default = ["std"]
std = ["cranelift-entity/std"]
[badges.maintenance]

29
third_party/rust/cranelift-bforest/src/lib.rs поставляемый
Просмотреть файл

@ -17,10 +17,7 @@
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", warn(unstable_features))]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
#![cfg_attr(
feature = "cargo-clippy",
allow(new_without_default, new_without_default_derive)
)]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
#![cfg_attr(
feature = "cargo-clippy",
warn(
@ -34,24 +31,24 @@
clippy::use_self
)
)]
// Turns on no_std and alloc features if std is not available.
#![cfg_attr(not(feature = "std"), no_std)]
#![no_std]
#![cfg_attr(not(feature = "std"), feature(alloc))]
/// This replaces `std` in builds with `core`.
#[cfg(test)]
#[cfg(not(feature = "std"))]
mod std {
extern crate alloc;
pub use self::alloc::{boxed, string, vec};
pub use core::*;
}
#[macro_use]
extern crate alloc as std;
#[cfg(test)]
#[cfg(feature = "std")]
#[macro_use]
extern crate std;
#[macro_use]
extern crate cranelift_entity as entity;
use entity::packed_option;
use crate::entity::packed_option;
use std::borrow::BorrowMut;
use std::cmp::Ordering;
use core::borrow::BorrowMut;
use core::cmp::Ordering;
mod map;
mod node;
@ -157,7 +154,7 @@ fn slice_shift<T: Copy>(s: &mut [T], n: usize) {
#[cfg(test)]
mod tests {
use super::*;
use entity::EntityRef;
use crate::entity::EntityRef;
/// An opaque reference to an extended basic block in a function.
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]

10
third_party/rust/cranelift-bforest/src/map.rs поставляемый
Просмотреть файл

@ -1,10 +1,10 @@
//! Forest of maps.
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, INNER_SIZE};
use packed_option::PackedOption;
use crate::packed_option::PackedOption;
#[cfg(test)]
use std::fmt;
use std::marker::PhantomData;
use core::fmt;
use core::marker::PhantomData;
#[cfg(test)]
use std::string::String;
@ -284,7 +284,7 @@ where
///
/// If the cursor reaches the end, return `None` and leave the cursor at the off-the-end
/// position.
#[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))]
#[cfg_attr(feature = "cargo-clippy", allow(clippy::should_implement_trait))]
pub fn next(&mut self) -> Option<(K, V)> {
self.path.next(self.pool)
}
@ -429,7 +429,7 @@ where
mod tests {
use super::super::NodeData;
use super::*;
use std::mem;
use core::mem;
use std::vec::Vec;
#[test]

Просмотреть файл

@ -1,8 +1,8 @@
//! B+-tree nodes.
use super::{slice_insert, slice_shift, Forest, Node, SetValue, INNER_SIZE};
use std::borrow::{Borrow, BorrowMut};
use std::fmt;
use core::borrow::{Borrow, BorrowMut};
use core::fmt;
/// B+-tree node.
///
@ -584,7 +584,7 @@ where
#[cfg(test)]
mod tests {
use super::*;
use std::mem;
use core::mem;
use std::string::ToString;
// Forest impl for a set implementation.

Просмотреть файл

@ -2,11 +2,11 @@
use super::node::Removed;
use super::{slice_insert, slice_shift, Comparator, Forest, Node, NodeData, NodePool, MAX_PATH};
use std::borrow::Borrow;
use std::marker::PhantomData;
use core::borrow::Borrow;
use core::marker::PhantomData;
#[cfg(test)]
use std::fmt;
use core::fmt;
pub(super) struct Path<F: Forest> {
/// Number of path entries including the root and leaf nodes.
@ -476,7 +476,7 @@ impl<F: Forest> Path<F> {
match status {
Removed::Healthy => {}
Removed::Rightmost => {
// The rightmost entry was removed from the curent node, so move the path so it
// The rightmost entry was removed from the current node, so move the path so it
// points at the first entry of the next node at this level.
debug_assert_eq!(
usize::from(self.entry[level]),
@ -706,7 +706,7 @@ impl<F: Forest> fmt::Display for Path<F> {
mod tests {
use super::super::{Forest, NodeData, NodePool};
use super::*;
use std::cmp::Ordering;
use core::cmp::Ordering;
struct TC();

Просмотреть файл

@ -3,10 +3,10 @@
#[cfg(test)]
use super::Comparator;
use super::{Forest, Node, NodeData};
use entity::PrimaryMap;
use crate::entity::PrimaryMap;
#[cfg(test)]
use std::fmt;
use std::ops::{Index, IndexMut};
use core::fmt;
use core::ops::{Index, IndexMut};
/// A pool of nodes, including a free list.
pub(super) struct NodePool<F: Forest> {
@ -63,7 +63,7 @@ impl<F: Forest> NodePool<F> {
pub fn free_tree(&mut self, node: Node) {
if let NodeData::Inner { size, tree, .. } = self[node] {
// Note that we have to capture `tree` by value to avoid borrow checker trouble.
#[cfg_attr(feature = "cargo-clippy", allow(needless_range_loop))]
#[cfg_attr(feature = "cargo-clippy", allow(clippy::needless_range_loop))]
for i in 0..usize::from(size + 1) {
// Recursively free sub-trees. This recursion can never be deeper than `MAX_PATH`,
// and since most trees have less than a handful of nodes, it is worthwhile to
@ -83,9 +83,9 @@ impl<F: Forest> NodePool<F> {
NodeData<F>: fmt::Display,
F::Key: fmt::Display,
{
use entity::SparseSet;
use std::borrow::Borrow;
use std::cmp::Ordering;
use crate::entity::SparseSet;
use core::borrow::Borrow;
use core::cmp::Ordering;
use std::vec::Vec;
// The root node can't be an inner node with just a single sub-tree. It should have been

10
third_party/rust/cranelift-bforest/src/set.rs поставляемый
Просмотреть файл

@ -1,10 +1,10 @@
//! Forest of sets.
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, SetValue, INNER_SIZE};
use packed_option::PackedOption;
use crate::packed_option::PackedOption;
#[cfg(test)]
use std::fmt;
use std::marker::PhantomData;
use core::fmt;
use core::marker::PhantomData;
#[cfg(test)]
use std::string::String;
@ -225,7 +225,7 @@ where
///
/// If the cursor reaches the end, return `None` and leave the cursor at the off-the-end
/// position.
#[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))]
#[cfg_attr(feature = "cargo-clippy", allow(clippy::should_implement_trait))]
pub fn next(&mut self) -> Option<K> {
self.path.next(self.pool).map(|(k, _)| k)
}
@ -357,7 +357,7 @@ where
mod tests {
use super::super::NodeData;
use super::*;
use std::mem;
use core::mem;
use std::vec::Vec;
#[test]

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"cdd4cff2d17ca34e3305e9fcf1e8277b0e9987e7369ce70da597e3957e56e408","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"b123f056d0d458396679c5f7f2a16d2762af0258fcda4ac14b6655a95e5a0022","src/base/mod.rs":"559075f0b76a744dd36224e06ff1c2e28ee70aaca9442fc724b116e37028ac52","src/base/settings.rs":"9cbe9bdd5141b9175074370a9b1d28f371249d586e999a31f76631739bf09c13","src/base/types.rs":"a3e449db1f515d268f3ad21301740ba415444d399f8433dbc48979f78557f66a","src/cdsl/isa.rs":"5c9a8173466e69d105245396abd342251eb00e704ab13f179ba1567b339f47e1","src/cdsl/mod.rs":"66ac1b5d095e431bcab88c4b9c5b1492a5d1ca87bcb9c9c3e544ede05b2ba925","src/cdsl/regs.rs":"41cca844b390bba3ceefa147e7b0dec170aba2b5759a41ecb5b9cd7f2cc59f60","src/cdsl/settings.rs":"724a4bd7cfd0608cfc8751ee7c38dbed90b91cfafd34585ed7df953807932794","src/cdsl/types.rs":"78f476f5f700697b94f2d2f00049af8684d3b27afc5684b2c87ea517aeb77e85","src/constant_hash.rs":"6522f86ebfd44efe9b47256d822d0e49d641ccdbb4fcc61d57bb94e6d52702c1","src/error.rs":"5110a4e3c1e97396ba02d9f5abbb8af4b586f0cc4d33a5c2473f1718cc4bef05","src/gen_registers.rs":"9bd381da256c19724964c6445db4fbac80d91174266dccfc5d3b72497a5332c9","src/gen_settings.rs":"a827a90cc1db7345e8081635169b77be497494e558c6e985eaa654386d5e8e48","src/gen_types.rs":"5eb4e9bd0fda7f7644bb2428045f0bf16f2b698ff32cadcbbf7f2c7669f18de3","src/isa/arm32/mod.rs":"b4049ff95164bbf244b6727e16974383e4d58c5be750f7ded3ef8cfe113e5373","src/isa/arm64/mod.rs":"759adfd4dd5c885644de26386797211efc82c5b47f2e147a58d57d24608b9cfb","src/isa/mod.rs":"d3a87bc45173f3743f25d3a004a9b40966c12feb7d95d794b5918bb9ccb988ac","src/isa/riscv/mod.rs":"6e3d96c48e9c289a13912d7f777bde805be327e4a56677d3f3bccf440ae4a09b","src/isa/x86/mod.rs":"e38c60a9d1aba3e5a48052c6185bab3f2b039e9cce639826becfe9f853c41499","src/lib.rs":"c4bfd9d2973e4a382f7a1ce8389cc1604aeba8478432a542ff3f1c24412c5b41","src/srcgen.rs":"e358b6232f0820e6e4525cdbe216206996ae5eb16a1df7a5fe41e3ce2e25b633","src/unique_table.rs":"f6041df1fa85f2a1ee914b84791e80165a0858a6253c212eaa99ff67cb56af26"},"package":"014c23ed3ebdc8377d41540af638245207dd169f421df042dfccc867465734ed"}
{"files":{"Cargo.toml":"05bb65ad8427efad48f44eac2db25961e6b56374941edf54912469a7b1e7110e","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"b123f056d0d458396679c5f7f2a16d2762af0258fcda4ac14b6655a95e5a0022","src/base/mod.rs":"559075f0b76a744dd36224e06ff1c2e28ee70aaca9442fc724b116e37028ac52","src/base/settings.rs":"bc6a15221d688bf63114c53493d31070860eb7fae208596374488404a65ee41a","src/base/types.rs":"a3e449db1f515d268f3ad21301740ba415444d399f8433dbc48979f78557f66a","src/cdsl/isa.rs":"5c9a8173466e69d105245396abd342251eb00e704ab13f179ba1567b339f47e1","src/cdsl/mod.rs":"66ac1b5d095e431bcab88c4b9c5b1492a5d1ca87bcb9c9c3e544ede05b2ba925","src/cdsl/regs.rs":"c45809713e8bf9d097c75991ff8dd4ca215a97e9f83df6407dcc09d76e6fbddb","src/cdsl/settings.rs":"4ddeadf1542cc2ddec0f9e6c22d1637050da519586cd9fec0243c3eab9619f82","src/cdsl/types.rs":"82aff98c094a564ed1a11ca7628bfba66c363d5fff278babbf26a4252b3a5107","src/constant_hash.rs":"b8acd3f8712a4999819d9d9beced2938d9940a5748ba016c182f1132d97eefab","src/error.rs":"5110a4e3c1e97396ba02d9f5abbb8af4b586f0cc4d33a5c2473f1718cc4bef05","src/gen_registers.rs":"cee8f9d4ad1d07e5bd59a9ca875ede3e4143ec4c97b5fd56c3e6f8b1dea64a53","src/gen_settings.rs":"c89aaecf6b6b53e229d052db90ffc43d11b5a69974961615437608ac705ae0dd","src/gen_types.rs":"9b8a06cd025fcb67e2f98f2b3c4697e551119997fd7254dc9ed2f9c5d2e2aa1c","src/isa/arm32/mod.rs":"741da8a24aa31919458349663e0a24e03727a7c2a72d5ebd813c2162cb19c65c","src/isa/arm64/mod.rs":"2b384d84fb2a1b53d6f3882ca18d8b9027161193493361a95406fa357a0822fa","src/isa/mod.rs":"c5ea6469fe770d49ceaa4b9c6370d8df2ac55fffc076fb3852fc5bbc8c096c2b","src/isa/riscv/mod.rs":"690a285d8185e38ad3134ac1dcd1e550e346ebb349f90c7b8b68b38ddd4b7a1f","src/isa/x86/mod.rs":"712a16bc2e0e50112f92bfbc5963e4548db5f701d5f14fd344df5fc76753f641","src/lib.rs":"995c6f1d6e8ca9dda8838b96c92f37f7c78d6d555e1f05b3700a1271760a161c","src/srcgen.rs":"a51b6f7b61110d958c541bc8de61592cb93cca0d6d46b2f5ffe47fca8feedae8","src/unique_table.rs":"f6041df1fa85f2a1ee914b84791e80165a0858a6253c212eaa99ff67cb56af26"},"package":"43131e662da7e0243cff28edfbc094a62968a4b57849f77a6c1e3685e9e6e1e6"}

Просмотреть файл

@ -11,15 +11,16 @@
# will likely look very different (and much more reasonable)
[package]
edition = "2018"
name = "cranelift-codegen-meta"
version = "0.26.0"
version = "0.28.0"
authors = ["The Cranelift Project Developers"]
description = "Metaprogram for cranelift-codegen code generator library"
readme = "README.md"
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/CraneStation/cranelift"
[dependencies.cranelift-entity]
version = "0.26.0"
version = "0.28.0"
[badges.maintenance]
status = "experimental"

Просмотреть файл

@ -1,4 +1,4 @@
use cdsl::settings::{SettingGroup, SettingGroupBuilder};
use crate::cdsl::settings::{SettingGroup, SettingGroupBuilder};
pub fn generate() -> SettingGroup {
let mut settings = SettingGroupBuilder::new("shared");

Просмотреть файл

@ -1,3 +1,4 @@
use cranelift_entity::entity_impl;
use cranelift_entity::EntityRef;
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]

Просмотреть файл

@ -101,7 +101,8 @@ impl Preset {
let mask = setting.byte_mask();
let val = setting.byte_for_value(true);
assert!((val & !mask) == 0);
let (l_mask, l_val) = layout.get_mut(setting.byte_offset as usize).unwrap();
let (ref mut l_mask, ref mut l_val) =
*layout.get_mut(setting.byte_offset as usize).unwrap();
*l_mask |= mask;
*l_val = (*l_val & !mask) | val;
}
@ -186,15 +187,15 @@ impl<'a> Into<PredicateNode> for (BoolSettingIndex, &'a SettingGroup) {
impl PredicateNode {
fn render(&self, group: &SettingGroup) -> String {
match self {
match *self {
PredicateNode::OwnedBool(bool_setting_index) => format!(
"{}.{}()",
group.name, group.settings[bool_setting_index.0].name
),
PredicateNode::SharedBool(group_name, bool_name) => {
PredicateNode::SharedBool(ref group_name, ref bool_name) => {
format!("{}.{}()", group_name, bool_name)
}
PredicateNode::And(lhs, rhs) => {
PredicateNode::And(ref lhs, ref rhs) => {
format!("{} && {}", lhs.render(group), rhs.render(group))
}
}

Просмотреть файл

@ -5,7 +5,7 @@
use std::fmt;
use base::types as base_types;
use crate::base::types as base_types;
// Numbering scheme for value types:
//

Просмотреть файл

@ -18,8 +18,7 @@ pub fn generate_table<T, H: Fn(&T) -> usize>(items: &Vec<T>, hash_function: H) -
size.next_power_of_two()
};
let mut table: Vec<Option<&T>> = Vec::new();
table.resize(size, None);
let mut table: Vec<Option<&T>> = vec![None; size];
for i in items {
let mut h = hash_function(i) % size;

Просмотреть файл

@ -1,8 +1,8 @@
use cdsl::isa::TargetIsa;
use cdsl::regs::{RegBank, RegClass};
use crate::cdsl::isa::TargetIsa;
use crate::cdsl::regs::{RegBank, RegClass};
use crate::error;
use crate::srcgen::Formatter;
use cranelift_entity::EntityRef;
use error;
use srcgen::Formatter;
fn gen_regbank(fmt: &mut Formatter, reg_bank: &RegBank) {
let names = if reg_bank.names.len() > 0 {

Просмотреть файл

@ -1,12 +1,14 @@
use base;
use cdsl::camel_case;
use cdsl::isa::TargetIsa;
use cdsl::settings::{BoolSetting, Predicate, Preset, Setting, SettingGroup, SpecificSetting};
use constant_hash::{generate_table, simple_hash};
use error;
use srcgen::{Formatter, Match};
use crate::base;
use crate::cdsl::camel_case;
use crate::cdsl::isa::TargetIsa;
use crate::cdsl::settings::{
BoolSetting, Predicate, Preset, Setting, SettingGroup, SpecificSetting,
};
use crate::constant_hash::{generate_table, simple_hash};
use crate::error;
use crate::srcgen::{Formatter, Match};
use crate::unique_table::UniqueTable;
use std::collections::HashMap;
use unique_table::UniqueTable;
enum ParentGroup {
None,
@ -224,7 +226,7 @@ enum SettingOrPreset<'a> {
impl<'a> SettingOrPreset<'a> {
fn name(&self) -> &str {
match self {
match *self {
SettingOrPreset::Setting(s) => s.name,
SettingOrPreset::Preset(p) => p.name,
}
@ -248,14 +250,14 @@ fn gen_descriptors(group: &SettingGroup, fmt: &mut Formatter) {
fmt.indent(|fmt| {
fmt.line(&format!("name: \"{}\",", setting.name));
fmt.line(&format!("offset: {},", setting.byte_offset));
match &setting.specific {
match setting.specific {
SpecificSetting::Bool(BoolSetting { bit_offset, .. }) => {
fmt.line(&format!(
"detail: detail::Detail::Bool {{ bit: {} }},",
bit_offset
));
}
SpecificSetting::Enum(values) => {
SpecificSetting::Enum(ref values) => {
let offset = enum_table.add(values);
fmt.line(&format!(
"detail: detail::Detail::Enum {{ last: {}, enumerators: {} }},",
@ -322,7 +324,7 @@ fn gen_descriptors(group: &SettingGroup, fmt: &mut Formatter) {
));
fmt.indent(|fmt| {
for h in &hash_table {
match h {
match *h {
Some(setting_or_preset) => fmt.line(&format!(
"{},",
&descriptor_index_map
@ -353,8 +355,7 @@ fn gen_descriptors(group: &SettingGroup, fmt: &mut Formatter) {
}
fn gen_template(group: &SettingGroup, fmt: &mut Formatter) {
let mut default_bytes: Vec<u8> = Vec::new();
default_bytes.resize(group.settings_size as usize, 0);
let mut default_bytes: Vec<u8> = vec![0; group.settings_size as usize];
for setting in &group.settings {
*default_bytes.get_mut(setting.byte_offset as usize).unwrap() |= setting.default_byte();
}

Просмотреть файл

@ -7,9 +7,9 @@
//! This ensures that the metaprogram and the generated program see the same
//! type numbering.
use cdsl::types as cdsl_types;
use error;
use srcgen;
use crate::cdsl::types as cdsl_types;
use crate::error;
use crate::srcgen;
/// Emit a constant definition of a single value type.
fn emit_type(ty: &cdsl_types::ValueType, fmt: &mut srcgen::Formatter) -> Result<(), error::Error> {

Просмотреть файл

@ -1,6 +1,6 @@
use cdsl::isa::{TargetIsa, TargetIsaBuilder};
use cdsl::regs::{RegBankBuilder, RegClassBuilder};
use cdsl::settings::{SettingGroup, SettingGroupBuilder};
use crate::cdsl::isa::{TargetIsa, TargetIsaBuilder};
use crate::cdsl::regs::{RegBankBuilder, RegClassBuilder};
use crate::cdsl::settings::{SettingGroup, SettingGroupBuilder};
fn define_settings(_shared: &SettingGroup) -> SettingGroup {
let setting = SettingGroupBuilder::new("arm32");

Просмотреть файл

@ -1,6 +1,6 @@
use cdsl::isa::{TargetIsa, TargetIsaBuilder};
use cdsl::regs::{RegBankBuilder, RegClassBuilder};
use cdsl::settings::{SettingGroup, SettingGroupBuilder};
use crate::cdsl::isa::{TargetIsa, TargetIsaBuilder};
use crate::cdsl::regs::{RegBankBuilder, RegClassBuilder};
use crate::cdsl::settings::{SettingGroup, SettingGroupBuilder};
fn define_settings(_shared: &SettingGroup) -> SettingGroup {
let setting = SettingGroupBuilder::new("arm64");

Просмотреть файл

@ -1,5 +1,5 @@
use cdsl::isa::TargetIsa;
use cdsl::settings::SettingGroup;
use crate::cdsl::isa::TargetIsa;
use crate::cdsl::settings::SettingGroup;
use std::fmt;
mod arm32;

Просмотреть файл

@ -1,6 +1,6 @@
use cdsl::isa::{TargetIsa, TargetIsaBuilder};
use cdsl::regs::{RegBankBuilder, RegClassBuilder};
use cdsl::settings::{PredicateNode, SettingGroup, SettingGroupBuilder};
use crate::cdsl::isa::{TargetIsa, TargetIsaBuilder};
use crate::cdsl::regs::{RegBankBuilder, RegClassBuilder};
use crate::cdsl::settings::{PredicateNode, SettingGroup, SettingGroupBuilder};
fn define_settings(shared: &SettingGroup) -> SettingGroup {
let mut setting = SettingGroupBuilder::new("riscv");

Просмотреть файл

@ -1,6 +1,6 @@
use cdsl::isa::{TargetIsa, TargetIsaBuilder};
use cdsl::regs::{RegBankBuilder, RegClassBuilder};
use cdsl::settings::{PredicateNode, SettingGroup, SettingGroupBuilder};
use crate::cdsl::isa::{TargetIsa, TargetIsaBuilder};
use crate::cdsl::regs::{RegBankBuilder, RegClassBuilder};
use crate::cdsl::settings::{PredicateNode, SettingGroup, SettingGroupBuilder};
pub fn define_settings(_shared: &SettingGroup) -> SettingGroup {
let mut settings = SettingGroupBuilder::new("x86");

Просмотреть файл

@ -1,6 +1,3 @@
#[macro_use]
extern crate cranelift_entity;
#[macro_use]
mod cdsl;

Просмотреть файл

@ -9,7 +9,7 @@ use std::fs;
use std::io::Write;
use std::path;
use error;
use crate::error;
static SHIFTWIDTH: usize = 4;
@ -122,7 +122,7 @@ impl Formatter {
pub fn add_match(&mut self, m: Match) {
self.line(&format!("match {} {{", m.expr));
self.indent(|fmt| {
for ((fields, body), names) in m.arms.iter() {
for (&(ref fields, ref body), ref names) in m.arms.iter() {
// name { fields } | name { fields } => { body }
let conditions: Vec<String> = names
.iter()
@ -151,7 +151,7 @@ fn _indent(s: &str) -> Option<usize> {
if s.is_empty() {
None
} else {
let t = s.trim_left();
let t = s.trim_start();
Some(s.len() - t.len())
}
}
@ -169,7 +169,7 @@ fn parse_multiline(s: &str) -> Vec<String> {
.iter()
.skip(1)
.filter(|l| !l.trim().is_empty())
.map(|l| l.len() - l.trim_left().len())
.map(|l| l.len() - l.trim_start().len())
.min();
// Strip off leading blank lines.
@ -186,12 +186,12 @@ fn parse_multiline(s: &str) -> Vec<String> {
// Note that empty lines may have fewer than `indent` chars.
lines_iter
.map(|l| &l[cmp::min(indent, l.len())..])
.map(|l| l.trim_right())
.map(|l| l.trim_end())
.map(|l| l.to_string())
.collect::<Vec<_>>()
} else {
lines_iter
.map(|l| l.trim_right())
.map(|l| l.trim_end())
.map(|l| l.to_string())
.collect::<Vec<_>>()
};
@ -252,7 +252,7 @@ mod srcgen_tests {
use super::Formatter;
use super::Match;
fn from_raw_string(s: impl Into<String>) -> Vec<String> {
fn from_raw_string<S: Into<String>>(s: S) -> Vec<String> {
s.into()
.trim()
.split("\n")

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

11
third_party/rust/cranelift-codegen/Cargo.toml поставляемый
Просмотреть файл

@ -11,8 +11,9 @@
# will likely look very different (and much more reasonable)
[package]
edition = "2018"
name = "cranelift-codegen"
version = "0.26.0"
version = "0.28.0"
authors = ["The Cranelift Project Developers"]
build = "build.rs"
description = "Low-level code generator library"
@ -23,11 +24,11 @@ categories = ["no-std"]
license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/CraneStation/cranelift"
[dependencies.cranelift-bforest]
version = "0.26.0"
version = "0.28.0"
default-features = false
[dependencies.cranelift-entity]
version = "0.26.0"
version = "0.28.0"
default-features = false
[dependencies.failure]
@ -44,14 +45,14 @@ version = "0.1.9"
optional = true
[dependencies.log]
version = "0.4.4"
version = "0.4.6"
default-features = false
[dependencies.target-lexicon]
version = "0.2.0"
default-features = false
[build-dependencies.cranelift-codegen-meta]
version = "0.26.0"
version = "0.28.0"
[features]
core = ["hashmap_core"]

4
third_party/rust/cranelift-codegen/build.rs поставляемый
Просмотреть файл

@ -18,9 +18,9 @@
// 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 cranelift_codegen_meta as meta;
use meta::isa::Isa;
use crate::meta::isa::Isa;
use std::env;
use std::process;
use std::time::Instant;

Просмотреть файл

@ -500,7 +500,7 @@ for inst_imm, inst in [
(urem_imm, urem),
(band_imm, band),
(bor_imm, bor),
(bxor_imm, bor),
(bxor_imm, bxor),
(ifcmp_imm, ifcmp)]:
expand.legalize(
a << inst_imm(x, y),

Просмотреть файл

@ -2,7 +2,7 @@
Cranelift DSL classes.
This module defines the classes that are used to define Cranelift instructions
and other entitties.
and other entities.
"""
from __future__ import absolute_import
import re

Просмотреть файл

@ -2,7 +2,7 @@
Abstract syntax trees.
This module defines classes that can be used to create abstract syntax trees
for patern matching an rewriting of cranelift instructions.
for pattern matching an rewriting of cranelift instructions.
"""
from __future__ import absolute_import
from . import instructions
@ -79,7 +79,7 @@ class Def(object):
# type: (VarAtomMap) -> Def
"""
Return a copy of this Def with vars replaced with fresh variables,
in accordance with the map m. Update m as neccessary.
in accordance with the map m. Update m as necessary.
"""
new_expr = self.expr.copy(m)
new_defs = [] # type: List[Var]
@ -423,7 +423,7 @@ class Apply(Expr):
# type: (VarAtomMap) -> Apply
"""
Return a copy of this Expr with vars replaced with fresh variables,
in accordance with the map m. Update m as neccessary.
in accordance with the map m. Update m as necessary.
"""
return Apply(self.inst, tuple(map(lambda e: replace_var(e, m),
self.args)))
@ -441,7 +441,7 @@ class Apply(Expr):
def substitution(self, other, s):
# type: (Apply, VarAtomMap) -> Optional[VarAtomMap]
"""
If there is a substituion from Var->Atom that converts self to other,
If there is a substitution from Var->Atom that converts self to other,
return it, otherwise return None. Note that this is strictly weaker
than unification (see TestXForm.test_subst_enum_bad_var_const for
example).
@ -513,7 +513,7 @@ class ConstantInt(Literal):
A value of an integer immediate operand.
Immediate operands like `imm64` or `offset32` can be specified in AST
expressions using the call syntax: `imm64(5)` which greates a `ConstantInt`
expressions using the call syntax: `imm64(5)` which creates a `ConstantInt`
node.
"""

Просмотреть файл

@ -244,7 +244,8 @@ class FieldPredicate(object):
"""
# Prepend `field` to the predicate function arguments.
args = (self.field.rust_name(),) + tuple(map(str, self.args))
return '::predicates::{}({})'.format(self.function, ', '.join(args))
return 'crate::predicates::{}({})'\
.format(self.function, ', '.join(args))
class IsEqual(FieldPredicate):

Просмотреть файл

@ -502,7 +502,7 @@ class TestXForm(TypeCheckingBaseTest):
# For any patterns where the type env includes constraints, at
# least one of the "theoretically possible" concrete typings must
# be prevented by the constraints. (i.e. we are not emitting
# unneccessary constraints).
# unnecessary constraints).
# We check that by asserting that the number of concrete typings is
# less than the number of all possible free typevar assignments
if (len(xform.ti.constraints) > 0):

Просмотреть файл

@ -233,7 +233,7 @@ class TestTypeVar(TestCase):
intersect = ts1.copy()
intersect &= ts2
# Propagate instersections backward
# Propagate intersections backward
ts1_src = reduce(lambda ts, func: ts.preimage(func),
reversed(i1),
intersect)

Просмотреть файл

@ -276,7 +276,7 @@ class SameWidth(TypeConstraint):
class TypeEnv(object):
"""
Class encapsulating the neccessary book keeping for type inference.
Class encapsulating the necessary book keeping for type inference.
:attribute type_map: dict holding the equivalence relations between tvs
:attribute constraints: a list of accumulated constraints - tuples
(tv1, tv2)) where tv1 and tv2 are equal
@ -331,7 +331,7 @@ class TypeEnv(object):
"""
Record a that the free tv1 is part of the same equivalence class as
tv2. The canonical representative of the merged class is tv2's
cannonical representative.
canonical representative.
"""
assert not tv1.is_derived
assert self[tv1] == tv1
@ -376,7 +376,7 @@ class TypeEnv(object):
non-derived TVs implicitly get the lowest rank (0). Derived variables
get their rank from their free typevar. Singletons have the highest
rank. TVs associated with vars in a source pattern have a higher rank
than TVs associted with temporary vars.
than TVs associated with temporary vars.
"""
default_rank = TypeEnv.RANK_INTERNAL if tv.singleton_type() is None \
else TypeEnv.RANK_SINGLETON
@ -837,7 +837,7 @@ def ti_def(definition, typ):
fresh_formal_tvs = move_first(fresh_formal_tvs, idx)
actual_tvs = move_first(actual_tvs, idx)
# Unify each actual typevar with the correpsonding fresh formal tv
# Unify each actual typevar with the corresponding fresh formal tv
for (actual_tv, formal_tv) in zip(actual_tvs, fresh_formal_tvs):
typ_or_err = unify(actual_tv, formal_tv, typ)
err = get_error(typ_or_err)

Просмотреть файл

@ -51,7 +51,7 @@ class Rtl(object):
# type: (VarAtomMap) -> Rtl
"""
Return a copy of this rtl with all Vars substituted with copies or
according to m. Update m as neccessary.
according to m. Update m as necessary.
"""
return Rtl(*[d.copy(m) for d in self.rtl])
@ -394,7 +394,7 @@ class XFormGroup(object):
# table referring to it.
return self.name
else:
return '::legalizer::{}'.format(self.name)
return 'crate::legalizer::{}'.format(self.name)
def legalize(self, src, dst):
# type: (Union[Def, Apply], Rtl) -> None

Просмотреть файл

@ -22,22 +22,11 @@ except ImportError:
pass
def source_files(top):
# type: (str) -> Iterable[str]
"""
Recursively find all interesting source files and directories in the
directory tree starting at top. Yield a path to each file.
"""
for (dirpath, dirnames, filenames) in os.walk(top):
yield dirpath
for f in filenames:
if f.endswith('.py'):
yield join(dirpath, f)
def generate():
# type: () -> None
print("Dependencies from meta language directory:")
meta = dirname(abspath(__file__))
for path in source_files(meta):
print("cargo:rerun-if-changed=" + path)
for (dirpath, _, filenames) in os.walk(meta):
for f in filenames:
if f.endswith('.py'):
print("cargo:rerun-if-changed=" + join(dirpath, f))

Просмотреть файл

@ -110,7 +110,7 @@ def emit_instp(instp, fmt, has_func=False):
fields = ', '.join(sorted(fnames))
with fmt.indented(
'if let ir::InstructionData::{} {{ {}, .. }} = *inst {{'
'if let crate::ir::InstructionData::{} {{ {}, .. }} = *inst {{'
.format(iform.name, fields), '}'):
if has_type_check:
# We could implement this if we need to.
@ -132,7 +132,8 @@ def emit_inst_predicates(instps, fmt):
for instp, number in instps.items():
name = 'inst_predicate_{}'.format(number)
with fmt.indented(
'fn {}(func: &ir::Function, inst: &ir::InstructionData)'
'fn {}(func: &crate::ir::Function, '
'inst: &crate::ir::InstructionData)'
'-> bool {{'.format(name), '}'):
emit_instp(instp, fmt, has_func=True)
@ -168,7 +169,7 @@ def emit_recipe_predicates(isa, fmt):
# Generate the predicate function.
with fmt.indented(
'fn {}({}: ::settings::PredicateView, '
'fn {}({}: crate::settings::PredicateView, '
'{}: &ir::InstructionData) -> bool {{'
.format(
name,
@ -657,7 +658,8 @@ def emit_level2_hashtables(level2_hashtables, offt, level2_doc, fmt):
if entry:
fmt.line(
'Level2Entry ' +
'{{ opcode: Some(ir::Opcode::{}), offset: {:#08x} }},'
'{{ opcode: Some(crate::ir::Opcode::{}), '
'offset: {:#08x} }},'
.format(entry.inst.camel_name, entry.offset))
else:
fmt.line(
@ -682,15 +684,15 @@ def emit_level1_hashtable(cpumode, level1, offt, fmt):
# Empty hash table entry. Include the default legalization action.
if not level2:
fmt.format(
'Level1Entry {{ ty: ir::types::INVALID, log2len: !0, '
'offset: 0, legalize: {} }},',
'Level1Entry {{ ty: crate::ir::types::INVALID, '
'log2len: !0, offset: 0, legalize: {} }},',
level1.legalize_code)
continue
if level2.ty is not None:
tyname = level2.ty.rust_name()
else:
tyname = 'ir::types::INVALID'
tyname = 'crate::ir::types::INVALID'
lcode = cpumode.isa.legalize_code(level2.legalize)

Просмотреть файл

@ -257,8 +257,8 @@ def gen_instruction_data_impl(fmt):
'pub fn eq(&self, other: &Self, pool: &ir::ValueListPool)'
' -> bool {',
'}'):
with fmt.indented('if ::std::mem::discriminant(self) != '
'::std::mem::discriminant(other) {', '}'):
with fmt.indented('if ::core::mem::discriminant(self) != '
'::core::mem::discriminant(other) {', '}'):
fmt.line('return false;')
with fmt.indented('match (self, other) {', '}'):
for f in InstructionFormat.all_formats:
@ -301,7 +301,7 @@ def gen_instruction_data_impl(fmt):
hash the contents of any `ValueLists`.
""")
with fmt.indented(
'pub fn hash<H: ::std::hash::Hasher>'
'pub fn hash<H: ::core::hash::Hasher>'
'(&self, state: &mut H, pool: &ir::ValueListPool) {',
'}'):
with fmt.indented('match *self {', '}'):
@ -323,13 +323,13 @@ def gen_instruction_data_impl(fmt):
members.append(field.member)
pat = n + ' { ' + ', '.join(members) + ' }'
with fmt.indented(pat + ' => {', '}'):
fmt.line('::std::hash::Hash::hash( '
'&::std::mem::discriminant(self), state);')
fmt.line('::std::hash::Hash::hash(&opcode, state);')
fmt.line('::core::hash::Hash::hash( '
'&::core::mem::discriminant(self), state);')
fmt.line('::core::hash::Hash::hash(&opcode, state);')
for field in f.imm_fields:
fmt.line('::std::hash::Hash::hash(&{}, state);'
fmt.line('::core::hash::Hash::hash(&{}, state);'
.format(field.member))
fmt.line('::std::hash::Hash::hash({}, state);'
fmt.line('::core::hash::Hash::hash({}, state);'
.format(args))
@ -661,7 +661,7 @@ def gen_inst_builder(inst, fmt):
# The controlling type variable will be inferred from the input values if
# possible. Otherwise, it is the first method argument.
if inst.is_polymorphic and not inst.use_typevar_operand:
args.append('{}: ir::Type'.format(inst.ctrl_typevar.name))
args.append('{}: crate::ir::Type'.format(inst.ctrl_typevar.name))
tmpl_types = list() # type: List[str]
into_args = list() # type: List[str]

Просмотреть файл

@ -32,10 +32,10 @@ except ImportError:
def get_runtime_typechecks(xform):
# type: (XForm) -> List[TypeConstraint]
"""
Given a XForm build a list of runtime type checks neccessary to determine
Given a XForm build a list of runtime type checks necessary to determine
if it applies. We have 2 types of runtime checks:
1) typevar tv belongs to typeset T - needed for free tvs whose
typeset is constrainted by their use in the dst pattern
typeset is constrained by their use in the dst pattern
2) tv1 == tv2 where tv1 and tv2 are derived TVs - caused by unification
of non-bijective functions
@ -103,19 +103,21 @@ def emit_runtime_typecheck(check, fmt, type_sets):
base_exp = build_derived_expr(tv.base)
if (tv.derived_func == TypeVar.LANEOF):
return "{}.map(|t: ir::Type| t.lane_type())".format(base_exp)
return "{}.map(|t: crate::ir::Type| t.lane_type())"\
.format(base_exp)
elif (tv.derived_func == TypeVar.ASBOOL):
return "{}.map(|t: ir::Type| t.as_bool())".format(base_exp)
return "{}.map(|t: crate::ir::Type| t.as_bool())".format(base_exp)
elif (tv.derived_func == TypeVar.HALFWIDTH):
return "{}.and_then(|t: ir::Type| t.half_width())".format(base_exp)
return "{}.and_then(|t: crate::ir::Type| t.half_width())"\
.format(base_exp)
elif (tv.derived_func == TypeVar.DOUBLEWIDTH):
return "{}.and_then(|t: ir::Type| t.double_width())"\
return "{}.and_then(|t: crate::ir::Type| t.double_width())"\
.format(base_exp)
elif (tv.derived_func == TypeVar.HALFVECTOR):
return "{}.and_then(|t: ir::Type| t.half_vector())"\
return "{}.and_then(|t: crate::ir::Type| t.half_vector())"\
.format(base_exp)
elif (tv.derived_func == TypeVar.DOUBLEVECTOR):
return "{}.and_then(|t: ir::Type| t.by(2))".format(base_exp)
return "{}.and_then(|t: crate::ir::Type| t.by(2))".format(base_exp)
else:
assert False, "Unknown derived function {}".format(tv.derived_func)
@ -174,7 +176,7 @@ def unwrap_inst(iref, node, fmt):
arg_names = tuple(
arg.name if isinstance(arg, Var) else '_' for arg in expr.args)
with fmt.indented(
'let ({}, predicate) = if let ir::InstructionData::{} {{'
'let ({}, predicate) = if let crate::ir::InstructionData::{} {{'
.format(', '.join(map(str, arg_names)), iform.name), '};'):
# Fields are encoded directly.
for f in iform.imm_fields:
@ -359,13 +361,13 @@ def gen_xform_group(xgrp, fmt, type_sets):
fmt.doc_comment("Legalize `inst`.")
fmt.line('#[allow(unused_variables,unused_assignments,non_snake_case)]')
with fmt.indented('pub fn {}('.format(xgrp.name)):
fmt.line('inst: ir::Inst,')
fmt.line('func: &mut ir::Function,')
fmt.line('cfg: &mut ::flowgraph::ControlFlowGraph,')
fmt.line('isa: &::isa::TargetIsa,')
fmt.line('inst: crate::ir::Inst,')
fmt.line('func: &mut crate::ir::Function,')
fmt.line('cfg: &mut crate::flowgraph::ControlFlowGraph,')
fmt.line('isa: &crate::isa::TargetIsa,')
with fmt.indented(') -> bool {', '}'):
fmt.line('use ir::InstBuilder;')
fmt.line('use cursor::{Cursor, FuncCursor};')
fmt.line('use crate::ir::InstBuilder;')
fmt.line('use crate::cursor::{Cursor, FuncCursor};')
fmt.line('let mut pos = FuncCursor::new(func).at_inst(inst);')
fmt.line('pos.use_srcloc(inst);')

Просмотреть файл

@ -117,10 +117,10 @@ def gen_getters(sgrp, fmt):
with fmt.indented('impl Flags {', '}'):
fmt.doc_comment('Get a view of the boolean predicates.')
with fmt.indented(
'pub fn predicate_view(&self) -> ::settings::PredicateView {',
'}'):
'pub fn predicate_view(&self) -> '
'crate::settings::PredicateView {', '}'):
fmt.format(
'::settings::PredicateView::new(&self.bytes[{}..])',
'crate::settings::PredicateView::new(&self.bytes[{}..])',
sgrp.boolean_offset)
if sgrp.settings:
fmt.doc_comment('Dynamic numbered predicate getter.')

Просмотреть файл

@ -1934,7 +1934,7 @@ icscc = TailRecipe(
PUT_OP(bits, rex2(in_reg0, in_reg1), sink);
modrm_rr(in_reg0, in_reg1, sink);
// `setCC` instruction, no REX.
use ir::condcodes::IntCC::*;
use crate::ir::condcodes::IntCC::*;
let setcc = match cond {
Equal => 0x94,
NotEqual => 0x95,
@ -1962,7 +1962,7 @@ icscc_ib = TailRecipe(
let imm: i64 = imm.into();
sink.put1(imm as u8);
// `setCC` instruction, no REX.
use ir::condcodes::IntCC::*;
use crate::ir::condcodes::IntCC::*;
let setcc = match cond {
Equal => 0x94,
NotEqual => 0x95,
@ -1990,7 +1990,7 @@ icscc_id = TailRecipe(
let imm: i64 = imm.into();
sink.put4(imm as u32);
// `setCC` instruction, no REX.
use ir::condcodes::IntCC::*;
use crate::ir::condcodes::IntCC::*;
let setcc = match cond {
Equal => 0x94,
NotEqual => 0x95,
@ -2030,7 +2030,7 @@ fcscc = TailRecipe(
PUT_OP(bits, rex2(in_reg1, in_reg0), sink);
modrm_rr(in_reg1, in_reg0, sink);
// `setCC` instruction, no REX.
use ir::condcodes::FloatCC::*;
use crate::ir::condcodes::FloatCC::*;
let setcc = match cond {
Ordered => 0x9b, // EQ|LT|GT => setnp (P=0)
Unordered => 0x9a, // UN => setp (P=1)

Просмотреть файл

@ -201,7 +201,7 @@ def equivalent(r1, r2, inp_m, out_m):
assert isinstance(v2, Var)
results_eq_exp.append(mk_eq(m1[v1], m2[v2]))
# Put the whole query toghether
# Put the whole query together
return q1 + q2 + args_eq_exp + [Not(And(*results_eq_exp))]

Просмотреть файл

@ -148,9 +148,9 @@ class TestRuntimeChecks(TestCase):
self.v5 << vselect(self.v1, self.v3, self.v4),
)
x = XForm(r, r)
tv2_exp = 'Some({}).map(|t: ir::Type| t.as_bool())'\
tv2_exp = 'Some({}).map(|t: crate::ir::Type| t.as_bool())'\
.format(self.v2.get_typevar().name)
tv3_exp = 'Some({}).map(|t: ir::Type| t.as_bool())'\
tv3_exp = 'Some({}).map(|t: crate::ir::Type| t.as_bool())'\
.format(self.v3.get_typevar().name)
self.check_yo_check(

Просмотреть файл

@ -3,8 +3,8 @@
//! This module provides functions and data structures that are useful for implementing the
//! `TargetIsa::legalize_signature()` method.
use ir::{AbiParam, ArgumentExtension, ArgumentLoc, Type};
use std::cmp::Ordering;
use crate::ir::{AbiParam, ArgumentExtension, ArgumentLoc, Type};
use core::cmp::Ordering;
use std::vec::Vec;
/// Legalization action to perform on a single argument or return value when converting a
@ -182,8 +182,8 @@ pub fn legalize_abi_value(have: Type, arg: &AbiParam) -> ValueConversion {
#[cfg(test)]
mod tests {
use super::*;
use ir::types;
use ir::AbiParam;
use crate::ir::types;
use crate::ir::AbiParam;
#[test]
fn legalize() {

Просмотреть файл

@ -15,8 +15,8 @@
//! `CodeSink::put*` methods, so the performance impact of the virtual callbacks is less severe.
use super::{Addend, CodeOffset, CodeSink, Reloc};
use ir::{ExternalName, JumpTable, SourceLoc, TrapCode};
use std::ptr::write_unaligned;
use crate::ir::{ExternalName, JumpTable, SourceLoc, TrapCode};
use core::ptr::write_unaligned;
/// A `CodeSink` that writes binary machine code directly into memory.
///
@ -57,13 +57,13 @@ impl<'a> MemoryCodeSink<'a> {
/// A trait for receiving relocations for code that is emitted directly into memory.
pub trait RelocSink {
/// Add a relocation referencing an EBB at the current offset.
fn reloc_ebb(&mut self, CodeOffset, Reloc, CodeOffset);
fn reloc_ebb(&mut self, _: CodeOffset, _: Reloc, _: CodeOffset);
/// Add a relocation referencing an external symbol at the current offset.
fn reloc_external(&mut self, CodeOffset, Reloc, &ExternalName, Addend);
fn reloc_external(&mut self, _: CodeOffset, _: Reloc, _: &ExternalName, _: Addend);
/// Add a relocation referencing a jump table.
fn reloc_jt(&mut self, CodeOffset, Reloc, JumpTable);
fn reloc_jt(&mut self, _: CodeOffset, _: Reloc, _: JumpTable);
}
/// A trait for receiving trap codes and offsets.
@ -72,7 +72,7 @@ pub trait RelocSink {
/// [`NullTrapSink`](binemit/trait.TrapSink.html) implementation.
pub trait TrapSink {
/// Add trap information for a specific offset.
fn trap(&mut self, CodeOffset, SourceLoc, TrapCode);
fn trap(&mut self, _: CodeOffset, _: SourceLoc, _: TrapCode);
}
impl<'a> CodeSink for MemoryCodeSink<'a> {
@ -89,7 +89,7 @@ impl<'a> CodeSink for MemoryCodeSink<'a> {
fn put2(&mut self, x: u16) {
unsafe {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
write_unaligned(self.data.offset(self.offset) as *mut u16, x);
}
self.offset += 2;
@ -97,7 +97,7 @@ impl<'a> CodeSink for MemoryCodeSink<'a> {
fn put4(&mut self, x: u32) {
unsafe {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
write_unaligned(self.data.offset(self.offset) as *mut u32, x);
}
self.offset += 4;
@ -105,7 +105,7 @@ impl<'a> CodeSink for MemoryCodeSink<'a> {
fn put8(&mut self, x: u64) {
unsafe {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
write_unaligned(self.data.offset(self.offset) as *mut u64, x);
}
self.offset += 8;

Просмотреть файл

@ -10,10 +10,10 @@ mod shrink;
pub use self::memorysink::{MemoryCodeSink, NullTrapSink, RelocSink, TrapSink};
pub use self::relaxation::relax_branches;
pub use self::shrink::shrink_instructions;
pub use regalloc::RegDiversions;
pub use crate::regalloc::RegDiversions;
use ir::{ExternalName, Function, Inst, JumpTable, SourceLoc, TrapCode};
use std::fmt;
use crate::ir::{ExternalName, Function, Inst, JumpTable, SourceLoc, TrapCode};
use core::fmt;
/// Offset in bytes from the beginning of the function.
///
@ -49,7 +49,7 @@ pub enum Reloc {
impl fmt::Display for Reloc {
/// Display trait implementation drops the arch, since its used in contexts where the arch is
/// already unambigious, e.g. clif syntax with isa specified. In other contexts, use Debug.
/// already unambiguous, e.g. clif syntax with isa specified. In other contexts, use Debug.
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Reloc::Abs4 => write!(f, "Abs4"),
@ -72,28 +72,28 @@ pub trait CodeSink {
fn offset(&self) -> CodeOffset;
/// Add 1 byte to the code section.
fn put1(&mut self, u8);
fn put1(&mut self, _: u8);
/// Add 2 bytes to the code section.
fn put2(&mut self, u16);
fn put2(&mut self, _: u16);
/// Add 4 bytes to the code section.
fn put4(&mut self, u32);
fn put4(&mut self, _: u32);
/// Add 8 bytes to the code section.
fn put8(&mut self, u64);
fn put8(&mut self, _: u64);
/// Add a relocation referencing an EBB at the current offset.
fn reloc_ebb(&mut self, Reloc, CodeOffset);
fn reloc_ebb(&mut self, _: Reloc, _: CodeOffset);
/// Add a relocation referencing an external symbol plus the addend at the current offset.
fn reloc_external(&mut self, Reloc, &ExternalName, Addend);
fn reloc_external(&mut self, _: Reloc, _: &ExternalName, _: Addend);
/// Add a relocation referencing a jump table.
fn reloc_jt(&mut self, Reloc, JumpTable);
fn reloc_jt(&mut self, _: Reloc, _: JumpTable);
/// Add trap information for the current offset.
fn trap(&mut self, TrapCode, SourceLoc);
fn trap(&mut self, _: TrapCode, _: SourceLoc);
/// Code output is complete, read-only data may follow.
fn begin_rodata(&mut self);

Просмотреть файл

@ -27,14 +27,15 @@
//! ebb23:
//! ```
use binemit::CodeOffset;
use cursor::{Cursor, FuncCursor};
use ir::{Function, InstructionData, Opcode};
use isa::{EncInfo, TargetIsa};
use iterators::IteratorExtras;
use regalloc::RegDiversions;
use timing;
use CodegenResult;
use crate::binemit::CodeOffset;
use crate::cursor::{Cursor, FuncCursor};
use crate::ir::{Function, InstructionData, Opcode};
use crate::isa::{EncInfo, TargetIsa};
use crate::iterators::IteratorExtras;
use crate::regalloc::RegDiversions;
use crate::timing;
use crate::CodegenResult;
use log::debug;
/// Relax branches and compute the final layout of EBB headers in `func`.
///

Просмотреть файл

@ -5,11 +5,12 @@
//! flexibility. However, once register allocation is done, this is no longer important, and we
//! can switch to smaller encodings when possible.
use ir::instructions::InstructionData;
use ir::Function;
use isa::TargetIsa;
use regalloc::RegDiversions;
use timing;
use crate::ir::instructions::InstructionData;
use crate::ir::Function;
use crate::isa::TargetIsa;
use crate::regalloc::RegDiversions;
use crate::timing;
use log::debug;
/// Pick the smallest valid encodings for instructions.
pub fn shrink_instructions(func: &mut Function, isa: &TargetIsa) {

Просмотреть файл

@ -5,9 +5,9 @@
//!
//! If you would like to add support for larger bitsets in the future, you need to change the trait
//! bound Into<u32> and the u32 in the implementation of `max_bits()`.
use std::convert::{From, Into};
use std::mem::size_of;
use std::ops::{Add, BitOr, Shl, Sub};
use core::convert::{From, Into};
use core::mem::size_of;
use core::ops::{Add, BitOr, Shl, Sub};
/// A small bitset built on a single primitive integer type
#[derive(Clone, Copy, Debug, PartialEq, Eq)]

Просмотреть файл

@ -1,10 +1,10 @@
//! The `CFGPrinter` utility.
use std::fmt::{Display, Formatter, Result, Write};
use core::fmt::{Display, Formatter, Result, Write};
use flowgraph::{BasicBlock, ControlFlowGraph};
use ir::instructions::BranchInfo;
use ir::Function;
use crate::flowgraph::{BasicBlock, ControlFlowGraph};
use crate::ir::instructions::BranchInfo;
use crate::ir::Function;
/// A utility for pretty-printing the CFG of a `Function`.
pub struct CFGPrinter<'a> {

Просмотреть файл

@ -9,28 +9,28 @@
//! contexts concurrently. Typically, you would have one context per compilation thread and only a
//! single ISA instance.
use binemit::{
use crate::binemit::{
relax_branches, shrink_instructions, CodeOffset, MemoryCodeSink, RelocSink, TrapSink,
};
use dce::do_dce;
use dominator_tree::DominatorTree;
use flowgraph::ControlFlowGraph;
use ir::Function;
use isa::TargetIsa;
use legalize_function;
use licm::do_licm;
use loop_analysis::LoopAnalysis;
use nan_canonicalization::do_nan_canonicalization;
use postopt::do_postopt;
use regalloc;
use result::CodegenResult;
use settings::{FlagsOrIsa, OptLevel};
use simple_gvn::do_simple_gvn;
use simple_preopt::do_preopt;
use crate::dce::do_dce;
use crate::dominator_tree::DominatorTree;
use crate::flowgraph::ControlFlowGraph;
use crate::ir::Function;
use crate::isa::TargetIsa;
use crate::legalize_function;
use crate::licm::do_licm;
use crate::loop_analysis::LoopAnalysis;
use crate::nan_canonicalization::do_nan_canonicalization;
use crate::postopt::do_postopt;
use crate::regalloc;
use crate::result::CodegenResult;
use crate::settings::{FlagsOrIsa, OptLevel};
use crate::simple_gvn::do_simple_gvn;
use crate::simple_preopt::do_preopt;
use crate::timing;
use crate::unreachable_code::eliminate_unreachable_code;
use crate::verifier::{verify_context, verify_locations, VerifierErrors, VerifierResult};
use std::vec::Vec;
use timing;
use unreachable_code::eliminate_unreachable_code;
use verifier::{verify_context, verify_locations, VerifierErrors, VerifierResult};
/// Persistent data structures and compilation pipeline.
pub struct Context {

Просмотреть файл

@ -2,8 +2,8 @@
//!
//! This module defines cursor data types that can be used for inserting instructions.
use ir;
use isa::TargetIsa;
use crate::ir;
use crate::isa::TargetIsa;
/// The possible positions of a cursor.
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
@ -751,7 +751,7 @@ impl<'c, 'f> ir::InstInserterBase<'c> for &'c mut EncCursor<'f> {
}
// Assign an encoding.
// XXX Is there a way to describe this error to the user?
#[cfg_attr(feature = "cargo-clippy", allow(match_wild_err_arm))]
#[cfg_attr(feature = "cargo-clippy", allow(clippy::match_wild_err_arm))]
match self
.isa
.encode(&self.func, &self.func.dfg[inst], ctrl_typevar)

Просмотреть файл

@ -1,5 +1,5 @@
//! Debug tracing helpers.
use std::fmt;
use core::fmt;
/// Prefix added to the log file names, just before the thread name or id.
pub static LOG_FILENAME_PREFIX: &str = "cranelift.dbg.";

17
third_party/rust/cranelift-codegen/src/dce.rs поставляемый
Просмотреть файл

@ -3,13 +3,12 @@
//! Dead code here means instructions that have no side effects and have no
//! result values used by other instructions.
use cursor::{Cursor, FuncCursor};
use dominator_tree::DominatorTree;
use entity::EntityRef;
use ir::instructions::InstructionData;
use ir::{DataFlowGraph, Function, Inst, Opcode};
use std::vec::Vec;
use timing;
use crate::cursor::{Cursor, FuncCursor};
use crate::dominator_tree::DominatorTree;
use crate::entity::EntityRef;
use crate::ir::instructions::InstructionData;
use crate::ir::{DataFlowGraph, Function, Inst, Opcode};
use crate::timing;
/// Test whether the given opcode is unsafe to even consider for DCE.
fn trivially_unsafe_for_dce(opcode: Opcode) -> bool {
@ -46,9 +45,7 @@ pub fn do_dce(func: &mut Function, domtree: &mut DominatorTree) {
let _tt = timing::dce();
debug_assert!(domtree.is_valid());
let mut live = Vec::with_capacity(func.dfg.num_values());
live.resize(func.dfg.num_values(), false);
let mut live = vec![false; func.dfg.num_values()];
for &ebb in domtree.cfg_postorder() {
let mut pos = FuncCursor::new(func).at_bottom(ebb);
while let Some(inst) = pos.prev_inst() {

Просмотреть файл

@ -8,39 +8,37 @@
//! so as to emphasise the similarity of the U32 and U64 cases and the S32
//! and S64 cases.
#![allow(non_snake_case)]
// Structures to hold the "magic numbers" computed.
#[derive(PartialEq, Debug)]
pub struct MU32 {
pub mulBy: u32,
pub doAdd: bool,
pub shiftBy: i32,
pub mul_by: u32,
pub do_add: bool,
pub shift_by: i32,
}
#[derive(PartialEq, Debug)]
pub struct MU64 {
pub mulBy: u64,
pub doAdd: bool,
pub shiftBy: i32,
pub mul_by: u64,
pub do_add: bool,
pub shift_by: i32,
}
#[derive(PartialEq, Debug)]
pub struct MS32 {
pub mulBy: i32,
pub shiftBy: i32,
pub mul_by: i32,
pub shift_by: i32,
}
#[derive(PartialEq, Debug)]
pub struct MS64 {
pub mulBy: i64,
pub shiftBy: i32,
pub mul_by: i64,
pub shift_by: i32,
}
// The actual "magic number" generators follow.
pub fn magicU32(d: u32) -> MU32 {
pub fn magic_u32(d: u32) -> MU32 {
debug_assert_ne!(d, 0);
debug_assert_ne!(d, 1); // d==1 generates out of range shifts.
@ -80,13 +78,13 @@ pub fn magicU32(d: u32) -> MU32 {
}
MU32 {
mulBy: q2 + 1,
doAdd: do_add,
shiftBy: p - 32,
mul_by: q2 + 1,
do_add: do_add,
shift_by: p - 32,
}
}
pub fn magicU64(d: u64) -> MU64 {
pub fn magic_u64(d: u64) -> MU64 {
debug_assert_ne!(d, 0);
debug_assert_ne!(d, 1); // d==1 generates out of range shifts.
@ -126,13 +124,13 @@ pub fn magicU64(d: u64) -> MU64 {
}
MU64 {
mulBy: q2 + 1,
doAdd: do_add,
shiftBy: p - 64,
mul_by: q2 + 1,
do_add: do_add,
shift_by: p - 64,
}
}
pub fn magicS32(d: i32) -> MS32 {
pub fn magic_s32(d: i32) -> MS32 {
debug_assert_ne!(d, -1);
debug_assert_ne!(d, 0);
debug_assert_ne!(d, 1);
@ -166,16 +164,16 @@ pub fn magicS32(d: i32) -> MS32 {
}
MS32 {
mulBy: (if d < 0 {
mul_by: (if d < 0 {
u32::wrapping_neg(q2 + 1)
} else {
q2 + 1
}) as i32,
shiftBy: p - 32,
shift_by: p - 32,
}
}
pub fn magicS64(d: i64) -> MS64 {
pub fn magic_s64(d: i64) -> MS64 {
debug_assert_ne!(d, -1);
debug_assert_ne!(d, 0);
debug_assert_ne!(d, 1);
@ -209,267 +207,312 @@ pub fn magicS64(d: i64) -> MS64 {
}
MS64 {
mulBy: (if d < 0 {
mul_by: (if d < 0 {
u64::wrapping_neg(q2 + 1)
} else {
q2 + 1
}) as i64,
shiftBy: p - 64,
shift_by: p - 64,
}
}
#[cfg(test)]
mod tests {
use super::{magicS32, magicS64, magicU32, magicU64};
use super::{magic_s32, magic_s64, magic_u32, magic_u64};
use super::{MS32, MS64, MU32, MU64};
fn mkMU32(mulBy: u32, doAdd: bool, shiftBy: i32) -> MU32 {
fn make_mu32(mul_by: u32, do_add: bool, shift_by: i32) -> MU32 {
MU32 {
mulBy,
doAdd,
shiftBy,
mul_by,
do_add,
shift_by,
}
}
fn mkMU64(mulBy: u64, doAdd: bool, shiftBy: i32) -> MU64 {
fn make_mu64(mul_by: u64, do_add: bool, shift_by: i32) -> MU64 {
MU64 {
mulBy,
doAdd,
shiftBy,
mul_by,
do_add,
shift_by,
}
}
fn mkMS32(mulBy: i32, shiftBy: i32) -> MS32 {
MS32 { mulBy, shiftBy }
fn make_ms32(mul_by: i32, shift_by: i32) -> MS32 {
MS32 { mul_by, shift_by }
}
fn mkMS64(mulBy: i64, shiftBy: i32) -> MS64 {
MS64 { mulBy, shiftBy }
fn make_ms64(mul_by: i64, shift_by: i32) -> MS64 {
MS64 { mul_by, shift_by }
}
#[test]
fn test_magicU32() {
assert_eq!(magicU32(2u32), mkMU32(0x80000000u32, false, 0));
assert_eq!(magicU32(3u32), mkMU32(0xaaaaaaabu32, false, 1));
assert_eq!(magicU32(4u32), mkMU32(0x40000000u32, false, 0));
assert_eq!(magicU32(5u32), mkMU32(0xcccccccdu32, false, 2));
assert_eq!(magicU32(6u32), mkMU32(0xaaaaaaabu32, false, 2));
assert_eq!(magicU32(7u32), mkMU32(0x24924925u32, true, 3));
assert_eq!(magicU32(9u32), mkMU32(0x38e38e39u32, false, 1));
assert_eq!(magicU32(10u32), mkMU32(0xcccccccdu32, false, 3));
assert_eq!(magicU32(11u32), mkMU32(0xba2e8ba3u32, false, 3));
assert_eq!(magicU32(12u32), mkMU32(0xaaaaaaabu32, false, 3));
assert_eq!(magicU32(25u32), mkMU32(0x51eb851fu32, false, 3));
assert_eq!(magicU32(125u32), mkMU32(0x10624dd3u32, false, 3));
assert_eq!(magicU32(625u32), mkMU32(0xd1b71759u32, false, 9));
assert_eq!(magicU32(1337u32), mkMU32(0x88233b2bu32, true, 11));
assert_eq!(magicU32(65535u32), mkMU32(0x80008001u32, false, 15));
assert_eq!(magicU32(65536u32), mkMU32(0x00010000u32, false, 0));
assert_eq!(magicU32(65537u32), mkMU32(0xffff0001u32, false, 16));
assert_eq!(magicU32(31415927u32), mkMU32(0x445b4553u32, false, 23));
assert_eq!(magicU32(0xdeadbeefu32), mkMU32(0x93275ab3u32, false, 31));
assert_eq!(magicU32(0xfffffffdu32), mkMU32(0x40000001u32, false, 30));
assert_eq!(magicU32(0xfffffffeu32), mkMU32(0x00000003u32, true, 32));
assert_eq!(magicU32(0xffffffffu32), mkMU32(0x80000001u32, false, 31));
assert_eq!(magic_u32(2u32), make_mu32(0x80000000u32, false, 0));
assert_eq!(magic_u32(3u32), make_mu32(0xaaaaaaabu32, false, 1));
assert_eq!(magic_u32(4u32), make_mu32(0x40000000u32, false, 0));
assert_eq!(magic_u32(5u32), make_mu32(0xcccccccdu32, false, 2));
assert_eq!(magic_u32(6u32), make_mu32(0xaaaaaaabu32, false, 2));
assert_eq!(magic_u32(7u32), make_mu32(0x24924925u32, true, 3));
assert_eq!(magic_u32(9u32), make_mu32(0x38e38e39u32, false, 1));
assert_eq!(magic_u32(10u32), make_mu32(0xcccccccdu32, false, 3));
assert_eq!(magic_u32(11u32), make_mu32(0xba2e8ba3u32, false, 3));
assert_eq!(magic_u32(12u32), make_mu32(0xaaaaaaabu32, false, 3));
assert_eq!(magic_u32(25u32), make_mu32(0x51eb851fu32, false, 3));
assert_eq!(magic_u32(125u32), make_mu32(0x10624dd3u32, false, 3));
assert_eq!(magic_u32(625u32), make_mu32(0xd1b71759u32, false, 9));
assert_eq!(magic_u32(1337u32), make_mu32(0x88233b2bu32, true, 11));
assert_eq!(magic_u32(65535u32), make_mu32(0x80008001u32, false, 15));
assert_eq!(magic_u32(65536u32), make_mu32(0x00010000u32, false, 0));
assert_eq!(magic_u32(65537u32), make_mu32(0xffff0001u32, false, 16));
assert_eq!(magic_u32(31415927u32), make_mu32(0x445b4553u32, false, 23));
assert_eq!(
magic_u32(0xdeadbeefu32),
make_mu32(0x93275ab3u32, false, 31)
);
assert_eq!(
magic_u32(0xfffffffdu32),
make_mu32(0x40000001u32, false, 30)
);
assert_eq!(magic_u32(0xfffffffeu32), make_mu32(0x00000003u32, true, 32));
assert_eq!(
magic_u32(0xffffffffu32),
make_mu32(0x80000001u32, false, 31)
);
}
#[test]
fn test_magicU64() {
assert_eq!(magicU64(2u64), mkMU64(0x8000000000000000u64, false, 0));
assert_eq!(magicU64(3u64), mkMU64(0xaaaaaaaaaaaaaaabu64, false, 1));
assert_eq!(magicU64(4u64), mkMU64(0x4000000000000000u64, false, 0));
assert_eq!(magicU64(5u64), mkMU64(0xcccccccccccccccdu64, false, 2));
assert_eq!(magicU64(6u64), mkMU64(0xaaaaaaaaaaaaaaabu64, false, 2));
assert_eq!(magicU64(7u64), mkMU64(0x2492492492492493u64, true, 3));
assert_eq!(magicU64(9u64), mkMU64(0xe38e38e38e38e38fu64, false, 3));
assert_eq!(magicU64(10u64), mkMU64(0xcccccccccccccccdu64, false, 3));
assert_eq!(magicU64(11u64), mkMU64(0x2e8ba2e8ba2e8ba3u64, false, 1));
assert_eq!(magicU64(12u64), mkMU64(0xaaaaaaaaaaaaaaabu64, false, 3));
assert_eq!(magicU64(25u64), mkMU64(0x47ae147ae147ae15u64, true, 5));
assert_eq!(magicU64(125u64), mkMU64(0x0624dd2f1a9fbe77u64, true, 7));
assert_eq!(magicU64(625u64), mkMU64(0x346dc5d63886594bu64, false, 7));
assert_eq!(magicU64(1337u64), mkMU64(0xc4119d952866a139u64, false, 10));
assert_eq!(magic_u64(2u64), make_mu64(0x8000000000000000u64, false, 0));
assert_eq!(magic_u64(3u64), make_mu64(0xaaaaaaaaaaaaaaabu64, false, 1));
assert_eq!(magic_u64(4u64), make_mu64(0x4000000000000000u64, false, 0));
assert_eq!(magic_u64(5u64), make_mu64(0xcccccccccccccccdu64, false, 2));
assert_eq!(magic_u64(6u64), make_mu64(0xaaaaaaaaaaaaaaabu64, false, 2));
assert_eq!(magic_u64(7u64), make_mu64(0x2492492492492493u64, true, 3));
assert_eq!(magic_u64(9u64), make_mu64(0xe38e38e38e38e38fu64, false, 3));
assert_eq!(magic_u64(10u64), make_mu64(0xcccccccccccccccdu64, false, 3));
assert_eq!(magic_u64(11u64), make_mu64(0x2e8ba2e8ba2e8ba3u64, false, 1));
assert_eq!(magic_u64(12u64), make_mu64(0xaaaaaaaaaaaaaaabu64, false, 3));
assert_eq!(magic_u64(25u64), make_mu64(0x47ae147ae147ae15u64, true, 5));
assert_eq!(magic_u64(125u64), make_mu64(0x0624dd2f1a9fbe77u64, true, 7));
assert_eq!(
magicU64(31415927u64),
mkMU64(0x116d154b9c3d2f85u64, true, 25)
magic_u64(625u64),
make_mu64(0x346dc5d63886594bu64, false, 7)
);
assert_eq!(
magicU64(0x00000000deadbeefu64),
mkMU64(0x93275ab2dfc9094bu64, false, 31)
magic_u64(1337u64),
make_mu64(0xc4119d952866a139u64, false, 10)
);
assert_eq!(
magicU64(0x00000000fffffffdu64),
mkMU64(0x8000000180000005u64, false, 31)
magic_u64(31415927u64),
make_mu64(0x116d154b9c3d2f85u64, true, 25)
);
assert_eq!(
magicU64(0x00000000fffffffeu64),
mkMU64(0x0000000200000005u64, true, 32)
magic_u64(0x00000000deadbeefu64),
make_mu64(0x93275ab2dfc9094bu64, false, 31)
);
assert_eq!(
magicU64(0x00000000ffffffffu64),
mkMU64(0x8000000080000001u64, false, 31)
magic_u64(0x00000000fffffffdu64),
make_mu64(0x8000000180000005u64, false, 31)
);
assert_eq!(
magicU64(0x0000000100000000u64),
mkMU64(0x0000000100000000u64, false, 0)
magic_u64(0x00000000fffffffeu64),
make_mu64(0x0000000200000005u64, true, 32)
);
assert_eq!(
magicU64(0x0000000100000001u64),
mkMU64(0xffffffff00000001u64, false, 32)
magic_u64(0x00000000ffffffffu64),
make_mu64(0x8000000080000001u64, false, 31)
);
assert_eq!(
magicU64(0x0ddc0ffeebadf00du64),
mkMU64(0x2788e9d394b77da1u64, true, 60)
magic_u64(0x0000000100000000u64),
make_mu64(0x0000000100000000u64, false, 0)
);
assert_eq!(
magicU64(0xfffffffffffffffdu64),
mkMU64(0x4000000000000001u64, false, 62)
magic_u64(0x0000000100000001u64),
make_mu64(0xffffffff00000001u64, false, 32)
);
assert_eq!(
magicU64(0xfffffffffffffffeu64),
mkMU64(0x0000000000000003u64, true, 64)
magic_u64(0x0ddc0ffeebadf00du64),
make_mu64(0x2788e9d394b77da1u64, true, 60)
);
assert_eq!(
magicU64(0xffffffffffffffffu64),
mkMU64(0x8000000000000001u64, false, 63)
magic_u64(0xfffffffffffffffdu64),
make_mu64(0x4000000000000001u64, false, 62)
);
assert_eq!(
magic_u64(0xfffffffffffffffeu64),
make_mu64(0x0000000000000003u64, true, 64)
);
assert_eq!(
magic_u64(0xffffffffffffffffu64),
make_mu64(0x8000000000000001u64, false, 63)
);
}
#[test]
fn test_magicS32() {
assert_eq!(magicS32(-0x80000000i32), mkMS32(0x7fffffffu32 as i32, 30));
assert_eq!(magicS32(-0x7FFFFFFFi32), mkMS32(0xbfffffffu32 as i32, 29));
assert_eq!(magicS32(-0x7FFFFFFEi32), mkMS32(0x7ffffffdu32 as i32, 30));
assert_eq!(magicS32(-31415927i32), mkMS32(0xbba4baadu32 as i32, 23));
assert_eq!(magicS32(-1337i32), mkMS32(0x9df73135u32 as i32, 9));
assert_eq!(magicS32(-256i32), mkMS32(0x7fffffffu32 as i32, 7));
assert_eq!(magicS32(-5i32), mkMS32(0x99999999u32 as i32, 1));
assert_eq!(magicS32(-3i32), mkMS32(0x55555555u32 as i32, 1));
assert_eq!(magicS32(-2i32), mkMS32(0x7fffffffu32 as i32, 0));
assert_eq!(magicS32(2i32), mkMS32(0x80000001u32 as i32, 0));
assert_eq!(magicS32(3i32), mkMS32(0x55555556u32 as i32, 0));
assert_eq!(magicS32(4i32), mkMS32(0x80000001u32 as i32, 1));
assert_eq!(magicS32(5i32), mkMS32(0x66666667u32 as i32, 1));
assert_eq!(magicS32(6i32), mkMS32(0x2aaaaaabu32 as i32, 0));
assert_eq!(magicS32(7i32), mkMS32(0x92492493u32 as i32, 2));
assert_eq!(magicS32(9i32), mkMS32(0x38e38e39u32 as i32, 1));
assert_eq!(magicS32(10i32), mkMS32(0x66666667u32 as i32, 2));
assert_eq!(magicS32(11i32), mkMS32(0x2e8ba2e9u32 as i32, 1));
assert_eq!(magicS32(12i32), mkMS32(0x2aaaaaabu32 as i32, 1));
assert_eq!(magicS32(25i32), mkMS32(0x51eb851fu32 as i32, 3));
assert_eq!(magicS32(125i32), mkMS32(0x10624dd3u32 as i32, 3));
assert_eq!(magicS32(625i32), mkMS32(0x68db8badu32 as i32, 8));
assert_eq!(magicS32(1337i32), mkMS32(0x6208cecbu32 as i32, 9));
assert_eq!(magicS32(31415927i32), mkMS32(0x445b4553u32 as i32, 23));
assert_eq!(magicS32(0x7ffffffei32), mkMS32(0x80000003u32 as i32, 30));
assert_eq!(magicS32(0x7fffffffi32), mkMS32(0x40000001u32 as i32, 29));
assert_eq!(
magic_s32(-0x80000000i32),
make_ms32(0x7fffffffu32 as i32, 30)
);
assert_eq!(
magic_s32(-0x7FFFFFFFi32),
make_ms32(0xbfffffffu32 as i32, 29)
);
assert_eq!(
magic_s32(-0x7FFFFFFEi32),
make_ms32(0x7ffffffdu32 as i32, 30)
);
assert_eq!(magic_s32(-31415927i32), make_ms32(0xbba4baadu32 as i32, 23));
assert_eq!(magic_s32(-1337i32), make_ms32(0x9df73135u32 as i32, 9));
assert_eq!(magic_s32(-256i32), make_ms32(0x7fffffffu32 as i32, 7));
assert_eq!(magic_s32(-5i32), make_ms32(0x99999999u32 as i32, 1));
assert_eq!(magic_s32(-3i32), make_ms32(0x55555555u32 as i32, 1));
assert_eq!(magic_s32(-2i32), make_ms32(0x7fffffffu32 as i32, 0));
assert_eq!(magic_s32(2i32), make_ms32(0x80000001u32 as i32, 0));
assert_eq!(magic_s32(3i32), make_ms32(0x55555556u32 as i32, 0));
assert_eq!(magic_s32(4i32), make_ms32(0x80000001u32 as i32, 1));
assert_eq!(magic_s32(5i32), make_ms32(0x66666667u32 as i32, 1));
assert_eq!(magic_s32(6i32), make_ms32(0x2aaaaaabu32 as i32, 0));
assert_eq!(magic_s32(7i32), make_ms32(0x92492493u32 as i32, 2));
assert_eq!(magic_s32(9i32), make_ms32(0x38e38e39u32 as i32, 1));
assert_eq!(magic_s32(10i32), make_ms32(0x66666667u32 as i32, 2));
assert_eq!(magic_s32(11i32), make_ms32(0x2e8ba2e9u32 as i32, 1));
assert_eq!(magic_s32(12i32), make_ms32(0x2aaaaaabu32 as i32, 1));
assert_eq!(magic_s32(25i32), make_ms32(0x51eb851fu32 as i32, 3));
assert_eq!(magic_s32(125i32), make_ms32(0x10624dd3u32 as i32, 3));
assert_eq!(magic_s32(625i32), make_ms32(0x68db8badu32 as i32, 8));
assert_eq!(magic_s32(1337i32), make_ms32(0x6208cecbu32 as i32, 9));
assert_eq!(magic_s32(31415927i32), make_ms32(0x445b4553u32 as i32, 23));
assert_eq!(
magic_s32(0x7ffffffei32),
make_ms32(0x80000003u32 as i32, 30)
);
assert_eq!(
magic_s32(0x7fffffffi32),
make_ms32(0x40000001u32 as i32, 29)
);
}
#[test]
fn test_magicS64() {
assert_eq!(
magicS64(-0x8000000000000000i64),
mkMS64(0x7fffffffffffffffu64 as i64, 62)
magic_s64(-0x8000000000000000i64),
make_ms64(0x7fffffffffffffffu64 as i64, 62)
);
assert_eq!(
magicS64(-0x7FFFFFFFFFFFFFFFi64),
mkMS64(0xbfffffffffffffffu64 as i64, 61)
magic_s64(-0x7FFFFFFFFFFFFFFFi64),
make_ms64(0xbfffffffffffffffu64 as i64, 61)
);
assert_eq!(
magicS64(-0x7FFFFFFFFFFFFFFEi64),
mkMS64(0x7ffffffffffffffdu64 as i64, 62)
magic_s64(-0x7FFFFFFFFFFFFFFEi64),
make_ms64(0x7ffffffffffffffdu64 as i64, 62)
);
assert_eq!(
magicS64(-0x0ddC0ffeeBadF00di64),
mkMS64(0x6c3b8b1635a4412fu64 as i64, 59)
magic_s64(-0x0ddC0ffeeBadF00di64),
make_ms64(0x6c3b8b1635a4412fu64 as i64, 59)
);
assert_eq!(
magicS64(-0x100000001i64),
mkMS64(0x800000007fffffffu64 as i64, 31)
magic_s64(-0x100000001i64),
make_ms64(0x800000007fffffffu64 as i64, 31)
);
assert_eq!(
magicS64(-0x100000000i64),
mkMS64(0x7fffffffffffffffu64 as i64, 31)
magic_s64(-0x100000000i64),
make_ms64(0x7fffffffffffffffu64 as i64, 31)
);
assert_eq!(
magicS64(-0xFFFFFFFFi64),
mkMS64(0x7fffffff7fffffffu64 as i64, 31)
magic_s64(-0xFFFFFFFFi64),
make_ms64(0x7fffffff7fffffffu64 as i64, 31)
);
assert_eq!(
magicS64(-0xFFFFFFFEi64),
mkMS64(0x7ffffffefffffffdu64 as i64, 31)
magic_s64(-0xFFFFFFFEi64),
make_ms64(0x7ffffffefffffffdu64 as i64, 31)
);
assert_eq!(
magicS64(-0xFFFFFFFDi64),
mkMS64(0x7ffffffe7ffffffbu64 as i64, 31)
magic_s64(-0xFFFFFFFDi64),
make_ms64(0x7ffffffe7ffffffbu64 as i64, 31)
);
assert_eq!(
magicS64(-0xDeadBeefi64),
mkMS64(0x6cd8a54d2036f6b5u64 as i64, 31)
magic_s64(-0xDeadBeefi64),
make_ms64(0x6cd8a54d2036f6b5u64 as i64, 31)
);
assert_eq!(
magicS64(-31415927i64),
mkMS64(0x7749755a31e1683du64 as i64, 24)
);
assert_eq!(magicS64(-1337i64), mkMS64(0x9df731356bccaf63u64 as i64, 9));
assert_eq!(magicS64(-256i64), mkMS64(0x7fffffffffffffffu64 as i64, 7));
assert_eq!(magicS64(-5i64), mkMS64(0x9999999999999999u64 as i64, 1));
assert_eq!(magicS64(-3i64), mkMS64(0x5555555555555555u64 as i64, 1));
assert_eq!(magicS64(-2i64), mkMS64(0x7fffffffffffffffu64 as i64, 0));
assert_eq!(magicS64(2i64), mkMS64(0x8000000000000001u64 as i64, 0));
assert_eq!(magicS64(3i64), mkMS64(0x5555555555555556u64 as i64, 0));
assert_eq!(magicS64(4i64), mkMS64(0x8000000000000001u64 as i64, 1));
assert_eq!(magicS64(5i64), mkMS64(0x6666666666666667u64 as i64, 1));
assert_eq!(magicS64(6i64), mkMS64(0x2aaaaaaaaaaaaaabu64 as i64, 0));
assert_eq!(magicS64(7i64), mkMS64(0x4924924924924925u64 as i64, 1));
assert_eq!(magicS64(9i64), mkMS64(0x1c71c71c71c71c72u64 as i64, 0));
assert_eq!(magicS64(10i64), mkMS64(0x6666666666666667u64 as i64, 2));
assert_eq!(magicS64(11i64), mkMS64(0x2e8ba2e8ba2e8ba3u64 as i64, 1));
assert_eq!(magicS64(12i64), mkMS64(0x2aaaaaaaaaaaaaabu64 as i64, 1));
assert_eq!(magicS64(25i64), mkMS64(0xa3d70a3d70a3d70bu64 as i64, 4));
assert_eq!(magicS64(125i64), mkMS64(0x20c49ba5e353f7cfu64 as i64, 4));
assert_eq!(magicS64(625i64), mkMS64(0x346dc5d63886594bu64 as i64, 7));
assert_eq!(magicS64(1337i64), mkMS64(0x6208ceca9433509du64 as i64, 9));
assert_eq!(
magicS64(31415927i64),
mkMS64(0x88b68aa5ce1e97c3u64 as i64, 24)
magic_s64(-31415927i64),
make_ms64(0x7749755a31e1683du64 as i64, 24)
);
assert_eq!(
magicS64(0x00000000deadbeefi64),
mkMS64(0x93275ab2dfc9094bu64 as i64, 31)
magic_s64(-1337i64),
make_ms64(0x9df731356bccaf63u64 as i64, 9)
);
assert_eq!(
magicS64(0x00000000fffffffdi64),
mkMS64(0x8000000180000005u64 as i64, 31)
magic_s64(-256i64),
make_ms64(0x7fffffffffffffffu64 as i64, 7)
);
assert_eq!(magic_s64(-5i64), make_ms64(0x9999999999999999u64 as i64, 1));
assert_eq!(magic_s64(-3i64), make_ms64(0x5555555555555555u64 as i64, 1));
assert_eq!(magic_s64(-2i64), make_ms64(0x7fffffffffffffffu64 as i64, 0));
assert_eq!(magic_s64(2i64), make_ms64(0x8000000000000001u64 as i64, 0));
assert_eq!(magic_s64(3i64), make_ms64(0x5555555555555556u64 as i64, 0));
assert_eq!(magic_s64(4i64), make_ms64(0x8000000000000001u64 as i64, 1));
assert_eq!(magic_s64(5i64), make_ms64(0x6666666666666667u64 as i64, 1));
assert_eq!(magic_s64(6i64), make_ms64(0x2aaaaaaaaaaaaaabu64 as i64, 0));
assert_eq!(magic_s64(7i64), make_ms64(0x4924924924924925u64 as i64, 1));
assert_eq!(magic_s64(9i64), make_ms64(0x1c71c71c71c71c72u64 as i64, 0));
assert_eq!(magic_s64(10i64), make_ms64(0x6666666666666667u64 as i64, 2));
assert_eq!(magic_s64(11i64), make_ms64(0x2e8ba2e8ba2e8ba3u64 as i64, 1));
assert_eq!(magic_s64(12i64), make_ms64(0x2aaaaaaaaaaaaaabu64 as i64, 1));
assert_eq!(magic_s64(25i64), make_ms64(0xa3d70a3d70a3d70bu64 as i64, 4));
assert_eq!(
magic_s64(125i64),
make_ms64(0x20c49ba5e353f7cfu64 as i64, 4)
);
assert_eq!(
magicS64(0x00000000fffffffei64),
mkMS64(0x8000000100000003u64 as i64, 31)
magic_s64(625i64),
make_ms64(0x346dc5d63886594bu64 as i64, 7)
);
assert_eq!(
magicS64(0x00000000ffffffffi64),
mkMS64(0x8000000080000001u64 as i64, 31)
magic_s64(1337i64),
make_ms64(0x6208ceca9433509du64 as i64, 9)
);
assert_eq!(
magicS64(0x0000000100000000i64),
mkMS64(0x8000000000000001u64 as i64, 31)
magic_s64(31415927i64),
make_ms64(0x88b68aa5ce1e97c3u64 as i64, 24)
);
assert_eq!(
magicS64(0x0000000100000001i64),
mkMS64(0x7fffffff80000001u64 as i64, 31)
magic_s64(0x00000000deadbeefi64),
make_ms64(0x93275ab2dfc9094bu64 as i64, 31)
);
assert_eq!(
magicS64(0x0ddc0ffeebadf00di64),
mkMS64(0x93c474e9ca5bbed1u64 as i64, 59)
magic_s64(0x00000000fffffffdi64),
make_ms64(0x8000000180000005u64 as i64, 31)
);
assert_eq!(
magicS64(0x7ffffffffffffffdi64),
mkMS64(0x2000000000000001u64 as i64, 60)
magic_s64(0x00000000fffffffei64),
make_ms64(0x8000000100000003u64 as i64, 31)
);
assert_eq!(
magicS64(0x7ffffffffffffffei64),
mkMS64(0x8000000000000003u64 as i64, 62)
magic_s64(0x00000000ffffffffi64),
make_ms64(0x8000000080000001u64 as i64, 31)
);
assert_eq!(
magicS64(0x7fffffffffffffffi64),
mkMS64(0x4000000000000001u64 as i64, 61)
magic_s64(0x0000000100000000i64),
make_ms64(0x8000000000000001u64 as i64, 31)
);
assert_eq!(
magic_s64(0x0000000100000001i64),
make_ms64(0x7fffffff80000001u64 as i64, 31)
);
assert_eq!(
magic_s64(0x0ddc0ffeebadf00di64),
make_ms64(0x93c474e9ca5bbed1u64 as i64, 59)
);
assert_eq!(
magic_s64(0x7ffffffffffffffdi64),
make_ms64(0x2000000000000001u64 as i64, 60)
);
assert_eq!(
magic_s64(0x7ffffffffffffffei64),
make_ms64(0x8000000000000003u64 as i64, 62)
);
assert_eq!(
magic_s64(0x7fffffffffffffffi64),
make_ms64(0x4000000000000001u64 as i64, 61)
);
}
#[test]
@ -478,67 +521,67 @@ mod tests {
// don't panic with integer wraparounds, especially at boundary
// cases for their arguments. The actual results are thrown away.
let mut total: u64 = 0;
// Testing UP magicU32
// Testing UP magic_u32
for x in 2..(200 * 1000u32) {
let m = magicU32(x);
total = total ^ (m.mulBy as u64);
total = total + (m.shiftBy as u64);
total = total - (if m.doAdd { 123 } else { 456 });
let m = magic_u32(x);
total = total ^ (m.mul_by as u64);
total = total + (m.shift_by as u64);
total = total - (if m.do_add { 123 } else { 456 });
}
assert_eq!(total, 1747815691);
// Testing DOWN magicU32
// Testing DOWN magic_u32
for x in 0..(200 * 1000u32) {
let m = magicU32(0xFFFF_FFFFu32 - x);
total = total ^ (m.mulBy as u64);
total = total + (m.shiftBy as u64);
total = total - (if m.doAdd { 123 } else { 456 });
let m = magic_u32(0xFFFF_FFFFu32 - x);
total = total ^ (m.mul_by as u64);
total = total + (m.shift_by as u64);
total = total - (if m.do_add { 123 } else { 456 });
}
assert_eq!(total, 2210292772);
// Testing UP magicU64
// Testing UP magic_u64
for x in 2..(200 * 1000u64) {
let m = magicU64(x);
total = total ^ m.mulBy;
total = total + (m.shiftBy as u64);
total = total - (if m.doAdd { 123 } else { 456 });
let m = magic_u64(x);
total = total ^ m.mul_by;
total = total + (m.shift_by as u64);
total = total - (if m.do_add { 123 } else { 456 });
}
assert_eq!(total, 7430004084791260605);
// Testing DOWN magicU64
// Testing DOWN magic_u64
for x in 0..(200 * 1000u64) {
let m = magicU64(0xFFFF_FFFF_FFFF_FFFFu64 - x);
total = total ^ m.mulBy;
total = total + (m.shiftBy as u64);
total = total - (if m.doAdd { 123 } else { 456 });
let m = magic_u64(0xFFFF_FFFF_FFFF_FFFFu64 - x);
total = total ^ m.mul_by;
total = total + (m.shift_by as u64);
total = total - (if m.do_add { 123 } else { 456 });
}
assert_eq!(total, 7547519887519825919);
// Testing UP magicS32
// Testing UP magic_s32
for x in 0..(200 * 1000i32) {
let m = magicS32(-0x8000_0000i32 + x);
total = total ^ (m.mulBy as u64);
total = total + (m.shiftBy as u64);
let m = magic_s32(-0x8000_0000i32 + x);
total = total ^ (m.mul_by as u64);
total = total + (m.shift_by as u64);
}
assert_eq!(total, 10899224186731671235);
// Testing DOWN magicS32
// Testing DOWN magic_s32
for x in 0..(200 * 1000i32) {
let m = magicS32(0x7FFF_FFFFi32 - x);
total = total ^ (m.mulBy as u64);
total = total + (m.shiftBy as u64);
let m = magic_s32(0x7FFF_FFFFi32 - x);
total = total ^ (m.mul_by as u64);
total = total + (m.shift_by as u64);
}
assert_eq!(total, 7547519887517897369);
// Testing UP magicS64
// Testing UP magic_s64
for x in 0..(200 * 1000i64) {
let m = magicS64(-0x8000_0000_0000_0000i64 + x);
total = total ^ (m.mulBy as u64);
total = total + (m.shiftBy as u64);
let m = magic_s64(-0x8000_0000_0000_0000i64 + x);
total = total ^ (m.mul_by as u64);
total = total + (m.shift_by as u64);
}
assert_eq!(total, 8029756891368555163);
// Testing DOWN magicS64
// Testing DOWN magic_s64
for x in 0..(200 * 1000i64) {
let m = magicS64(0x7FFF_FFFF_FFFF_FFFFi64 - x);
total = total ^ (m.mulBy as u64);
total = total + (m.shiftBy as u64);
let m = magic_s64(0x7FFF_FFFF_FFFF_FFFFi64 - x);
total = total ^ (m.mul_by as u64);
total = total + (m.shift_by as u64);
}
// Force `total` -- and hence, the entire computation -- to
// be used, so that rustc can't optimise it out.

Просмотреть файл

@ -1,15 +1,15 @@
//! A Dominator Tree represented as mappings of Ebbs to their immediate dominator.
use entity::SecondaryMap;
use flowgraph::{BasicBlock, ControlFlowGraph};
use ir::instructions::BranchInfo;
use ir::{Ebb, ExpandedProgramPoint, Function, Inst, Layout, ProgramOrder, Value};
use packed_option::PackedOption;
use std::cmp;
use std::cmp::Ordering;
use std::mem;
use crate::entity::SecondaryMap;
use crate::flowgraph::{BasicBlock, ControlFlowGraph};
use crate::ir::instructions::BranchInfo;
use crate::ir::{Ebb, ExpandedProgramPoint, Function, Inst, Layout, ProgramOrder, Value};
use crate::packed_option::PackedOption;
use crate::timing;
use core::cmp;
use core::cmp::Ordering;
use core::mem;
use std::vec::Vec;
use timing;
/// RPO numbers are not first assigned in a contiguous way but as multiples of STRIDE, to leave
/// room for modifications of the dominator tree.
@ -505,7 +505,7 @@ impl DominatorTree {
/// - An ordering of EBBs according to a dominator tree pre-order.
/// - Constant time dominance checks at the EBB granularity.
///
/// The information in this auxillary data structure is not easy to update when the control flow
/// The information in this auxiliary data structure is not easy to update when the control flow
/// graph changes, which is why it is kept separate.
pub struct DominatorTreePreorder {
nodes: SecondaryMap<Ebb, ExtraNode>,
@ -671,12 +671,12 @@ impl DominatorTreePreorder {
#[cfg(test)]
mod tests {
use super::*;
use cursor::{Cursor, FuncCursor};
use flowgraph::ControlFlowGraph;
use ir::types::*;
use ir::{Function, InstBuilder, TrapCode};
use settings;
use verifier::{verify_context, VerifierErrors};
use crate::cursor::{Cursor, FuncCursor};
use crate::flowgraph::ControlFlowGraph;
use crate::ir::types::*;
use crate::ir::{Function, InstBuilder, TrapCode};
use crate::settings;
use crate::verifier::{verify_context, VerifierErrors};
#[test]
fn empty() {

Просмотреть файл

@ -23,12 +23,12 @@
//! Here `Ebb1` and `Ebb2` would each have a single predecessor denoted as `(Ebb0, brz)`
//! and `(Ebb0, jmp Ebb2)` respectively.
use bforest;
use entity::SecondaryMap;
use ir::instructions::BranchInfo;
use ir::{Ebb, Function, Inst};
use std::mem;
use timing;
use crate::bforest;
use crate::entity::SecondaryMap;
use crate::ir::instructions::BranchInfo;
use crate::ir::{Ebb, Function, Inst};
use crate::timing;
use core::mem;
/// A basic block denoted by its enclosing Ebb and last instruction.
#[derive(PartialEq, Eq)]
@ -212,8 +212,8 @@ pub type SuccIter<'a> = bforest::SetIter<'a, Ebb>;
#[cfg(test)]
mod tests {
use super::*;
use cursor::{Cursor, FuncCursor};
use ir::{types, Function, InstBuilder};
use crate::cursor::{Cursor, FuncCursor};
use crate::ir::{types, Function, InstBuilder};
use std::vec::Vec;
#[test]

Просмотреть файл

@ -10,10 +10,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::collections::{HashMap, HashSet};
use std::default::Default;
use std::hash::{BuildHasherDefault, Hash, Hasher};
use std::ops::BitXor;
use super::{HashMap, HashSet};
use core::default::Default;
use core::hash::{BuildHasherDefault, Hash, Hasher};
use core::ops::BitXor;
pub type FxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;
pub type FxHashSet<V> = HashSet<V, BuildHasherDefault<FxHasher>>;

Просмотреть файл

@ -3,11 +3,11 @@
//! A `Builder` provides a convenient interface for inserting instructions into a Cranelift
//! function. Many of its methods are generated from the meta language instruction definitions.
use ir;
use ir::types;
use ir::{DataFlowGraph, InstructionData};
use ir::{Inst, Opcode, Type, Value};
use isa;
use crate::ir;
use crate::ir::types;
use crate::ir::{DataFlowGraph, InstructionData};
use crate::ir::{Inst, Opcode, Type, Value};
use crate::isa;
/// Base trait for instruction builders.
///
@ -59,7 +59,7 @@ pub trait InstInserterBase<'f>: Sized {
fn insert_built_inst(self, inst: Inst, ctrl_typevar: Type) -> &'f mut DataFlowGraph;
}
use std::marker::PhantomData;
use core::marker::PhantomData;
/// Builder that inserts an instruction at the current position.
///
@ -162,7 +162,7 @@ where
{
let dfg = self.inserter.data_flow_graph_mut();
inst = dfg.make_inst(data);
// Make an `Interator<Item = Option<Value>>`.
// Make an `Iterator<Item = Option<Value>>`.
let ru = self.reuse.as_ref().iter().cloned();
dfg.make_inst_results_reusing(inst, ctrl_typevar, ru);
}
@ -215,10 +215,10 @@ impl<'f> InstBuilderBase<'f> for ReplaceBuilder<'f> {
#[cfg(test)]
mod tests {
use cursor::{Cursor, FuncCursor};
use ir::condcodes::*;
use ir::types::*;
use ir::{Function, InstBuilder, ValueDef};
use crate::cursor::{Cursor, FuncCursor};
use crate::ir::condcodes::*;
use crate::ir::types::*;
use crate::ir::{Function, InstBuilder, ValueDef};
#[test]
fn types() {

Просмотреть файл

@ -4,8 +4,8 @@
//! are different rules for comparing integers and floating point numbers, so they use different
//! condition codes.
use std::fmt::{self, Display, Formatter};
use std::str::FromStr;
use core::fmt::{self, Display, Formatter};
use core::str::FromStr;
/// Common traits of condition codes.
pub trait CondCode: Copy {

Просмотреть файл

@ -1,20 +1,20 @@
//! Data flow graph tracking Instructions, Values, and EBBs.
use entity::{self, PrimaryMap, SecondaryMap};
use ir;
use ir::builder::ReplaceBuilder;
use ir::extfunc::ExtFuncData;
use ir::instructions::{BranchInfo, CallInfo, InstructionData};
use ir::types;
use ir::{Ebb, FuncRef, Inst, SigRef, Signature, Type, Value, ValueList, ValueListPool};
use isa::TargetIsa;
use packed_option::ReservedValue;
use std::fmt;
use std::iter;
use std::mem;
use std::ops::{Index, IndexMut};
use std::u16;
use write::write_operands;
use crate::entity::{self, PrimaryMap, SecondaryMap};
use crate::ir;
use crate::ir::builder::ReplaceBuilder;
use crate::ir::extfunc::ExtFuncData;
use crate::ir::instructions::{BranchInfo, CallInfo, InstructionData};
use crate::ir::types;
use crate::ir::{Ebb, FuncRef, Inst, SigRef, Signature, Type, Value, ValueList, ValueListPool};
use crate::isa::TargetIsa;
use crate::packed_option::ReservedValue;
use crate::write::write_operands;
use core::fmt;
use core::iter;
use core::mem;
use core::ops::{Index, IndexMut};
use core::u16;
/// A data flow graph defines all instructions and extended basic blocks in a function as well as
/// the data flow dependencies between them. The DFG also tracks values which can be either
@ -1063,9 +1063,9 @@ impl DataFlowGraph {
#[cfg(test)]
mod tests {
use super::*;
use cursor::{Cursor, FuncCursor};
use ir::types;
use ir::{Function, InstructionData, Opcode, TrapCode};
use crate::cursor::{Cursor, FuncCursor};
use crate::ir::types;
use crate::ir::{Function, InstructionData, Opcode, TrapCode};
use std::string::ToString;
#[test]
@ -1218,8 +1218,8 @@ mod tests {
#[test]
fn aliases() {
use ir::condcodes::IntCC;
use ir::InstBuilder;
use crate::ir::condcodes::IntCC;
use crate::ir::InstBuilder;
let mut func = Function::new();
let ebb0 = func.dfg.make_ebb();

Просмотреть файл

@ -19,8 +19,9 @@
//! The entity references all implement the `Display` trait in a way that matches the textual IR
//! format.
use std::fmt;
use std::u32;
use crate::entity::entity_impl;
use core::fmt;
use core::u32;
/// An opaque reference to an extended basic block in a function.
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
@ -304,8 +305,8 @@ impl From<Table> for AnyEntity {
#[cfg(test)]
mod tests {
use super::*;
use core::u32;
use std::string::ToString;
use std::u32;
#[test]
fn value_with_number() {
@ -318,8 +319,8 @@ mod tests {
#[test]
fn memory() {
use packed_option::PackedOption;
use std::mem;
use crate::packed_option::PackedOption;
use core::mem;
// This is the whole point of `PackedOption`.
assert_eq!(
mem::size_of::<Value>(),

Просмотреть файл

@ -5,10 +5,10 @@
//!
//! This module declares the data types used to represent external functions and call signatures.
use ir::{ArgumentLoc, ExternalName, SigRef, Type};
use isa::{CallConv, RegInfo, RegUnit};
use std::fmt;
use std::str::FromStr;
use crate::ir::{ArgumentLoc, ExternalName, SigRef, Type};
use crate::isa::{CallConv, RegInfo, RegUnit};
use core::fmt;
use core::str::FromStr;
use std::vec::Vec;
/// Function signature.
@ -334,7 +334,7 @@ impl fmt::Display for ExtFuncData {
#[cfg(test)]
mod tests {
use super::*;
use ir::types::{B8, F32, I32};
use crate::ir::types::{B8, F32, I32};
use std::string::ToString;
#[test]

Просмотреть файл

@ -4,10 +4,10 @@
//! function. The name of an external declaration doesn't have any meaning to
//! Cranelift, which compiles functions independently.
use ir::LibCall;
use std::cmp;
use std::fmt::{self, Write};
use std::str::FromStr;
use crate::ir::LibCall;
use core::cmp;
use core::fmt::{self, Write};
use core::str::FromStr;
const TESTCASE_NAME_LENGTH: usize = 16;
@ -119,9 +119,9 @@ impl FromStr for ExternalName {
#[cfg(test)]
mod tests {
use super::ExternalName;
use ir::LibCall;
use crate::ir::LibCall;
use core::u32;
use std::string::ToString;
use std::u32;
#[test]
fn display_testcase() {

Просмотреть файл

@ -3,20 +3,20 @@
//! The `Function` struct defined in this module owns all of its extended basic blocks and
//! instructions.
use binemit::CodeOffset;
use entity::{PrimaryMap, SecondaryMap};
use ir;
use ir::{DataFlowGraph, ExternalName, Layout, Signature};
use ir::{
use crate::binemit::CodeOffset;
use crate::entity::{PrimaryMap, SecondaryMap};
use crate::ir;
use crate::ir::{DataFlowGraph, ExternalName, Layout, Signature};
use crate::ir::{
Ebb, ExtFuncData, FuncRef, GlobalValue, GlobalValueData, Heap, HeapData, JumpTable,
JumpTableData, SigRef, StackSlot, StackSlotData, Table, TableData,
};
use ir::{EbbOffsets, InstEncodings, SourceLocs, StackSlots, ValueLocations};
use ir::{JumpTableOffsets, JumpTables};
use isa::{CallConv, EncInfo, Encoding, Legalize, TargetIsa};
use regalloc::RegDiversions;
use std::fmt;
use write::write_function;
use crate::ir::{EbbOffsets, InstEncodings, SourceLocs, StackSlots, ValueLocations};
use crate::ir::{JumpTableOffsets, JumpTables};
use crate::isa::{CallConv, EncInfo, Encoding, Legalize, TargetIsa};
use crate::regalloc::RegDiversions;
use crate::write::write_function;
use core::fmt;
/// A function.
///

Просмотреть файл

@ -1,9 +1,9 @@
//! Global values.
use ir::immediates::{Imm64, Offset32};
use ir::{ExternalName, GlobalValue, Type};
use isa::TargetIsa;
use std::fmt;
use crate::ir::immediates::{Imm64, Offset32};
use crate::ir::{ExternalName, GlobalValue, Type};
use crate::isa::TargetIsa;
use core::fmt;
/// Information about a global value declaration.
#[derive(Clone)]
@ -27,7 +27,8 @@ pub enum GlobalValueData {
/// Type of the loaded value.
global_type: Type,
/// Specifies whether the memory that this refers to is readonly, allowing for the elimination of redundant loads.
/// Specifies whether the memory that this refers to is readonly, allowing for the
/// elimination of redundant loads.
readonly: bool,
},

Просмотреть файл

@ -1,8 +1,8 @@
//! Heaps.
use ir::immediates::Uimm64;
use ir::{GlobalValue, Type};
use std::fmt;
use crate::ir::immediates::Uimm64;
use crate::ir::{GlobalValue, Type};
use core::fmt;
/// Information about a heap declaration.
#[derive(Clone)]

Просмотреть файл

@ -4,10 +4,10 @@
//! Each type here should have a corresponding definition in the `cranelift.immediates` Python
//! module in the meta language.
use std::fmt::{self, Display, Formatter};
use std::mem;
use std::str::FromStr;
use std::{i32, u32};
use core::fmt::{self, Display, Formatter};
use core::mem;
use core::str::FromStr;
use core::{i32, u32};
/// 64-bit immediate signed integer operand.
///
@ -729,10 +729,10 @@ impl FromStr for Ieee64 {
#[cfg(test)]
mod tests {
use super::*;
use std::fmt::Display;
use std::str::FromStr;
use core::fmt::Display;
use core::str::FromStr;
use core::{f32, f64};
use std::string::ToString;
use std::{f32, f64};
#[test]
fn format_imm64() {

Просмотреть файл

@ -6,19 +6,19 @@
//! A large part of this module is auto-generated from the instruction descriptions in the meta
//! directory.
use std::fmt::{self, Display, Formatter};
use std::ops::{Deref, DerefMut};
use std::str::FromStr;
use core::fmt::{self, Display, Formatter};
use core::ops::{Deref, DerefMut};
use core::str::FromStr;
use std::vec::Vec;
use ir;
use ir::types;
use ir::{Ebb, FuncRef, JumpTable, SigRef, Type, Value};
use isa;
use crate::ir;
use crate::ir::types;
use crate::ir::{Ebb, FuncRef, JumpTable, SigRef, Type, Value};
use crate::isa;
use bitset::BitSet;
use entity;
use ref_slice::{ref_slice, ref_slice_mut};
use crate::bitset::BitSet;
use crate::entity;
use crate::ref_slice::{ref_slice, ref_slice_mut};
/// Some instructions use an external list of argument values because there is not enough space in
/// the 16-byte `InstructionData` struct. These value lists are stored in a memory pool in
@ -73,7 +73,7 @@ impl FromStr for Opcode {
/// Parse an Opcode name from a string.
fn from_str(s: &str) -> Result<Self, &'static str> {
use constant_hash::{probe, simple_hash, Table};
use crate::constant_hash::{probe, simple_hash, Table};
impl<'a> Table<&'a str> for [Option<Opcode>] {
fn len(&self) -> usize {
@ -335,8 +335,8 @@ pub struct OpcodeConstraints {
typeset_offset: u8,
/// Offset into `OPERAND_CONSTRAINT` table of the descriptors for this opcode. The first
/// `num_fixed_results()` entries describe the result constraints, then follows constraints for the
/// fixed `Value` input operands. (`num_fixed_value_arguments()` of them).
/// `num_fixed_results()` entries describe the result constraints, then follows constraints for
/// the fixed `Value` input operands. (`num_fixed_value_arguments()` of them).
constraint_offset: u16,
}
@ -561,7 +561,7 @@ mod tests {
#[test]
fn opcodes() {
use std::mem;
use core::mem;
let x = Opcode::Iadd;
let mut y = Opcode::Isub;
@ -590,7 +590,7 @@ mod tests {
#[test]
fn instruction_data() {
use std::mem;
use core::mem;
// The size of the `InstructionData` enum is important for performance. It should not
// exceed 16 bytes. Use `Box<FooData>` out-of-line payloads for instruction formats that
// require more space than that. It would be fine with a data structure smaller than 16
@ -645,7 +645,7 @@ mod tests {
#[test]
fn value_set() {
use ir::types::*;
use crate::ir::types::*;
let vts = ValueTypeSet {
lanes: BitSet16::from_range(0, 8),

Просмотреть файл

@ -3,9 +3,9 @@
//! Jump tables are declared in the preamble and assigned an `ir::entities::JumpTable` reference.
//! The actual table of destinations is stored in a `JumpTableData` struct defined in this module.
use ir::entities::Ebb;
use std::fmt::{self, Display, Formatter};
use std::slice::{Iter, IterMut};
use crate::ir::entities::Ebb;
use core::fmt::{self, Display, Formatter};
use core::slice::{Iter, IterMut};
use std::vec::Vec;
/// Contents of a jump table.
@ -83,8 +83,8 @@ impl Display for JumpTableData {
#[cfg(test)]
mod tests {
use super::JumpTableData;
use entity::EntityRef;
use ir::Ebb;
use crate::entity::EntityRef;
use crate::ir::Ebb;
use std::string::ToString;
#[test]

Просмотреть файл

@ -3,13 +3,14 @@
//! The order of extended basic blocks in a function and the order of instructions in an EBB is
//! determined by the `Layout` data structure defined in this module.
use entity::SecondaryMap;
use ir::progpoint::{ExpandedProgramPoint, ProgramOrder};
use ir::{Ebb, Inst};
use packed_option::PackedOption;
use std::cmp;
use std::iter::{IntoIterator, Iterator};
use timing;
use crate::entity::SecondaryMap;
use crate::ir::progpoint::{ExpandedProgramPoint, ProgramOrder};
use crate::ir::{Ebb, Inst};
use crate::packed_option::PackedOption;
use crate::timing;
use core::cmp;
use core::iter::{IntoIterator, Iterator};
use log::debug;
/// The `Layout` struct determines the layout of EBBs and instructions in a function. It does not
/// contain definitions of instructions or EBBs, but depends on `Inst` and `Ebb` entity references
@ -741,10 +742,10 @@ impl<'f> DoubleEndedIterator for Insts<'f> {
#[cfg(test)]
mod tests {
use super::Layout;
use cursor::{Cursor, CursorPosition};
use entity::EntityRef;
use ir::{Ebb, Inst, ProgramOrder, SourceLoc};
use std::cmp::Ordering;
use crate::cursor::{Cursor, CursorPosition};
use crate::entity::EntityRef;
use crate::ir::{Ebb, Inst, ProgramOrder, SourceLoc};
use core::cmp::Ordering;
use std::vec::Vec;
struct LayoutCursor<'f> {

Просмотреть файл

@ -1,12 +1,12 @@
//! Naming well-known routines in the runtime library.
use ir::{
use crate::ir::{
types, AbiParam, ArgumentPurpose, ExtFuncData, ExternalName, FuncRef, Function, Inst, Opcode,
Signature, Type,
};
use isa::{CallConv, RegUnit, TargetIsa};
use std::fmt;
use std::str::FromStr;
use crate::isa::{CallConv, RegUnit, TargetIsa};
use core::fmt;
use core::str::FromStr;
/// The name of a runtime library routine.
///

Просмотреть файл

@ -1,6 +1,6 @@
//! Memory operation flags.
use std::fmt;
use core::fmt;
enum FlagBit {
Notrap,
@ -92,8 +92,8 @@ impl MemFlags {
/// Test if the `readonly` flag is set.
///
/// Loads with this flag have no memory dependendies.
/// This results in indefined behavior if the dereferenced memory is mutated at any time
/// Loads with this flag have no memory dependencies.
/// This results in undefined behavior if the dereferenced memory is mutated at any time
/// between when the function is called and when it is exited.
pub fn readonly(self) -> bool {
self.read(FlagBit::Readonly)

Просмотреть файл

@ -23,32 +23,36 @@ mod trapcode;
pub mod types;
mod valueloc;
pub use ir::builder::{InsertBuilder, InstBuilder, InstBuilderBase, InstInserterBase};
pub use ir::dfg::{DataFlowGraph, ValueDef};
pub use ir::entities::{
pub use crate::ir::builder::{InsertBuilder, InstBuilder, InstBuilderBase, InstInserterBase};
pub use crate::ir::dfg::{DataFlowGraph, ValueDef};
pub use crate::ir::entities::{
Ebb, FuncRef, GlobalValue, Heap, Inst, JumpTable, SigRef, StackSlot, Table, Value,
};
pub use ir::extfunc::{AbiParam, ArgumentExtension, ArgumentPurpose, ExtFuncData, Signature};
pub use ir::extname::ExternalName;
pub use ir::function::Function;
pub use ir::globalvalue::GlobalValueData;
pub use ir::heap::{HeapData, HeapStyle};
pub use ir::instructions::{InstructionData, Opcode, ValueList, ValueListPool, VariableArgs};
pub use ir::jumptable::JumpTableData;
pub use ir::layout::Layout;
pub use ir::libcall::{get_libcall_funcref, get_probestack_funcref, LibCall};
pub use ir::memflags::MemFlags;
pub use ir::progpoint::{ExpandedProgramPoint, ProgramOrder, ProgramPoint};
pub use ir::sourceloc::SourceLoc;
pub use ir::stackslot::{StackSlotData, StackSlotKind, StackSlots};
pub use ir::table::TableData;
pub use ir::trapcode::TrapCode;
pub use ir::types::Type;
pub use ir::valueloc::{ArgumentLoc, ValueLoc};
pub use crate::ir::extfunc::{
AbiParam, ArgumentExtension, ArgumentPurpose, ExtFuncData, Signature,
};
pub use crate::ir::extname::ExternalName;
pub use crate::ir::function::Function;
pub use crate::ir::globalvalue::GlobalValueData;
pub use crate::ir::heap::{HeapData, HeapStyle};
pub use crate::ir::instructions::{
InstructionData, Opcode, ValueList, ValueListPool, VariableArgs,
};
pub use crate::ir::jumptable::JumpTableData;
pub use crate::ir::layout::Layout;
pub use crate::ir::libcall::{get_libcall_funcref, get_probestack_funcref, LibCall};
pub use crate::ir::memflags::MemFlags;
pub use crate::ir::progpoint::{ExpandedProgramPoint, ProgramOrder, ProgramPoint};
pub use crate::ir::sourceloc::SourceLoc;
pub use crate::ir::stackslot::{StackSlotData, StackSlotKind, StackSlots};
pub use crate::ir::table::TableData;
pub use crate::ir::trapcode::TrapCode;
pub use crate::ir::types::Type;
pub use crate::ir::valueloc::{ArgumentLoc, ValueLoc};
use binemit;
use entity::{PrimaryMap, SecondaryMap};
use isa;
use crate::binemit;
use crate::entity::{PrimaryMap, SecondaryMap};
use crate::isa;
/// Map of value locations.
pub type ValueLocations = SecondaryMap<Value, ValueLoc>;

Просмотреть файл

@ -1,10 +1,10 @@
//! Program points.
use entity::EntityRef;
use ir::{Ebb, Inst, ValueDef};
use std::cmp;
use std::fmt;
use std::u32;
use crate::entity::EntityRef;
use crate::ir::{Ebb, Inst, ValueDef};
use core::cmp;
use core::fmt;
use core::u32;
/// A `ProgramPoint` represents a position in a function where the live range of an SSA value can
/// begin or end. It can be either:
@ -146,8 +146,8 @@ pub trait ProgramOrder {
#[cfg(test)]
mod tests {
use super::*;
use entity::EntityRef;
use ir::{Ebb, Inst};
use crate::entity::EntityRef;
use crate::ir::{Ebb, Inst};
use std::string::ToString;
#[test]

Просмотреть файл

@ -3,7 +3,7 @@
//! Cranelift tracks the original source location of each instruction, and preserves the source
//! location when instructions are transformed.
use std::fmt;
use core::fmt;
/// A source location.
///
@ -50,7 +50,7 @@ impl fmt::Display for SourceLoc {
#[cfg(test)]
mod tests {
use ir::SourceLoc;
use crate::ir::SourceLoc;
use std::string::ToString;
#[test]

Просмотреть файл

@ -3,14 +3,14 @@
//! The `StackSlotData` struct keeps track of a single stack slot in a function.
//!
use entity::{Iter, IterMut, Keys, PrimaryMap};
use ir::{StackSlot, Type};
use packed_option::PackedOption;
use std::cmp;
use std::fmt;
use std::ops::{Index, IndexMut};
use std::slice;
use std::str::FromStr;
use crate::entity::{Iter, IterMut, Keys, PrimaryMap};
use crate::ir::{StackSlot, Type};
use crate::packed_option::PackedOption;
use core::cmp;
use core::fmt;
use core::ops::{Index, IndexMut};
use core::slice;
use core::str::FromStr;
use std::vec::Vec;
/// The size of an object on the stack, or the size of a stack frame.
@ -340,8 +340,8 @@ impl StackSlots {
#[cfg(test)]
mod tests {
use super::*;
use ir::types;
use ir::Function;
use crate::ir::types;
use crate::ir::Function;
use std::string::ToString;
#[test]

Просмотреть файл

@ -1,8 +1,8 @@
//! Tables.
use ir::immediates::Uimm64;
use ir::{GlobalValue, Type};
use std::fmt;
use crate::ir::immediates::Uimm64;
use crate::ir::{GlobalValue, Type};
use core::fmt;
/// Information about a table declaration.
#[derive(Clone)]

Просмотреть файл

@ -1,7 +1,7 @@
//! Trap codes describing the reason for a trap.
use std::fmt::{self, Display, Formatter};
use std::str::FromStr;
use core::fmt::{self, Display, Formatter};
use core::str::FromStr;
/// A trap code describing the reason for a trap.
///
@ -42,6 +42,9 @@ pub enum TrapCode {
/// Failed float-to-int conversion.
BadConversionToInteger,
/// Code that was supposed to have been unreachable was reached.
UnreachableCodeReached,
/// Execution has potentially run too long and may be interrupted.
/// This trap is resumable.
Interrupt,
@ -63,6 +66,7 @@ impl Display for TrapCode {
IntegerOverflow => "int_ovf",
IntegerDivisionByZero => "int_divz",
BadConversionToInteger => "bad_toint",
UnreachableCodeReached => "unreachable",
Interrupt => "interrupt",
User(x) => return write!(f, "user{}", x),
};
@ -85,6 +89,7 @@ impl FromStr for TrapCode {
"int_ovf" => Ok(IntegerOverflow),
"int_divz" => Ok(IntegerDivisionByZero),
"bad_toint" => Ok(BadConversionToInteger),
"unreachable" => Ok(UnreachableCodeReached),
"interrupt" => Ok(Interrupt),
_ if s.starts_with("user") => s[4..].parse().map(User).map_err(|_| ()),
_ => Err(()),
@ -98,7 +103,7 @@ mod tests {
use std::string::ToString;
// Everything but user-defined codes.
const CODES: [TrapCode; 9] = [
const CODES: [TrapCode; 11] = [
TrapCode::StackOverflow,
TrapCode::HeapOutOfBounds,
TrapCode::TableOutOfBounds,
@ -108,6 +113,8 @@ mod tests {
TrapCode::IntegerOverflow,
TrapCode::IntegerDivisionByZero,
TrapCode::BadConversionToInteger,
TrapCode::UnreachableCodeReached,
TrapCode::Interrupt,
];
#[test]

Просмотреть файл

@ -1,7 +1,7 @@
//! Common types for the Cranelift code generator.
use std::default::Default;
use std::fmt::{self, Debug, Display, Formatter};
use core::default::Default;
use core::fmt::{self, Debug, Display, Formatter};
use target_lexicon::{PointerWidth, Triple};
/// The type of an SSA value.

Просмотреть файл

@ -3,9 +3,9 @@
//! The register allocator assigns every SSA value to either a register or a stack slot. This
//! assignment is represented by a `ValueLoc` object.
use ir::StackSlot;
use isa::{RegInfo, RegUnit};
use std::fmt;
use crate::ir::StackSlot;
use crate::isa::{RegInfo, RegUnit};
use core::fmt;
/// Value location.
#[derive(Copy, Clone, Debug, PartialEq, Eq)]

Просмотреть файл

@ -1,10 +1,10 @@
//! ARM ABI implementation.
use super::registers::{D, GPR, Q, S};
use ir;
use isa::RegClass;
use regalloc::RegisterSet;
use settings as shared_settings;
use crate::ir;
use crate::isa::RegClass;
use crate::regalloc::RegisterSet;
use crate::settings as shared_settings;
/// Legalize `sig`.
pub fn legalize_signature(

Просмотреть файл

@ -1,7 +1,7 @@
//! Emitting binary ARM32 machine code.
use binemit::{bad_encoding, CodeSink};
use ir::{Function, Inst};
use regalloc::RegDiversions;
use crate::binemit::{bad_encoding, CodeSink};
use crate::ir::{Function, Inst};
use crate::regalloc::RegDiversions;
include!(concat!(env!("OUT_DIR"), "/binemit-arm32.rs"));

Просмотреть файл

@ -1,10 +1,9 @@
//! Encoding tables for ARM32 ISA.
use ir;
use isa;
use isa::constraints::*;
use isa::enc_tables::*;
use isa::encoding::RecipeSizing;
use crate::isa;
use crate::isa::constraints::*;
use crate::isa::enc_tables::*;
use crate::isa::encoding::RecipeSizing;
include!(concat!(env!("OUT_DIR"), "/encoding-arm32.rs"));
include!(concat!(env!("OUT_DIR"), "/legalize-arm32.rs"));

Просмотреть файл

@ -8,15 +8,15 @@ pub mod settings;
use super::super::settings as shared_settings;
#[cfg(feature = "testing_hooks")]
use binemit::CodeSink;
use binemit::{emit_function, MemoryCodeSink};
use ir;
use isa::enc_tables::{self as shared_enc_tables, lookup_enclist, Encodings};
use isa::Builder as IsaBuilder;
use isa::{EncInfo, RegClass, RegInfo, TargetIsa};
use regalloc;
use crate::binemit::CodeSink;
use crate::binemit::{emit_function, MemoryCodeSink};
use crate::ir;
use crate::isa::enc_tables::{self as shared_enc_tables, lookup_enclist, Encodings};
use crate::isa::Builder as IsaBuilder;
use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa};
use crate::regalloc;
use core::fmt;
use std::boxed::Box;
use std::fmt;
use target_lexicon::{Architecture, Triple};
#[allow(dead_code)]

Просмотреть файл

@ -1,13 +1,13 @@
//! ARM32 register descriptions.
use isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
use crate::isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
include!(concat!(env!("OUT_DIR"), "/registers-arm32.rs"));
#[cfg(test)]
mod tests {
use super::{D, GPR, INFO, S};
use isa::RegUnit;
use crate::isa::RegUnit;
use std::string::{String, ToString};
#[test]
@ -34,7 +34,7 @@ mod tests {
#[test]
fn overlaps() {
// arm32 has the most interesting register geometries, so test `regs_overlap()` here.
use isa::regs_overlap;
use crate::isa::regs_overlap;
let r0 = GPR.unit(0);
let r1 = GPR.unit(1);

Просмотреть файл

@ -1,7 +1,7 @@
//! ARM32 Settings.
use settings::{self, detail, Builder};
use std::fmt;
use crate::settings::{self, detail, Builder};
use core::fmt;
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
// `Flags` struct with an impl for all of the settings defined in

Просмотреть файл

@ -1,10 +1,10 @@
//! ARM 64 ABI implementation.
use super::registers::{FPR, GPR};
use ir;
use isa::RegClass;
use regalloc::RegisterSet;
use settings as shared_settings;
use crate::ir;
use crate::isa::RegClass;
use crate::regalloc::RegisterSet;
use crate::settings as shared_settings;
/// Legalize `sig`.
pub fn legalize_signature(

Просмотреть файл

@ -1,7 +1,7 @@
//! Emitting binary ARM64 machine code.
use binemit::{bad_encoding, CodeSink};
use ir::{Function, Inst};
use regalloc::RegDiversions;
use crate::binemit::{bad_encoding, CodeSink};
use crate::ir::{Function, Inst};
use crate::regalloc::RegDiversions;
include!(concat!(env!("OUT_DIR"), "/binemit-arm64.rs"));

Просмотреть файл

@ -1,10 +1,9 @@
//! Encoding tables for ARM64 ISA.
use ir;
use isa;
use isa::constraints::*;
use isa::enc_tables::*;
use isa::encoding::RecipeSizing;
use crate::isa;
use crate::isa::constraints::*;
use crate::isa::enc_tables::*;
use crate::isa::encoding::RecipeSizing;
include!(concat!(env!("OUT_DIR"), "/encoding-arm64.rs"));
include!(concat!(env!("OUT_DIR"), "/legalize-arm64.rs"));

Просмотреть файл

@ -8,15 +8,15 @@ pub mod settings;
use super::super::settings as shared_settings;
#[cfg(feature = "testing_hooks")]
use binemit::CodeSink;
use binemit::{emit_function, MemoryCodeSink};
use ir;
use isa::enc_tables::{lookup_enclist, Encodings};
use isa::Builder as IsaBuilder;
use isa::{EncInfo, RegClass, RegInfo, TargetIsa};
use regalloc;
use crate::binemit::CodeSink;
use crate::binemit::{emit_function, MemoryCodeSink};
use crate::ir;
use crate::isa::enc_tables::{lookup_enclist, Encodings};
use crate::isa::Builder as IsaBuilder;
use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa};
use crate::regalloc;
use core::fmt;
use std::boxed::Box;
use std::fmt;
use target_lexicon::Triple;
#[allow(dead_code)]

Просмотреть файл

@ -1,13 +1,13 @@
//! ARM64 register descriptions.
use isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
use crate::isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
include!(concat!(env!("OUT_DIR"), "/registers-arm64.rs"));
#[cfg(test)]
mod tests {
use super::INFO;
use isa::RegUnit;
use crate::isa::RegUnit;
use std::string::{String, ToString};
#[test]

Просмотреть файл

@ -1,7 +1,7 @@
//! ARM64 Settings.
use settings::{self, detail, Builder};
use std::fmt;
use crate::settings::{self, detail, Builder};
use core::fmt;
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
// `Flags` struct with an impl for all of the settings defined in

Просмотреть файл

@ -1,5 +1,5 @@
use std::fmt;
use std::str;
use core::fmt;
use core::str;
use target_lexicon::{CallingConvention, Triple};
/// Calling convention identifiers.

Просмотреть файл

@ -7,10 +7,10 @@
//! It is the register allocator's job to make sure that the register constraints on value operands
//! are satisfied.
use binemit::CodeOffset;
use ir::{Function, Inst, ValueLoc};
use isa::{RegClass, RegUnit};
use regalloc::RegDiversions;
use crate::binemit::CodeOffset;
use crate::ir::{Function, Inst, ValueLoc};
use crate::isa::{RegClass, RegUnit};
use crate::regalloc::RegDiversions;
/// Register constraint for a single value operand or instruction result.
#[derive(PartialEq, Debug)]

Просмотреть файл

@ -3,11 +3,11 @@
//! This module contains types and functions for working with the encoding tables generated by
//! `lib/codegen/meta-python/gen_encoding.py`.
use constant_hash::{probe, Table};
use ir::{Function, InstructionData, Opcode, Type};
use isa::{Encoding, Legalize};
use settings::PredicateView;
use std::ops::Range;
use crate::constant_hash::{probe, Table};
use crate::ir::{Function, InstructionData, Opcode, Type};
use crate::isa::{Encoding, Legalize};
use crate::settings::PredicateView;
use core::ops::Range;
/// A recipe predicate.
///

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше