Commit Graph

9128 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
cc71744b74 Implement select and vselect instructions.
This gives us the opportunity to use the AsBool derived type variables and a
Select instruction format with a non-default typevar_operand setting.
2016-05-20 15:11:17 -07:00
Jakob Stoklund Olesen
b44d6c6541 Implement select and vselect instructions.
This gives us the opportunity to use the AsBool derived type variables and a
Select instruction format with a non-default typevar_operand setting.
2016-05-20 15:11:17 -07:00
Jakob Stoklund Olesen
ad01af40e4 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
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
c3b76b67ca 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
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
ceb134ac32 Add a BinaryOverflow instruction format.
This will eventualy be used for add-with-carry and add-with-overflow type
instructions. For now it only serves as a representative of instruction formats
that have multiple_results=True and boxed_storage=False at the same time.
2016-05-19 10:43:14 -07:00
Jakob Stoklund Olesen
210139c4bd Add a BinaryOverflow instruction format.
This will eventualy be used for add-with-carry and add-with-overflow type
instructions. For now it only serves as a representative of instruction formats
that have multiple_results=True and boxed_storage=False at the same time.
2016-05-19 10:43:14 -07:00
Jakob Stoklund Olesen
6d0486cced 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
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
b06f5ef72f Define control flow instructions.
Rename 'br' to 'jump'. We'll use jump/br to mean unconditional/conditional
control transfer respectively.
2016-05-19 09:01:40 -07:00
Jakob Stoklund Olesen
ebe224a912 Define control flow instructions.
Rename 'br' to 'jump'. We'll use jump/br to mean unconditional/conditional
control transfer respectively.
2016-05-19 09:01:40 -07:00
Jakob Stoklund Olesen
27a311701d Add entity references as a new operand kind.
Define known entities in the cretonne.entities module.
2016-05-18 15:31:02 -07:00
Jakob Stoklund Olesen
d85fda0346 Add entity references as a new operand kind.
Define known entities in the cretonne.entities module.
2016-05-18 15:31:02 -07:00
Jakob Stoklund Olesen
25e78fdbff Parse basic blocks and instructions.
Create map entries for ebbs and values as they are defined, but leave ebb and
value operands unresolved on instructions as they are parsed. Instruction
operands can refer to ebbs and values that may not have been defined yet.

Don't infer or check result types yet.
2016-05-18 12:27:12 -07:00
Jakob Stoklund Olesen
1dcac579fb Parse basic blocks and instructions.
Create map entries for ebbs and values as they are defined, but leave ebb and
value operands unresolved on instructions as they are parsed. Instruction
operands can refer to ebbs and values that may not have been defined yet.

Don't infer or check result types yet.
2016-05-18 12:27:12 -07:00
Jakob Stoklund Olesen
74625a9b79 Add restrictions on polymorphism.
Also introduce the concept of a derived type variable, and provide two
methods for deriving type vars: lane() and as_bool().
2016-05-18 12:27:12 -07:00
Jakob Stoklund Olesen
2dc15b78ae Add restrictions on polymorphism.
Also introduce the concept of a derived type variable, and provide two
methods for deriving type vars: lane() and as_bool().
2016-05-18 12:27:12 -07:00
Jakob Stoklund Olesen
639d92177a Reorganize meta language reference.
Separate instruction descriptions from instruction formats which deal with the
Rust representation.

Add type class restrictions to type variables.
2016-05-18 12:27:12 -07:00
Jakob Stoklund Olesen
bd221af412 Reorganize meta language reference.
Separate instruction descriptions from instruction formats which deal with the
Rust representation.

Add type class restrictions to type variables.
2016-05-18 12:27:12 -07:00
Jakob Stoklund Olesen
1be81c4352 Implement write_instruction and write_ebb.
Use the new iterators to write out the contents of a function.
2016-05-14 11:33:07 -07:00
Jakob Stoklund Olesen
9838a4040e Implement write_instruction and write_ebb.
Use the new iterators to write out the contents of a function.
2016-05-14 11:33:07 -07:00
Jakob Stoklund Olesen
dd5c1a1a3f Track instruction order in an EBB.
Place instructions in a doubly linked list and point to the first and last
instruction in an EBB.

Provide an iterator for all the EBBs too. This doesn't reflect the layout
order, but simply the order blocks were created.
2016-05-13 17:58:55 -07:00
Jakob Stoklund Olesen
5e0e923464 Track instruction order in an EBB.
Place instructions in a doubly linked list and point to the first and last
instruction in an EBB.

