Commit Graph

1543 Commits

Author SHA1 Message Date
Dan Gohman
2d9b902d2e Clean up a redundant cast. 2017-08-31 14:35:19 -07:00
Dan Gohman
7be0abb442 Remove an unneeded extern crate. 2017-08-31 14:31:45 -07:00
Dan Gohman
0cacba15b9 Replace as casts with type-conversion functions.
https://github.com/rust-lang-nursery/rust-clippy/wiki#cast_lossless
2017-08-31 14:31:23 -07:00
Dan Gohman
af74cdf364 Cretonne's top-level tools don't need to directly depend on wasmparser. 2017-08-31 13:40:35 -07:00
Dan Gohman
dc79d155ff Comment wording cleanups. 2017-08-31 12:47:05 -07:00
Dan Gohman
bc528917fd Avoid redundant '@ _' in match patterns.
https://github.com/rust-lang-nursery/rust-clippy/wiki#redundant_pattern
2017-08-31 12:47:05 -07:00
Dan Gohman
ebbb836bb9 Use debug_assert_eq rather than debug_assert with an ==. 2017-08-31 12:47:05 -07:00
Dan Gohman
3c5755cfbd Avoid unneeded return keywords. 2017-08-31 12:47:05 -07:00
Dan Gohman
a7d629c368 Use the Self keyword where applicable.
https://github.com/rust-lang-nursery/rust-clippy/wiki#use_self
2017-08-31 12:47:05 -07:00
Dan Gohman
99b361567a Remove unneeded mut keywords. 2017-08-31 12:47:05 -07:00
Dan Gohman
55ae51acfe Add an underscore between a literal value and its suffix.
https://github.com/rust-lang-nursery/rust-clippy/wiki#unseparated_literal_suffix
2017-08-31 12:47:05 -07:00
Dan Gohman
da2c2151b1 Fix trivial_numeric_casts errors. 2017-08-31 12:47:05 -07:00
Dan Gohman
9726bb7367 Avoid matching with reference patterns.
https://github.com/rust-lang-nursery/rust-clippy/wiki#match_ref_pats
2017-08-31 12:47:05 -07:00
Dan Gohman
5a8d1a9fda Use if let instead of match.
https://github.com/rust-lang-nursery/rust-clippy/wiki#single_match
2017-08-31 12:47:05 -07:00
Dan Gohman
574031e4d2 Avoid unneeded passing by value.
https://github.com/rust-lang-nursery/rust-clippy/wiki#needless_pass_by_value
2017-08-31 12:47:05 -07:00
Dan Gohman
b6641ff443 Avoid clone() on a Copy type.
https://github.com/rust-lang-nursery/rust-clippy/wiki#clone_on_copy
2017-08-31 12:47:05 -07:00
Dan Gohman
105998944e Avoid redundant borrows.
https://github.com/rust-lang-nursery/rust-clippy/wiki#needless_borrow
2017-08-31 12:47:05 -07:00
Dan Gohman
9a8f01b832 Avoid unnecessary '&' in matches.
https://github.com/rust-lang-nursery/rust-clippy/wiki#match_ref_pats
2017-08-31 12:47:05 -07:00
Dan Gohman
acf4f1009b Eliminate redundant uses of format!.
https://github.com/rust-lang-nursery/rust-clippy/wiki#useless_format
2017-08-31 12:47:05 -07:00
Dan Gohman
abbc6ddf24 Use is_empty() instead of comparing len() with 0.
https://github.com/rust-lang-nursery/rust-clippy/wiki#len_zero
2017-08-31 12:47:05 -07:00
Dan Gohman
adfdd77311 Avoid creating a reference to a reference.
https://github.com/rust-lang-nursery/rust-clippy/wiki#needless_borrow
2017-08-31 12:47:05 -07:00
Dan Gohman
b411d01d6d Use [] instead of .get().unwrap().
https://github.com/rust-lang-nursery/rust-clippy/wiki#get_unwrap
2017-08-31 12:47:05 -07:00
Dan Gohman
2efdc0ed37 Update rustfmt to 0.9.0. 2017-08-31 10:44:59 -07:00
Dan Gohman
46fb64cbb4 Add SideEffects::new(). 2017-08-31 10:28:56 -07:00
Dan Gohman
52186b8390 Refactor code for obtaining the header block. 2017-08-31 10:28:56 -07:00
Dan Gohman
fc374b6c06 Test that stack layout with an unsupported offset is rejected cleanly. 2017-08-31 08:54:50 -07:00
Dan Gohman
bd0590604d Test dfg's next_inst(). 2017-08-31 08:54:50 -07:00
Dan Gohman
4c3ac6053f Test the error case of condcode parsing. 2017-08-31 08:54:50 -07:00
Dan Gohman
6702221e94 Change EbbHeaderBlockData's predecessors list from a HashMap to a Vec. (#148)
In addition to efficiency, this change also eliminates some nondeterminsm
resulting from HashMap key ordering.
2017-08-31 08:54:34 -07:00
Dan Gohman
a0a3401ef1 Don't special-case br_table with an empty table.
Empty br_table tables are very uncommon (they're easy for wasm producers to
optimize away), so we don't need to special-case them.
2017-08-30 15:05:00 -07:00
Dan Gohman
4ccd21ba94 Simplify iteration. 2017-08-30 15:04:53 -07:00
Dan Gohman
110697cfdd Replace match blocks with .expect calls. 2017-08-30 14:53:49 -07:00
Dan Gohman
5e99a4fb6a Simplify a pattern-match. 2017-08-30 14:53:39 -07:00
Dan Gohman
0cc8bd06cd Remove unnecessary () values. 2017-08-30 14:53:34 -07:00
Dan Gohman
8647b10135 Loop over references to containers instead of using explicit iteration methods.
https://github.com/rust-lang-nursery/rust-clippy/wiki#explicit_iter_loop
2017-08-30 14:52:17 -07:00
Dan Gohman
03698f6bc8 Use slices rather than Vec borrows.
https://github.com/rust-lang-nursery/rust-clippy/wiki#ptr_arg
2017-08-30 14:48:17 -07:00
Dan Gohman
01744d6f65 Avoid unneeded return keywords. 2017-08-30 14:46:48 -07:00
Dan Gohman
3532c3533a Teach simple_gvn that iconst.i32 is not congruent to iconst.i64. 2017-08-30 14:33:54 -07:00
Dan Gohman
9ea5226b89 Add simple_gvn to the optimization pipeline for WebAssembly functions. 2017-08-30 14:32:42 -07:00
Dan Gohman
dcb65b59c1 Remove an unnecessary mut, fixing a compiler warning. 2017-08-30 09:10:08 -07:00
Dan Gohman
b2fcb1ad17 Change translate_module to use a slice rather than a borrowed Vec.
This makes it more convenient to call from a cargo-fuzz fuzzer.
2017-08-30 09:10:08 -07:00
Dan Gohman
5303e7708b Handle wasmparser errors gracefully. 2017-08-30 09:10:08 -07:00
Jakob Stoklund Olesen
0deaa616a3 Record identity assignments in regalloc constraint solver.
Fixes #147.

