Commit Graph

111 Commits

Author SHA1 Message Date
Benjamin Bouvier
e34a4759cd [meta] Fix typo in x86 setting name use_lzcnt; 2019-07-03 18:39:28 +02:00
Benjamin Bouvier
ec5678ab7a [meta] Add the ability to bind any type to an instruction; 2019-07-03 18:39:28 +02:00
Benjamin Bouvier
9dcc185264 [meta] Add a MapWithDefault trait;
This traits augments HashMap so they have a `get_or_default` method that
can be used to avoid boilerplate around usage of `entry.or_default`.
2019-07-03 18:39:28 +02:00
Benjamin Bouvier
18fb87cd9c [meta] Refactor instruction predicates to distinguish format and type checks;
Also add the instruction format name in format predicates, since they're
going to be used when generating encodings.
2019-07-03 18:39:28 +02:00
Benjamin Bouvier
f1d1d1e960 [meta] Uniquely number every instruction in the Rust crate; 2019-07-03 18:39:28 +02:00
Dan Gohman
b35227b417 Bump version to 0.32.0 2019-07-02 12:27:39 -07:00
Dan Gohman
4b924d34b6 Bump version to 0.31.0 2019-06-28 11:37:39 -07:00
Benjamin Bouvier
83336290c2 Mark the jump_table_entry Instruction as loading; 2019-06-27 17:38:20 +02:00
Benjamin Bouvier
d7d48d5cc6 Add the dyn keyword before trait objects; 2019-06-24 11:42:26 +02:00
Benjamin Bouvier
70f79d23bf [meta] Make Builders build() instead of finish(); 2019-05-29 14:05:01 +02:00
Benjamin Bouvier
d9277f249b [meta] Introduce the InstructionGroupBuilder;
This follows the rest of the code base data structures, where we have a
mutable data structure builder; once the data structure is constructed,
it's immutable.

This also makes the definition of instructions easier, and it paves the
way for defining immediate variants.
2019-05-29 14:05:01 +02:00
Benjamin Bouvier
feb90e376a [meta] Make Instruction name/doc Strings so they can be automatically generated; 2019-05-29 14:05:01 +02:00
Benjamin Bouvier
22a6823496 [meta] Rename cdsl/inst to cdsl/instructions; 2019-05-29 14:05:01 +02:00
Julian Seward
03368895fe Cranelift: Redundant stack-slot-to-stack-slot copy removal. PR#773.
This is also https://bugzilla.mozilla.org/show_bug.cgi?id=1552737.

Cranelift currently has a tendency to create redundant copies (self-copies) of
values from a stack slot back to the same stack slot.  This generates a
pointless load and store and an unnecessary register use.  The copies are
created by `visit_inst` in regalloc/reload.rs.  They appear to occur mostly,
but not exclusively, at loop heads.  It's unclear why this happens.

This patch adds a special case to `visit_inst` to find such copies.  They are
converted into a new instruction, `copy_nop`, which takes and produces the
same SSA names, so as not to break any of the SSA invariants, but which has a
zero-length encoding, hence removing the copy at emission time.

`copy_nop`s source and destination operands must be stack slots and of course
the *same* stack slot.  The verifier has been enhanced to check this, since
misuse of `copy_nop` will likely lead to hard-to-find incorrect-code bugs.

