Commit Graph

18 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
d45b011fa2 Represent type sets with ranges.
Allow limits on the smallest and largest integer type in the set, the
highest and lowest number of lanes etc.
2016-09-27 13:31:31 -07:00
Jakob Stoklund Olesen
9cb3451432 Integer add with carry instructions.
Integer addition with carry in/out/both.
2016-09-23 13:42:00 -07:00
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
a6fd6e95d8 Flake8 lints. 2016-08-26 09:45:10 -07:00
Jakob Stoklund Olesen
1e1baec50a 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
Jakob Stoklund Olesen
92f84c655b Rename meta/target -> meta/isa.
Clarify terminology by always referring to a 'Target ISA' instead of just
'Target'. Use 'isa' as a module name instead of 'target' both in Rust and Python
code.

This is only to clarify terminology and not at all because Cargo insists on
using the 'target' sub-directory for build products. Oh, no. Not at all.
2016-08-04 11:50:19 -07:00
Jakob Stoklund Olesen
ecd8287eb0 Parse controlling type variable. Do basic type inference.
Replace the make_multi_inst() function with a make_inst_results() which uses
the constraint system to create the result values. A typevar argument ensures
that this function does not infer anything from the instruction data arguments.
These arguments may not be valid during parsing.

Implement basic type inference in the parser. If the designated value operand
on a polymorphic instruction refers to a known value, use that to infer the
controlling type variable.

This simple method of type inference requires the operand value to be defined
above the use in the text. Since reordering the EBBs could place a dominating
EBB below the current one, this is a bit fragile. One possibility would be to
require the value is defined in the same EBB. In all other cases, the
controlling typevar should be explicit.
2016-06-01 10:38:34 -07:00
Jakob Stoklund Olesen
692a85d720 Generate value type constraints.
Add an Opcode::constraints() method which returns an OpcodeConstraints object.
This object provides information on instruction polymorphism and how many
results is produced.

Generate a list of TypeSet objects for checking free type variables. The type
sets are parametrized rather than being represented as fully general sets.

Add UniqueTable and UniqueSeqTable classes to the meta code generator. Use for
compressing tabular data by removing duplicates.
2016-05-20 14:43:16 -07:00
Jakob Stoklund Olesen
1e631fdbd6 Verify restrictions on polymorphism.
Add a typevar_operand argument to the InstructionFormat constructor which
determines the operand used for inferring the controlling type variable.

Identify polymorphic instructions when they are created, determine if the
controlling type variable can be inferred from the typevar_operand, and verify
the use of type variables in the other operands.

Generate type variable summary in the documentation, including how the
controlling type variable is inferred.
2016-05-19 14:59:46 -07:00
Jakob Stoklund Olesen
2ce5f05bed Auto-generate boilerplate for 'impl InstructionData'.
Accessors for shared fields and multiple results can be generated automatically.

Add a 'boxed_storage' flag to the instruction format definitions to enable
generated code to access 'data'.
2016-05-19 10:16:40 -07:00
Jakob Stoklund Olesen
3670f57c40 Synchronize InstructionFormat and InstructionData.
These two enums must have identical variants. One is generated from the
instruction formats in meta/cretonne/formats.py, the other defines the contents
of an instruction.

Emit a conversion from InstructionData to InstructionFormat which also serves
to verify the correspondence. Rustc will error is the match is not complete.
2016-05-13 14:29:14 -07:00
Jakob Stoklund Olesen
e3927e205e Generate an InstructionFormat enum.
This is a no-payload enum which will have the same variants as InstructionData.
This makes it possible to talk about the format of an instruction without
actually creating an InstructionData instance.
2016-05-13 11:54:05 -07:00
Jakob Stoklund Olesen
ef04f4fc40 Add an InstructionFormat class to the meta language.
Define all known instruction formats in the cretonne.formats module.
2016-05-13 09:12:06 -07:00
Jakob Stoklund Olesen
f1e2dffa81 PEP8 formatting. 2016-05-12 13:37:03 -07:00
Jakob Stoklund Olesen
24e0828d20 Generate a constant hash table for recognizing opcodes.
Use a simple quadratically probed, open addressed hash table. We could use a
parfect hash function, but it would take longer to compute in Python, and this
is not in the critical path performancewise.
2016-04-07 20:24:21 -07:00
Jakob Stoklund Olesen
3dcd2f8e58 Generate an opcode_name() function.
This function returning a &'static str is more primitive that the Display
implementation. It allows the opcode strings to be reused by the parser.
2016-04-07 13:49:35 -07:00
Jakob Stoklund Olesen
d650d551a0 Include generated Opcode enum in the immediates module.
Generate nice doc comments for the Opcode enum variants that 'cargo doc'
will pick up.

Include a `Display` trait implementation that prints the lower
snake-case version of the opcode name.
2016-04-06 14:55:21 -07:00
Jakob Stoklund Olesen
15f39c776c Begin source generation.
Start out easy by emiting an opcodes.rs file containing an opcode enumeration.
2016-04-06 12:22:56 -07:00