Commit Graph

1762 Commits

Author SHA1 Message Date
Alex Crichton
3a13f79b66 Try to reduce CI times with a Rust *.wat parser (#1332)
This commit moves the cranelift tests and tools from the `wabt` crate on
crates.io (which compiles the wabt C++ codebase) to the `wat` crate on
crates.io which is a Rust parser for the `*.wat` format. This was
motivated by me noticing that release builds on Windows are ~5 minutes
longer than Linux builds, and local timing graphs showed that `wabt-sys`
was by far the longest build step in the build process.

This commit changes the `clif-util` binary where the `--enable-simd`
flag is no longer respected with the text format as input, since the
`wat` crate has no feature gating. This was already sort of not
respected, though, since `--enable-simd` wasn't consulted for binary
inputs which `clif-util` supports as well. If this isn't ok though then
it should be ok to close this PR!
2020-01-10 14:32:16 -08:00
Dan Gohman
582e7942f8 Bump version to 0.54.0 (#1333) 2020-01-10 14:08:07 -08:00
data-pup
250ea0e5db Verify that EBBs are non-empty (#1330)
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2020-01-10 10:40:27 -08:00
Andrew Brown
c7b0d49550 Fix V128AndNot type mapping (#1319)
Prior to this fix, `type_of` could not determine the Cranelift type for the parameters to `V128AndNot`.
2020-01-10 08:41:11 -08:00
Andrew Brown
e8c3302bc5 Fix some additional clippy warnings 2020-01-10 08:38:40 -08:00
Andrew Brown
71914c7668 Fix clippy warnings in EncodingBits 2020-01-10 08:38:40 -08:00
Dan Gohman
d765677fcc Add a is_wasm_parameter method to the wasm FuncEnvironment. (#1329)
This provides a more flexible way to allow embedding to tell
cranelift-wasm which function parameters are hidden, and which should be
translated as wasm user variables.

This replaces https://github.com/bytecodealliance/cranelift/pull/1086.
2020-01-10 04:40:25 -08:00
Philip Craig
43f1e05156 Update target-lexicon to 0.10 2020-01-10 11:30:12 +01:00
Alex Crichton
04d233301c Require the Send trait for TargetIsa
The `TargetIsa` trait already requires that the implementor is `Sync` to
be shared across threads, and this commit adds in an additional
restriction of `Send` to ensure that the type can be sent-by-value
across threads as well.

This is part of an effort to make various data structures in `wasmtime`
sendable/shareable across threads.
2020-01-08 19:07:47 +01:00
Benjamin Bouvier
3a4b1cc989 Split define encodings + start splitting instruction definitions (#1322)
* [meta] Split the x86 encodings define function into smaller ones;
* [meta] Start splitting instruction definitions into smaller functions;
2020-01-08 09:38:40 -08:00
Andrew Brown
6fe86bcb61 Fix SIMD float comparison encoding (#1285)
The Intel manual uses `CMPNLT` and `CMPNLE` to denote not-less-than and not-less-than-or-equals. These were translated previously to `FloatCC::GreaterThan` and `FloatCC::GreaterThanOrEqual` but should be correctly translated to `FloatCC::UnorderedOrGreaterThanOrEqual` and `FloatCC::UnorderedOrGreaterThan`. This change adds the necessary legalizations to make use of these new encodings.
2020-01-08 09:28:05 -08:00
C Burgos
8ff6d640d6 Remove unused function and associated tests (#1312)
* Remove unused function and associated tests
* Removed unused imports
2020-01-07 10:09:34 -08:00
Andrew Brown
46e58fbaaa Bitcasting at control flow exits (#1272)
* Bitcast vectors immediately before a return

* Bitcast vectors immediately before a block end

* Use helper function for bitcasting arguments

* Add FuncTranslationState::peekn_mut; allows mutating of peeked values

* Bitcast values in place, avoiding an allocation

Also, retrieves the correct EBB header types for bitcasting on Operator::End.

* Bitcast values of a function with no explicit Wasm return instruction

* Add Signature::return_types method

This eliminates some duplicate code and avoids extra `use`s of `Vec`.

* Add Signature::param_types method; only collect normal parameters in both this and Signature::return_types

* Move normal_args to Signature::num_normal_params method

This matches the organization of the other Signature::num_*_params methods.

* Bitcast values of Operator::Call and Operator::CallIndirect

* Add DataFlowGraph::ebb_param_types

* Bitcast values of Operator::Br and Operator::BrIf

* Bitcast values of Operator::BrTable
2020-01-06 15:33:22 -08:00
bjorn3
9bbe378d41 Fix master tests (#1316)
Co-authored-by: Benjamin Bouvier <public@benj.me>
2020-01-06 14:39:04 +01:00
bjorn3
9fcd561220 Use explicit rex for brz and brnz encodings (#1308)
Fixes #1305. This papers over the problem to prevent crashes while we investigate the cause.
2019-12-21 23:10:36 -07:00
Nick Fitzgerald
c1c55607e1 cranelift-wasm: Check for u32::MAX function indices (#1307)
As an implementation-specific limit, we do not allow the full index space of
`0..=2^32 - 1` because we reserve index `2^32 - 1` for ourselves in
`cranelift-entity`.

Fixes #1306
2019-12-21 13:37:42 -08:00
Sean Stangl
cf9e762f16 Add a DynRex recipe type for x86, decreasing the number of recipes (#1298)
This patch adds a third mode for templates: REX inference is requestable
at template instantiation time. This reduces the number of recipes
by removing rex()/nonrex() redundancy for many instructions.
2019-12-19 15:49:34 -07:00
Andrew Brown
b486289ab8 Translate Wasm's V128AndNot to CLIF's band_not (#1297)
The CLIF is already implemented for x86 SIMD.
2019-12-18 13:50:12 -07:00
Benjamin Bouvier
ac8a952a6b Bump version to 0.52.0 2019-12-18 12:37:08 +01:00
Andrew Brown
887f897c9a Update wasmparser to 0.45.0 (#1295)
Adds many new operators and a few API changes.
2019-12-17 14:07:11 -06:00
Y-Nak
8db7349712 Report when output register annotation is missing (#1289) 2019-12-17 11:28:45 +01:00
Philip Craig
86b66e8ede Fix build failure in cranelift-codegen (#1294)
error[E0425]: cannot find value `ones` in this scope
   --> cranelift-codegen/meta/src/isa/x86/legalize.rs:564:33
    |
564 |                 def!(c = vconst(ones)),
    |                                 ^^^^ not found in this scope
2019-12-16 19:38:09 -08:00
Andrew Brown
4433ad2858 Fix legalization of icmp ugt (#1278)
Previously, the same pattern (pmax + pcmpeq) as `uge` was used but this logic was incorrect for operands with equal values.
2019-12-16 14:14:51 -07:00
Andrew Brown
6181f20326 Fix legalization of SIMD fneg (#1286)
Previously `fsub` was used but this fails when negating -0.0 and +0.0 in the SIMD spec tests; using more instructions, this change uses shifts to create a constant for flipping the most significant bit of each lane with `bxor`.
2019-12-16 10:32:08 -08:00
Andrew Brown
0604ec480c Fix scalar_to_vector: move not wide enough for 64-bit values (#1287)
Previously, the use of `enc_x86_64` emitted two 64-bit mode encodings for `scalar_to_vector.i64`, neither of which contained the REX.W bit telling `MOVD/MOVQ` to move 64 bits of data instead of 32 bits. Now, `scalar_to_vector.i64` will always use a sole 64-bit mode REX.W encoding and `scalar_to_vector` with other widths will have three encodings: a 32-bit mode move, a 64-bit mode move with no REX, and a 64-bit mode move with REX (but not REX.W).
2019-12-16 10:17:08 -08:00
Joshua Nelson
fcb0593796 [module] Finalize definitions for the end-user
Closes https://github.com/bytecodealliance/cranelift/issues/1288 by
calling `module.finalize_definitions` whenever `module.finish` is
called.
2019-12-16 12:44:25 +01:00
Andrew Brown
d4df756acf Remove packed_struct dependency; closes #1271 and #1284 (#1282) 2019-12-12 17:01:31 -08:00
Andrew Brown
af64187ec7 Truncate over-large parameters to splat (#1276)
See https://github.com/WebAssembly/simd/issues/149 for associated discussion on this.
2019-12-12 13:52:26 -08:00
Andrew Brown
396eba5235 Bitcast values incoming to vall_true and vany_true before use in Wasm translation (#1275) 2019-12-09 10:05:47 -08:00
llogiq
0d8f8bc71f Fix some clippy warnings (#1277) 2019-12-07 09:47:43 -08:00
Yury Delendik
2c51341888 Add wasm reference/pointers translation. (#1073) 2019-12-06 17:46:03 -06:00
Ryan Hunt
aabf6559a0 Add hooks for implementing bulk-memory-operations (#1258) 2019-12-06 16:13:53 +01:00
Benjamin Bouvier
81782f8efa Ensure builds are deterministic in CI.
This introduces a script that has a high probability of failing if the
Rust source code generated by the meta crate is not consistent accross
build script runs.

It also adds a new CI job to run it on each push, on a single platform.
2019-12-04 19:57:37 +01:00
bjorn3
4cc0241f37 More i8 legalizations (#1253)
* Legalize stack_{load,store}.i8, fixes #433
* Legalize select.i8, cc: #466
* Legalize brz.i8 and brnz.i8, cc: #1117
2019-12-04 09:16:22 -08:00
Mike Hommey
b342cbdd64 Sort the list of instruction formats by name
This makes opcodes.rs and inst_builders.rs deterministic.
2019-12-04 12:15:48 +01:00
Icy Defiance
31cc184c34 Pin actions/checkout to v1 because v2 doesn't support submodules yet
Fixes error: "The input 'submodules' is not supported in actions/checkout@v2"
2019-12-04 10:15:19 +01:00
Benjamin Bouvier
de7c0dddc6 Fix #1247: Tweak enable_verifier doc comment so it's true 2019-12-04 09:42:55 +01:00
Andrew Brown
3e5f039333 Remove macros from verifier; fixes #1248
This removes `report!`, `fatal!`, and `nonfatal!` from the verifier code and replaces them with methods on `VerifierErrors`. In order to maintain similar ease-of-use, `VerifierError` is expanded with several `From` implementations that convert a tuple to a verifier error.
2019-12-02 14:44:18 -08:00
Andrew Brown
e1e4e0bfc6 Update build badge (#1264) 2019-12-02 21:33:11 +01:00
Joshua Nelson
9775c4be1d publish cranelift-object to crates.io 2019-12-02 15:29:26 +01:00
Joshua Nelson
eac124970c Use a published version of object
This allows publishing `cranelift-object` since it no longer depends on
a git version of a dependency.

See https://github.com/bytecodealliance/cranelift/issues/1254 for
context.
2019-12-02 15:29:26 +01:00
data-pup
dbdeb788f0 Fix jump table comment grammar (#1259) 2019-11-27 18:41:37 -05:00
Joshua Nelson
b9296b792d Derive Debug for FaerieProduct (#1252)
This allows using Result::unwrap_err for `Result`s with FaerieProducts.
2019-11-25 13:46:15 +01:00
krk
bc9f05e5e2 Add legalization for bitrev.i128 via narrowing, fixes #1116 (#1229) 2019-11-22 12:38:04 +01:00
Dan Gohman
b4528beaf5 Bump version to 0.51.0 (#1250) 2019-11-20 22:40:55 -08:00
Andrew Brown
838f2f4646 Merge pull request #1226 from abrown/log-verifier-errors
Log verifier errors
2019-11-20 13:29:53 -08:00
bjorn3
c5e74986e1 Legalize uextend and sextend to 128bit ints 2019-11-19 14:42:21 -08:00
Benjamin Bouvier
0b7e7916bd Fixes #1228: add a link to the contributing.md file from the readme. (#1245) 2019-11-19 13:49:50 +01:00
iximeow
d804ab8b92 Track frame layout changes. (#1204)
* Track frame layout changes.
2019-11-18 10:18:38 -08:00
Andrew Brown
f72a5d9caa Translate WASM floating-point abs and neg to CLIF 2019-11-15 13:45:25 -08:00