Commit Graph

39 Commits

Author SHA1 Message Date
Nathan Froyd
363eea6960 avoid directories for cargo build dependencies
We are facing peculiar Windows-only regressions in build times in
https://bugzilla.mozilla.org/show_bug.cgi?id=1506511 and while the build
times might just be Windows being slow, putting directories in
`rerun-if-changed` might also be causing problems.  The build only
depends on the files, anyway, so let's just say that.
2019-01-22 13:20:55 -08:00
Dan Gohman
aeb9161e2c Update no_std support for Rust 2018 Edition.
With Rust 2018 Edition, the `mod std` trick to alias `core` names to
`std` no longer works, so switch to just having the code use `core`
explicitly.

So instead, switch to just using `core::*` for things that in core.
This is more consistent with other Rust no_std code. And it allows
us to enable `no_std` mode unconditionally in the crates that support
it, which makes testing a little easier.

There actually three cases:

 - For things in std and also in core, like `cmp`: Just use them via
   `core::*`.

 - For things in std and also in alloc, like `Vec`: Import alloc as std, as
   use them from std. This allows them to work on both stable (which
   doesn't provide alloc, but we don't support no_std mode anyway) and
   nightly.

 - For HashMap and similar which are not in core or alloc, import them in
   the top-level lib.rs files from either std or the third-party hashmap_core
   crate, and then have the code use super::hashmap_core.