The Solver::reassign_in() method would previously not record fixed
register assignments for values that are already in the correct
register. The register would simply be marked as unavailable for the
solver.

This did have the effect of tripping up the sanity checks in
Solver::add_var() when that method was called with such a "reassigned"
value. The function can be called for a value that already has a fixed
assignment, but the sanity checks want to make sure the variable
constraints are compatible with the existing fixed assignment. When no
such assignment could be found, the method panicked.

To fix this, make sure that even identity reassignments are recorded
in the assignments vector. Instead, filter the identity assignments out
before scheduling a move sequence for the assignments.

Also add some debug tracing to the regalloc solver.
2017-08-29 10:45:33 -07:00
Dan Gohman
c380df1d04 Eliminate a heap allocation. 2017-08-29 05:44:40 -07:00
Dan Gohman
4afa5df3b6 Remove the last_inst_return field.
It's not necessary to explicitly track whether the last instruction is a
return; if the builder for the last block isn't filled by the time we reach
the end, it needs a return to fill it.
2017-08-29 05:09:25 -07:00
Dan Gohman
ea1d053831 Simplify the "am I in unreachable code" predicate.
The phantom unreachable stack is only used when the real unreachable stack is
active, so it's sufficient to check whether the real unreachable stack is empty.
2017-08-29 03:36:38 -07:00
Dan Gohman
c71d4fc01b Remove a stale comment. 2017-08-29 03:30:22 -07:00
Dan Gohman
253f602a4c Fix a few warnings. 2017-08-28 17:17:41 -07:00
Dan Gohman
f905dc914b Enable missing_docs errors in the wasm crate.
This adds `#![deny(missing_docs)]` to the wasm crate, and adds documentation
to several struct and enum fields, as needed.
2017-08-28 17:07:28 -07:00
Denis Merigoux
ee9989c4b9 Dumped code from the wasm2cretonne repo.
Integrated wasm test suite translation as cretonne test

Fixes #146.
Fixes #143.
2017-08-28 15:57:43 -07:00