Commit Graph

2671 Commits

Author SHA1 Message Date
stefson
bafd79330d upgrade to latest target-lexicon 0.8.1
this fixes the compile for arm and aarch64

reported via https://github.com/CraneStation/cranelift/issues/977
2019-09-06 15:20:04 +02:00
Dan Gohman
d858ebb4aa Bump version to 0.42.0 2019-09-05 17:36:04 -07:00
Ujjwal Sharma
1a099f2e8c [codegen] change operand type from bool to iflag for isub borrow variants
The type of the borrow operands for the borrow variants of the isub
instruction (isub_bin, isub_bout, isub_borrow) was bool for compatibility
reasons for isa/riscv. Since support for these instructions on RISC
architectures has been temporarily suspended, we can safely change the
type to iflags.
2019-09-05 19:28:33 +02:00
Ujjwal Sharma
9fb8bdd6d5 [codegen] remove support for isub borrow variants on riscv
Previously, the borrow variants of isub (isub_bin, isub_bout and
isub_borrow) were being legalized for isa/riscv since RISC architectures
lack a flags register.

This forced us to return and accept booleans for these operations, which
proved to be problematic and inconvenient, especially for x86.

This commit removes support for said statements and all dependent
statements for isa/riscv so that we can work on a better legalization
strategy in the future.
2019-09-05 19:28:33 +02:00
Ujjwal Sharma
dce8ad8229 [codegen] add encodings for isub borrow variants
Add encodings for isub borrow variants (isub_bout, isub_bin,
isub_borrow) for x86_32, enabling the legalization for isub.i64 to work.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1576675
Bug: https://github.com/CraneStation/cranelift/issues/765
2019-09-05 19:28:33 +02:00
Benjamin Bouvier
1c28d43f00 [meta] Remove unused immfield index in the FormatField; 2019-09-05 17:55:03 +02:00
Benjamin Bouvier
38656cce35 [meta] Simplify and comment instruction building a bit; 2019-09-05 17:55:03 +02:00
Benjamin Bouvier
0acddc08ea [meta] Split FormatBuilder::imm to avoid the extra Into<> parameter type; 2019-09-05 17:55:03 +02:00
Benjamin Bouvier
8a9384f869 Tweak comments; 2019-09-05 17:55:03 +02:00
Sean Stangl
26b88ae7b5 Limit redundant jump folding to only fold parameterless target blocks (#972) 2019-09-05 08:21:29 -06:00
Ujjwal Sharma
ea919489ee [codegen] add encodings for iadd carry variants (#961)
* [codegen] add encodings for iadd carry variants

Add encodings for iadd carry variants (iadd_cout, iadd_cin, iadd_carry)
for x86_32, enabling the legalization for iadd.i64 to work.

* [codegen] remove support for iadd carry variants on riscv

Previously, the carry variants of iadd (iadd_cin, iadd_cout and
iadd_carry) were being legalized for isa/riscv since RISC architectures
lack a flags register.

This forced us to return and accept booleans for these operations, which
proved to be problematic and inconvenient, especially for x86.

This commit removes support for said statements and all dependent
statements for isa/riscv so that we can work on a better legalization
strategy in the future.

* [codegen] change operand type from bool to iflag for iadd carry variants

The type of the carry operands for the carry variants of the iadd
instruction (iadd_cin, iadd_cout, iadd_carry) was bool for compatibility
reasons for isa/riscv. Since support for these instructions on RISC
architectures has been temporarily suspended, we can safely change the
type to iflags.
2019-09-05 15:03:13 +02:00
Nicolas B. Pierron
7e398af999 Basic-block: Insert regmove instructions in new blocks dedicated to hold the diversions. 2019-09-05 14:55:35 +02:00
Pat Hickey
0f4101a509 upgrade to faerie 0.11.0
which fixes a use-after-free bug under the hood
2019-09-04 15:12:17 -07:00
Pat Hickey
89d741f8ae upgrade to target-lexicon 0.8.0
* the target-lexicon crate no longer has or needs the std feature
  in cargo, so we can delete all default-features=false, any mentions
  of its std feature, and the nostd configs in many lib.rs files
* the representation of arm architectures has changed, so some case
  statements needed refactoring
2019-09-04 15:12:17 -07:00
Benjamin Bouvier
49a37e48fb [codegen] Make scalar_to_vector's output type a lane of its input type; 2019-09-04 19:09:54 +02:00
Andrew Brown
d64e454004 Improve uimm128 parsing
This commit changes 128-bit constant parsing in two ways:
 - it adds the ability to use underscores to separate digits when writing a 128-bit constant in hexadecimal; e.g. `0x00010203...` can now be written as `0x0001_0203_...`
 - it adds a new mechanism for parsing 128-bit constants using integer/float/boolean literals; e.g. `vconst.i32x4 [1 2 3 4]`. Note that currently the controlling type of the instruction dictates how many literals to parse inside the brackets.
2019-09-04 07:16:04 -07:00
Julian Seward
98056aa05d Don't incorrectly omit a REX prefix for some encodings of copy_to_ssa. Mozilla bug #1576969.
Also, as a ridealong fix, removes R32 encodings for x86_64 in `enc_r32_r64`,
since the type `rXX` by definition only exists for targets with word size `XX`
bits.
2019-09-04 13:59:01 +02:00
Benjamin Bouvier
d09fc93fef Remove Travis CI; (#967) 2019-09-03 15:20:38 +02:00
Benjamin Bouvier
44942a26a2 Tweak comments; 2019-09-03 14:08:37 +02:00
Benjamin Bouvier
47e5d6c83e [regalloc] Transform the program_input_abi function into a Context method;
It was implemented this way before to avoid borrow-checking issues,
where self would be both mutably borrowed (because of the solver) and
immutably borrowed (because of the ABI parameters list). This is worked
around by adding a local AbiParams struct which contains a summary of
the information that's needed by program_input_abi, allowing to retrieve
the ABI params within the method's body itself.
2019-09-03 14:08:37 +02:00
Benjamin Bouvier
cd1b2c0af0 [meta] Try to use {prefix+number} when looking up a register by name;
This makes it possible to look up registers like r15 on x86.
2019-09-03 14:08:37 +02:00
Dan Gohman
8becc9a64c Bump version to 0.41.0 2019-08-30 23:22:48 -07:00
Nicolas B. Pierron
381578311c Split edges to have a block to add regmove & copy instructions.
When using basic block instructions cannot be added in-between jump instructions which are ending basic blocks. These changes create extra basic blocks such that extra space is available for the spilling and moving registers where they are expected.
2019-08-30 18:44:35 +02:00
Nicolas B. Pierron
bb87f1a54a Add EntryRegDiversions to record diversions for each block entry. 2019-08-30 14:48:08 +02:00
Till Schneidereit
9eb1847d80 Add Azure Pipelines CI setup (#948)
Add Azure Pipelines CI setup
2019-08-29 11:31:38 +02:00
Andrew Brown
4e7226ddca Fix documentation warnings in ConstantPool 2019-08-29 11:08:29 +02:00
Nicolas B. Pierron
04b10b3fde Add feature flags to test files.
Cranelift can be compiled with feature flags which can change its output. To
accomodate changes of output related to feature flags, test file can now include
`feature "..."` and `feature ! "..."` directives in the preamble of the test
file.

The test runner would skip the test if the flag does not match the expectation
of the test case.
2019-08-28 16:42:07 +02:00
Benjamin Bouvier
26efc696c6 Remove specific calling convention in clif-util's run test. 2019-08-28 16:33:25 +02:00
Andrew Brown
9612c71fbd Remove calling convention on FunctionRunner test
For this test to run on Windows, the explicit calling convention
must be removed so that the parser is free to use the host's
calling convention.
2019-08-28 16:33:25 +02:00
Andrew Brown
6fdc69ff2e Add options for parsing test files (#942)
* Add options for parsing test files

This change allows adding parsing parameters more easily; e.g. a parameter is needed for setting the default calling convention for functions parsed as a part of the `run` test feature.

* Set default calling convention that of the host for `test run` file tests

Previously `test run` used the parser's hard-coded CallConv::Fast as the default calling convention but with this change any test being `run` will use the default calling convention of the machine running the test. `test run` will now throw an error if the calling convention of the function does not match the host's.
2019-08-27 20:31:08 +02:00
Benjamin Bouvier
e4702d695e [meta] Generate doc comments for the encodings tables; 2019-08-27 14:16:54 +02:00
Benjamin Bouvier
69f90b390e Build: remove pip packages from the install step;
Pip packages were installed because of the meta build in Python, but
they're now unused, so it's a waste of build time and cache space.
2019-08-27 11:48:59 +02:00
Benjamin Bouvier
173cfb02e6 Fixes #841: Bump the required version of rustc to 1.37; 2019-08-27 11:48:59 +02:00
Andrew Brown
2b49b51306 Add flags to allow wasm SIMD instructions (#910)
Add `--enable-simd` flag to `clif-util wasm`
2019-08-27 10:52:06 +02:00
Andrew Brown
ca6449626f Verify that cranelift-wasm can translate SIMD instructions
To do so we must use a new version of wabt-rs that allows us to enable features (e.g. SIMD) when translating the wasmtests
2019-08-26 16:12:06 -07:00
Andrew Brown
c595acfd0d Convert constants added by v128.const to the appropriate type before use
By default, constants added by SIMD's v128.const will be typed as I8x16 in CLIF. This type must be changed to the appropriate vector type before use to satisfy cranelift's type checking. To do this, we track what SSA values are created by v128.const and convert them with a raw_bitcast immediately before use in the currently implemented SIMD instructions.
2019-08-26 16:12:06 -07:00
Andrew Brown
020e5987d3 Use little-endian ordering for CLIF vconst immediate
Examining wasm-objdump revealed that it stores SIMD constants in little-endian order, e.g.:

000071 func[2] <test_const>:
 000072: fd 02 01 00 00 00 02 00 00 | v128.const 0x00000001 0x00000002 0x00000003 0x00000004
 00007b: 00 03 00 00 00 04 00 00 00 |
 000084: fd 0d 03                   | i32x4.extract_lane 3
 000087: 0b                         | end

This change avoids confusion by making the CLIF representation use little-endian order as well.
2019-08-26 16:12:06 -07:00
Andrew Brown
cb041407c1 Translate existing WASM SIMD operations to CLIF 2019-08-26 16:12:06 -07:00
Andrew Brown
c3cc225de9 Add filetest for verifying emitted rodata (i.e. test rodata) 2019-08-26 16:12:06 -07:00
Andrew Brown
8d812b24cc Add x86 encoding for vconst 2019-08-26 16:12:06 -07:00
Andrew Brown
684721ca29 Add x86 recipe for vconst 2019-08-26 16:12:06 -07:00
Andrew Brown
407d24c013 Add operand kind and format for unsigned 128-bit immediates 2019-08-26 16:12:06 -07:00
Andrew Brown
5ded38ce3e Add unsigned 128-bit immediate 2019-08-26 16:12:06 -07:00
Andrew Brown
7b2d055f78 Add ability to relocate constants using RelocSink 2019-08-26 16:12:06 -07:00
Andrew Brown
c20b13d5a9 Add ConstantPool 2019-08-26 16:12:06 -07:00
Andrew Brown
ea9ee202bb Clear jump tables when function data is cleared 2019-08-26 16:12:06 -07:00
Benjamin Bouvier
67a995f107 [clif-util] Use a simple cfg guard instead of cfg_if for the wasm module; 2019-08-26 17:19:32 +02:00
Till Schneidereit
9edbfed65f Switch from mmap to memmap to support Windows 2019-08-26 14:07:39 +02:00
Ujjwal Sharma
ec8f72bf20 Use roundss/roundsd when available for Ceil/Floor/Trunc/Nearest (#931)
Don't tie the preexisting SIMD ISA predicates to the shared
enable_simd setting but make new ones instead.

Fixes: https://github.com/CraneStation/cranelift/issues/908
2019-08-26 13:37:27 +02:00
julian-seward1
b8fb52446c Cranelift: implement redundant fill removal on tree-shaped CFG regions. Mozilla bug 1570584. (#906) 2019-08-25 19:37:34 +02:00