Commit Graph

291 Commits

Author SHA1 Message Date
bjorn3
954a2007d2 Fix isplit legalization 2019-09-07 09:55:09 -07:00
bjorn3
f04b334b20 Rustfmt 2019-09-07 09:55:09 -07:00
bjorn3
6f7d57a71f Handle isplit when it is not the result of a legalization 2019-09-07 09:55:09 -07:00
bjorn3
c1553194a7 Fix WideInt max size in insturctions.py 2019-09-07 09:55:09 -07:00
bjorn3
c9a25abbc4 Basic i128 support 2019-09-07 09:55:09 -07:00
Benjamin Bouvier
e35cf861db Fixes #984: Add a isa::lookup_by_name function;
This removes the explicit dependency on target-lexicon for the embedder,
which can instead use the ISA's name directly. It can simplify
dependency management, in particular avoid the need for synchronizing
the target-lexicon dependencies versions.

It also tweak the error when an ISA isn't built as part of Cranelift to
be a SupportDisabled error; this was dead code before this.
2019-09-06 16:19:01 +02:00
Benjamin Bouvier
c1609b70e8 [codegen] Allow using the pinned register as the heap base via a setting; 2019-09-06 16:18:27 +02:00
Benjamin Bouvier
660b8b28b8 [codegen] Add a pinned register that's entirely under the control of the user; 2019-09-06 16:18:27 +02:00
Benjamin Bouvier
d1d2e790b9 [meta] Morph a few pub into pub(crate), and remove dead code; 2019-09-06 15:47:20 +02:00
Benjamin Bouvier
8fba449b7b [meta] Introduce the EntityRefs structure instead of using dynamic lookup; 2019-09-06 15:47:20 +02:00
Benjamin Bouvier
29e3ec51c1 [meta] Introduce the Immediates structure instead of using dynamic lookup; 2019-09-06 15:47:20 +02:00
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
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
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
Andrew Brown
4e7226ddca Fix documentation warnings in ConstantPool 2019-08-29 11:08:29 +02:00
Benjamin Bouvier
e4702d695e [meta] Generate doc comments for the encodings tables; 2019-08-27 14:16:54 +02: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
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
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
Andrew Brown
cc57e84cbd Fix segfault due to b64 encoding (#919)
* Fix segfault due to b64 encoding

Prior to this patch, bconst.b64 encoded its instruction with a 32-bit immediate that caused improper decoding of the MOV instruction; instead, use a REX prefix and rely on zero-extension of the immediate. Fixes #911.
2019-08-23 18:04:34 +02:00
Artur Jamro
d3815a0399 Implement serde and equality traits for SecondaryMap 2019-08-22 15:54:10 -07:00
Sean Stangl
e736367b8c Make fold_redundant_jumps() feature-gated on basic-blocks 2019-08-22 18:54:49 +02:00
Mike Hommey
97996d79ce Sort custom_legalizes for more deterministic generated code
For better caching.
2019-08-22 11:44:19 +02:00
Andrew Brown
ff3c44385c Add test run to cranelift-filetests to allow executing CLIF (#890)
* Add ability to run CLIF IR using `clif-util run [-v] {file}` and add `test run` to cranelift-filetests to allow executing CLIF

This re-factors the compile/execute parts to a FunctionRunner that is shared between cranelift-filetests and clif-util. CLIF can be now be run using `clif-util run` as well as during `clif-util test` for files with a `test run` header. As before, only functions suffixed with a `run` comment are executed. The `run: fn(...) == ...` expression syntax is left for a subsequent change.
2019-08-21 18:03:09 +02:00