Commit Graph

11145 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
7476d996f6 Generate level 2 hashtables.
All of the level 2 hashtables are concatenated into one constant array per ISA.
2016-08-26 17:15:05 -07:00
Jakob Stoklund Olesen
a21935a5a2 Add 32-bit ops to RV64.
The 32-bit arithmetic instructions are encoded differently in the RISC-V 64-bit
mode.
2016-08-26 16:13:22 -07:00
Jakob Stoklund Olesen
8a1f87d32e Add 32-bit ops to RV64.
The 32-bit arithmetic instructions are encoded differently in the RISC-V 64-bit
mode.
2016-08-26 16:13:22 -07:00
Jakob Stoklund Olesen
0c8f251bee Emit encoding lists (WIP).
Compute the u16 representation of encoding lists and emit a big table
concatenating all of them. Use the UniqueSeqTable to share some table space
between CPU modes.
2016-08-26 16:07:18 -07:00
Jakob Stoklund Olesen
176427e220 Emit encoding lists (WIP).
Compute the u16 representation of encoding lists and emit a big table
concatenating all of them. Use the UniqueSeqTable to share some table space
between CPU modes.
2016-08-26 16:07:18 -07:00
Jakob Stoklund Olesen
6a8a4c43c2 Collect and number all active encoding recipes.
The recipes are shared across CPU modes.
2016-08-26 15:14:33 -07:00
Jakob Stoklund Olesen
a26673654f Collect and number all active encoding recipes.
The recipes are shared across CPU modes.
2016-08-26 15:14:33 -07:00
Jakob Stoklund Olesen
15b5576d99 Generate type numbers at meta-time.
We need to generate hash tables keyed by types, so the Python scripts need to
know the index used to represent types in Rust code.

To enforce this, add a new gen_types.py script which generates constant
definitions for the ir/types module.

Also generate constants for common SIMD vector sizes.
2016-08-26 14:02:32 -07:00
Jakob Stoklund Olesen
747dd508df Generate type numbers at meta-time.
We need to generate hash tables keyed by types, so the Python scripts need to
know the index used to represent types in Rust code.

To enforce this, add a new gen_types.py script which generates constant
definitions for the ir/types module.

Also generate constants for common SIMD vector sizes.
2016-08-26 14:02:32 -07:00
Morgan Phillips
ea3396c2ff Add another dominator tree test case 2016-08-26 13:41:57 -07:00
Morgan Phillips
4b72d0e64d Add another dominator tree test case 2016-08-26 13:41:57 -07:00
Jakob Stoklund Olesen
3e40c3e454 Flake8 lints. 2016-08-26 09:45:10 -07:00
Jakob Stoklund Olesen
a6fd6e95d8 Flake8 lints. 2016-08-26 09:45:10 -07:00
Jakob Stoklund Olesen
c1ae0c99ed Move predicate collection into TargetISA.
Add a TargetISA.finish() method which computes derived data structures after
the ISA definitions have been loaded.
2016-08-26 09:37:05 -07:00
Jakob Stoklund Olesen
c11d82ea02 Move predicate collection into TargetISA.
Add a TargetISA.finish() method which computes derived data structures after
the ISA definitions have been loaded.
2016-08-26 09:37:05 -07:00
Jakob Stoklund Olesen
7cb975ce63 Add string conversions for predicates and encodings.
This is just used for printing better comments in generated code.
2016-08-26 08:50:47 -07:00
Jakob Stoklund Olesen
0b1aa7c6cd Add string conversions for predicates and encodings.
This is just used for printing better comments in generated code.
2016-08-26 08:50:47 -07:00
Jakob Stoklund Olesen
0c6e0e9cb7 Generate encoding tables. (WIP).
Amend build script to generate an encodings-<isa>.rs file for each target ISA.

Emit a function that can evaluate instruction predicates.

Describe the 3-level tables used for representing insrruction encoding tables.
Add Python classes representing the tables.

The generated code is incomplete and not used anywhere yet.
2016-08-25 16:19:10 -07:00
Jakob Stoklund Olesen
4f14d1ea32 Generate encoding tables. (WIP).
Amend build script to generate an encodings-<isa>.rs file for each target ISA.

Emit a function that can evaluate instruction predicates.

Describe the 3-level tables used for representing insrruction encoding tables.
Add Python classes representing the tables.

The generated code is incomplete and not used anywhere yet.
2016-08-25 16:19:10 -07:00
Jakob Stoklund Olesen
c166279bb9 Call function in the predicates module.
When generating Rust code for an instruction predicate, call the corresponding
function in the predicates module, using a qualified name.

We don't have methods corresponding to the predicates.
2016-08-25 14:26:44 -07:00
Jakob Stoklund Olesen
5f6859f0d9 Call function in the predicates module.
When generating Rust code for an instruction predicate, call the corresponding
function in the predicates module, using a qualified name.

We don't have methods corresponding to the predicates.
2016-08-25 14:26:44 -07:00
Jakob Stoklund Olesen
8641076369 Fix Python3 compat in docs directory.
Update copyright.
2016-08-25 11:55:57 -07:00
Jakob Stoklund Olesen
b788ab8020 Fix Python3 compat in docs directory.
Update copyright.
2016-08-25 11:55:57 -07:00
Jakob Stoklund Olesen
fb7997aa38 Collect list of CPU modes in TargetISA.
Fix a typo nearby.
2016-08-25 11:38:40 -07:00
Jakob Stoklund Olesen
c251f26d0d Collect list of CPU modes in TargetISA.
Fix a typo nearby.
2016-08-25 11:38:40 -07:00
Jakob Stoklund Olesen
a24daf5ded Add a predicate_leafs() method.
This collects all of the leaf predicates that go into a compound predicate.
Current leaf predicates are:

