зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1559099: Bump Cranelift in Spidermonkey to e455f6ae; r=lth
Changes have been reviewed on the Cranelift side; this is just a bump to the latest version. Differential Revision: https://phabricator.services.mozilla.com/D36327 --HG-- extra : rebase_source : 66c188e223fc956562e4d4c901afa059a178da8a extra : histedit_source : 39ce43e74dd1666440a39a25703c4f5023e0472b
This commit is contained in:
Родитель
76f416f162
Коммит
7a302743be
|
@ -24,7 +24,7 @@ replace-with = "vendored-sources"
|
|||
|
||||
[source."https://github.com/CraneStation/Cranelift"]
|
||||
git = "https://github.com/CraneStation/Cranelift"
|
||||
rev = "475aa632fea5360c6f8c4cc1f26e3ee0369385ef"
|
||||
rev = "e455f6ae0f3577ceb210c0ce167181c33c133a69"
|
||||
replace-with = "vendored-sources"
|
||||
|
||||
[source.vendored-sources]
|
||||
|
|
|
@ -197,8 +197,8 @@ name = "baldrdash"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bindgen 0.49.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)",
|
||||
"cranelift-wasm 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)",
|
||||
"cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)",
|
||||
"cranelift-wasm 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)",
|
||||
"env_logger 0.5.6 (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.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -613,19 +613,19 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cranelift-bforest"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef#475aa632fea5360c6f8c4cc1f26e3ee0369385ef"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69#e455f6ae0f3577ceb210c0ce167181c33c133a69"
|
||||
dependencies = [
|
||||
"cranelift-entity 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)",
|
||||
"cranelift-entity 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-codegen"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef#475aa632fea5360c6f8c4cc1f26e3ee0369385ef"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69#e455f6ae0f3577ceb210c0ce167181c33c133a69"
|
||||
dependencies = [
|
||||
"cranelift-bforest 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)",
|
||||
"cranelift-codegen-meta 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)",
|
||||
"cranelift-entity 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)",
|
||||
"cranelift-bforest 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)",
|
||||
"cranelift-codegen-meta 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)",
|
||||
"cranelift-entity 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)",
|
||||
"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.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -635,22 +635,22 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cranelift-codegen-meta"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef#475aa632fea5360c6f8c4cc1f26e3ee0369385ef"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69#e455f6ae0f3577ceb210c0ce167181c33c133a69"
|
||||
dependencies = [
|
||||
"cranelift-entity 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)",
|
||||
"cranelift-entity 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-entity"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef#475aa632fea5360c6f8c4cc1f26e3ee0369385ef"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69#e455f6ae0f3577ceb210c0ce167181c33c133a69"
|
||||
|
||||
[[package]]
|
||||
name = "cranelift-frontend"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef#475aa632fea5360c6f8c4cc1f26e3ee0369385ef"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69#e455f6ae0f3577ceb210c0ce167181c33c133a69"
|
||||
dependencies = [
|
||||
"cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)",
|
||||
"cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -658,15 +658,15 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "cranelift-wasm"
|
||||
version = "0.30.0"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef#475aa632fea5360c6f8c4cc1f26e3ee0369385ef"
|
||||
source = "git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69#e455f6ae0f3577ceb210c0ce167181c33c133a69"
|
||||
dependencies = [
|
||||
"cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)",
|
||||
"cranelift-entity 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)",
|
||||
"cranelift-frontend 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)",
|
||||
"cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)",
|
||||
"cranelift-entity 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)",
|
||||
"cranelift-frontend 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)",
|
||||
"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.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmparser 0.29.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmparser 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -3540,7 +3540,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.29.2"
|
||||
version = "0.31.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
|
@ -3887,12 +3887,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.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)" = "<none>"
|
||||
"checksum cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)" = "<none>"
|
||||
"checksum cranelift-codegen-meta 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)" = "<none>"
|
||||
"checksum cranelift-entity 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)" = "<none>"
|
||||
"checksum cranelift-frontend 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)" = "<none>"
|
||||
"checksum cranelift-wasm 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=475aa632fea5360c6f8c4cc1f26e3ee0369385ef)" = "<none>"
|
||||
"checksum cranelift-bforest 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)" = "<none>"
|
||||
"checksum cranelift-codegen 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)" = "<none>"
|
||||
"checksum cranelift-codegen-meta 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)" = "<none>"
|
||||
"checksum cranelift-entity 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)" = "<none>"
|
||||
"checksum cranelift-frontend 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)" = "<none>"
|
||||
"checksum cranelift-wasm 0.30.0 (git+https://github.com/CraneStation/Cranelift?rev=e455f6ae0f3577ceb210c0ce167181c33c133a69)" = "<none>"
|
||||
"checksum crc 1.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bd5d02c0aac6bd68393ed69e00bbc2457f3e89075c6349db7189618dc4ddc1d7"
|
||||
"checksum crossbeam-channel 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8d4f5844607ce8da3fff431e7dba56cda8bfcc570aa50bee36adba8a32b8cad7"
|
||||
"checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
|
||||
|
@ -4158,7 +4158,7 @@ dependencies = [
|
|||
"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 warp 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a120bf7041d4381a5429c4e6d12633bfb874c968a78ec3a3563e9ca6e12d6"
|
||||
"checksum wasmparser 0.29.2 (registry+https://github.com/rust-lang/crates.io-index)" = "981a8797cf89762e0233ec45fae731cb79a4dfaee12d9f0fe6cee01e4ac58d00"
|
||||
"checksum wasmparser 0.31.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6f324afc05fd8282bbc49dae854a1c20f74aeff10a575b5a43453d1864db97"
|
||||
"checksum weedle 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "26a4c67f132386d965390b8a734d5d10adbcd30eb5cc74bd9229af8b83f10044"
|
||||
"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"
|
||||
|
|
|
@ -64,8 +64,8 @@ packed_simd = { git = "https://github.com/hsivonen/packed_simd", branch = "rust_
|
|||
|
||||
[patch.crates-io.cranelift-codegen]
|
||||
git = "https://github.com/CraneStation/Cranelift"
|
||||
rev = "475aa632fea5360c6f8c4cc1f26e3ee0369385ef"
|
||||
rev = "e455f6ae0f3577ceb210c0ce167181c33c133a69"
|
||||
|
||||
[patch.crates-io.cranelift-wasm]
|
||||
git = "https://github.com/CraneStation/Cranelift"
|
||||
rev = "475aa632fea5360c6f8c4cc1f26e3ee0369385ef"
|
||||
rev = "e455f6ae0f3577ceb210c0ce167181c33c133a69"
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"4fb2be5a108736ec2eeb257fd9c90d7e4384321e34eaef0fc7c5517a8e096650","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":null}
|
||||
{"files":{"Cargo.toml":"4fb2be5a108736ec2eeb257fd9c90d7e4384321e34eaef0fc7c5517a8e096650","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"af367c67340fa7f6fb9a35b0aa637dcf303957f7ae7427a5f4f6356801c8bb04","src/lib.rs":"1b23abbfe5850a4cd77ae6ae5dcfc2f678ef36b4032fd7496f2b333c51e63301","src/map.rs":"5d891d62814941e19dfc88ff36538efa3da5479f3f97de8219a6f610c9a1ee32","src/node.rs":"e620c64e78488035f11723b14892c7986c06ad37dc5b115a35a453ff1ae66ca3","src/path.rs":"a86ee1c882c173e8af96fd53a416a0fb485dd3f045ac590ef313a9d9ecf90f56","src/pool.rs":"6090f8c0e0da16ebee0e31bca66392d0075b3aff529d30d4e716fa20cd0aef99","src/set.rs":"b411158f813a310c7a6c337d4ada3bf0a021088c443875dc25233415dcbe0633"},"package":null}
|
|
@ -49,7 +49,7 @@ impl<F: Forest> Path<F> {
|
|||
key: F::Key,
|
||||
root: Node,
|
||||
pool: &NodePool<F>,
|
||||
comp: &Comparator<F::Key>,
|
||||
comp: &dyn Comparator<F::Key>,
|
||||
) -> Option<F::Value> {
|
||||
let mut node = root;
|
||||
for level in 0.. {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"253c80832ab598570d604ae8a8108ea9835b8eef8d9b9645408ed025ce3b574a","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"b123f056d0d458396679c5f7f2a16d2762af0258fcda4ac14b6655a95e5a0022","src/cdsl/ast.rs":"170f0526c73e4ebdd22cf25290607b6610e9e3fe0b1d79ee38962085f878d2e4","src/cdsl/cpu_modes.rs":"57c40621115a58faa7af1c729ecaf8cda01c2b143008bde6d8c70885e7c3fd75","src/cdsl/formats.rs":"8eaee84c9c574e7a2ab73b4bf63b97c1cea3ffce0a477f1701e75a7a523ada57","src/cdsl/instructions.rs":"dd734b1ff0750ec09a06e5746338f479ae97eb122dc64dba37b656ab5ae79ebd","src/cdsl/isa.rs":"569bf078c68c800fbd36fde1b52e0371747f6249252655e2dc4715d4e975be40","src/cdsl/mod.rs":"86149f101e1b00a9623028dcd779ad66b6a67f0f67b423c5ac88cd96dabdd227","src/cdsl/operands.rs":"1cda258798d861c4f467783b5c70c1202a57f554861017eead6477af2ee34063","src/cdsl/regs.rs":"049d299c63a757aad7adb7945b3919bd62c9204348a4f8b9727ca84fecbf3115","src/cdsl/settings.rs":"b6b1653b486fb4b86aaab59328a959cf784cb4b61b3216fe7acebe0490849642","src/cdsl/type_inference.rs":"2771631701c150e077c5dcf705c8ae8705944d86ab945ae9e7adc82f3ca5447a","src/cdsl/types.rs":"4cc1f20eb8383fdee6a9e7ca0f7758e563a4fb715056b5edbd4db72f8dfd471b","src/cdsl/typevar.rs":"7249fcd7c3cd3645e8489c73595bd5327bedc499bd7bc87f2a68e241fba329c3","src/cdsl/xform.rs":"005bd2fca7f8b737c605a75a0f44f2d70f0138e67f3013343ced81f639dce8bb","src/constant_hash.rs":"b8acd3f8712a4999819d9d9beced2938d9940a5748ba016c182f1132d97eefab","src/error.rs":"5110a4e3c1e97396ba02d9f5abbb8af4b586f0cc4d33a5c2473f1718cc4bef05","src/gen_inst.rs":"94e71181683f022fdcc55abf487a20be5d4dd51fe3092345b6bc4e2bde04441b","src/gen_legalizer.rs":"8c525a42df0b8283c445a1abd5376682500b49ee8033bc66575f8e14f29f4de3","src/gen_registers.rs":"a544a2b91fafe08639e39e50bea0892fda89fe2f6eaf111b2d5f3e98e4d07b86","src/gen_settings.rs":"4469bf496f9539835fce3cd9743ac0fbc270b3029b0e6c949f406e790685199c","src/gen_types.rs":"3935da6c6a53f9332e06f74bc3a46270656b4d4231ad28ed2648d7b1d2774e90","src/isa/arm32/mod.rs":"54e88d89644c5cee61cdc8315f1d77b01c232dc322c52f6e244cef9e7688a3ad","src/isa/arm64/mod.rs":"c5169b92c1bcb562649a48b7880033f542c9affa73274d23b3817e4ac83942fe","src/isa/mod.rs":"fce60d19dd3c099ebee3ac5ae64a2bee363f13da9ff5a4960d3c1a0bee71d29a","src/isa/riscv/mod.rs":"2da05e3974ef0b72431c9fdda14314890f72500b94def1d74cdf5e74bd950bc0","src/isa/x86/instructions.rs":"ad88f311fd51f341f7dfe395f98d8805ea55e1c86d1a89272ed999f5ae8dc3f0","src/isa/x86/legalize.rs":"251af731b2514fead08e27e812ca44dc674a41bd4a9637d9d919259497961961","src/isa/x86/mod.rs":"14715e552eedfeae1693a416bb82bda2156b31cd4b306e07530a3c1acdc17125","src/isa/x86/registers.rs":"c0bc60336a8c8b7b4db92dc623e9419a60af14dd6252f0b19e227e46f7166178","src/isa/x86/settings.rs":"1a74b3d1ef5e99e0b7c75528b9fd5afbb3394979615b005b43b72108757a9886","src/lib.rs":"8c9364c6fce73c158abfb7c88ecff01dc608a05c250e89df9bec3082773cde6d","src/shared/entities.rs":"80b8ff57a09c7b2f9dab755abbcc2738317de474776fe1de0d2a581310aa9af8","src/shared/formats.rs":"20908b1048c5e71a185de6b6ded79cdff2c26ddb38ba7b134b7a27f37e8324f3","src/shared/immediates.rs":"804c4c9ffa2fe55d90279ee158aaa6bd6c7f0c604d63d7457a98e82269cec9a7","src/shared/instructions.rs":"4222d17a9a8be083cc729715527290ca22c8ebe1f9679812a5237025a0479dcd","src/shared/legalize.rs":"e3ed83c004afd088bedad0db6664983bfc15149fb99d7d28dea535b2ff48d761","src/shared/mod.rs":"6e30631fe2ba19d819330ea14d29cce4910b435f030e706be2fc94af23b88d71","src/shared/settings.rs":"42c2c5b6f5fdef090c35760c5920d5013afe4ddc472ee9cc37eb6d8ddaae2906","src/shared/types.rs":"158d73840185e6aa8385463bbf6568efdda0c8de8284cf6b4e565f425ec5d921","src/srcgen.rs":"79fee2f603b33f76f7c9c8b9452c745a363d732c40c0814d84001ff3ef805677","src/unique_table.rs":"90b7203b29241a1ede70f0a3e50d96799e0b41d8f7455170d6ffb127f87f3cc3"},"package":null}
|
||||
{"files":{"Cargo.toml":"253c80832ab598570d604ae8a8108ea9835b8eef8d9b9645408ed025ce3b574a","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"b123f056d0d458396679c5f7f2a16d2762af0258fcda4ac14b6655a95e5a0022","src/cdsl/ast.rs":"170f0526c73e4ebdd22cf25290607b6610e9e3fe0b1d79ee38962085f878d2e4","src/cdsl/cpu_modes.rs":"57c40621115a58faa7af1c729ecaf8cda01c2b143008bde6d8c70885e7c3fd75","src/cdsl/formats.rs":"8eaee84c9c574e7a2ab73b4bf63b97c1cea3ffce0a477f1701e75a7a523ada57","src/cdsl/instructions.rs":"dd734b1ff0750ec09a06e5746338f479ae97eb122dc64dba37b656ab5ae79ebd","src/cdsl/isa.rs":"569bf078c68c800fbd36fde1b52e0371747f6249252655e2dc4715d4e975be40","src/cdsl/mod.rs":"86149f101e1b00a9623028dcd779ad66b6a67f0f67b423c5ac88cd96dabdd227","src/cdsl/operands.rs":"1cda258798d861c4f467783b5c70c1202a57f554861017eead6477af2ee34063","src/cdsl/regs.rs":"049d299c63a757aad7adb7945b3919bd62c9204348a4f8b9727ca84fecbf3115","src/cdsl/settings.rs":"b6b1653b486fb4b86aaab59328a959cf784cb4b61b3216fe7acebe0490849642","src/cdsl/type_inference.rs":"2771631701c150e077c5dcf705c8ae8705944d86ab945ae9e7adc82f3ca5447a","src/cdsl/types.rs":"4cc1f20eb8383fdee6a9e7ca0f7758e563a4fb715056b5edbd4db72f8dfd471b","src/cdsl/typevar.rs":"7249fcd7c3cd3645e8489c73595bd5327bedc499bd7bc87f2a68e241fba329c3","src/cdsl/xform.rs":"005bd2fca7f8b737c605a75a0f44f2d70f0138e67f3013343ced81f639dce8bb","src/constant_hash.rs":"b8acd3f8712a4999819d9d9beced2938d9940a5748ba016c182f1132d97eefab","src/error.rs":"5110a4e3c1e97396ba02d9f5abbb8af4b586f0cc4d33a5c2473f1718cc4bef05","src/gen_inst.rs":"94e71181683f022fdcc55abf487a20be5d4dd51fe3092345b6bc4e2bde04441b","src/gen_legalizer.rs":"368ea72fe2d253f7d4d7548ae449fde875781e43ce0ecb9a604765595e387cc2","src/gen_registers.rs":"a544a2b91fafe08639e39e50bea0892fda89fe2f6eaf111b2d5f3e98e4d07b86","src/gen_settings.rs":"4469bf496f9539835fce3cd9743ac0fbc270b3029b0e6c949f406e790685199c","src/gen_types.rs":"3935da6c6a53f9332e06f74bc3a46270656b4d4231ad28ed2648d7b1d2774e90","src/isa/arm32/mod.rs":"54e88d89644c5cee61cdc8315f1d77b01c232dc322c52f6e244cef9e7688a3ad","src/isa/arm64/mod.rs":"c5169b92c1bcb562649a48b7880033f542c9affa73274d23b3817e4ac83942fe","src/isa/mod.rs":"fce60d19dd3c099ebee3ac5ae64a2bee363f13da9ff5a4960d3c1a0bee71d29a","src/isa/riscv/mod.rs":"2da05e3974ef0b72431c9fdda14314890f72500b94def1d74cdf5e74bd950bc0","src/isa/x86/instructions.rs":"ad88f311fd51f341f7dfe395f98d8805ea55e1c86d1a89272ed999f5ae8dc3f0","src/isa/x86/legalize.rs":"251af731b2514fead08e27e812ca44dc674a41bd4a9637d9d919259497961961","src/isa/x86/mod.rs":"14715e552eedfeae1693a416bb82bda2156b31cd4b306e07530a3c1acdc17125","src/isa/x86/registers.rs":"c0bc60336a8c8b7b4db92dc623e9419a60af14dd6252f0b19e227e46f7166178","src/isa/x86/settings.rs":"1a74b3d1ef5e99e0b7c75528b9fd5afbb3394979615b005b43b72108757a9886","src/lib.rs":"8c9364c6fce73c158abfb7c88ecff01dc608a05c250e89df9bec3082773cde6d","src/shared/entities.rs":"80b8ff57a09c7b2f9dab755abbcc2738317de474776fe1de0d2a581310aa9af8","src/shared/formats.rs":"20908b1048c5e71a185de6b6ded79cdff2c26ddb38ba7b134b7a27f37e8324f3","src/shared/immediates.rs":"804c4c9ffa2fe55d90279ee158aaa6bd6c7f0c604d63d7457a98e82269cec9a7","src/shared/instructions.rs":"85f74df59fb0564613055df2173699e61d9e711fb481015635de47c5286690fd","src/shared/legalize.rs":"e3ed83c004afd088bedad0db6664983bfc15149fb99d7d28dea535b2ff48d761","src/shared/mod.rs":"6e30631fe2ba19d819330ea14d29cce4910b435f030e706be2fc94af23b88d71","src/shared/settings.rs":"42c2c5b6f5fdef090c35760c5920d5013afe4ddc472ee9cc37eb6d8ddaae2906","src/shared/types.rs":"158d73840185e6aa8385463bbf6568efdda0c8de8284cf6b4e565f425ec5d921","src/srcgen.rs":"79fee2f603b33f76f7c9c8b9452c745a363d732c40c0814d84001ff3ef805677","src/unique_table.rs":"90b7203b29241a1ede70f0a3e50d96799e0b41d8f7455170d6ffb127f87f3cc3"},"package":null}
|
|
@ -410,7 +410,7 @@ fn gen_transform_group<'a>(
|
|||
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,");
|
||||
fmt.line("isa: &dyn crate::isa::TargetIsa,");
|
||||
});
|
||||
fmtln!(fmt, ") -> bool {");
|
||||
|
||||
|
|
|
@ -309,7 +309,8 @@ pub fn define(
|
|||
"#,
|
||||
)
|
||||
.operands_in(vec![x, addr, Size, JT])
|
||||
.operands_out(vec![entry]),
|
||||
.operands_out(vec![entry])
|
||||
.can_load(true),
|
||||
);
|
||||
|
||||
ig.push(
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -164,7 +164,7 @@ jump_table_entry = Instruction(
|
|||
Currently, the only type supported is entries which are relative to the
|
||||
base of the jump table.
|
||||
""",
|
||||
ins=(x, addr, Size, JT), outs=entry)
|
||||
ins=(x, addr, Size, JT), outs=entry, can_load=True)
|
||||
|
||||
jump_table_base = Instruction(
|
||||
'jump_table_base', r"""
|
||||
|
|
|
@ -3,12 +3,13 @@ RISC-V Encodings.
|
|||
"""
|
||||
from __future__ import absolute_import
|
||||
from base import instructions as base
|
||||
from base import types
|
||||
from base.immediates import intcc
|
||||
from .defs import RV32, RV64
|
||||
from .recipes import OPIMM, OPIMM32, OP, OP32, LUI, BRANCH, JALR, JAL
|
||||
from .recipes import LOAD, STORE
|
||||
from .recipes import R, Rshamt, Ricmp, Ii, Iz, Iicmp, Iret, Icall, Icopy
|
||||
from .recipes import U, UJ, UJcall, SB, SBzero, GPsp, GPfi, Irmov
|
||||
from .recipes import U, UJ, UJcall, SB, SBzero, GPsp, GPfi, Irmov, stacknull
|
||||
from .settings import use_m
|
||||
from cdsl.ast import Var
|
||||
from base.legalize import narrow, expand
|
||||
|
@ -160,3 +161,9 @@ RV32.enc(base.copy.b1, Icopy, OPIMM(0b000))
|
|||
RV64.enc(base.copy.b1, Icopy, OPIMM(0b000))
|
||||
RV32.enc(base.regmove.b1, Irmov, OPIMM(0b000))
|
||||
RV64.enc(base.regmove.b1, Irmov, OPIMM(0b000))
|
||||
|
||||
# Stack-slot-to-the-same-stack-slot copy, which is guaranteed to turn
|
||||
# into a no-op.
|
||||
for ty in [types.i64, types.i32, types.i16, types.i8, types.f64, types.f32]:
|
||||
RV64.enc(base.copy_nop.bind(ty), stacknull, 0)
|
||||
RV32.enc(base.copy_nop.bind(ty), stacknull, 0)
|
||||
|
|
|
@ -223,3 +223,8 @@ GPfi = EncRecipe(
|
|||
'GPfi', Unary, base_size=4,
|
||||
ins=Stack(GPR), outs=GPR,
|
||||
emit='unimplemented!();')
|
||||
|
||||
# Stack-slot-to-the-same-stack-slot copy, which is guaranteed to turn
|
||||
# into a no-op.
|
||||
stacknull = EncRecipe('stacknull', Unary, base_size=0,
|
||||
ins=Stack(GPR), outs=Stack(GPR), emit='')
|
||||
|
|
|
@ -342,11 +342,23 @@ X86_64.enc(base.copy_special, *r.copysp.rex(0x89, w=1))
|
|||
X86_32.enc(base.copy_special, *r.copysp(0x89))
|
||||
|
||||
# Stack-slot-to-the-same-stack-slot copy, which is guaranteed to turn
|
||||
# into a no-op.
|
||||
X86_64.enc(base.copy_nop.i64, r.stacknull, 0)
|
||||
X86_64.enc(base.copy_nop.i32, r.stacknull, 0)
|
||||
X86_64.enc(base.copy_nop.f64, r.stacknull, 0)
|
||||
X86_64.enc(base.copy_nop.f32, r.stacknull, 0)
|
||||
# into a no-op. Ideally we could to make this encoding available for
|
||||
# all types, and write `base.copy_nop.any`, but it appears that the
|
||||
# controlling type variable must not polymorphic. So we make do with
|
||||
# the following limited set, and guard the generating transformation in
|
||||
# regalloc/reload.rs accordingly.
|
||||
#
|
||||
# The same encoding is generated for both the 64- and 32-bit architectures.
|
||||
# Note that we can't use `enc_both` here, because that attempts to create a
|
||||
# variant with a REX prefix in the 64-bit-architecture case. But since
|
||||
# there's no actual instruction for the REX prefix to modify the meaning of,
|
||||
# it will modify the meaning of whatever instruction happens to follow this
|
||||
# one, which is obviously wrong. Note also that we can and indeed *must*
|
||||
# claim that there's a 64-bit encoding for the 32-bit arch case, even though
|
||||
# no such single instruction actually exists for the 32-bit arch case.
|
||||
for ty in [types.i64, types.i32, types.i16, types.i8, types.f64, types.f32]:
|
||||
X86_64.enc(base.copy_nop.bind(ty), r.stacknull, 0)
|
||||
X86_32.enc(base.copy_nop.bind(ty), r.stacknull, 0)
|
||||
|
||||
# Adjust SP down by a dynamic value (or up, with a negative operand).
|
||||
X86_32.enc(base.adjust_sp_down.i32, *r.adjustsp(0x29))
|
||||
|
|
|
@ -34,8 +34,8 @@ pub struct MemoryCodeSink<'a> {
|
|||
data: *mut u8,
|
||||
/// Offset is isize because its major consumer needs it in that form.
|
||||
offset: isize,
|
||||
relocs: &'a mut RelocSink,
|
||||
traps: &'a mut TrapSink,
|
||||
relocs: &'a mut dyn RelocSink,
|
||||
traps: &'a mut dyn TrapSink,
|
||||
/// Information about the generated code and read-only data.
|
||||
pub info: CodeInfo,
|
||||
}
|
||||
|
@ -45,7 +45,11 @@ impl<'a> MemoryCodeSink<'a> {
|
|||
///
|
||||
/// This function is unsafe since `MemoryCodeSink` does not perform bounds checking on the
|
||||
/// memory buffer, and it can't guarantee that the `data` pointer is valid.
|
||||
pub unsafe fn new(data: *mut u8, relocs: &'a mut RelocSink, traps: &'a mut TrapSink) -> Self {
|
||||
pub unsafe fn new(
|
||||
data: *mut u8,
|
||||
relocs: &'a mut dyn RelocSink,
|
||||
traps: &'a mut dyn TrapSink,
|
||||
) -> Self {
|
||||
Self {
|
||||
data,
|
||||
offset: 0,
|
||||
|
@ -142,7 +146,7 @@ impl<'a> CodeSink for MemoryCodeSink<'a> {
|
|||
}
|
||||
|
||||
fn end_codegen(&mut self) {
|
||||
self.info.rodata_size = self.offset() - self.info.jumptables_size;
|
||||
self.info.rodata_size = self.offset() - (self.info.jumptables_size + self.info.code_size);
|
||||
self.info.total_size = self.offset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ use log::debug;
|
|||
/// Relax branches and compute the final layout of EBB headers in `func`.
|
||||
///
|
||||
/// Fill in the `func.offsets` table so the function is ready for binary emission.
|
||||
pub fn relax_branches(func: &mut Function, isa: &TargetIsa) -> CodegenResult<CodeInfo> {
|
||||
pub fn relax_branches(func: &mut Function, isa: &dyn TargetIsa) -> CodegenResult<CodeInfo> {
|
||||
let _tt = timing::relax_branches();
|
||||
|
||||
let encinfo = isa.encoding_info();
|
||||
|
@ -174,7 +174,7 @@ fn relax_branch(
|
|||
offset: CodeOffset,
|
||||
dest_offset: CodeOffset,
|
||||
encinfo: &EncInfo,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> CodeOffset {
|
||||
let inst = cur.current_inst().unwrap();
|
||||
debug!(
|
||||
|
|
|
@ -13,7 +13,7 @@ use crate::timing;
|
|||
use log::debug;
|
||||
|
||||
/// Pick the smallest valid encodings for instructions.
|
||||
pub fn shrink_instructions(func: &mut Function, isa: &TargetIsa) {
|
||||
pub fn shrink_instructions(func: &mut Function, isa: &dyn TargetIsa) {
|
||||
let _tt = timing::shrink_instructions();
|
||||
|
||||
let encinfo = isa.encoding_info();
|
||||
|
|
|
@ -23,14 +23,14 @@ impl<'a> CFGPrinter<'a> {
|
|||
}
|
||||
|
||||
/// Write the CFG for this function to `w`.
|
||||
pub fn write(&self, w: &mut Write) -> Result {
|
||||
pub fn write(&self, w: &mut dyn Write) -> Result {
|
||||
self.header(w)?;
|
||||
self.ebb_nodes(w)?;
|
||||
self.cfg_connections(w)?;
|
||||
writeln!(w, "}}")
|
||||
}
|
||||
|
||||
fn header(&self, w: &mut Write) -> Result {
|
||||
fn header(&self, w: &mut dyn Write) -> Result {
|
||||
writeln!(w, "digraph \"{}\" {{", self.func.name)?;
|
||||
if let Some(entry) = self.func.layout.entry_block() {
|
||||
writeln!(w, " {{rank=min; {}}}", entry)?;
|
||||
|
@ -38,7 +38,7 @@ impl<'a> CFGPrinter<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn ebb_nodes(&self, w: &mut Write) -> Result {
|
||||
fn ebb_nodes(&self, w: &mut dyn Write) -> Result {
|
||||
for ebb in &self.func.layout {
|
||||
write!(w, " {} [shape=record, label=\"{{{}", ebb, ebb)?;
|
||||
// Add all outgoing branch instructions to the label.
|
||||
|
@ -62,7 +62,7 @@ impl<'a> CFGPrinter<'a> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn cfg_connections(&self, w: &mut Write) -> Result {
|
||||
fn cfg_connections(&self, w: &mut dyn Write) -> Result {
|
||||
for ebb in &self.func.layout {
|
||||
for BasicBlock { ebb: parent, inst } in self.cfg.pred_iter(ebb) {
|
||||
writeln!(w, " {}:{} -> {}", parent, inst, ebb)?;
|
||||
|
|
|
@ -96,10 +96,10 @@ impl Context {
|
|||
/// Returns information about the function's code and read-only data.
|
||||
pub fn compile_and_emit(
|
||||
&mut self,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
mem: &mut Vec<u8>,
|
||||
relocs: &mut RelocSink,
|
||||
traps: &mut TrapSink,
|
||||
relocs: &mut dyn RelocSink,
|
||||
traps: &mut dyn TrapSink,
|
||||
) -> CodegenResult<CodeInfo> {
|
||||
let info = self.compile(isa)?;
|
||||
let old_len = mem.len();
|
||||
|
@ -117,7 +117,7 @@ impl Context {
|
|||
/// code sink.
|
||||
///
|
||||
/// Returns information about the function's code and read-only data.
|
||||
pub fn compile(&mut self, isa: &TargetIsa) -> CodegenResult<CodeInfo> {
|
||||
pub fn compile(&mut self, isa: &dyn TargetIsa) -> CodegenResult<CodeInfo> {
|
||||
let _tt = timing::compile();
|
||||
self.verify_if(isa)?;
|
||||
|
||||
|
@ -164,10 +164,10 @@ impl Context {
|
|||
/// Returns information about the emitted code and data.
|
||||
pub unsafe fn emit_to_memory(
|
||||
&self,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
mem: *mut u8,
|
||||
relocs: &mut RelocSink,
|
||||
traps: &mut TrapSink,
|
||||
relocs: &mut dyn RelocSink,
|
||||
traps: &mut dyn TrapSink,
|
||||
) -> CodeInfo {
|
||||
let _tt = timing::binemit();
|
||||
let mut sink = MemoryCodeSink::new(mem, relocs, traps);
|
||||
|
@ -199,7 +199,7 @@ impl Context {
|
|||
}
|
||||
|
||||
/// Run the locations verifier on the function.
|
||||
pub fn verify_locations(&self, isa: &TargetIsa) -> VerifierResult<()> {
|
||||
pub fn verify_locations(&self, isa: &dyn TargetIsa) -> VerifierResult<()> {
|
||||
let mut errors = VerifierErrors::default();
|
||||
let _ = verify_locations(isa, &self.func, None, &mut errors);
|
||||
|
||||
|
@ -211,7 +211,7 @@ impl Context {
|
|||
}
|
||||
|
||||
/// Run the locations verifier only if the `enable_verifier` setting is true.
|
||||
pub fn verify_locations_if(&self, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
pub fn verify_locations_if(&self, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
if isa.flags().enable_verifier() {
|
||||
self.verify_locations(isa)?;
|
||||
}
|
||||
|
@ -226,20 +226,20 @@ impl Context {
|
|||
}
|
||||
|
||||
/// Perform pre-legalization rewrites on the function.
|
||||
pub fn preopt(&mut self, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
pub fn preopt(&mut self, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
do_preopt(&mut self.func, &mut self.cfg);
|
||||
self.verify_if(isa)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Perform NaN canonicalizing rewrites on the function.
|
||||
pub fn canonicalize_nans(&mut self, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
pub fn canonicalize_nans(&mut self, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
do_nan_canonicalization(&mut self.func);
|
||||
self.verify_if(isa)
|
||||
}
|
||||
|
||||
/// Run the legalizer for `isa` on the function.
|
||||
pub fn legalize(&mut self, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
pub fn legalize(&mut self, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
// Legalization invalidates the domtree and loop_analysis by mutating the CFG.
|
||||
// TODO: Avoid doing this when legalization doesn't actually mutate the CFG.
|
||||
self.domtree.clear();
|
||||
|
@ -249,7 +249,7 @@ impl Context {
|
|||
}
|
||||
|
||||
/// Perform post-legalization rewrites on the function.
|
||||
pub fn postopt(&mut self, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
pub fn postopt(&mut self, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
do_postopt(&mut self.func, isa);
|
||||
self.verify_if(isa)?;
|
||||
Ok(())
|
||||
|
@ -284,7 +284,7 @@ impl Context {
|
|||
}
|
||||
|
||||
/// Perform LICM on the function.
|
||||
pub fn licm(&mut self, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
pub fn licm(&mut self, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
do_licm(
|
||||
isa,
|
||||
&mut self.func,
|
||||
|
@ -305,13 +305,13 @@ impl Context {
|
|||
}
|
||||
|
||||
/// Run the register allocator.
|
||||
pub fn regalloc(&mut self, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
pub fn regalloc(&mut self, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
self.regalloc
|
||||
.run(isa, &mut self.func, &self.cfg, &mut self.domtree)
|
||||
}
|
||||
|
||||
/// Insert prologue and epilogues after computing the stack frame layout.
|
||||
pub fn prologue_epilogue(&mut self, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
pub fn prologue_epilogue(&mut self, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
isa.prologue_epilogue(&mut self.func)?;
|
||||
self.verify_if(isa)?;
|
||||
self.verify_locations_if(isa)?;
|
||||
|
@ -319,7 +319,7 @@ impl Context {
|
|||
}
|
||||
|
||||
/// Run the instruction shrinking pass.
|
||||
pub fn shrink_instructions(&mut self, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
pub fn shrink_instructions(&mut self, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
shrink_instructions(&mut self.func, isa);
|
||||
self.verify_if(isa)?;
|
||||
self.verify_locations_if(isa)?;
|
||||
|
@ -328,7 +328,7 @@ impl Context {
|
|||
|
||||
/// Run the branch relaxation pass and return information about the function's code and
|
||||
/// read-only data.
|
||||
pub fn relax_branches(&mut self, isa: &TargetIsa) -> CodegenResult<CodeInfo> {
|
||||
pub fn relax_branches(&mut self, isa: &dyn TargetIsa) -> CodegenResult<CodeInfo> {
|
||||
let info = relax_branches(&mut self.func, isa)?;
|
||||
self.verify_if(isa)?;
|
||||
self.verify_locations_if(isa)?;
|
||||
|
@ -336,7 +336,10 @@ impl Context {
|
|||
}
|
||||
|
||||
/// Builds ranges and location for specified value labels.
|
||||
pub fn build_value_labels_ranges(&self, isa: &TargetIsa) -> CodegenResult<ValueLabelsRanges> {
|
||||
pub fn build_value_labels_ranges(
|
||||
&self,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> CodegenResult<ValueLabelsRanges> {
|
||||
Ok(build_value_labels_ranges::<ComparableSourceLoc>(
|
||||
&self.func,
|
||||
&self.regalloc,
|
||||
|
|
|
@ -657,12 +657,12 @@ pub struct EncCursor<'f> {
|
|||
pub func: &'f mut ir::Function,
|
||||
|
||||
/// The target ISA that will be used to encode instructions.
|
||||
pub isa: &'f TargetIsa,
|
||||
pub isa: &'f dyn TargetIsa,
|
||||
}
|
||||
|
||||
impl<'f> EncCursor<'f> {
|
||||
/// Create a new `EncCursor` pointing nowhere.
|
||||
pub fn new(func: &'f mut ir::Function, isa: &'f TargetIsa) -> Self {
|
||||
pub fn new(func: &'f mut ir::Function, isa: &'f dyn TargetIsa) -> Self {
|
||||
Self {
|
||||
pos: CursorPosition::Nowhere,
|
||||
srcloc: Default::default(),
|
||||
|
|
|
@ -426,7 +426,7 @@ impl DataFlowGraph {
|
|||
}
|
||||
|
||||
/// Returns an object that displays `inst`.
|
||||
pub fn display_inst<'a, I: Into<Option<&'a TargetIsa>>>(
|
||||
pub fn display_inst<'a, I: Into<Option<&'a dyn TargetIsa>>>(
|
||||
&'a self,
|
||||
inst: Inst,
|
||||
isa: I,
|
||||
|
@ -909,7 +909,7 @@ impl EbbData {
|
|||
}
|
||||
|
||||
/// Object that can display an instruction.
|
||||
pub struct DisplayInst<'a>(&'a DataFlowGraph, Option<&'a TargetIsa>, Inst);
|
||||
pub struct DisplayInst<'a>(&'a DataFlowGraph, Option<&'a dyn TargetIsa>, Inst);
|
||||
|
||||
impl<'a> fmt::Display for DisplayInst<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
|
|
@ -238,7 +238,7 @@ impl fmt::Display for AnyEntity {
|
|||
|
||||
impl fmt::Debug for AnyEntity {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
(self as &fmt::Display).fmt(f)
|
||||
(self as &dyn fmt::Display).fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -155,7 +155,10 @@ impl Function {
|
|||
}
|
||||
|
||||
/// Return an object that can display this function with correct ISA-specific annotations.
|
||||
pub fn display<'a, I: Into<Option<&'a TargetIsa>>>(&'a self, isa: I) -> DisplayFunction<'a> {
|
||||
pub fn display<'a, I: Into<Option<&'a dyn TargetIsa>>>(
|
||||
&'a self,
|
||||
isa: I,
|
||||
) -> DisplayFunction<'a> {
|
||||
DisplayFunction(self, isa.into().into())
|
||||
}
|
||||
|
||||
|
@ -202,13 +205,13 @@ impl Function {
|
|||
}
|
||||
|
||||
/// Wrapper around `encode` which assigns `inst` the resulting encoding.
|
||||
pub fn update_encoding(&mut self, inst: ir::Inst, isa: &TargetIsa) -> Result<(), Legalize> {
|
||||
pub fn update_encoding(&mut self, inst: ir::Inst, isa: &dyn TargetIsa) -> Result<(), Legalize> {
|
||||
self.encode(inst, isa).map(|e| self.encodings[inst] = e)
|
||||
}
|
||||
|
||||
/// Wrapper around `TargetIsa::encode` for encoding an existing instruction
|
||||
/// in the `Function`.
|
||||
pub fn encode(&self, inst: ir::Inst, isa: &TargetIsa) -> Result<Encoding, Legalize> {
|
||||
pub fn encode(&self, inst: ir::Inst, isa: &dyn TargetIsa) -> Result<Encoding, Legalize> {
|
||||
isa.encode(&self, &self.dfg[inst], self.dfg.ctrl_typevar(inst))
|
||||
}
|
||||
|
||||
|
@ -221,7 +224,7 @@ impl Function {
|
|||
/// Additional annotations for function display.
|
||||
pub struct DisplayFunctionAnnotations<'a> {
|
||||
/// Enable ISA annotations.
|
||||
pub isa: Option<&'a TargetIsa>,
|
||||
pub isa: Option<&'a dyn TargetIsa>,
|
||||
|
||||
/// Enable value labels annotations.
|
||||
pub value_ranges: Option<&'a ValueLabelsRanges>,
|
||||
|
@ -237,8 +240,8 @@ impl<'a> DisplayFunctionAnnotations<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<Option<&'a TargetIsa>> for DisplayFunctionAnnotations<'a> {
|
||||
fn from(isa: Option<&'a TargetIsa>) -> DisplayFunctionAnnotations {
|
||||
impl<'a> From<Option<&'a dyn TargetIsa>> for DisplayFunctionAnnotations<'a> {
|
||||
fn from(isa: Option<&'a dyn TargetIsa>) -> DisplayFunctionAnnotations {
|
||||
DisplayFunctionAnnotations {
|
||||
isa,
|
||||
value_ranges: None,
|
||||
|
|
|
@ -76,7 +76,7 @@ impl GlobalValueData {
|
|||
}
|
||||
|
||||
/// Return the type of this global.
|
||||
pub fn global_type(&self, isa: &TargetIsa) -> Type {
|
||||
pub fn global_type(&self, isa: &dyn TargetIsa) -> Type {
|
||||
match *self {
|
||||
GlobalValueData::VMContext { .. } | GlobalValueData::Symbol { .. } => {
|
||||
isa.pointer_type()
|
||||
|
|
|
@ -107,7 +107,7 @@ pub fn get_libcall_funcref(
|
|||
libcall: LibCall,
|
||||
func: &mut Function,
|
||||
inst: Inst,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
find_funcref(libcall, func).unwrap_or_else(|| make_funcref_for_inst(libcall, func, inst, isa))
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ pub fn get_probestack_funcref(
|
|||
func: &mut Function,
|
||||
reg_type: Type,
|
||||
arg_reg: RegUnit,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
find_funcref(LibCall::Probestack, func)
|
||||
.unwrap_or_else(|| make_funcref_for_probestack(func, reg_type, arg_reg, isa))
|
||||
|
@ -147,7 +147,7 @@ fn make_funcref_for_probestack(
|
|||
func: &mut Function,
|
||||
reg_type: Type,
|
||||
arg_reg: RegUnit,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
let mut sig = Signature::new(CallConv::Probestack);
|
||||
let rax = AbiParam::special_reg(reg_type, ArgumentPurpose::Normal, arg_reg);
|
||||
|
@ -163,7 +163,7 @@ fn make_funcref_for_inst(
|
|||
libcall: LibCall,
|
||||
func: &mut Function,
|
||||
inst: Inst,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
let mut sig = Signature::new(isa.default_call_conv());
|
||||
for &v in func.dfg.inst_args(inst) {
|
||||
|
@ -177,7 +177,12 @@ fn make_funcref_for_inst(
|
|||
}
|
||||
|
||||
/// Create a funcref for `libcall`.
|
||||
fn make_funcref(libcall: LibCall, func: &mut Function, sig: Signature, isa: &TargetIsa) -> FuncRef {
|
||||
fn make_funcref(
|
||||
libcall: LibCall,
|
||||
func: &mut Function,
|
||||
sig: Signature,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> FuncRef {
|
||||
let sigref = func.import_signature(sig);
|
||||
|
||||
func.import_function(ExtFuncData {
|
||||
|
|
|
@ -40,7 +40,7 @@ fn isa_constructor(
|
|||
triple: Triple,
|
||||
shared_flags: shared_settings::Flags,
|
||||
builder: shared_settings::Builder,
|
||||
) -> Box<TargetIsa> {
|
||||
) -> Box<dyn TargetIsa> {
|
||||
let level1 = match triple.architecture {
|
||||
Architecture::Thumbv6m | Architecture::Thumbv7em | Architecture::Thumbv7m => {
|
||||
&enc_tables::LEVEL1_T32[..]
|
||||
|
@ -119,7 +119,7 @@ impl TargetIsa for Isa {
|
|||
func: &ir::Function,
|
||||
inst: ir::Inst,
|
||||
divert: &mut regalloc::RegDiversions,
|
||||
sink: &mut CodeSink,
|
||||
sink: &mut dyn CodeSink,
|
||||
) {
|
||||
binemit::emit_inst(func, inst, divert, sink)
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ fn isa_constructor(
|
|||
triple: Triple,
|
||||
shared_flags: shared_settings::Flags,
|
||||
builder: shared_settings::Builder,
|
||||
) -> Box<TargetIsa> {
|
||||
) -> Box<dyn TargetIsa> {
|
||||
Box::new(Isa {
|
||||
triple,
|
||||
isa_flags: settings::Flags::new(&shared_flags, builder),
|
||||
|
@ -106,7 +106,7 @@ impl TargetIsa for Isa {
|
|||
func: &ir::Function,
|
||||
inst: ir::Inst,
|
||||
divert: &mut regalloc::RegDiversions,
|
||||
sink: &mut CodeSink,
|
||||
sink: &mut dyn CodeSink,
|
||||
) {
|
||||
binemit::emit_inst(func, inst, divert, sink)
|
||||
}
|
||||
|
|
|
@ -141,13 +141,13 @@ pub enum LookupError {
|
|||
pub struct Builder {
|
||||
triple: Triple,
|
||||
setup: settings::Builder,
|
||||
constructor: fn(Triple, settings::Flags, settings::Builder) -> Box<TargetIsa>,
|
||||
constructor: fn(Triple, settings::Flags, settings::Builder) -> Box<dyn TargetIsa>,
|
||||
}
|
||||
|
||||
impl Builder {
|
||||
/// Combine the ISA-specific settings with the provided ISA-independent settings and allocate a
|
||||
/// fully configured `TargetIsa` trait object.
|
||||
pub fn finish(self, shared_flags: settings::Flags) -> Box<TargetIsa> {
|
||||
pub fn finish(self, shared_flags: settings::Flags) -> Box<dyn TargetIsa> {
|
||||
(self.constructor)(self.triple, shared_flags, self.setup)
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ impl settings::Configurable for Builder {
|
|||
///
|
||||
/// The `Encodings` iterator returns a legalization function to call.
|
||||
pub type Legalize =
|
||||
fn(ir::Inst, &mut ir::Function, &mut flowgraph::ControlFlowGraph, &TargetIsa) -> bool;
|
||||
fn(ir::Inst, &mut ir::Function, &mut flowgraph::ControlFlowGraph, &dyn TargetIsa) -> bool;
|
||||
|
||||
/// This struct provides information that a frontend may need to know about a target to
|
||||
/// produce Cranelift IR for the target.
|
||||
|
@ -367,7 +367,7 @@ pub trait TargetIsa: fmt::Display + Sync {
|
|||
func: &ir::Function,
|
||||
inst: ir::Inst,
|
||||
divert: &mut regalloc::RegDiversions,
|
||||
sink: &mut binemit::CodeSink,
|
||||
sink: &mut dyn binemit::CodeSink,
|
||||
);
|
||||
|
||||
/// Emit a whole function into memory.
|
||||
|
|
|
@ -40,7 +40,7 @@ fn isa_constructor(
|
|||
triple: Triple,
|
||||
shared_flags: shared_settings::Flags,
|
||||
builder: shared_settings::Builder,
|
||||
) -> Box<TargetIsa> {
|
||||
) -> Box<dyn TargetIsa> {
|
||||
let level1 = match triple.pointer_width().unwrap() {
|
||||
PointerWidth::U16 => panic!("16-bit RISC-V unrecognized"),
|
||||
PointerWidth::U32 => &enc_tables::LEVEL1_RV32[..],
|
||||
|
@ -113,7 +113,7 @@ impl TargetIsa for Isa {
|
|||
func: &ir::Function,
|
||||
inst: ir::Inst,
|
||||
divert: &mut regalloc::RegDiversions,
|
||||
sink: &mut CodeSink,
|
||||
sink: &mut dyn CodeSink,
|
||||
) {
|
||||
binemit::emit_inst(func, inst, divert, sink)
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ mod tests {
|
|||
use std::string::{String, ToString};
|
||||
use target_lexicon::triple;
|
||||
|
||||
fn encstr(isa: &isa::TargetIsa, enc: Result<isa::Encoding, isa::Legalize>) -> String {
|
||||
fn encstr(isa: &dyn isa::TargetIsa, enc: Result<isa::Encoding, isa::Legalize>) -> String {
|
||||
match enc {
|
||||
Ok(e) => isa.encoding_info().display(e).to_string(),
|
||||
Err(_) => "no encoding".to_string(),
|
||||
|
|
|
@ -199,7 +199,7 @@ pub fn allocatable_registers(_func: &ir::Function, triple: &Triple) -> RegisterS
|
|||
}
|
||||
|
||||
/// Get the set of callee-saved registers.
|
||||
fn callee_saved_gprs(isa: &TargetIsa, call_conv: CallConv) -> &'static [RU] {
|
||||
fn callee_saved_gprs(isa: &dyn TargetIsa, call_conv: CallConv) -> &'static [RU] {
|
||||
match isa.triple().pointer_width().unwrap() {
|
||||
PointerWidth::U16 => panic!(),
|
||||
PointerWidth::U32 => &[RU::rbx, RU::rsi, RU::rdi],
|
||||
|
@ -227,7 +227,7 @@ fn callee_saved_gprs(isa: &TargetIsa, call_conv: CallConv) -> &'static [RU] {
|
|||
}
|
||||
|
||||
/// Get the set of callee-saved registers that are used.
|
||||
fn callee_saved_gprs_used(isa: &TargetIsa, func: &ir::Function) -> RegisterSet {
|
||||
fn callee_saved_gprs_used(isa: &dyn TargetIsa, func: &ir::Function) -> RegisterSet {
|
||||
let mut all_callee_saved = RegisterSet::empty();
|
||||
for reg in callee_saved_gprs(isa, func.signature.call_conv) {
|
||||
all_callee_saved.free(GPR, *reg as RegUnit);
|
||||
|
@ -269,7 +269,7 @@ fn callee_saved_gprs_used(isa: &TargetIsa, func: &ir::Function) -> RegisterSet {
|
|||
used
|
||||
}
|
||||
|
||||
pub fn prologue_epilogue(func: &mut ir::Function, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
pub fn prologue_epilogue(func: &mut ir::Function, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
match func.signature.call_conv {
|
||||
// For now, just translate fast and cold as system_v.
|
||||
CallConv::Fast | CallConv::Cold | CallConv::SystemV => {
|
||||
|
@ -281,7 +281,7 @@ pub fn prologue_epilogue(func: &mut ir::Function, isa: &TargetIsa) -> CodegenRes
|
|||
}
|
||||
}
|
||||
|
||||
fn baldrdash_prologue_epilogue(func: &mut ir::Function, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
fn baldrdash_prologue_epilogue(func: &mut ir::Function, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
debug_assert!(
|
||||
!isa.flags().probestack_enabled(),
|
||||
"baldrdash does not expect cranelift to emit stack probes"
|
||||
|
@ -302,7 +302,7 @@ fn baldrdash_prologue_epilogue(func: &mut ir::Function, isa: &TargetIsa) -> Code
|
|||
|
||||
/// Implementation of the fastcall-based Win64 calling convention described at [1]
|
||||
/// [1] https://msdn.microsoft.com/en-us/library/ms235286.aspx
|
||||
fn fastcall_prologue_epilogue(func: &mut ir::Function, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
fn fastcall_prologue_epilogue(func: &mut ir::Function, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
if isa.triple().pointer_width().unwrap() != PointerWidth::U64 {
|
||||
panic!("TODO: windows-fastcall: x86-32 not implemented yet");
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ fn fastcall_prologue_epilogue(func: &mut ir::Function, isa: &TargetIsa) -> Codeg
|
|||
}
|
||||
|
||||
/// Insert a System V-compatible prologue and epilogue.
|
||||
fn system_v_prologue_epilogue(func: &mut ir::Function, isa: &TargetIsa) -> CodegenResult<()> {
|
||||
fn system_v_prologue_epilogue(func: &mut ir::Function, isa: &dyn TargetIsa) -> CodegenResult<()> {
|
||||
// The original 32-bit x86 ELF ABI had a 4-byte aligned stack pointer, but
|
||||
// newer versions use a 16-byte aligned stack pointer.
|
||||
let stack_align = 16;
|
||||
|
@ -435,7 +435,7 @@ fn insert_common_prologue(
|
|||
stack_size: i64,
|
||||
reg_type: ir::types::Type,
|
||||
csrs: &RegisterSet,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) {
|
||||
if stack_size > 0 {
|
||||
// Check if there is a special stack limit parameter. If so insert stack check.
|
||||
|
|
|
@ -115,7 +115,7 @@ fn expand_sdivrem(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
isa: &isa::TargetIsa,
|
||||
isa: &dyn isa::TargetIsa,
|
||||
) {
|
||||
let (x, y, is_srem) = match func.dfg[inst] {
|
||||
ir::InstructionData::Binary {
|
||||
|
@ -225,7 +225,7 @@ fn expand_udivrem(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
_cfg: &mut ControlFlowGraph,
|
||||
isa: &isa::TargetIsa,
|
||||
isa: &dyn isa::TargetIsa,
|
||||
) {
|
||||
let (x, y, is_urem) = match func.dfg[inst] {
|
||||
ir::InstructionData::Binary {
|
||||
|
@ -278,7 +278,7 @@ fn expand_minmax(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
_isa: &isa::TargetIsa,
|
||||
_isa: &dyn isa::TargetIsa,
|
||||
) {
|
||||
let (x, y, x86_opc, bitwise_opc) = match func.dfg[inst] {
|
||||
ir::InstructionData::Binary {
|
||||
|
@ -370,7 +370,7 @@ fn expand_fcvt_from_uint(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
_isa: &isa::TargetIsa,
|
||||
_isa: &dyn isa::TargetIsa,
|
||||
) {
|
||||
let x;
|
||||
match func.dfg[inst] {
|
||||
|
@ -441,7 +441,7 @@ fn expand_fcvt_to_sint(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
_isa: &isa::TargetIsa,
|
||||
_isa: &dyn isa::TargetIsa,
|
||||
) {
|
||||
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||
|
||||
|
@ -536,7 +536,7 @@ fn expand_fcvt_to_sint_sat(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
_isa: &isa::TargetIsa,
|
||||
_isa: &dyn isa::TargetIsa,
|
||||
) {
|
||||
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||
|
||||
|
@ -655,7 +655,7 @@ fn expand_fcvt_to_uint(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
_isa: &isa::TargetIsa,
|
||||
_isa: &dyn isa::TargetIsa,
|
||||
) {
|
||||
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||
|
||||
|
@ -736,7 +736,7 @@ fn expand_fcvt_to_uint_sat(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
_isa: &isa::TargetIsa,
|
||||
_isa: &dyn isa::TargetIsa,
|
||||
) {
|
||||
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ fn isa_constructor(
|
|||
triple: Triple,
|
||||
shared_flags: shared_settings::Flags,
|
||||
builder: shared_settings::Builder,
|
||||
) -> Box<TargetIsa> {
|
||||
) -> Box<dyn TargetIsa> {
|
||||
let level1 = match triple.pointer_width().unwrap() {
|
||||
PointerWidth::U16 => unimplemented!("x86-16"),
|
||||
PointerWidth::U32 => &enc_tables::LEVEL1_I32[..],
|
||||
|
@ -123,7 +123,7 @@ impl TargetIsa for Isa {
|
|||
func: &ir::Function,
|
||||
inst: ir::Inst,
|
||||
divert: &mut regalloc::RegDiversions,
|
||||
sink: &mut CodeSink,
|
||||
sink: &mut dyn CodeSink,
|
||||
) {
|
||||
binemit::emit_inst(func, inst, divert, sink)
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ use std::vec::Vec;
|
|||
/// This changes all signatures to be ABI-compliant with full `ArgumentLoc` annotations. It doesn't
|
||||
/// change the entry block arguments, calls, or return instructions, so this can leave the function
|
||||
/// in a state with type discrepancies.
|
||||
pub fn legalize_signatures(func: &mut Function, isa: &TargetIsa) {
|
||||
pub fn legalize_signatures(func: &mut Function, isa: &dyn TargetIsa) {
|
||||
legalize_signature(&mut func.signature, true, isa);
|
||||
for sig_data in func.dfg.signatures.values_mut() {
|
||||
legalize_signature(sig_data, false, isa);
|
||||
|
@ -49,14 +49,14 @@ pub fn legalize_signatures(func: &mut Function, isa: &TargetIsa) {
|
|||
|
||||
/// Legalize the libcall signature, which we may generate on the fly after
|
||||
/// `legalize_signatures` has been called.
|
||||
pub fn legalize_libcall_signature(signature: &mut Signature, isa: &TargetIsa) {
|
||||
pub fn legalize_libcall_signature(signature: &mut Signature, isa: &dyn TargetIsa) {
|
||||
legalize_signature(signature, false, isa);
|
||||
}
|
||||
|
||||
/// Legalize the given signature.
|
||||
///
|
||||
/// `current` is true if this is the signature for the current function.
|
||||
fn legalize_signature(signature: &mut Signature, current: bool, isa: &TargetIsa) {
|
||||
fn legalize_signature(signature: &mut Signature, current: bool, isa: &dyn TargetIsa) {
|
||||
isa.legalize_signature(signature, current);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ pub fn expand_call(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
_cfg: &mut ControlFlowGraph,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) {
|
||||
// Unpack the instruction.
|
||||
let (func_ref, old_args) = match func.dfg[inst] {
|
||||
|
|
|
@ -13,7 +13,7 @@ pub fn expand_global_value(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
_cfg: &mut ControlFlowGraph,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) {
|
||||
// Unpack the instruction.
|
||||
let gv = match func.dfg[inst] {
|
||||
|
@ -90,7 +90,7 @@ fn load_addr(
|
|||
offset: ir::immediates::Offset32,
|
||||
global_type: ir::Type,
|
||||
readonly: bool,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) {
|
||||
// We need to load a pointer from the `base` global value, so insert a new `global_value`
|
||||
// instruction. This depends on the iterative legalization loop. Note that the IR verifier
|
||||
|
@ -123,7 +123,7 @@ fn load_addr(
|
|||
}
|
||||
|
||||
/// Expand a `global_value` instruction for a symbolic name global.
|
||||
fn symbol(inst: ir::Inst, func: &mut ir::Function, gv: ir::GlobalValue, isa: &TargetIsa) {
|
||||
fn symbol(inst: ir::Inst, func: &mut ir::Function, gv: ir::GlobalValue, isa: &dyn TargetIsa) {
|
||||
let ptr_ty = isa.pointer_type();
|
||||
func.dfg.replace(inst).symbol_value(ptr_ty, gv);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ pub fn expand_heap_addr(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
_isa: &TargetIsa,
|
||||
_isa: &dyn TargetIsa,
|
||||
) {
|
||||
// Unpack the instruction.
|
||||
let (heap, offset, access_size) = match func.dfg[inst] {
|
||||
|
|
|
@ -7,7 +7,7 @@ use crate::legalizer::boundary::legalize_libcall_signature;
|
|||
use std::vec::Vec;
|
||||
|
||||
/// Try to expand `inst` as a library call, returning true is successful.
|
||||
pub fn expand_as_libcall(inst: ir::Inst, func: &mut ir::Function, isa: &TargetIsa) -> bool {
|
||||
pub fn expand_as_libcall(inst: ir::Inst, func: &mut ir::Function, isa: &dyn TargetIsa) -> bool {
|
||||
// Does the opcode/ctrl_type combo even have a well-known runtime library name.
|
||||
let libcall = match ir::LibCall::for_inst(func.dfg[inst].opcode(), func.dfg.ctrl_typevar(inst))
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@ fn legalize_inst(
|
|||
inst: ir::Inst,
|
||||
pos: &mut FuncCursor,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> bool {
|
||||
let opcode = pos.func.dfg[inst].opcode();
|
||||
|
||||
|
@ -83,7 +83,7 @@ fn legalize_inst(
|
|||
/// - Transform any instructions that don't have a legal representation in `isa`.
|
||||
/// - Fill out `func.encodings`.
|
||||
///
|
||||
pub fn legalize_function(func: &mut ir::Function, cfg: &mut ControlFlowGraph, isa: &TargetIsa) {
|
||||
pub fn legalize_function(func: &mut ir::Function, cfg: &mut ControlFlowGraph, isa: &dyn TargetIsa) {
|
||||
let _tt = timing::legalize();
|
||||
debug_assert!(cfg.is_valid());
|
||||
|
||||
|
@ -129,7 +129,7 @@ fn expand_cond_trap(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
_isa: &TargetIsa,
|
||||
_isa: &dyn TargetIsa,
|
||||
) {
|
||||
// Parse the instruction.
|
||||
let trapz;
|
||||
|
@ -179,7 +179,7 @@ fn expand_br_table(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) {
|
||||
if isa.flags().jump_tables_enabled() {
|
||||
expand_br_table_jt(inst, func, cfg, isa);
|
||||
|
@ -193,7 +193,7 @@ fn expand_br_table_jt(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) {
|
||||
use crate::ir::condcodes::IntCC;
|
||||
|
||||
|
@ -239,7 +239,7 @@ fn expand_br_table_conds(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
_isa: &TargetIsa,
|
||||
_isa: &dyn TargetIsa,
|
||||
) {
|
||||
use crate::ir::condcodes::IntCC;
|
||||
|
||||
|
@ -280,7 +280,7 @@ fn expand_select(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
_isa: &TargetIsa,
|
||||
_isa: &dyn TargetIsa,
|
||||
) {
|
||||
let (ctrl, tval, fval) = match func.dfg[inst] {
|
||||
ir::InstructionData::Ternary {
|
||||
|
@ -315,7 +315,7 @@ fn expand_br_icmp(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
_isa: &TargetIsa,
|
||||
_isa: &dyn TargetIsa,
|
||||
) {
|
||||
let (cond, a, b, destination, ebb_args) = match func.dfg[inst] {
|
||||
ir::InstructionData::BranchIcmp {
|
||||
|
@ -350,7 +350,7 @@ fn expand_fconst(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
_cfg: &mut ControlFlowGraph,
|
||||
_isa: &TargetIsa,
|
||||
_isa: &dyn TargetIsa,
|
||||
) {
|
||||
let ty = func.dfg.value_type(func.dfg.first_result(inst));
|
||||
debug_assert!(!ty.is_vector(), "Only scalar fconst supported: {}", ty);
|
||||
|
@ -378,7 +378,7 @@ fn expand_stack_load(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
_cfg: &mut ControlFlowGraph,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) {
|
||||
let ty = func.dfg.value_type(func.dfg.first_result(inst));
|
||||
let addr_ty = isa.pointer_type();
|
||||
|
@ -410,7 +410,7 @@ fn expand_stack_store(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
_cfg: &mut ControlFlowGraph,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) {
|
||||
let addr_ty = isa.pointer_type();
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ pub fn expand_table_addr(
|
|||
inst: ir::Inst,
|
||||
func: &mut ir::Function,
|
||||
_cfg: &mut ControlFlowGraph,
|
||||
_isa: &TargetIsa,
|
||||
_isa: &dyn TargetIsa,
|
||||
) {
|
||||
// Unpack the instruction.
|
||||
let (table, index, element_offset) = match func.dfg[inst] {
|
||||
|
|
|
@ -17,7 +17,7 @@ use std::vec::Vec;
|
|||
/// loop-invariant instructions out of them.
|
||||
/// Changes the CFG and domtree in-place during the operation.
|
||||
pub fn do_licm(
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
func: &mut Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
domtree: &mut DominatorTree,
|
||||
|
@ -64,7 +64,7 @@ pub fn do_licm(
|
|||
// Insert a pre-header before the header, modifying the function layout and CFG to reflect it.
|
||||
// A jump instruction to the header is placed at the end of the pre-header.
|
||||
fn create_pre_header(
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
header: Ebb,
|
||||
func: &mut Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
|
|
|
@ -45,7 +45,7 @@ fn optimize_cpu_flags(
|
|||
pos: &mut EncCursor,
|
||||
inst: Inst,
|
||||
last_flags_clobber: Option<Inst>,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) {
|
||||
// Look for compare and branch patterns.
|
||||
// This code could be considerably simplified with non-lexical lifetimes.
|
||||
|
@ -179,7 +179,7 @@ struct MemOpInfo {
|
|||
offset: Offset32,
|
||||
}
|
||||
|
||||
fn optimize_complex_addresses(pos: &mut EncCursor, inst: Inst, isa: &TargetIsa) {
|
||||
fn optimize_complex_addresses(pos: &mut EncCursor, inst: Inst, isa: &dyn TargetIsa) {
|
||||
// Look for simple loads and stores we can optimize.
|
||||
let info = match pos.func.dfg[inst] {
|
||||
InstructionData::Load {
|
||||
|
@ -357,7 +357,7 @@ fn optimize_complex_addresses(pos: &mut EncCursor, inst: Inst, isa: &TargetIsa)
|
|||
//
|
||||
// The main post-opt pass.
|
||||
|
||||
pub fn do_postopt(func: &mut Function, isa: &TargetIsa) {
|
||||
pub fn do_postopt(func: &mut Function, isa: &dyn TargetIsa) {
|
||||
let _tt = timing::postopt();
|
||||
let mut pos = EncCursor::new(func, isa);
|
||||
while let Some(_ebb) = pos.next_ebb() {
|
||||
|
|
|
@ -17,8 +17,8 @@ use std::vec::Vec;
|
|||
/// Pretty-print a verifier error.
|
||||
pub fn pretty_verifier_error<'a>(
|
||||
func: &ir::Function,
|
||||
isa: Option<&TargetIsa>,
|
||||
func_w: Option<Box<FuncWriter + 'a>>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
func_w: Option<Box<dyn FuncWriter + 'a>>,
|
||||
errors: VerifierErrors,
|
||||
) -> String {
|
||||
let mut errors = errors.0;
|
||||
|
@ -44,14 +44,14 @@ pub fn pretty_verifier_error<'a>(
|
|||
w
|
||||
}
|
||||
|
||||
struct PrettyVerifierError<'a>(Box<FuncWriter + 'a>, &'a mut Vec<VerifierError>);
|
||||
struct PrettyVerifierError<'a>(Box<dyn FuncWriter + 'a>, &'a mut Vec<VerifierError>);
|
||||
|
||||
impl<'a> FuncWriter for PrettyVerifierError<'a> {
|
||||
fn write_ebb_header(
|
||||
&mut self,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
isa: Option<&TargetIsa>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
ebb: Ebb,
|
||||
indent: usize,
|
||||
) -> fmt::Result {
|
||||
|
@ -60,10 +60,10 @@ impl<'a> FuncWriter for PrettyVerifierError<'a> {
|
|||
|
||||
fn write_instruction(
|
||||
&mut self,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
aliases: &SecondaryMap<Value, Vec<Value>>,
|
||||
isa: Option<&TargetIsa>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
inst: Inst,
|
||||
indent: usize,
|
||||
) -> fmt::Result {
|
||||
|
@ -72,10 +72,10 @@ impl<'a> FuncWriter for PrettyVerifierError<'a> {
|
|||
|
||||
fn write_entity_definition(
|
||||
&mut self,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
entity: AnyEntity,
|
||||
value: &fmt::Display,
|
||||
value: &dyn fmt::Display,
|
||||
) -> fmt::Result {
|
||||
pretty_preamble_error(w, func, entity, value, &mut *self.0, self.1)
|
||||
}
|
||||
|
@ -83,12 +83,12 @@ impl<'a> FuncWriter for PrettyVerifierError<'a> {
|
|||
|
||||
/// Pretty-print a function verifier error for a given EBB.
|
||||
fn pretty_ebb_header_error(
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
isa: Option<&TargetIsa>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
cur_ebb: Ebb,
|
||||
indent: usize,
|
||||
func_w: &mut FuncWriter,
|
||||
func_w: &mut dyn FuncWriter,
|
||||
errors: &mut Vec<VerifierError>,
|
||||
) -> fmt::Result {
|
||||
let mut s = String::new();
|
||||
|
@ -121,13 +121,13 @@ fn pretty_ebb_header_error(
|
|||
|
||||
/// Pretty-print a function verifier error for a given instruction.
|
||||
fn pretty_instruction_error(
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
aliases: &SecondaryMap<Value, Vec<Value>>,
|
||||
isa: Option<&TargetIsa>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
cur_inst: Inst,
|
||||
indent: usize,
|
||||
func_w: &mut FuncWriter,
|
||||
func_w: &mut dyn FuncWriter,
|
||||
errors: &mut Vec<VerifierError>,
|
||||
) -> fmt::Result {
|
||||
let mut s = String::new();
|
||||
|
@ -159,11 +159,11 @@ fn pretty_instruction_error(
|
|||
}
|
||||
|
||||
fn pretty_preamble_error(
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
entity: AnyEntity,
|
||||
value: &fmt::Display,
|
||||
func_w: &mut FuncWriter,
|
||||
value: &dyn fmt::Display,
|
||||
func_w: &mut dyn FuncWriter,
|
||||
errors: &mut Vec<VerifierError>,
|
||||
) -> fmt::Result {
|
||||
let mut s = String::new();
|
||||
|
@ -195,7 +195,7 @@ fn pretty_preamble_error(
|
|||
|
||||
/// Prints:
|
||||
/// ; ^~~~~~
|
||||
fn print_arrow(w: &mut Write, entity: &str) -> fmt::Result {
|
||||
fn print_arrow(w: &mut dyn Write, entity: &str) -> fmt::Result {
|
||||
write!(w, ";")?;
|
||||
|
||||
let indent = entity.len() - entity.trim_start().len();
|
||||
|
@ -212,13 +212,13 @@ fn print_arrow(w: &mut Write, entity: &str) -> fmt::Result {
|
|||
|
||||
/// Prints:
|
||||
/// ; error: [ERROR BODY]
|
||||
fn print_error(w: &mut Write, err: VerifierError) -> fmt::Result {
|
||||
fn print_error(w: &mut dyn Write, err: VerifierError) -> fmt::Result {
|
||||
writeln!(w, "; error: {}", err.to_string())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Pretty-print a Cranelift error.
|
||||
pub fn pretty_error(func: &ir::Function, isa: Option<&TargetIsa>, err: CodegenError) -> String {
|
||||
pub fn pretty_error(func: &ir::Function, isa: Option<&dyn TargetIsa>, err: CodegenError) -> String {
|
||||
if let CodegenError::Verifier(e) = err {
|
||||
pretty_verifier_error(func, isa, None, e)
|
||||
} else {
|
||||
|
|
|
@ -48,7 +48,7 @@ impl Affinity {
|
|||
}
|
||||
|
||||
/// Create an affinity that matches an ABI argument for `isa`.
|
||||
pub fn abi(arg: &AbiParam, isa: &TargetIsa) -> Self {
|
||||
pub fn abi(arg: &AbiParam, isa: &dyn TargetIsa) -> Self {
|
||||
match arg.location {
|
||||
ArgumentLoc::Unassigned => Affinity::Unassigned,
|
||||
ArgumentLoc::Reg(_) => Affinity::Reg(isa.regclass_for_abi_type(arg.value_type).into()),
|
||||
|
|
|
@ -66,7 +66,7 @@ pub struct Coalescing {
|
|||
|
||||
/// One-shot context created once per invocation.
|
||||
struct Context<'a> {
|
||||
isa: &'a TargetIsa,
|
||||
isa: &'a dyn TargetIsa,
|
||||
encinfo: EncInfo,
|
||||
|
||||
func: &'a mut Function,
|
||||
|
@ -108,7 +108,7 @@ impl Coalescing {
|
|||
/// Convert `func` to Conventional SSA form and build virtual registers in the process.
|
||||
pub fn conventional_ssa(
|
||||
&mut self,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
func: &mut Function,
|
||||
cfg: &ControlFlowGraph,
|
||||
domtree: &DominatorTree,
|
||||
|
|
|
@ -118,7 +118,7 @@ impl Coloring {
|
|||
/// Run the coloring algorithm over `func`.
|
||||
pub fn run(
|
||||
&mut self,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
func: &mut Function,
|
||||
domtree: &DominatorTree,
|
||||
liveness: &mut Liveness,
|
||||
|
|
|
@ -75,7 +75,7 @@ impl Context {
|
|||
/// location that is consistent with instruction encoding constraints.
|
||||
pub fn run(
|
||||
&mut self,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
func: &mut Function,
|
||||
cfg: &ControlFlowGraph,
|
||||
domtree: &mut DominatorTree,
|
||||
|
|
|
@ -195,7 +195,7 @@ type LiveRangeSet = SparseMap<Value, LiveRange>;
|
|||
fn get_or_create<'a>(
|
||||
lrset: &'a mut LiveRangeSet,
|
||||
value: Value,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
func: &Function,
|
||||
encinfo: &EncInfo,
|
||||
) -> &'a mut LiveRange {
|
||||
|
@ -389,7 +389,7 @@ impl Liveness {
|
|||
|
||||
/// Compute the live ranges of all SSA values used in `func`.
|
||||
/// This clears out any existing analysis stored in this data structure.
|
||||
pub fn compute(&mut self, isa: &TargetIsa, func: &mut Function, cfg: &ControlFlowGraph) {
|
||||
pub fn compute(&mut self, isa: &dyn TargetIsa, func: &mut Function, cfg: &ControlFlowGraph) {
|
||||
let _tt = timing::ra_liveness();
|
||||
self.ranges.clear();
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ mod tests {
|
|||
use target_lexicon::triple;
|
||||
|
||||
// Make an arm32 `TargetIsa`, if possible.
|
||||
fn arm32() -> Option<Box<TargetIsa>> {
|
||||
fn arm32() -> Option<Box<dyn TargetIsa>> {
|
||||
use crate::isa;
|
||||
use crate::settings;
|
||||
|
||||
|
@ -294,7 +294,7 @@ mod tests {
|
|||
}
|
||||
|
||||
// Get a register class by name.
|
||||
fn rc_by_name(isa: &TargetIsa, name: &str) -> RegClass {
|
||||
fn rc_by_name(isa: &dyn TargetIsa, name: &str) -> RegClass {
|
||||
isa.register_info()
|
||||
.classes
|
||||
.iter()
|
||||
|
|
|
@ -65,7 +65,7 @@ impl Reload {
|
|||
/// Run the reload algorithm over `func`.
|
||||
pub fn run(
|
||||
&mut self,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
func: &mut Function,
|
||||
domtree: &DominatorTree,
|
||||
liveness: &mut Liveness,
|
||||
|
@ -222,18 +222,29 @@ impl<'a> Context<'a> {
|
|||
{
|
||||
let dst_vals = self.cur.func.dfg.inst_results(inst);
|
||||
if dst_vals.len() == 1 {
|
||||
let dst_val = dst_vals[0];
|
||||
let can_transform = match (
|
||||
self.cur.func.locations[arg],
|
||||
self.cur.func.locations[dst_vals[0]],
|
||||
self.cur.func.locations[dst_val],
|
||||
) {
|
||||
(ValueLoc::Stack(src_slot), ValueLoc::Stack(dst_slot)) => src_slot == dst_slot,
|
||||
(ValueLoc::Stack(src_slot), ValueLoc::Stack(dst_slot)) => {
|
||||
src_slot == dst_slot && {
|
||||
let src_ty = self.cur.func.dfg.value_type(arg);
|
||||
let dst_ty = self.cur.func.dfg.value_type(dst_val);
|
||||
debug_assert!(src_ty == dst_ty);
|
||||
// This limits the transformation to copies of the
|
||||
// types: I64 I32 I16 I8 F64 and F32, since that's
|
||||
// the set of `copy_nop` encodings available.
|
||||
src_ty.is_int() || src_ty.is_float()
|
||||
}
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
if can_transform {
|
||||
// Convert the instruction into a `copy_nop`.
|
||||
self.cur.func.dfg.replace(inst).copy_nop(arg);
|
||||
let ok = self.cur.func.update_encoding(inst, self.cur.isa).is_ok();
|
||||
debug_assert!(ok);
|
||||
debug_assert!(ok, "copy_nop encoding missing for this type");
|
||||
|
||||
// And move on to the next insn.
|
||||
self.reloads.clear();
|
||||
|
@ -455,7 +466,7 @@ fn handle_abi_args(
|
|||
abi_types: &[AbiParam],
|
||||
var_args: &[Value],
|
||||
offset: usize,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
liveness: &Liveness,
|
||||
) {
|
||||
debug_assert_eq!(abi_types.len(), var_args.len());
|
||||
|
|
|
@ -406,7 +406,7 @@ impl fmt::Display for Move {
|
|||
|
||||
impl fmt::Debug for Move {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let as_display: &fmt::Display = self;
|
||||
let as_display: &dyn fmt::Display = self;
|
||||
as_display.fmt(f)
|
||||
}
|
||||
}
|
||||
|
@ -1139,7 +1139,7 @@ mod tests {
|
|||
use target_lexicon::triple;
|
||||
|
||||
// Make an arm32 `TargetIsa`, if possible.
|
||||
fn arm32() -> Option<Box<TargetIsa>> {
|
||||
fn arm32() -> Option<Box<dyn TargetIsa>> {
|
||||
use crate::isa;
|
||||
use crate::settings;
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ impl Spilling {
|
|||
/// Run the spilling algorithm over `func`.
|
||||
pub fn run(
|
||||
&mut self,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
func: &mut Function,
|
||||
domtree: &DominatorTree,
|
||||
liveness: &mut Liveness,
|
||||
|
|
|
@ -346,7 +346,7 @@ pub struct FlagsOrIsa<'a> {
|
|||
pub flags: &'a Flags,
|
||||
|
||||
/// The ISA may not be present.
|
||||
pub isa: Option<&'a TargetIsa>,
|
||||
pub isa: Option<&'a dyn TargetIsa>,
|
||||
}
|
||||
|
||||
impl<'a> From<&'a Flags> for FlagsOrIsa<'a> {
|
||||
|
@ -355,8 +355,8 @@ impl<'a> From<&'a Flags> for FlagsOrIsa<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a TargetIsa> for FlagsOrIsa<'a> {
|
||||
fn from(isa: &'a TargetIsa) -> FlagsOrIsa {
|
||||
impl<'a> From<&'a dyn TargetIsa> for FlagsOrIsa<'a> {
|
||||
fn from(isa: &'a dyn TargetIsa) -> FlagsOrIsa {
|
||||
FlagsOrIsa {
|
||||
flags: isa.flags(),
|
||||
isa: Some(isa),
|
||||
|
|
|
@ -81,7 +81,7 @@ where
|
|||
pub fn build_value_labels_ranges<T>(
|
||||
func: &Function,
|
||||
regalloc: &Context,
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
) -> ValueLabelsRanges
|
||||
where
|
||||
T: From<SourceLoc> + Deref<Target = SourceLoc> + Ord + Copy,
|
||||
|
|
|
@ -24,7 +24,7 @@ use crate::verifier::{VerifierErrors, VerifierStepResult};
|
|||
pub fn verify_flags(
|
||||
func: &ir::Function,
|
||||
cfg: &ControlFlowGraph,
|
||||
isa: Option<&isa::TargetIsa>,
|
||||
isa: Option<&dyn isa::TargetIsa>,
|
||||
errors: &mut VerifierErrors,
|
||||
) -> VerifierStepResult<()> {
|
||||
let _tt = timing::verify_flags();
|
||||
|
|
|
@ -23,7 +23,7 @@ use core::cmp::Ordering;
|
|||
/// We don't verify that live ranges are minimal. This would require recomputing live ranges for
|
||||
/// all values.
|
||||
pub fn verify_liveness(
|
||||
isa: &TargetIsa,
|
||||
isa: &dyn TargetIsa,
|
||||
func: &Function,
|
||||
cfg: &ControlFlowGraph,
|
||||
liveness: &Liveness,
|
||||
|
@ -42,7 +42,7 @@ pub fn verify_liveness(
|
|||
}
|
||||
|
||||
struct LivenessVerifier<'a> {
|
||||
isa: &'a TargetIsa,
|
||||
isa: &'a dyn TargetIsa,
|
||||
func: &'a Function,
|
||||
cfg: &'a ControlFlowGraph,
|
||||
liveness: &'a Liveness,
|
||||
|
|
|
@ -19,7 +19,7 @@ use crate::verifier::{VerifierErrors, VerifierStepResult};
|
|||
/// If a liveness analysis is provided, it is used to verify that there are no active register
|
||||
/// diversions across control flow edges.
|
||||
pub fn verify_locations(
|
||||
isa: &isa::TargetIsa,
|
||||
isa: &dyn isa::TargetIsa,
|
||||
func: &ir::Function,
|
||||
liveness: Option<&Liveness>,
|
||||
errors: &mut VerifierErrors,
|
||||
|
@ -37,7 +37,7 @@ pub fn verify_locations(
|
|||
}
|
||||
|
||||
struct LocationVerifier<'a> {
|
||||
isa: &'a isa::TargetIsa,
|
||||
isa: &'a dyn isa::TargetIsa,
|
||||
func: &'a ir::Function,
|
||||
reginfo: isa::RegInfo,
|
||||
encinfo: isa::EncInfo,
|
||||
|
|
|
@ -266,7 +266,7 @@ struct Verifier<'a> {
|
|||
func: &'a Function,
|
||||
expected_cfg: ControlFlowGraph,
|
||||
expected_domtree: DominatorTree,
|
||||
isa: Option<&'a TargetIsa>,
|
||||
isa: Option<&'a dyn TargetIsa>,
|
||||
}
|
||||
|
||||
impl<'a> Verifier<'a> {
|
||||
|
@ -580,7 +580,7 @@ impl<'a> Verifier<'a> {
|
|||
}
|
||||
|
||||
for &res in self.func.dfg.inst_results(inst) {
|
||||
self.verify_inst_result(inst, res, errors).is_ok();
|
||||
self.verify_inst_result(inst, res, errors)?;
|
||||
}
|
||||
|
||||
match self.func.dfg[inst] {
|
||||
|
@ -1073,11 +1073,11 @@ impl<'a> Verifier<'a> {
|
|||
};
|
||||
|
||||
// Typechecking instructions is never fatal
|
||||
self.typecheck_results(inst, ctrl_type, errors).is_ok();
|
||||
self.typecheck_fixed_args(inst, ctrl_type, errors).is_ok();
|
||||
self.typecheck_variable_args(inst, errors).is_ok();
|
||||
self.typecheck_return(inst, errors).is_ok();
|
||||
self.typecheck_special(inst, ctrl_type, errors).is_ok();
|
||||
let _ = self.typecheck_results(inst, ctrl_type, errors);
|
||||
let _ = self.typecheck_fixed_args(inst, ctrl_type, errors);
|
||||
let _ = self.typecheck_variable_args(inst, errors);
|
||||
let _ = self.typecheck_return(inst, errors);
|
||||
let _ = self.typecheck_special(inst, ctrl_type, errors);
|
||||
|
||||
// Misuses of copy_nop instructions are fatal
|
||||
self.typecheck_copy_nop(inst, errors)?;
|
||||
|
|
|
@ -22,9 +22,9 @@ pub trait FuncWriter {
|
|||
/// Write the extended basic block header for the current function.
|
||||
fn write_ebb_header(
|
||||
&mut self,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
isa: Option<&TargetIsa>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
ebb: Ebb,
|
||||
indent: usize,
|
||||
) -> fmt::Result;
|
||||
|
@ -32,10 +32,10 @@ pub trait FuncWriter {
|
|||
/// Write the given `inst` to `w`.
|
||||
fn write_instruction(
|
||||
&mut self,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
aliases: &SecondaryMap<Value, Vec<Value>>,
|
||||
isa: Option<&TargetIsa>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
inst: Inst,
|
||||
indent: usize,
|
||||
) -> fmt::Result;
|
||||
|
@ -43,7 +43,7 @@ pub trait FuncWriter {
|
|||
/// Write the preamble to `w`. By default, this uses `write_entity_definition`.
|
||||
fn write_preamble(
|
||||
&mut self,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
regs: Option<&RegInfo>,
|
||||
) -> Result<bool, fmt::Error> {
|
||||
|
@ -53,7 +53,7 @@ pub trait FuncWriter {
|
|||
/// Default impl of `write_preamble`
|
||||
fn super_preamble(
|
||||
&mut self,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
regs: Option<&RegInfo>,
|
||||
) -> Result<bool, fmt::Error> {
|
||||
|
@ -108,10 +108,10 @@ pub trait FuncWriter {
|
|||
/// Write an entity definition defined in the preamble to `w`.
|
||||
fn write_entity_definition(
|
||||
&mut self,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
entity: AnyEntity,
|
||||
value: &fmt::Display,
|
||||
value: &dyn fmt::Display,
|
||||
) -> fmt::Result {
|
||||
self.super_entity_definition(w, func, entity, value)
|
||||
}
|
||||
|
@ -120,10 +120,10 @@ pub trait FuncWriter {
|
|||
#[allow(unused_variables)]
|
||||
fn super_entity_definition(
|
||||
&mut self,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
entity: AnyEntity,
|
||||
value: &fmt::Display,
|
||||
value: &dyn fmt::Display,
|
||||
) -> fmt::Result {
|
||||
writeln!(w, " {} = {}", entity, value)
|
||||
}
|
||||
|
@ -135,10 +135,10 @@ pub struct PlainWriter;
|
|||
impl FuncWriter for PlainWriter {
|
||||
fn write_instruction(
|
||||
&mut self,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
aliases: &SecondaryMap<Value, Vec<Value>>,
|
||||
isa: Option<&TargetIsa>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
inst: Inst,
|
||||
indent: usize,
|
||||
) -> fmt::Result {
|
||||
|
@ -147,9 +147,9 @@ impl FuncWriter for PlainWriter {
|
|||
|
||||
fn write_ebb_header(
|
||||
&mut self,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
isa: Option<&TargetIsa>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
ebb: Ebb,
|
||||
indent: usize,
|
||||
) -> fmt::Result {
|
||||
|
@ -160,7 +160,7 @@ impl FuncWriter for PlainWriter {
|
|||
/// Write `func` to `w` as equivalent text.
|
||||
/// Use `isa` to emit ISA-dependent annotations.
|
||||
pub fn write_function(
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
annotations: &DisplayFunctionAnnotations,
|
||||
) -> fmt::Result {
|
||||
|
@ -184,7 +184,7 @@ fn alias_map(func: &Function) -> SecondaryMap<Value, Vec<Value>> {
|
|||
/// pretty_function_error is passed as 'closure' to add error decoration.
|
||||
pub fn decorate_function<FW: FuncWriter>(
|
||||
func_w: &mut FW,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
annotations: &DisplayFunctionAnnotations,
|
||||
) -> fmt::Result {
|
||||
|
@ -210,7 +210,7 @@ pub fn decorate_function<FW: FuncWriter>(
|
|||
//
|
||||
// Function spec.
|
||||
|
||||
fn write_spec(w: &mut Write, func: &Function, regs: Option<&RegInfo>) -> fmt::Result {
|
||||
fn write_spec(w: &mut dyn Write, func: &Function, regs: Option<&RegInfo>) -> fmt::Result {
|
||||
write!(w, "{}{}", func.name, func.signature.display(regs))
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,12 @@ fn write_spec(w: &mut Write, func: &Function, regs: Option<&RegInfo>) -> fmt::Re
|
|||
//
|
||||
// Basic blocks
|
||||
|
||||
fn write_arg(w: &mut Write, func: &Function, regs: Option<&RegInfo>, arg: Value) -> fmt::Result {
|
||||
fn write_arg(
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
regs: Option<&RegInfo>,
|
||||
arg: Value,
|
||||
) -> fmt::Result {
|
||||
write!(w, "{}: {}", arg, func.dfg.value_type(arg))?;
|
||||
let loc = func.locations[arg];
|
||||
if loc.is_assigned() {
|
||||
|
@ -235,9 +240,9 @@ fn write_arg(w: &mut Write, func: &Function, regs: Option<&RegInfo>, arg: Value)
|
|||
/// ebb10(v4: f64, v5: b1):
|
||||
///
|
||||
pub fn write_ebb_header(
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
isa: Option<&TargetIsa>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
ebb: Ebb,
|
||||
indent: usize,
|
||||
) -> fmt::Result {
|
||||
|
@ -263,7 +268,7 @@ pub fn write_ebb_header(
|
|||
writeln!(w, "):")
|
||||
}
|
||||
|
||||
fn write_valueloc(w: &mut Write, loc: &ValueLoc, regs: &RegInfo) -> fmt::Result {
|
||||
fn write_valueloc(w: &mut dyn Write, loc: &ValueLoc, regs: &RegInfo) -> fmt::Result {
|
||||
match loc {
|
||||
ValueLoc::Reg(r) => write!(w, "{}", regs.display_regunit(*r)),
|
||||
ValueLoc::Stack(ss) => write!(w, "{}", ss),
|
||||
|
@ -272,7 +277,7 @@ fn write_valueloc(w: &mut Write, loc: &ValueLoc, regs: &RegInfo) -> fmt::Result
|
|||
}
|
||||
|
||||
fn write_value_range_markers(
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
val_ranges: &ValueLabelsRanges,
|
||||
regs: &RegInfo,
|
||||
offset: u32,
|
||||
|
@ -306,7 +311,7 @@ fn write_value_range_markers(
|
|||
|
||||
fn decorate_ebb<FW: FuncWriter>(
|
||||
func_w: &mut FW,
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
aliases: &SecondaryMap<Value, Vec<Value>>,
|
||||
annotations: &DisplayFunctionAnnotations,
|
||||
|
@ -385,7 +390,7 @@ fn type_suffix(func: &Function, inst: Inst) -> Option<Type> {
|
|||
|
||||
/// Write out any aliases to the given target, including indirect aliases
|
||||
fn write_value_aliases(
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
aliases: &SecondaryMap<Value, Vec<Value>>,
|
||||
target: Value,
|
||||
indent: usize,
|
||||
|
@ -402,10 +407,10 @@ fn write_value_aliases(
|
|||
}
|
||||
|
||||
fn write_instruction(
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
func: &Function,
|
||||
aliases: &SecondaryMap<Value, Vec<Value>>,
|
||||
isa: Option<&TargetIsa>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
inst: Inst,
|
||||
indent: usize,
|
||||
) -> fmt::Result {
|
||||
|
@ -472,9 +477,9 @@ fn write_instruction(
|
|||
|
||||
/// Write the operands of `inst` to `w` with a prepended space.
|
||||
pub fn write_operands(
|
||||
w: &mut Write,
|
||||
w: &mut dyn Write,
|
||||
dfg: &DataFlowGraph,
|
||||
isa: Option<&TargetIsa>,
|
||||
isa: Option<&dyn TargetIsa>,
|
||||
inst: Inst,
|
||||
) -> fmt::Result {
|
||||
let pool = &dfg.value_lists;
|
||||
|
@ -687,7 +692,7 @@ pub fn write_operands(
|
|||
}
|
||||
|
||||
/// Write EBB args using optional parantheses.
|
||||
fn write_ebb_args(w: &mut Write, args: &[Value]) -> fmt::Result {
|
||||
fn write_ebb_args(w: &mut dyn Write, args: &[Value]) -> fmt::Result {
|
||||
if args.is_empty() {
|
||||
Ok(())
|
||||
} else {
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"48e037bea5be27018e3f98bfba7ca7b0af1322c2083c69a137ab3320cd64b9fb","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"96ceffbfd88fb06e3b41aa4d3087cffbbf8441d04eba7ab09662a72ab600a321","src/boxed_slice.rs":"687428ee0442013c0d5962dd78d0964830233bc4cb19aa530d30da0f1dc437a9","src/iter.rs":"4a4d3309fe9aad14fd7702f02459f4277b4ddb50dba700e58dcc75665ffebfb3","src/keys.rs":"b8c2fba26dee15bf3d1880bb2b41e8d66fe1428d242ee6d9fd30ee94bbd0407d","src/lib.rs":"139fc0eeed2e8cde2b82b8b7402e8c7cd079a9fbbf1ec692622e5ad0c10d9faf","src/list.rs":"fc3decc81bcef92e106aae53e586a0ef21d70916fa53a48f7b813c5da44b8dc2","src/map.rs":"f35031459aca446734726c132c0a571482f1ec2ca8221b352d2e18c74950e977","src/packed_option.rs":"9d47f5b8302ee685c096817e376144e363507d1c77ef562d3ae4dbddae568195","src/primary.rs":"e95e4b2ed36413d80c4c0dcfc19dcf8a9f52e34467aaec196c774fd639747028","src/set.rs":"ec0ff7a9ee674c90ff9d06ea1fd4ab05039369146c2d259f476c6f612417933f","src/sparse.rs":"cf345a81d69a5dddaed4778b6aaaf06c70da2c1fd4cd21e366ed6ca5906ffdab"},"package":null}
|
||||
{"files":{"Cargo.toml":"48e037bea5be27018e3f98bfba7ca7b0af1322c2083c69a137ab3320cd64b9fb","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"96ceffbfd88fb06e3b41aa4d3087cffbbf8441d04eba7ab09662a72ab600a321","src/boxed_slice.rs":"687428ee0442013c0d5962dd78d0964830233bc4cb19aa530d30da0f1dc437a9","src/iter.rs":"4a4d3309fe9aad14fd7702f02459f4277b4ddb50dba700e58dcc75665ffebfb3","src/keys.rs":"b8c2fba26dee15bf3d1880bb2b41e8d66fe1428d242ee6d9fd30ee94bbd0407d","src/lib.rs":"f83cdc6c4a2cd0d75e85c355ee2c8b19b25194c86468c2285bde1f725656062f","src/list.rs":"fc3decc81bcef92e106aae53e586a0ef21d70916fa53a48f7b813c5da44b8dc2","src/map.rs":"f35031459aca446734726c132c0a571482f1ec2ca8221b352d2e18c74950e977","src/packed_option.rs":"9d47f5b8302ee685c096817e376144e363507d1c77ef562d3ae4dbddae568195","src/primary.rs":"e95e4b2ed36413d80c4c0dcfc19dcf8a9f52e34467aaec196c774fd639747028","src/set.rs":"ec0ff7a9ee674c90ff9d06ea1fd4ab05039369146c2d259f476c6f612417933f","src/sparse.rs":"cf345a81d69a5dddaed4778b6aaaf06c70da2c1fd4cd21e366ed6ca5906ffdab"},"package":null}
|
|
@ -126,7 +126,7 @@ macro_rules! entity_impl {
|
|||
|
||||
impl $crate::__core::fmt::Debug for $entity {
|
||||
fn fmt(&self, f: &mut $crate::__core::fmt::Formatter) -> $crate::__core::fmt::Result {
|
||||
(self as &$crate::__core::fmt::Display).fmt(f)
|
||||
(self as &dyn $crate::__core::fmt::Display).fmt(f)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"c92f07d9959d10331c6b4770a4db12f706927a18897dfed45472abcd6e58190e","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"dea43e8044284df50f8b8772e9b48ba8b109b45c74111ff73619775d57ad8d67","src/frontend.rs":"149ccdd1fdbdff42693720b14f9077dfbaa5c54ad6cae097d68756678a7486e2","src/lib.rs":"1cc2e7aaffa45bccea9e59fcc9d9c5d295a9f7adacd6bd55933834e20e969aef","src/ssa.rs":"88cb07071943f3e72a91c91afb58960689b4d9c56352b3bb7cd5d69288066190","src/switch.rs":"b8f337966b540254feb5f979b4a146f5ef69ae199864da6332c9d7513ff3ec8b","src/variable.rs":"f082efaa4b2d3c5eb48f6344149408074e1e15cb581f7a63f549313c7a1037be"},"package":null}
|
||||
{"files":{"Cargo.toml":"c92f07d9959d10331c6b4770a4db12f706927a18897dfed45472abcd6e58190e","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"dea43e8044284df50f8b8772e9b48ba8b109b45c74111ff73619775d57ad8d67","src/frontend.rs":"f2fcd908b6a3c9b4a925702a578c9b2f0c6af6ed53cfc3cd7070b6fa3b7d58cb","src/lib.rs":"1cc2e7aaffa45bccea9e59fcc9d9c5d295a9f7adacd6bd55933834e20e969aef","src/ssa.rs":"88cb07071943f3e72a91c91afb58960689b4d9c56352b3bb7cd5d69288066190","src/switch.rs":"b8f337966b540254feb5f979b4a146f5ef69ae199864da6332c9d7513ff3ec8b","src/variable.rs":"f082efaa4b2d3c5eb48f6344149408074e1e15cb581f7a63f549313c7a1037be"},"package":null}
|
|
@ -571,7 +571,7 @@ impl<'a> FunctionBuilder<'a> {
|
|||
/// Useful for debug purposes. Use it with `None` for standard printing.
|
||||
// Clippy thinks the lifetime that follows is needless, but rustc needs it
|
||||
#[cfg_attr(feature = "cargo-clippy", allow(clippy::needless_lifetimes))]
|
||||
pub fn display<'b, I: Into<Option<&'b TargetIsa>>>(&'b self, isa: I) -> DisplayFunction {
|
||||
pub fn display<'b, I: Into<Option<&'b dyn TargetIsa>>>(&'b self, isa: I) -> DisplayFunction {
|
||||
self.func.display(isa)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"6065884c733b5e4ae101f38771c52bff0ba7b9984bf9438dde102aa68e4b9b5c","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"87679cdb53e8cbec3b1aa45afb2124727c1c059f8bd10363d27daf318a9f9a36","src/code_translator.rs":"56a399a242c9b59c25104e5c3faa81d289d0d441d17617a20b0061fbd9297aa3","src/environ/dummy.rs":"ee4d8d4924b4b04027f8af07968d5098ecd72ee62b53622d30334d1a38b227b8","src/environ/mod.rs":"617c147485038dfd797ab0ea71b4cfa9574d95d5d5b1ca362c6b7b6a462cf577","src/environ/spec.rs":"f45b20f6f9e60d94eb13829168ce8f7078ac61282689d43f58e1fccf9815d488","src/func_translator.rs":"07e1ebda4949f744e7d7b5a679bf1951fbefd807a0f0748231353cf1ef536d82","src/lib.rs":"0897b0270e746961db3d4dc74e5f766aced0ef23f870399aa9e685f1ec62ea83","src/module_translator.rs":"ac54c24aaa3775f72ccd16d1781be648bb0e83ea83909f933d07e86ef1879213","src/sections_translator.rs":"b7313a25c4e95917f8e87103fa8613166b25c040933979a0ff293c89eb3f99dc","src/state.rs":"9e4f67900439f6aa18cfa3f16c694487374ddf42530db4504bccab0ebc360c96","src/translation_utils.rs":"72ccd5bed655f1a215873218d004b087f692b0d060af0f57773b961b75214cac","tests/wasm_testsuite.rs":"9b4e008587c61377cf38f9d0e4635418ee38e32a865db8da5dfc6e0fae047436"},"package":null}
|
||||
{"files":{"Cargo.toml":"1988715f39ef56d0e40ffcb2ffde965a1753a8ed15375e8a30fccabba16bd701","LICENSE":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","README.md":"87679cdb53e8cbec3b1aa45afb2124727c1c059f8bd10363d27daf318a9f9a36","src/code_translator.rs":"77040f6e49784aafce63a04057a3464651ed7a817ba055226d40ef5755914989","src/environ/dummy.rs":"ee4d8d4924b4b04027f8af07968d5098ecd72ee62b53622d30334d1a38b227b8","src/environ/mod.rs":"617c147485038dfd797ab0ea71b4cfa9574d95d5d5b1ca362c6b7b6a462cf577","src/environ/spec.rs":"f45b20f6f9e60d94eb13829168ce8f7078ac61282689d43f58e1fccf9815d488","src/func_translator.rs":"07e1ebda4949f744e7d7b5a679bf1951fbefd807a0f0748231353cf1ef536d82","src/lib.rs":"0897b0270e746961db3d4dc74e5f766aced0ef23f870399aa9e685f1ec62ea83","src/module_translator.rs":"2345a4ee009eb59a90898795f939b9c7b241604a44abb27278610257cce84156","src/sections_translator.rs":"8ad698652ec7741feea8c10badfd6891d27d9b5b2b06819b08ec009afa584e81","src/state.rs":"9e4f67900439f6aa18cfa3f16c694487374ddf42530db4504bccab0ebc360c96","src/translation_utils.rs":"cb6b1ab91b4dd4739e5282989c61e6778cd1150319c8c7466b32f6ecc5db7afe","tests/wasm_testsuite.rs":"9b4e008587c61377cf38f9d0e4635418ee38e32a865db8da5dfc6e0fae047436"},"package":null}
|
|
@ -11,7 +11,7 @@ keywords = ["webassembly", "wasm"]
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
wasmparser = { version = "0.29.2", default-features = false }
|
||||
wasmparser = { version = "0.31.0", default-features = false }
|
||||
cranelift-codegen = { path = "../cranelift-codegen", version = "0.30.0", default-features = false }
|
||||
cranelift-entity = { path = "../cranelift-entity", version = "0.30.0", default-features = false }
|
||||
cranelift-frontend = { path = "../cranelift-frontend", version = "0.30.0", default-features = false }
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
use super::{hash_map, HashMap};
|
||||
use crate::environ::{FuncEnvironment, GlobalVariable, ReturnMode, WasmError, WasmResult};
|
||||
use crate::state::{ControlStackFrame, TranslationState};
|
||||
use crate::translation_utils::{f32_translation, f64_translation, num_return_values, type_to_type};
|
||||
use crate::translation_utils::{
|
||||
blocktype_to_type, f32_translation, f64_translation, num_return_values,
|
||||
};
|
||||
use crate::translation_utils::{FuncIndex, MemoryIndex, SignatureIndex, TableIndex};
|
||||
use core::{i32, u32};
|
||||
use cranelift_codegen::ir::condcodes::{FloatCC, IntCC};
|
||||
|
@ -130,7 +132,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
|||
***********************************************************************************/
|
||||
Operator::Block { ty } => {
|
||||
let next = builder.create_ebb();
|
||||
if let Ok(ty_cre) = type_to_type(ty) {
|
||||
if let Ok(ty_cre) = blocktype_to_type(ty) {
|
||||
builder.append_ebb_param(next, ty_cre);
|
||||
}
|
||||
state.push_block(next, num_return_values(ty));
|
||||
|
@ -138,7 +140,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
|||
Operator::Loop { ty } => {
|
||||
let loop_body = builder.create_ebb();
|
||||
let next = builder.create_ebb();
|
||||
if let Ok(ty_cre) = type_to_type(ty) {
|
||||
if let Ok(ty_cre) = blocktype_to_type(ty) {
|
||||
builder.append_ebb_param(next, ty_cre);
|
||||
}
|
||||
builder.ins().jump(loop_body, &[]);
|
||||
|
@ -156,7 +158,7 @@ pub fn translate_operator<FE: FuncEnvironment + ?Sized>(
|
|||
// and we add nothing;
|
||||
// - either the If have an Else clause, in that case the destination of this jump
|
||||
// instruction will be changed later when we translate the Else operator.
|
||||
if let Ok(ty_cre) = type_to_type(ty) {
|
||||
if let Ok(ty_cre) = blocktype_to_type(ty) {
|
||||
builder.append_ebb_param(if_not, ty_cre);
|
||||
}
|
||||
state.push_if(jump_inst, if_not, num_return_values(ty));
|
||||
|
|
|
@ -13,7 +13,7 @@ use wasmparser::{ModuleReader, SectionCode};
|
|||
/// [`Function`](../codegen/ir/function/struct.Function.html).
|
||||
pub fn translate_module<'data>(
|
||||
data: &'data [u8],
|
||||
environ: &mut ModuleEnvironment<'data>,
|
||||
environ: &mut dyn ModuleEnvironment<'data>,
|
||||
) -> WasmResult<()> {
|
||||
let _tt = timing::wasm_translate_module();
|
||||
let mut reader = ModuleReader::new(data)?;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
//! Helper functions to gather information for each of the non-function sections of a
|
||||
//! WebAssembly module.
|
||||
//!
|
||||
//! The code of theses helper function is straightforward since it is only about reading metadata
|
||||
//! about linear memories, tables, globals, etc. and storing them for later use.
|
||||
//! The code of these helper functions is straightforward since they only read metadata
|
||||
//! about linear memories, tables, globals, etc. and store them for later use.
|
||||
//!
|
||||
//! The special case of the initialize expressions for table elements offsets or global variables
|
||||
//! is handled, according to the semantics of WebAssembly, to only specific expressions that are
|
||||
|
@ -27,7 +27,7 @@ use wasmparser::{
|
|||
/// Parses the Type section of the wasm module.
|
||||
pub fn parse_type_section(
|
||||
types: TypeSectionReader,
|
||||
environ: &mut ModuleEnvironment,
|
||||
environ: &mut dyn ModuleEnvironment,
|
||||
) -> WasmResult<()> {
|
||||
environ.reserve_signatures(types.get_count());
|
||||
|
||||
|
@ -60,7 +60,7 @@ pub fn parse_type_section(
|
|||
/// Parses the Import section of the wasm module.
|
||||
pub fn parse_import_section<'data>(
|
||||
imports: ImportSectionReader<'data>,
|
||||
environ: &mut ModuleEnvironment<'data>,
|
||||
environ: &mut dyn ModuleEnvironment<'data>,
|
||||
) -> WasmResult<()> {
|
||||
environ.reserve_imports(imports.get_count());
|
||||
|
||||
|
@ -122,7 +122,7 @@ pub fn parse_import_section<'data>(
|
|||
/// Parses the Function section of the wasm module.
|
||||
pub fn parse_function_section(
|
||||
functions: FunctionSectionReader,
|
||||
environ: &mut ModuleEnvironment,
|
||||
environ: &mut dyn ModuleEnvironment,
|
||||
) -> WasmResult<()> {
|
||||
environ.reserve_func_types(functions.get_count());
|
||||
|
||||
|
@ -137,7 +137,7 @@ pub fn parse_function_section(
|
|||
/// Parses the Table section of the wasm module.
|
||||
pub fn parse_table_section(
|
||||
tables: TableSectionReader,
|
||||
environ: &mut ModuleEnvironment,
|
||||
environ: &mut dyn ModuleEnvironment,
|
||||
) -> WasmResult<()> {
|
||||
environ.reserve_tables(tables.get_count());
|
||||
|
||||
|
@ -159,7 +159,7 @@ pub fn parse_table_section(
|
|||
/// Parses the Memory section of the wasm module.
|
||||
pub fn parse_memory_section(
|
||||
memories: MemorySectionReader,
|
||||
environ: &mut ModuleEnvironment,
|
||||
environ: &mut dyn ModuleEnvironment,
|
||||
) -> WasmResult<()> {
|
||||
environ.reserve_memories(memories.get_count());
|
||||
|
||||
|
@ -178,7 +178,7 @@ pub fn parse_memory_section(
|
|||
/// Parses the Global section of the wasm module.
|
||||
pub fn parse_global_section(
|
||||
globals: GlobalSectionReader,
|
||||
environ: &mut ModuleEnvironment,
|
||||
environ: &mut dyn ModuleEnvironment,
|
||||
) -> WasmResult<()> {
|
||||
environ.reserve_globals(globals.get_count());
|
||||
|
||||
|
@ -215,7 +215,7 @@ pub fn parse_global_section(
|
|||
/// Parses the Export section of the wasm module.
|
||||
pub fn parse_export_section<'data>(
|
||||
exports: ExportSectionReader<'data>,
|
||||
environ: &mut ModuleEnvironment<'data>,
|
||||
environ: &mut dyn ModuleEnvironment<'data>,
|
||||
) -> WasmResult<()> {
|
||||
environ.reserve_exports(exports.get_count());
|
||||
|
||||
|
@ -243,7 +243,7 @@ pub fn parse_export_section<'data>(
|
|||
}
|
||||
|
||||
/// Parses the Start section of the wasm module.
|
||||
pub fn parse_start_section(index: u32, environ: &mut ModuleEnvironment) -> WasmResult<()> {
|
||||
pub fn parse_start_section(index: u32, environ: &mut dyn ModuleEnvironment) -> WasmResult<()> {
|
||||
environ.declare_start_func(FuncIndex::from_u32(index));
|
||||
Ok(())
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ pub fn parse_start_section(index: u32, environ: &mut ModuleEnvironment) -> WasmR
|
|||
/// Parses the Element section of the wasm module.
|
||||
pub fn parse_element_section<'data>(
|
||||
elements: ElementSectionReader<'data>,
|
||||
environ: &mut ModuleEnvironment,
|
||||
environ: &mut dyn ModuleEnvironment,
|
||||
) -> WasmResult<()> {
|
||||
environ.reserve_table_elements(elements.get_count());
|
||||
|
||||
|
@ -292,7 +292,7 @@ pub fn parse_element_section<'data>(
|
|||
/// Parses the Code section of the wasm module.
|
||||
pub fn parse_code_section<'data>(
|
||||
code: CodeSectionReader<'data>,
|
||||
environ: &mut ModuleEnvironment<'data>,
|
||||
environ: &mut dyn ModuleEnvironment<'data>,
|
||||
) -> WasmResult<()> {
|
||||
for body in code {
|
||||
let mut reader = body?.get_binary_reader();
|
||||
|
@ -306,7 +306,7 @@ pub fn parse_code_section<'data>(
|
|||
/// Parses the Data section of the wasm module.
|
||||
pub fn parse_data_section<'data>(
|
||||
data: DataSectionReader<'data>,
|
||||
environ: &mut ModuleEnvironment<'data>,
|
||||
environ: &mut dyn ModuleEnvironment<'data>,
|
||||
) -> WasmResult<()> {
|
||||
environ.reserve_data_initializers(data.get_count());
|
||||
|
||||
|
|
|
@ -119,6 +119,14 @@ pub fn type_to_type(ty: wasmparser::Type) -> Result<ir::Type, ()> {
|
|||
})
|
||||
}
|
||||
|
||||
/// Helper function translating wasmparser block signatures to Cranelift types when possible.
|
||||
pub fn blocktype_to_type(ty: wasmparser::TypeOrFuncType) -> Result<ir::Type, ()> {
|
||||
match ty {
|
||||
wasmparser::TypeOrFuncType::Type(ty) => type_to_type(ty),
|
||||
wasmparser::TypeOrFuncType::FuncType(_) => unimplemented!("multi-value block signatures"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Turns a `wasmparser` `f32` into a `Cranelift` one.
|
||||
pub fn f32_translation(x: wasmparser::Ieee32) -> ir::immediates::Ieee32 {
|
||||
ir::immediates::Ieee32::with_bits(x.bits())
|
||||
|
@ -130,14 +138,17 @@ pub fn f64_translation(x: wasmparser::Ieee64) -> ir::immediates::Ieee64 {
|
|||
}
|
||||
|
||||
/// Translate a `wasmparser` type into its `Cranelift` equivalent, when possible
|
||||
pub fn num_return_values(ty: wasmparser::Type) -> usize {
|
||||
pub fn num_return_values(ty: wasmparser::TypeOrFuncType) -> usize {
|
||||
match ty {
|
||||
wasmparser::Type::EmptyBlockType => 0,
|
||||
wasmparser::Type::I32
|
||||
| wasmparser::Type::F32
|
||||
| wasmparser::Type::I64
|
||||
| wasmparser::Type::F64 => 1,
|
||||
_ => panic!("unsupported return value type"),
|
||||
wasmparser::TypeOrFuncType::Type(ty) => match ty {
|
||||
wasmparser::Type::EmptyBlockType => 0,
|
||||
wasmparser::Type::I32
|
||||
| wasmparser::Type::F32
|
||||
| wasmparser::Type::I64
|
||||
| wasmparser::Type::F64 => 1,
|
||||
_ => panic!("unsupported return value type"),
|
||||
},
|
||||
wasmparser::TypeOrFuncType::FuncType(_) => unimplemented!("multi-value block signatures"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"files":{"Cargo.toml":"6f05ad46e7a84c8ae06ee90f29bb874acb68074a88aa31838554b9f9c07cd405","LICENSE":"a6c48161a09acc75a0e25503bab66a731eb5fba5392ed4bb4743e4ba5085327a","README.md":"13ea373a411dfa7371cd994736289bb000db51957da92315fecbcc9fe7dcab92","examples/dump.rs":"fdebf1af451d06691d011ba7220f3f9a483b2c54a851f06b610aaa5fcb3832df","examples/simple.rs":"c79ae542913e72cfcd03711543d173b2e8f62783e6c206459953bdb94dbb8c0c","format-all.sh":"6b02a40629ef3d2c0b9671222582a6217d526317a41262ae06c7a95de53bcbeb","src/binary_reader.rs":"e8d58f2ab57123955c680e9c9e790aec8e8a36732a77349bcdbadd7d8faf1c7d","src/lib.rs":"2fae91a32fe51183d5f9d4aab48665a0e617d6127a2031d6aaf4aa257e76dca1","src/limits.rs":"2cf22e266c2828d68bb521485b8bd604a2ecb7a023204d7874b3da5837ec44f9","src/parser.rs":"40624c94c125446b0c6106e7590b35c58df2a6ceafc85a72bb013eef2018eb58","src/primitives.rs":"4627647982376ea8519f931f09108d04c7080cf6b2a4b2d85e559ba7cfb6ad70","src/readers/code_section.rs":"2034c399b76428ac993c22f551f3c541b132d8b4ccc74e34f0043e25534d107b","src/readers/data_count_section.rs":"27ef37517b6beac21245008b14b5416b851c52d0af8e2ae85c1456674e1c9a9e","src/readers/data_section.rs":"e7e2a539d2d3049d4a8f68df9ea2f21d97e7061657bbd91845e1df3e9c1f2ebc","src/readers/element_section.rs":"e31e1d819c0b10acf58b8975238554245defe36db1c3206683b056c52978fb21","src/readers/export_section.rs":"7c74f7a11406a95c162f6ad4f77aafd0b1eee309f33b69f06bea12b23925e143","src/readers/function_section.rs":"57c0479ba8d7f61908ed74e86cbc26553fdd6d2d952f032ce29385a39f82efd3","src/readers/global_section.rs":"5fa18bed0fffadcc2dbdcbaedbe4e4398992fd1ce9e611b0319333a7681082ac","src/readers/import_section.rs":"1db4bf7290d04783d5cf526050d025b15a1daaf2bd97fca1a92ecb873d48f641","src/readers/init_expr.rs":"7020c80013dad4518a5f969c3ab4d624b46d778f03e632871cf343964f63441c","src/readers/linking_section.rs":"9df71f3ee5356f0d273c099212213353080001e261ca697caddf6b847fb5af09","src/readers/memory_section.rs":"83212f86cfc40d18fb392e9234c880afdf443f4af38a727ba346f9c740ef8718","src/readers/mod.rs":"13822fff4190b72f6ae14e29635d2c148a38ee972e148eb99a4688b0309bc2c9","src/readers/module.rs":"66473e7077b3d77ed01ed58d2796c8de7afdb2b90f2b0669c06fa90ca1b3434e","src/readers/name_section.rs":"297f57393d5fef745ec265438108aa6eb7ed2762c03c3beb539493612442f3da","src/readers/operators.rs":"da43ee8afcb0c1d6e7f1e19e8a10143101f0c598b1e533a394c7397f43881a82","src/readers/producers_section.rs":"674f402fc4545c94487f827153871b37adab44ed5eff4070a436eb18e514023a","src/readers/reloc_section.rs":"0ef818a8b83a4542c4c29c23642436a92d3e7c37bc0248e817ed5a9d65ec38ce","src/readers/section_reader.rs":"3d2260449fa0455d710ba6d97810372ec36cba70722c10dd236c3a18ca0eb56f","src/readers/sourcemappingurl_section.rs":"ababe84d51e4817ad19f827aa2b5239578e7f202e5ec06dd688b618885138434","src/readers/start_section.rs":"3eeae00e1aa0fcb2e0d93b7b0eaac30a60d3f1431c71c589cd3f73adb363d532","src/readers/table_section.rs":"e564876825a7b31df2b5dc850279b523e26dc50a08da935cc8d635a49e809951","src/readers/type_section.rs":"2fa33a7b793f3bfa01c259b5dbc38633b7343931886ab41f0cb96dd78db3bf6e","src/tests.rs":"ca486d82ffaa31370534d7d1475c0603f0e9d4888d3d07287b9d5458e6d11156","src/validator.rs":"ec0d1368f3b7833ff6d6178db50e3ffc6b2878d1d6ddab37728fdf21e8256896","test-all.sh":"ff894f4e5e34389ad6ef697bd4ade28a2483dd456eabba8b757945546568f4c9","test-no_std.sh":"f8bc939b378fe618b7ec6297152708e7c8740858eb94e5756464934a38796b8c"},"package":"981a8797cf89762e0233ec45fae731cb79a4dfaee12d9f0fe6cee01e4ac58d00"}
|
||||
{"files":{"Cargo.toml":"83c9345be6b7ac1c67bf7aa61e82fb440c299277dd02817a86e7dac7ba3ac7fa","LICENSE":"a6c48161a09acc75a0e25503bab66a731eb5fba5392ed4bb4743e4ba5085327a","README.md":"13ea373a411dfa7371cd994736289bb000db51957da92315fecbcc9fe7dcab92","benches/benchmark.rs":"25caa5e42e88412fdc443cdf1e870b100c9bf5e2907bbfd75f077757be3090bc","compare-master.sh":"165490eab36ef4eceb2913a6c5cdeff479a05e1e0119a7f4551b03dbcda51ad4","examples/dump.rs":"de2bbdba75e21b9ff92b32697b3d9941f8695b8f7e3a8dee8fc5d7f4c3a0649c","examples/simple.rs":"c79ae542913e72cfcd03711543d173b2e8f62783e6c206459953bdb94dbb8c0c","format-all.sh":"6b02a40629ef3d2c0b9671222582a6217d526317a41262ae06c7a95de53bcbeb","src/binary_reader.rs":"e523ef680480c5a106e0238b1fa4eb77ecaabc2652b65d5dc0f683ee0eed66d7","src/lib.rs":"bc786f619be99366d838c8837416c9008fa15beb873395e8b9ab98579a6b1c18","src/limits.rs":"4e4f9b7ed1d26e7a6727e36b136015cd9f4e38f596b3c8f82236789f45905cae","src/operators_validator.rs":"be295f7529ba863884a10d3236ee3e39c2b4b138ae5a1343b15612a367cd99ca","src/parser.rs":"9b1ab93de63117cfc43900cc99c9912dcd307b347ca982eb4e307331edab4ca2","src/primitives.rs":"9f1417b9dba839c548d9afd94488be7c1d179d243cfeca4f8b10c9805995af62","src/readers/code_section.rs":"2034c399b76428ac993c22f551f3c541b132d8b4ccc74e34f0043e25534d107b","src/readers/data_count_section.rs":"27ef37517b6beac21245008b14b5416b851c52d0af8e2ae85c1456674e1c9a9e","src/readers/data_section.rs":"e7e2a539d2d3049d4a8f68df9ea2f21d97e7061657bbd91845e1df3e9c1f2ebc","src/readers/element_section.rs":"e31e1d819c0b10acf58b8975238554245defe36db1c3206683b056c52978fb21","src/readers/export_section.rs":"7c74f7a11406a95c162f6ad4f77aafd0b1eee309f33b69f06bea12b23925e143","src/readers/function_section.rs":"57c0479ba8d7f61908ed74e86cbc26553fdd6d2d952f032ce29385a39f82efd3","src/readers/global_section.rs":"5fa18bed0fffadcc2dbdcbaedbe4e4398992fd1ce9e611b0319333a7681082ac","src/readers/import_section.rs":"1db4bf7290d04783d5cf526050d025b15a1daaf2bd97fca1a92ecb873d48f641","src/readers/init_expr.rs":"7020c80013dad4518a5f969c3ab4d624b46d778f03e632871cf343964f63441c","src/readers/linking_section.rs":"9df71f3ee5356f0d273c099212213353080001e261ca697caddf6b847fb5af09","src/readers/memory_section.rs":"83212f86cfc40d18fb392e9234c880afdf443f4af38a727ba346f9c740ef8718","src/readers/mod.rs":"13822fff4190b72f6ae14e29635d2c148a38ee972e148eb99a4688b0309bc2c9","src/readers/module.rs":"66473e7077b3d77ed01ed58d2796c8de7afdb2b90f2b0669c06fa90ca1b3434e","src/readers/name_section.rs":"297f57393d5fef745ec265438108aa6eb7ed2762c03c3beb539493612442f3da","src/readers/operators.rs":"da43ee8afcb0c1d6e7f1e19e8a10143101f0c598b1e533a394c7397f43881a82","src/readers/producers_section.rs":"674f402fc4545c94487f827153871b37adab44ed5eff4070a436eb18e514023a","src/readers/reloc_section.rs":"0ef818a8b83a4542c4c29c23642436a92d3e7c37bc0248e817ed5a9d65ec38ce","src/readers/section_reader.rs":"3d2260449fa0455d710ba6d97810372ec36cba70722c10dd236c3a18ca0eb56f","src/readers/sourcemappingurl_section.rs":"ababe84d51e4817ad19f827aa2b5239578e7f202e5ec06dd688b618885138434","src/readers/start_section.rs":"3eeae00e1aa0fcb2e0d93b7b0eaac30a60d3f1431c71c589cd3f73adb363d532","src/readers/table_section.rs":"e564876825a7b31df2b5dc850279b523e26dc50a08da935cc8d635a49e809951","src/readers/type_section.rs":"2fa33a7b793f3bfa01c259b5dbc38633b7343931886ab41f0cb96dd78db3bf6e","src/tests.rs":"927ed18fc70cf340a02b3e2f7f535a062003fcc3d6f66857093c431b88054dd3","src/validator.rs":"592db08da9b2f6a6cd658faac06d737434de98a09fd8bdc125e7a3c7f003d008","test-all.sh":"ff894f4e5e34389ad6ef697bd4ade28a2483dd456eabba8b757945546568f4c9","test-no_std.sh":"f8bc939b378fe618b7ec6297152708e7c8740858eb94e5756464934a38796b8c"},"package":"8a6f324afc05fd8282bbc49dae854a1c20f74aeff10a575b5a43453d1864db97"}
|
|
@ -3,7 +3,7 @@
|
|||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
# to registry (e.g., crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
|
@ -12,16 +12,22 @@
|
|||
|
||||
[package]
|
||||
name = "wasmparser"
|
||||
version = "0.29.2"
|
||||
version = "0.31.1"
|
||||
authors = ["Yury Delendik <ydelendik@mozilla.com>"]
|
||||
exclude = ["fuzz/**/*", "tests/**/*"]
|
||||
description = "A simple event-driven library for parsing WebAssembly binary files.\n"
|
||||
keywords = ["parser", "WebAssembly", "wasm"]
|
||||
license = "Apache-2.0 WITH LLVM-exception"
|
||||
repository = "https://github.com/yurydelendik/wasmparser.rs"
|
||||
|
||||
[[bench]]
|
||||
name = "benchmark"
|
||||
harness = false
|
||||
[dependencies.hashmap_core]
|
||||
version = "0.1.9"
|
||||
version = "0.1.10"
|
||||
optional = true
|
||||
[dev-dependencies.criterion]
|
||||
version = "0.2"
|
||||
|
||||
[features]
|
||||
core = ["hashmap_core"]
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
pub fn read_file_data(path: &PathBuf) -> Vec<u8> {
|
||||
let mut data = Vec::new();
|
||||
let mut f = File::open(path).ok().unwrap();
|
||||
f.read_to_end(&mut data).unwrap();
|
||||
data
|
||||
}
|
||||
|
||||
const VALIDATOR_CONFIG: Option<ValidatingParserConfig> = Some(ValidatingParserConfig {
|
||||
operator_config: OperatorValidatorConfig {
|
||||
enable_threads: true,
|
||||
enable_reference_types: true,
|
||||
enable_simd: true,
|
||||
enable_bulk_memory: true,
|
||||
},
|
||||
mutable_global_imports: true,
|
||||
});
|
||||
|
||||
#[macro_use]
|
||||
extern crate criterion;
|
||||
extern crate wasmparser;
|
||||
|
||||
use criterion::Criterion;
|
||||
use wasmparser::{
|
||||
validate, OperatorValidatorConfig, Parser, ParserState, ValidatingParser,
|
||||
ValidatingParserConfig, WasmDecoder,
|
||||
};
|
||||
|
||||
use std::fs::{read_dir, File};
|
||||
use std::io::Read;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn read_all_wasm<'a, T>(mut d: T)
|
||||
where
|
||||
T: WasmDecoder<'a>,
|
||||
{
|
||||
loop {
|
||||
match *d.read() {
|
||||
ParserState::Error(e) => panic!("unexpected error {:?}", e),
|
||||
ParserState::EndWasm => return,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn it_works_benchmark(c: &mut Criterion) {
|
||||
let mut data: Vec<Vec<u8>> = vec![];
|
||||
for entry in read_dir("tests").unwrap() {
|
||||
let dir = entry.unwrap();
|
||||
if !dir.file_type().unwrap().is_file() {
|
||||
continue;
|
||||
}
|
||||
data.push(read_file_data(&dir.path()));
|
||||
}
|
||||
c.bench_function("it works benchmark", move |b| {
|
||||
for d in &mut data {
|
||||
b.iter(|| read_all_wasm(Parser::new(d.as_slice())));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn validator_not_fails_benchmark(c: &mut Criterion) {
|
||||
let mut data: Vec<Vec<u8>> = vec![];
|
||||
for entry in read_dir("tests").unwrap() {
|
||||
let dir = entry.unwrap();
|
||||
if !dir.file_type().unwrap().is_file() {
|
||||
continue;
|
||||
}
|
||||
data.push(read_file_data(&dir.path()));
|
||||
}
|
||||
c.bench_function("validator no fails benchmark", move |b| {
|
||||
for d in &mut data {
|
||||
b.iter(|| read_all_wasm(ValidatingParser::new(d.as_slice(), VALIDATOR_CONFIG)));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn validate_benchmark(c: &mut Criterion) {
|
||||
let mut data: Vec<Vec<u8>> = vec![vec![]];
|
||||
for entry in read_dir("tests").unwrap() {
|
||||
let dir = entry.unwrap();
|
||||
if !dir.file_type().unwrap().is_file() {
|
||||
continue;
|
||||
}
|
||||
data.push(read_file_data(&dir.path()));
|
||||
}
|
||||
c.bench_function("validate benchmark", move |b| {
|
||||
for d in &mut data {
|
||||
b.iter(|| validate(&d, VALIDATOR_CONFIG));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(
|
||||
benchmark,
|
||||
it_works_benchmark,
|
||||
validator_not_fails_benchmark,
|
||||
validate_benchmark
|
||||
);
|
||||
criterion_main!(benchmark);
|
|
@ -0,0 +1,12 @@
|
|||
#/bin/bash
|
||||
|
||||
# record current bench results
|
||||
cargo bench --bench benchmark -- --noplot --save-baseline after
|
||||
|
||||
# switch to master and record its bench results
|
||||
git checkout master && \
|
||||
cargo bench --bench benchmark -- --noplot --save-baseline before
|
||||
|
||||
# compare
|
||||
cargo install critcmp --force && \
|
||||
critcmp before after
|
|
@ -19,6 +19,7 @@ fn main() {
|
|||
let buf: Vec<u8> = read_wasm(&args[1]).unwrap();
|
||||
let mut parser = Parser::new(&buf);
|
||||
loop {
|
||||
print!("0x{:08x}\t", parser.current_position());
|
||||
let state = parser.read();
|
||||
match *state {
|
||||
ParserState::ExportSectionEntry {
|
||||
|
|
|
@ -25,7 +25,7 @@ use limits::{
|
|||
use primitives::{
|
||||
BinaryReaderError, BrTable, CustomSectionKind, ExternalKind, FuncType, GlobalType, Ieee32,
|
||||
Ieee64, LinkingType, MemoryImmediate, MemoryType, NameType, Operator, RelocType,
|
||||
ResizableLimits, Result, SIMDLineIndex, SectionCode, TableType, Type, V128,
|
||||
ResizableLimits, Result, SIMDLineIndex, SectionCode, TableType, Type, TypeOrFuncType, V128,
|
||||
};
|
||||
|
||||
const MAX_WASM_BR_TABLE_SIZE: usize = MAX_WASM_FUNCTION_SIZE;
|
||||
|
@ -249,7 +249,7 @@ impl<'a> BinaryReader<'a> {
|
|||
let returns_len = self.read_var_u32()? as usize;
|
||||
if returns_len > MAX_WASM_FUNCTION_RETURNS {
|
||||
return Err(BinaryReaderError {
|
||||
message: "function params size is out of bound",
|
||||
message: "function returns size is out of bound",
|
||||
offset: self.original_position() - 1,
|
||||
});
|
||||
}
|
||||
|
@ -517,6 +517,23 @@ impl<'a> BinaryReader<'a> {
|
|||
Ok((result << ashift) >> ashift)
|
||||
}
|
||||
|
||||
pub fn read_var_s33(&mut self) -> Result<i64> {
|
||||
// Note: this is not quite spec compliant, in that it doesn't enforce
|
||||
// that the number is encoded in ceil(N / 7) bytes. We should make a
|
||||
// generic-over-N decoding function and replace all the various
|
||||
// `read_var_{i,s}NN` methods with calls to instantiations of that.
|
||||
|
||||
let n = self.read_var_i64()?;
|
||||
if n > (1 << 33 - 1) {
|
||||
Err(BinaryReaderError {
|
||||
message: "Invalid var_s33",
|
||||
offset: self.original_position() - 1,
|
||||
})
|
||||
} else {
|
||||
Ok(n)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_var_i64(&mut self) -> Result<i64> {
|
||||
let mut result: i64 = 0;
|
||||
let mut shift = 0;
|
||||
|
@ -790,19 +807,36 @@ impl<'a> BinaryReader<'a> {
|
|||
})
|
||||
}
|
||||
|
||||
fn read_blocktype(&mut self) -> Result<TypeOrFuncType> {
|
||||
let position = self.position;
|
||||
if let Ok(ty) = self.read_type() {
|
||||
Ok(TypeOrFuncType::Type(ty))
|
||||
} else {
|
||||
self.position = position;
|
||||
let idx = self.read_var_s33()?;
|
||||
if idx < 0 || idx > (::std::u32::MAX as i64) {
|
||||
return Err(BinaryReaderError {
|
||||
message: "invalid function type",
|
||||
offset: position,
|
||||
});
|
||||
}
|
||||
Ok(TypeOrFuncType::FuncType(idx as u32))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_operator(&mut self) -> Result<Operator<'a>> {
|
||||
let code = self.read_u8()? as u8;
|
||||
Ok(match code {
|
||||
0x00 => Operator::Unreachable,
|
||||
0x01 => Operator::Nop,
|
||||
0x02 => Operator::Block {
|
||||
ty: self.read_type()?,
|
||||
ty: self.read_blocktype()?,
|
||||
},
|
||||
0x03 => Operator::Loop {
|
||||
ty: self.read_type()?,
|
||||
ty: self.read_blocktype()?,
|
||||
},
|
||||
0x04 => Operator::If {
|
||||
ty: self.read_type()?,
|
||||
ty: self.read_blocktype()?,
|
||||
},
|
||||
0x05 => Operator::Else,
|
||||
0x0b => Operator::End,
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
//! a data-structure using this library.
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
extern crate hashmap_core;
|
||||
|
@ -66,14 +65,17 @@ pub use primitives::Result;
|
|||
pub use primitives::SectionCode;
|
||||
pub use primitives::TableType;
|
||||
pub use primitives::Type;
|
||||
pub use primitives::TypeOrFuncType;
|
||||
pub use primitives::V128;
|
||||
|
||||
pub use validator::validate;
|
||||
pub use validator::OperatorValidatorConfig;
|
||||
pub use validator::validate_function_body;
|
||||
pub use validator::ValidatingOperatorParser;
|
||||
pub use validator::ValidatingParser;
|
||||
pub use validator::ValidatingParserConfig;
|
||||
pub use validator::WasmModuleResources;
|
||||
|
||||
pub use operators_validator::OperatorValidatorConfig;
|
||||
pub use operators_validator::WasmModuleResources;
|
||||
|
||||
pub use readers::CodeSectionReader;
|
||||
pub use readers::Data;
|
||||
|
@ -116,6 +118,7 @@ pub use readers::TypeSectionReader;
|
|||
|
||||
mod binary_reader;
|
||||
mod limits;
|
||||
mod operators_validator;
|
||||
mod parser;
|
||||
mod primitives;
|
||||
mod readers;
|
||||
|
@ -124,7 +127,7 @@ mod validator;
|
|||
|
||||
#[cfg(not(feature = "std"))]
|
||||
mod std {
|
||||
pub use alloc::{boxed, vec};
|
||||
pub use alloc::{boxed, string, vec};
|
||||
pub use core::*;
|
||||
pub mod collections {
|
||||
pub use hashmap_core::HashSet;
|
||||
|
|
|
@ -27,8 +27,7 @@ pub const _MAX_WASM_MODULE_SIZE: usize = 1024 * 1024 * 1024; //= 1 GiB
|
|||
pub const MAX_WASM_FUNCTION_SIZE: usize = 128 * 1024;
|
||||
pub const MAX_WASM_FUNCTION_LOCALS: usize = 50000;
|
||||
pub const MAX_WASM_FUNCTION_PARAMS: usize = 1000;
|
||||
pub const _MAX_WASM_FUNCTION_MULTI_RETURNS: usize = 1000;
|
||||
pub const MAX_WASM_FUNCTION_RETURNS: usize = 1;
|
||||
pub const MAX_WASM_FUNCTION_RETURNS: usize = 1000;
|
||||
pub const _MAX_WASM_TABLE_SIZE: usize = 10000000;
|
||||
pub const MAX_WASM_TABLE_ENTRIES: usize = 10000000;
|
||||
pub const MAX_WASM_TABLES: usize = 1;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -269,8 +269,12 @@ impl<'a> Parser<'a> {
|
|||
.original_position();
|
||||
}
|
||||
match self.section_reader {
|
||||
ParserSectionReader::CodeSectionReader(ref reader) => return reader.original_position(),
|
||||
ParserSectionReader::DataSectionReader(ref reader) => return reader.original_position(),
|
||||
ParserSectionReader::CodeSectionReader(ref reader) => {
|
||||
return reader.original_position()
|
||||
}
|
||||
ParserSectionReader::DataSectionReader(ref reader) => {
|
||||
return reader.original_position()
|
||||
}
|
||||
ParserSectionReader::ElementSectionReader(ref reader) => {
|
||||
return reader.original_position();
|
||||
}
|
||||
|
@ -292,8 +296,12 @@ impl<'a> Parser<'a> {
|
|||
ParserSectionReader::TableSectionReader(ref reader) => {
|
||||
return reader.original_position();
|
||||
}
|
||||
ParserSectionReader::TypeSectionReader(ref reader) => return reader.original_position(),
|
||||
ParserSectionReader::NameSectionReader(ref reader) => return reader.original_position(),
|
||||
ParserSectionReader::TypeSectionReader(ref reader) => {
|
||||
return reader.original_position()
|
||||
}
|
||||
ParserSectionReader::NameSectionReader(ref reader) => {
|
||||
return reader.original_position()
|
||||
}
|
||||
ParserSectionReader::LinkingSectionReader(ref reader) => {
|
||||
return reader.original_position();
|
||||
}
|
||||
|
|
|
@ -14,10 +14,12 @@
|
|||
*/
|
||||
|
||||
use std::boxed::Box;
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
use std::result;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use std::error::Error;
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct BinaryReaderError {
|
||||
pub message: &'static str,
|
||||
|
@ -26,6 +28,7 @@ pub struct BinaryReaderError {
|
|||
|
||||
pub type Result<T> = result::Result<T, BinaryReaderError>;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl Error for BinaryReaderError {}
|
||||
|
||||
impl fmt::Display for BinaryReaderError {
|
||||
|
@ -46,7 +49,7 @@ pub enum CustomSectionKind {
|
|||
|
||||
/// Section code as defined [here].
|
||||
///
|
||||
/// [here]: https://webassembly.github.io/spec/binary/modules.html#sections
|
||||
/// [here]: https://webassembly.github.io/spec/core/binary/modules.html#sections
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum SectionCode<'a> {
|
||||
Custom {
|
||||
|
@ -69,7 +72,7 @@ pub enum SectionCode<'a> {
|
|||
|
||||
/// Types as defined [here].
|
||||
///
|
||||
/// [here]: https://webassembly.github.io/spec/syntax/types.html#types
|
||||
/// [here]: https://webassembly.github.io/spec/core/syntax/types.html#types
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum Type {
|
||||
I32,
|
||||
|
@ -83,9 +86,22 @@ pub enum Type {
|
|||
EmptyBlockType,
|
||||
}
|
||||
|
||||
/// Either a value type or a function type.
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum TypeOrFuncType {
|
||||
/// A value type.
|
||||
///
|
||||
/// When used as the type for a block, this type is the optional result
|
||||
/// type: `[] -> [t?]`.
|
||||
Type(Type),
|
||||
|
||||
/// A function type (referenced as an index into the types section).
|
||||
FuncType(u32),
|
||||
}
|
||||
|
||||
/// External types as defined [here].
|
||||
///
|
||||
/// [here]: https://webassembly.github.io/spec/syntax/types.html#external-types
|
||||
/// [here]: https://webassembly.github.io/spec/core/syntax/types.html#external-types
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub enum ExternalKind {
|
||||
Function,
|
||||
|
@ -215,14 +231,14 @@ pub type SIMDLineIndex = u8;
|
|||
|
||||
/// Instructions as defined [here].
|
||||
///
|
||||
/// [here]: https://webassembly.github.io/spec/binary/instructions.html
|
||||
/// [here]: https://webassembly.github.io/spec/core/binary/instructions.html
|
||||
#[derive(Debug)]
|
||||
pub enum Operator<'a> {
|
||||
Unreachable,
|
||||
Nop,
|
||||
Block { ty: Type },
|
||||
Loop { ty: Type },
|
||||
If { ty: Type },
|
||||
Block { ty: TypeOrFuncType },
|
||||
Loop { ty: TypeOrFuncType },
|
||||
If { ty: TypeOrFuncType },
|
||||
Else,
|
||||
End,
|
||||
Br { relative_depth: u32 },
|
||||
|
|
|
@ -16,12 +16,13 @@
|
|||
#[cfg(feature = "std")]
|
||||
#[cfg(test)]
|
||||
mod simple_tests {
|
||||
use operators_validator::OperatorValidatorConfig;
|
||||
use parser::{Parser, ParserInput, ParserState, WasmDecoder};
|
||||
use primitives::{Operator, SectionCode};
|
||||
use std::fs::{read_dir, File};
|
||||
use std::io::prelude::*;
|
||||
use std::path::PathBuf;
|
||||
use validator::{OperatorValidatorConfig, ValidatingParser, ValidatingParserConfig};
|
||||
use validator::{ValidatingParser, ValidatingParserConfig};
|
||||
|
||||
const VALIDATOR_CONFIG: Option<ValidatingParserConfig> = Some(ValidatingParserConfig {
|
||||
operator_config: OperatorValidatorConfig {
|
||||
|
@ -29,6 +30,7 @@ mod simple_tests {
|
|||
enable_reference_types: true,
|
||||
enable_simd: true,
|
||||
enable_bulk_memory: true,
|
||||
enable_multi_value: true,
|
||||
},
|
||||
mutable_global_imports: true,
|
||||
});
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче