Commit Graph

469 Commits

Author SHA1 Message Date
jmkrauz
ae6ba1e58c Fix narrow_icmp_imm (#1343) 2020-01-21 15:20:44 +01:00
Andrew Brown
fd04ea2b06 Fix incorrect assertion for insertlane (#1355)
Previously, the assertion checked for `lane > 0` when it should have been `lane >= 0`; since lane is unsigned, this half of the assertion can be entirely removed.
2020-01-17 14:39:31 -08:00
Dan Gohman
80d11e3f8d Bump version to 0.56.0 (#1356) 2020-01-17 14:33:52 -08:00
Alex Crichton
1266b68f9a Use is_wasm_parameter in translating wasm calls (#1352)
* Use `is_wasm_parameter` in translating wasm calls

Added in #1329 it's now possible for multiple parameters to be non-wasm
parameters, so the previous `param_types` method is no longer suitable
for acquiring all wasm-related parameters, rather then `FuncEnvironment`
must be consulted. This removes usage of `param_types()` as a method
from the wasm translation and instead adds a custom method inline for
filtering the parameters based on `is_wasm_parameter`.

* Apply feedback

* Run rustfmt

* Don't require `mut`

* Run rustfmt
2020-01-17 12:11:54 -08:00
Andrew Brown
e1d513ab4b Fix remaining clippy warnings (#1340)
* clippy: allow complex encoding function

* clippy: remove unnecessary main() function in doctest

* clippy: remove redundant `Type` suffix on LaneType enum variants

* clippy: ignore incorrect debug_assert_with_mut_call warning

* clippy: fix FDE clippy warnings
2020-01-17 14:03:30 -06:00
Dan Gohman
b00a181824 Bump version to 0.55.0 (#1345) 2020-01-14 13:04:11 -08:00
Dan Gohman
1d504ecf6d Correctly count the number of wasm parameters. (#1337)
* Correctly count the number of wasm parameters.

Following up on #1329, this further replaces `num_normal_params` with a function
which calls `is_wasm_parameter` to correctly count the number of wasm
parameters a function has.

* Move is_wasm_parameter's implementation into the trait.
2020-01-14 11:42:22 -08:00
Benjamin Bouvier
dd497c19e1 Renames Settings ⚠️ (fixes #976) (#1321)
This is a breaking API change: the following settings have been renamed:

- jump_tables_enabled -> enable_jump_tables
- colocated_libcalls -> use_colocated_libcalls
- probestack_enabled -> enable_probestack
- allones_funcaddrs -> emit_all_ones_funcaddrs
2020-01-13 14:42:49 -07:00
Yury Delendik
bd88155483 Refactor unwind; add FDE support. (#1320)
* Refactor unwind

* add FDE support

* use sink directly in emit functions

* pref off all unwinding generation with feature
2020-01-13 10:32:55 -06: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
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
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
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
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
Benjamin Bouvier
ac8a952a6b Bump version to 0.52.0 2019-12-18 12:37:08 +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
Andrew Brown
d4df756acf Remove packed_struct dependency; closes #1271 and #1284 (#1282) 2019-12-12 17:01:31 -08:00
llogiq
0d8f8bc71f Fix some clippy warnings (#1277) 2019-12-07 09:47:43 -08: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
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
data-pup
dbdeb788f0 Fix jump table comment grammar (#1259) 2019-11-27 18:41:37 -05: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
iximeow
d804ab8b92 Track frame layout changes. (#1204)
* Track frame layout changes.
2019-11-18 10:18:38 -08:00
Andrew Brown
91d29c09d0 Add x86 SIMD floating-point absolute value 2019-11-15 13:45:25 -08:00
Andrew Brown
1f17e35e95 Add x86 SIMD immediate shifts 2019-11-15 13:45:25 -08:00
Andrew Brown
6519a43b08 Add x86 SIMD floating-point negation 2019-11-15 13:45:25 -08:00
krk
f7c7245b06 Add legalization for popcnt.i128 via narrowing, fixes #1116 2019-11-15 14:03:49 +01:00
Benjamin Bouvier
569a57fa7d Hoist the stack alignment and Windows64 fastcall shadow stack space constants. 2019-11-15 13:58:47 +01:00
Sean Stangl
f8ae622003 Use a struct interface for creating and reading encoding bits on x86. #1156 (#1212) 2019-11-13 18:01:13 -07:00
Andrew Brown
215884e907 Simplify variable name: change inst_ to inst 2019-11-12 17:05:39 -08:00
Andrew Brown
c8eb4e9612 Add x86 SIMD floating-point arithmetic 2019-11-12 17:05:39 -08:00
Andrew Brown
04db2a9f39 Bind constant vectors to vconst; fixes #1052 (#1217) 2019-11-12 15:57:59 -08:00
Benjamin Bouvier
9080a02e10 Replace CraneStation by bytecodealliance everywhere; (#1221) 2019-11-12 10:09:31 -08:00
Andrew Brown
d32301854d Add x86 SIMD implementation of float comparison 2019-11-08 14:06:53 -08:00
Nick Fitzgerald
7e32fa2731 Try and assign directly to return registers; backtrack to use struct-return param (#1213)
* Try and assign directly to return registers; backtrack to use struct-return param

Rather than trying to count number of return registers that would be used by a
given set of return values, optimistically assign the return values to
registers. If we later find that we can't fit them all in registers, then
backtrack and introduce the use of a struct-return pointer parameter.

* Rename `rets2` and wrap it in an option so we avoid the clone for non-multi-value
2019-11-08 09:51:57 -08:00