Provide an iterator for all the EBBs too. This doesn't reflect the layout
order, but simply the order blocks were created.
2016-05-13 17:58:55 -07:00
Jakob Stoklund Olesen
e735836383 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
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
62ecbc7448 Break entity references and instruction info out into new modules.
Avoid gathering too much code in repr.rs.

The `entities` module contains entity reference types, and the `instructions`
module contains instruction opcodes and formats.
2016-05-13 14:02:04 -07:00
Jakob Stoklund Olesen
9c9be1cb58 Break entity references and instruction info out into new modules.
Avoid gathering too much code in repr.rs.

The `entities` module contains entity reference types, and the `instructions`
module contains instruction opcodes and formats.
2016-05-13 14:02:04 -07:00
Jakob Stoklund Olesen
593b7bbd51 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
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
4109b9fe13 Generate recursive meta language dependencies.
Cargo doesn't scan a directory for changed dependencies recursively, so do that
as part of the build.py script.
2016-05-13 10:00:38 -07:00
Jakob Stoklund Olesen
3909cdbc2d Generate recursive meta language dependencies.
Cargo doesn't scan a directory for changed dependencies recursively, so do that
as part of the build.py script.
2016-05-13 10:00:38 -07:00
Jakob Stoklund Olesen
af535acdc6 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
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
477fa01bfc Add OperandKind to the meta language.
We have a two-level type system: OperandKinds and ValueTypes. The value types
only apply to value operands, but there are many more kinds of operands:
immediate numbers, condition codes, basic block references, etc.
2016-05-12 15:59:40 -07:00
Jakob Stoklund Olesen
814231245c Add OperandKind to the meta language.
We have a two-level type system: OperandKinds and ValueTypes. The value types
only apply to value operands, but there are many more kinds of operands:
immediate numbers, condition codes, basic block references, etc.
2016-05-12 15:59:40 -07:00
Jakob Stoklund Olesen
ea46a17f56 PEP8 formatting. 2016-05-12 13:37:03 -07:00
Jakob Stoklund Olesen
f1e2dffa81 PEP8 formatting. 2016-05-12 13:37:03 -07:00
Jakob Stoklund Olesen
6e17d229d0 Fix build. 2016-05-02 16:04:21 -07:00
Jakob Stoklund Olesen
21b0eae044 Fix build. 2016-05-02 16:04:21 -07:00
Jakob Stoklund Olesen
24970593ac Implement value lists.
Values that are defined together are represented as a singly linked list. These
lists appear in:

- Instructions with multiple result values. The first result value is special, and the
  following results form a linked list of Def extended_value table entries.

- EBB arguments are represented as a linked list of Argument extended_value
  table entries. The EbbData struct has pointers to the first and last argument
  to allow fast insertion at both ends.

Add a Values iterator type whicih can enumerate both kinds of value lists.
2016-05-02 15:36:54 -07:00
Jakob Stoklund Olesen
1d768ff734 Implement value lists.
Values that are defined together are represented as a singly linked list. These
lists appear in:

- Instructions with multiple result values. The first result value is special, and the
  following results form a linked list of Def extended_value table entries.

- EBB arguments are represented as a linked list of Argument extended_value
  table entries. The EbbData struct has pointers to the first and last argument
  to allow fast insertion at both ends.

Add a Values iterator type whicih can enumerate both kinds of value lists.
2016-05-02 15:36:54 -07:00
Jakob Stoklund Olesen
ab50f17412 Implement Index<Inst/StackSlot> for Function.
When Function serves as a container for IL entities, use the Index trait to
translate a reference class to a Data object.

Works for:

- StackSlot -> StackSlotData
- Inst -> InstructionData
2016-05-02 12:13:24 -07:00
Jakob Stoklund Olesen
e026b36db4 Implement Index<Inst/StackSlot> for Function.
When Function serves as a container for IL entities, use the Index trait to
translate a reference class to a Data object.

Works for:

- StackSlot -> StackSlotData
- Inst -> InstructionData
2016-05-02 12:13:24 -07:00
Jakob Stoklund Olesen
aec94912d7 Exit test script on errors. 2016-04-29 15:45:48 -07:00
Jakob Stoklund Olesen
e414ce6315 Exit test script on errors. 2016-04-29 15:45:48 -07:00
Jakob Stoklund Olesen
a6c9d2b339 Build status badge. 2016-04-29 15:33:24 -07:00
Jakob Stoklund Olesen
3c0e2f6e9d Build status badge. 2016-04-29 15:33:24 -07:00
Jakob Stoklund Olesen
c344dbf437 Set up Travis CI 2016-04-29 15:31:25 -07:00
Jakob Stoklund Olesen
4e4c634666 Set up Travis CI 2016-04-29 15:31:25 -07:00