- Settings for ISA predicates, and
- FieldPredicates for instruction predicates.
2016-08-25 09:50:23 -07:00
Jakob Stoklund Olesen
4d1eb84037 Add a predicate_leafs() method.
This collects all of the leaf predicates that go into a compound predicate.
Current leaf predicates are:

- Settings for ISA predicates, and
- FieldPredicates for instruction predicates.
2016-08-25 09:50:23 -07:00
Jakob Stoklund Olesen
46dec8a11d Verify Rust source code formatting as part of the unit tests.
Only do this is rustfmt is installed, which likely means don't run on Travis
CI.
2016-08-24 16:36:52 -07:00
Jakob Stoklund Olesen
d0db391897 Verify Rust source code formatting as part of the unit tests.
Only do this is rustfmt is installed, which likely means don't run on Travis
CI.
2016-08-24 16:36:52 -07:00
Jakob Stoklund Olesen
33235b3981 Pass arguments on to rustfmt.
This allows the usage:

    src/format-all.sh --write-mode=diff
2016-08-24 16:29:54 -07:00
Jakob Stoklund Olesen
21ba900d19 Pass arguments on to rustfmt.
This allows the usage:

    src/format-all.sh --write-mode=diff
2016-08-24 16:29:54 -07:00
Jakob Stoklund Olesen
eb03abe864 Allow predicates on both EncRecipe and Encoding.
If both specify a predicate, combine them with 'And'.
2016-08-24 16:02:41 -07:00
Jakob Stoklund Olesen
9853657220 Allow predicates on both EncRecipe and Encoding.
If both specify a predicate, combine them with 'And'.
2016-08-24 16:02:41 -07:00
Jakob Stoklund Olesen
1a92876989 Add module with commonly used immediate predicates. 2016-08-24 15:22:15 -07:00
Jakob Stoklund Olesen
e812041738 Add module with commonly used immediate predicates. 2016-08-24 15:22:15 -07:00
Jakob Stoklund Olesen
055c7a0374 Clarify that Imm64 holds sign-extended values.
When representing smaller integer types, immediate values should be
sign-extended to i64.
2016-08-24 15:22:05 -07:00
Jakob Stoklund Olesen
cdd5872a1b Clarify that Imm64 holds sign-extended values.
When representing smaller integer types, immediate values should be
sign-extended to i64.
2016-08-24 15:22:05 -07:00
Morgan Phillips
125b79c06a Add additional test cases 2016-08-24 13:13:31 -07:00
Morgan Phillips
ea6eab4b3c Add additional test cases 2016-08-24 13:13:31 -07:00
Jakob Stoklund Olesen
586fbbc797 Add RISC-V arithmetic w/immediate operand encodings.
Add new instruction predicates to support the 'I' encoding recipe: IsSignedInt,
IsUnsignedInt used to test that an immediate operand is in the allowed range.
2016-08-24 08:53:44 -07:00
Jakob Stoklund Olesen
1da15a10d7 Add RISC-V arithmetic w/immediate operand encodings.
Add new instruction predicates to support the 'I' encoding recipe: IsSignedInt,
IsUnsignedInt used to test that an immediate operand is in the allowed range.
2016-08-24 08:53:44 -07:00
Jakob Stoklund Olesen
b8509c6273 Add bitwise operations with an immediate operand. 2016-08-24 08:41:05 -07:00
Jakob Stoklund Olesen
5a5688e446 Add bitwise operations with an immediate operand. 2016-08-24 08:41:05 -07:00
Jakob Stoklund Olesen
077c5ce1f6 Create format fields for immediate operands.
Each InstructionFormat instance gets data members corresponding to its immediate
operands, so the can be referred to as BinaryImm.imm, for example.

This will be used to construct instruction predicates.
2016-08-24 08:40:51 -07:00
Jakob Stoklund Olesen
fe7ad84129 Create format fields for immediate operands.
Each InstructionFormat instance gets data members corresponding to its immediate
operands, so the can be referred to as BinaryImm.imm, for example.

This will be used to construct instruction predicates.
2016-08-24 08:40:51 -07:00
Jakob Stoklund Olesen
9c5637902c Track the default member name for immediate operands.
Usually an instruction firmat has only a single immediate operand called 'imm',
or 'cond' if it is one of the condigtion codes. Add a 'default_member' field to
ImmediateKind to keep track of this default member name in the InstructionData
struct.
2016-08-24 08:40:51 -07:00
Jakob Stoklund Olesen
7ead1e3f6f Track the default member name for immediate operands.
Usually an instruction firmat has only a single immediate operand called 'imm',
or 'cond' if it is one of the condigtion codes. Add a 'default_member' field to
ImmediateKind to keep track of this default member name in the InstructionData
struct.
2016-08-24 08:40:51 -07:00
Jakob Stoklund Olesen
2f322e3d0e Add script for Python 3 compat checks. 2016-08-24 08:40:51 -07:00
Jakob Stoklund Olesen
2dfeea67e1 Add script for Python 3 compat checks. 2016-08-24 08:40:51 -07:00
Jakob Stoklund Olesen
9da6847805 Python 3 compat.
Try to keep our Python sources compatible with both Python 2.7 and 3.

Check with 'pylint --py3k' and 'python -3'.
2016-08-23 16:35:58 -07:00