Attempts were made to write a standalone .clif test case.  But these failed
because it appears the .clif parser accepts but ignores location hints that
are stack slots.  So it's impossible to write, in clif, the exact form of
`copy` instruction that triggers the transformation.
2019-05-27 13:55:48 +02:00
Benjamin Bouvier
6935033c9e [meta] Have bind() be a method of {Bound,}Instruction instead of a static method; 2019-05-23 14:31:00 +02:00
Benjamin Bouvier
724d1cd2a1 [meta] Rename ApplyTarget to InstSpec; 2019-05-23 14:31:00 +02:00
Benjamin Bouvier
a46b2d7173 [meta] Move ApplyTarget/bind to cdsl/inst; 2019-05-23 14:31:00 +02:00
Benjamin Bouvier
cbbb7a220e [meta] Move x86 registers generation to their own file; 2019-05-22 10:55:02 +02:00
Benjamin Bouvier
92109f664c [meta] Move x86 settings generation to their own file; 2019-05-22 10:55:02 +02:00
Benjamin Bouvier
97ebaa6f37 Add Rust implementation and address review comments of #742; 2019-05-20 11:52:43 +02:00
Benjamin Bouvier
d6059d4605 [meta] Use the Rust crate for settings generation; 2019-05-03 12:01:12 +02:00
Benjamin Bouvier
f335c5c56c [meta] Small fixes in the settings generation; 2019-05-03 12:01:12 +02:00
Benjamin Bouvier
390cfb37da [meta] Use named predicates for x86 settings in the Rust crate too;
And generate them using the same deterministic order that the Python
code uses.
2019-05-03 12:01:12 +02:00
Benjamin Bouvier
dca168f350 [meta] Switch to the Rust crate to generate legalizations and remove Python code; 2019-05-02 10:08:53 +02:00
Benjamin Bouvier
e3e66acfb1 [meta] Generate legalizations in the Rust crate; 2019-04-25 11:44:56 +02:00
Benjamin Bouvier
1f21349c4b [meta] Add CPU modes to the meta crate; 2019-04-25 11:44:56 +02:00
Benjamin Bouvier
d00e42ede3 [meta] Port shared and x86 legalizations to the Rust crate; 2019-04-25 11:44:56 +02:00
Benjamin Bouvier
494f3abf1d [meta] Add type inference, transforms and AST helpers for legalization; 2019-04-25 11:44:56 +02:00
Benjamin Bouvier
dfb27c3402 [meta] Make TypeVar shareable and mutable;
... since its type set can change over time during type inference. Use a
Rc<RefCell> to achieve this.
2019-04-25 11:44:56 +02:00
Benjamin Bouvier
b85146e945 [meta] Add helper methods and tests to TypeSet; 2019-04-25 11:44:56 +02:00
Benjamin Bouvier
e71ae7b02f [meta] Add instruction predicates; 2019-04-25 11:44:56 +02:00
Benjamin Bouvier
d92778a19e [meta] Add Instruction helpers and change its representation to make it easily copiable;
- adds helpers used by other parts of the code
- allows cheap copies by having Instruction be a lightweight ref-cloned
wrapper of the actual instruction's content.
2019-04-25 11:44:56 +02:00
Benjamin Bouvier
00429ebe99 [meta] Fix outdented_line in srcgen; 2019-04-24 10:47:26 +02:00
Benjamin Bouvier
d2d2cdcd78 [meta] Rejigger comments in cdsl/formats; 2019-04-24 10:47:26 +02:00
Benjamin Bouvier
b3a950b589 [meta] Fix condition codes in immediates; 2019-04-24 10:47:26 +02:00
Benjamin Bouvier
9b156fd9bb [meta] Use the Rust crate for opcodes/inst_builder code generation; 2019-04-09 15:42:28 +02:00
Benjamin Bouvier
b5595aadd2 [meta] Generate opcodes.rs/inst_builder.rs with the Rust crate; 2019-04-09 15:42:28 +02:00
Benjamin Bouvier
84fede890c [meta] Optimize the sequence table to use whole table suffix prefixing; 2019-04-05 11:59:09 -07:00
Benjamin Bouvier
2dd1552369 [meta] Make Typevar::type_set private, and add a second getter to read it directly;
There might be a silent bug in the Python module which directly reads
from this type_set field; in particular, it does so when reading all
controlling type variables, which all seem to be free variables (i.e. no
parent typevar). So imitate this behavior here, until we're sure there
are no other meta generators that rely on this.
2019-04-02 17:30:50 +02:00
Benjamin Bouvier
5edee84f67 [meta] Port TypeVar's test_functions to Rust;
Fixes two issues:

- name of derived type variables wasn't correct. (This is used during
code generation.)
- the TypeVar::derived() function wasn't creating the correct type set
(and would instead propagate the parent's one).
2019-04-02 17:30:50 +02:00
Benjamin Bouvier
dd63ebfb68 [meta] Port typeset_singleton tests to the Rust crate; 2019-04-02 17:30:50 +02:00
Benjamin Bouvier
ac37cb9bf5 [meta] Add test for {half/double}_{vector/width} and as_bool; 2019-04-02 17:30:50 +02:00
Benjamin Bouvier
6053201128 [meta] Move the TypeSet building out of the TypeVar builder so as to test it; 2019-04-02 17:30:50 +02:00
Benjamin Bouvier
3e7543df79 [meta] Introduce the num_set! macro to create NumSet as vec! does; 2019-04-02 17:30:50 +02:00
Benjamin Bouvier
86430abc4c [meta] Port all the Cranelift instructions to the meta crate; 2019-03-28 14:13:29 +01:00
Benjamin Bouvier
3c31eac48c [meta] Port Instruction/InstructionGroup to the Rust meta crate; 2019-03-28 14:13:29 +01:00
Benjamin Bouvier
d59bef1902 [meta] Port Formats and Operands to the Rust crate; 2019-03-27 14:43:27 +01:00
Benjamin Bouvier
146e0bd2f5 [meta] Port Typevar to the Rust crate; 2019-03-27 14:43:27 +01:00
Benjamin Bouvier
f3f449b45b [meta] Tweak generation of settings/registers; 2019-03-27 14:43:27 +01:00
Benjamin Bouvier
393b88af6e [meta] Implement UniqueTable in the Rust crate;
... and also rename the previously-named UniqueTable to UniqueSeqTable,
which is the name used in the Python code.
2019-03-27 14:43:27 +01:00