Also, no_std support continues to be "best effort" at this time and not
something most people need to be testing.
2019-01-14 21:48:15 -08:00
Muhammad Mominul Huque
effe6c04e4 Update to Rust 2018 edition (#632)
* initial cargo fix run

* Upgrade cranelift-entity crate

* Upgrade bforest crate

* Upgrade the codegen crate

* Upgrade the faerie crate

* Upgrade the filetests crate

* Upgrade the codegen-meta crate

* Upgrade the frontend crate

* Upgrade the cranelift-module crate

* Upgrade the cranelift-native crate

* Upgrade the cranelift-preopt crate

* Upgrade the cranelift-reader crate

* Upgrade the cranelift-serde crate

* Upgrade the cranelift-simplejit crate

* Upgrade the cranelift or cranelift-umbrella crate

* Upgrade the cranelift-wasm crate

* Upgrade cranelift-tools crate

* Use new import style on remaining files

* run format-all.sh

* run test-all.sh, update Readme and travis ci configuration
fixed an AssertionError also

* Remove deprecated functions
2018-12-26 09:49:05 -08:00
Bruce Mitchener
4f8753fa11 Fix typos. 2018-12-24 10:03:22 -08:00
Benjamin Bouvier
93696a80bb Fixes #614: Implement a debug trap; 2018-12-10 14:14:04 -05:00
Benjamin Bouvier
d94e027c2a [build] Move settings generation from Python to Rust code; 2018-11-30 11:05:21 -06:00
Dan Gohman
9947c315b7 Fix Python check script to work outside of Travis. 2018-11-30 06:07:18 -08:00
Dan Gohman
ba48fd2223 Add TODO comments noting temporary bug workarounds. 2018-11-28 17:18:12 -08:00
Dan Gohman
06d269be63 Disable mypy on OSX on Travis. 2018-11-28 16:36:59 -08:00
Benjamin Bouvier
d45e8b5830 Add SIB/offset for ABCD stores too; 2018-11-14 13:08:54 -08:00
Benjamin Bouvier
b170b74b65 Fixes #600: Add a SIB byte when encoding a non-indexed load/store into r12/rsp;
Memory access instructions which took the GPR_ZERO_DEREF_SAFE register
class (that was removed in #600) should check for the need of either an
offset (r13/rbp) or the SIB byte (r12/rsp). Some load/store instructions
would already take an index, thus already contain the SIB byte in this
case (see instructions which have a comment telling that the else branch
already contains an SIB byte). Non-indexed memory accesses lacked the
SIB byte check, which this patch adds.
2018-11-14 13:08:54 -08:00
Benjamin Bouvier
ce2364ddd9 [build] Remove dead code in Python and move assertions to the Rust code generator; 2018-11-09 09:23:36 -08:00
Dan Gohman
997424a4c5 Add more comments explaining ghost instructions. 2018-11-07 11:03:23 +01:00
Dan Gohman
88bbbca6cd Make regalloc visit fallthrough_return instructions.
Add an explicit "is_ghost" property to selected instructions, and use
that to determine whether reload and coloring should visit instructions.
This allows them to visit fallthrough_return instructions and insert
fills and register moves as needed.
2018-11-07 11:03:23 +01:00
Benjamin Bouvier
bcbb2d01cc [build] Stop using Python code to generate the register files; 2018-11-06 13:12:17 -08:00
Benjamin Bouvier
b7f2acf0ea [build] Implement registers code generation in the Rust meta crate; 2018-11-06 13:12:17 -08:00
Benjamin Bouvier
17e88ed1c5 [build] Use the Rust-generated types files in place of the Python one; 2018-11-06 13:12:17 -08:00
Dan Gohman
d4f8eb7453 Introduce a TargetFrontendConfig type. (#570)
* Introduce a `TargetFrontendConfig` type.

`TargetFrontendConfig` is information specific to the target which is
provided to frontends to allow them to produce Cranelift IR for the
target. Currently this includes the pointer size and the default calling
convention.

The default calling convention is now inferred from the target, rather
than being a setting. cranelift-native is now just a provider of target
information, rather than also being a provider of settings, which gives
it a clearer role.

And instead of having cranelift-frontend routines require the whole
`TargetIsa`, just require the `TargetFrontendConfig`, and add a way to
get the `TargetFrontendConfig` from a `Module`.

Fixes #529.
Fixes #555.
2018-11-02 13:51:42 -07:00
theJosher
d2b3ff6183 Errors reported by mypy 0.641 #558 2018-10-29 19:53:43 -07:00
Dan Gohman
a2fcb32245 Escape backslashes in Python comments.
The latest version of flake8 diagnoses these as invalid escape
sequences, so properly escape them.
2018-10-24 10:00:42 -07:00
Benjamin Bouvier
9d6821d6d9 Fix #335: Introduce variable size recipes and remove GPR_SAFE reg classes (#552)
* Rename size to base_size and introduce a compute_size function;

* Add infra to inspect in/outs registers when computing the size of an instruction;

* Remove the GPR_SAFE_DEREF and GPR_ZERO_DEREF_SAFE register classes on x86 (fixes #335);
2018-10-15 15:43:38 -07:00
Dan Gohman
bf041e3ae2 Move return_at_end out of Settings and into the wasm FuncEnvironment. (#547)
* Move `return_at_end` out of Settings and into the wasm FuncEnvironment.

The `return_at_end` flag supports users that want to append a custom
epilogue to Cranelift-produced functions. It arranges for functions to
always return via a single return statement at the end, and users are
expected to remove this return to append their code.

This patch makes two changes:
 - First, introduce a `fallthrough_return` instruction and use that
   instead of adding a `return` at the end. That's simpler than having
   users remove the `return` themselves.

 - Second, move this setting out of the Settings and into the wasm
   FuncEnvironment. This flag isn't something the code generator uses,
   it's something that the wasm translator uses. The code generator
   needs to preserve the property, however we can give the
   `fallthrough_return` instruction properties to ensure this as needed,
   such as marking it non-cloneable.
2018-10-05 06:43:22 -07:00
Dan Gohman
2eb9ae45aa Tidy up some comments. 2018-10-04 10:43:11 -07:00
bjorn3
b2a28d69e6 Add encodings for i8 and i16 copy, spill, fill, ireduce.i8.i16 (#534)
* Add encodings for i8 and i16 copy, spill, fill, ireduce.i8.i16

Also adds legalization for srem, irsub_imm, {u,s}extend.i16.i8

Fixes #477 cc #466

* Legalize popcnt, clz and ctz for i8 and i16

* Fix bug in call_memset
2018-10-03 14:43:59 -07:00
Tyler McMullen
79cea5e18b Implement jump tables (#453)
* Add 'jump_table_entry' and 'indirect_jump' instructions.

* Update CodeSink to keep track of code size. Pretty up clif-util's disassembly output.

* Only disassemble the machine portion of output. Pretty print the read-only data after it.

* Update switch frontend code to use new br_table instruction w/ default.
2018-10-03 10:04:21 -07:00
Dan Gohman
aa5ba71c97 Clarify the meaning of the symbol_value instruction. 2018-09-27 11:43:41 -07:00
bjorn3
2eec1469a8 Legalize some more i8/i16 intructions (#524)
* Legalize some more i8/i16 intructions
2018-09-25 16:10:23 -07:00
Dan Gohman
608e74d8cb Document that b8 etc. are intended for use as SIMD elements. 2018-09-05 14:23:03 -07:00
Dan Gohman
d4b8622393 Rename the VOID type to INVALID and clean up obsolete comments.
The VOID type isn't used for anything resembling what "void" means in C,
so rename it to INVALID to avoid confusion.
2018-09-04 21:46:22 -07:00
Dan Gohman
18900df4d5 Clean up obsolete comments. 2018-09-04 21:22:50 -07:00
Dan Gohman
ca9da7702e Reorganize the global value kinds. (#490)
* Reorganize the global value kinds.

This:
 - renames "deref" global values to "load" and gives it a offset that works
   like the "load" instructions' does
 - adds an explicit "iadd_imm" global value kind, which replaces the
   builtin iadd in "vmctx" and "deref" global values.
 - also renames "globalsym" to "symbol"
2018-09-04 21:09:04 -07:00
Aaron Power
17bb62c16c Added bitrev instruction for 32 and 64 bit integers (#486) 2018-09-04 16:23:50 -07:00
Dan Gohman
c23bfdaa91 Minor code simplification. 2018-08-28 16:24:10 -07:00
bjorn3
3f582f7cbd Legalize br_icmp (#449)
* Legalize br_icmp
2018-08-13 18:31:39 -07:00
bjorn3
fa65ee7a68 Legalize bint.i8 2018-08-13 21:23:25 +02:00
Benjamin Bouvier
f7e481d9ac Implement wasm saturating conversions; 2018-08-09 19:50:41 -07:00
Dan Gohman
1b30265c5c Define a "table" concept.
"Table" is to WebAssembly tables as "Heap" is to WebAssembly linear
memories.
2018-08-02 15:21:34 -07:00
bjorn3
01729be8d7 Add comment support (#379)
* Add comment support

* Don't print empty comments

* Add nop instruction

* Add test and note

* Add FuncWriter trait

* Remove comment support

* Add write_preamble to FuncWriter

* Fix test

* Some changes
2018-08-01 11:21:05 -07:00
data-pup
d9d40e1cdf lib/codegen-meta moved into lib/codegen. (#423)
* lib/codegen-meta moved into lib/codegen.

* Renamed codegen-meta and existing meta.
2018-07-31 07:56:26 -07:00