Commit Graph

6452 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
5e4602efb4 Add expansion patterns for large immediates.
Expand foo_imm into iconst + foo.
2016-11-10 15:55:54 -08:00
Jakob Stoklund Olesen
d76280afba Add expansion patterns for large immediates.
Expand foo_imm into iconst + foo.
2016-11-10 15:55:54 -08:00
Jakob Stoklund Olesen
59eef69a4f Emit type arguments to builder methods that need it.
Use the inferred type variables to construct a type argument for builder
methods. This is for those instructions where the result types cannot be
computed from the result types.
2016-11-10 15:55:54 -08:00
Jakob Stoklund Olesen
a7c58b817c Emit type arguments to builder methods that need it.
Use the inferred type variables to construct a type argument for builder
methods. This is for those instructions where the result types cannot be
computed from the result types.
2016-11-10 15:55:54 -08:00
Jakob Stoklund Olesen
36871d3fb1 Add TypeVar.rust_expr().
Generate a Rust expression that computes the value of a derived type
variable.
2016-11-10 15:47:57 -08:00
Jakob Stoklund Olesen
5c9a12f101 Add TypeVar.rust_expr().
Generate a Rust expression that computes the value of a derived type
variable.
2016-11-10 15:47:57 -08:00
Jakob Stoklund Olesen
68c9f20b77 Infer type constraints on patterns.
Each instruction used in a pattern has constraints on the types of its
operands. These constraints are expressed as symbolic type variables.

Compute type variables for each variable used in a transformation
pattern. Some are free type variables, and some are derived from the
free type variables.

The type variables associated with variables can be used for computing
the result types of replacement instructions that don't support simple
forward type inference from their inputs.

The type sets computed by this patch are conservatively too large, so
they can't yet be used to type check patterns.
2016-11-10 13:26:07 -08:00
Jakob Stoklund Olesen
bf1568035f Infer type constraints on patterns.
Each instruction used in a pattern has constraints on the types of its
operands. These constraints are expressed as symbolic type variables.

Compute type variables for each variable used in a transformation
pattern. Some are free type variables, and some are derived from the
free type variables.

The type variables associated with variables can be used for computing
the result types of replacement instructions that don't support simple
forward type inference from their inputs.

The type sets computed by this patch are conservatively too large, so
they can't yet be used to type check patterns.
2016-11-10 13:26:07 -08:00
Jakob Stoklund Olesen
38f4b9a7c8 Add a TypeVar.constrain_types() function.
This reduces the set of types a type variable can assume.

This implementation is not complete yet, so it may yield type sets that
are too large.
2016-11-10 11:58:10 -08:00
Jakob Stoklund Olesen
935da5946f Add a TypeVar.constrain_types() function.
This reduces the set of types a type variable can assume.

This implementation is not complete yet, so it may yield type sets that
are too large.
2016-11-10 11:58:10 -08:00
Jakob Stoklund Olesen
129fd4b06e Add TypeVar.strip_sameas().
Strips out any type variable copies from an expression.
2016-11-10 10:41:49 -08:00
Jakob Stoklund Olesen
6fd5c6195d Add TypeVar.strip_sameas().
Strips out any type variable copies from an expression.
2016-11-10 10:41:49 -08:00
Jakob Stoklund Olesen
d22541dfa2 Add TypeVar.derived() function.
Add TypeVar constants representing the available type functions, and a
TypeVar.derived() static method which creates a derived TypeVar.

Keep the existing non-parametric methods for creating derived type
variables.

Add a method for converting a free type variable to a derived one.
2016-11-10 10:34:27 -08:00
Jakob Stoklund Olesen
98b3bd9e09 Add TypeVar.derived() function.
Add TypeVar constants representing the available type functions, and a
TypeVar.derived() static method which creates a derived TypeVar.

Keep the existing non-parametric methods for creating derived type
variables.

Add a method for converting a free type variable to a derived one.
2016-11-10 10:34:27 -08:00
Jakob Stoklund Olesen
cb631dc578 Fix doc build. 2016-11-08 15:26:30 -08:00
Jakob Stoklund Olesen
dd326350ff Fix doc build. 2016-11-08 15:26:30 -08:00
Jakob Stoklund Olesen
5e75b22c01 Assign a type variable to all VALUE operands.
A few operands have a fixed type assigned. Create a singleton type
variable for these exceptions. Most instructions are polymorphic, so
this is a little overhead.

Eliminate the Operand.typ field and replace it with an Operand.typevar
field which is always a TypeVar, but which only exists in VALUE
operands.
2016-11-08 14:58:44 -08:00
Jakob Stoklund Olesen
45fd134d3e Assign a type variable to all VALUE operands.
A few operands have a fixed type assigned. Create a singleton type
variable for these exceptions. Most instructions are polymorphic, so
this is a little overhead.

Eliminate the Operand.typ field and replace it with an Operand.typevar
field which is always a TypeVar, but which only exists in VALUE
operands.
2016-11-08 14:58:44 -08:00
Jakob Stoklund Olesen
a35756bbcc Clean up meta-language reference after module splitup. 2016-11-08 13:30:17 -08:00
Jakob Stoklund Olesen
9327d567b4 Clean up meta-language reference after module splitup. 2016-11-08 13:30:17 -08:00
Jakob Stoklund Olesen
8846cb8105 Move ISA definitions into cdsl.isa.
The cretonne package is now split into two: cdsl and base.
2016-11-08 13:21:05 -08:00
Jakob Stoklund Olesen
bd76623266 Move ISA definitions into cdsl.isa.
The cretonne package is now split into two: cdsl and base.
2016-11-08 13:21:05 -08:00
Jakob Stoklund Olesen
cc86964ab3 Move ast, xform, and legalize modules.
- cdsl.ast defines classes representing abstract syntax trees.
- cdsl.xform defines classes for instruction transformations.
- base.legalize defines legalization patterns.
2016-11-08 12:33:50 -08:00
Jakob Stoklund Olesen
09204ca14a Move ast, xform, and legalize modules.
- cdsl.ast defines classes representing abstract syntax trees.
- cdsl.xform defines classes for instruction transformations.
- base.legalize defines legalization patterns.
2016-11-08 12:33:50 -08:00
Jakob Stoklund Olesen
0b9b956695 Split out instruction definitions.
- cdsl.instructions defines the Instruction class.
- base.instructions defines the base instruction set.
2016-11-08 12:33:50 -08:00
Jakob Stoklund Olesen
5fa322f797 Split out instruction definitions.
- cdsl.instructions defines the Instruction class.
- base.instructions defines the base instruction set.
2016-11-08 12:33:50 -08:00
Jakob Stoklund Olesen
87eb1a8ea0 Split out instruction formats.
- cdsl.formats provides classes for describing instruction formats.
- base.formats provides concrete instruction format definitions.
2016-11-08 11:48:05 -08:00
Jakob Stoklund Olesen
2a15130518 Split out instruction formats.
- cdsl.formats provides classes for describing instruction formats.
- base.formats provides concrete instruction format definitions.
2016-11-08 11:48:05 -08:00
Jakob Stoklund Olesen
b5e592ad56 Move Operand itself into cdsl.operands. 2016-11-08 11:30:31 -08:00
Jakob Stoklund Olesen
fa7dc6825a Move Operand itself into cdsl.operands. 2016-11-08 11:30:31 -08:00
Jakob Stoklund Olesen
0666c8818a Get rid of operand_kind()
This method caused lots of import cycles when type checking.

Use isinstance() in the Operand constructor instead to decipher the
OperandSpec union type.
2016-11-08 11:26:26 -08:00
Jakob Stoklund Olesen
93a1387f2f Get rid of operand_kind()
This method caused lots of import cycles when type checking.

Use isinstance() in the Operand constructor instead to decipher the
OperandSpec union type.
2016-11-08 11:26:26 -08:00
Jakob Stoklund Olesen
2e718c6554 Split out the typevar module.
- cdsl.typevar defines TypeVar and TypeSet classes.
2016-11-08 11:26:25 -08:00
Jakob Stoklund Olesen
5498169ca0 Split out the typevar module.
- cdsl.typevar defines TypeVar and TypeSet classes.
2016-11-08 11:26:25 -08:00
Jakob Stoklund Olesen
eb688dc72d Move formats, entities, and immediates to the base package.
- base.formats defines instruction formats.
- base.entities defines kinds of entity references.
- base.immediates defines kinds of imediate operands.
2016-11-08 11:06:37 -08:00
Jakob Stoklund Olesen
6eaa8eb382 Move formats, entities, and immediates to the base package.
- base.formats defines instruction formats.
- base.entities defines kinds of entity references.
- base.immediates defines kinds of imediate operands.
2016-11-08 11:06:37 -08:00
Jakob Stoklund Olesen
19287c1f32 Split out operand descriptions.
- cdsl.operands has the Operand and OperandKind classes.
2016-11-08 10:58:23 -08:00
Jakob Stoklund Olesen
bb28dc6686 Split out operand descriptions.
- cdsl.operands has the Operand and OperandKind classes.
2016-11-08 10:58:23 -08:00
Jakob Stoklund Olesen
e6b959436d Split out predicates and settings.
- cdsl.predicates defines classes for describing predicates.
- cdsl.settings defines classes for describing settings.
- base.settings defines shared settings.
2016-11-08 10:37:17 -08:00
Jakob Stoklund Olesen
2fe61e83f6 Split out predicates and settings.
- cdsl.predicates defines classes for describing predicates.
- cdsl.settings defines classes for describing settings.
- base.settings defines shared settings.
2016-11-08 10:37:17 -08:00
Jakob Stoklund Olesen
ac59376c46 Move ValueType into a new cdsl top-level module.
We want to separate the Python classes that make up the DSL used to
define the Cretonne language from the concrete definitions.

- cdsl.types defines the ValueType class hierarchy.
- base.types defines the concrete types.
2016-11-08 10:12:47 -08:00
Jakob Stoklund Olesen
f8545574b5 Move ValueType into a new cdsl top-level module.
We want to separate the Python classes that make up the DSL used to
define the Cretonne language from the concrete definitions.

- cdsl.types defines the ValueType class hierarchy.
- base.types defines the concrete types.
2016-11-08 10:12:47 -08:00
Jakob Stoklund Olesen
6419ba12bc Resolve import cycles. 2016-11-08 09:06:28 -08:00
Jakob Stoklund Olesen
1e1830aaa6 Resolve import cycles. 2016-11-08 09:06:28 -08:00
Jakob Stoklund Olesen
4389079647 Add more Python type annotations. 2016-11-08 08:52:21 -08:00
Jakob Stoklund Olesen
01494b1a47 Add more Python type annotations. 2016-11-08 08:52:21 -08:00
Jakob Stoklund Olesen
15c635f537 Check for unsupported value transformations.
Add an assertion for the value placements that we don't support yet.

1. A primary result in the source pattern becomes a secondary result in
   the destination.
2. A secondary result becomes a secondary result, and the destination
   instruction is not exactly matching the source.
2016-11-04 17:39:20 -07:00
Jakob Stoklund Olesen
1e2f3c0ed4 Check for unsupported value transformations.
Add an assertion for the value placements that we don't support yet.

1. A primary result in the source pattern becomes a secondary result in
   the destination.
2. A secondary result becomes a secondary result, and the destination
   instruction is not exactly matching the source.
2016-11-04 17:39:20 -07:00
Jakob Stoklund Olesen
be3577ad7e Resolve value aliases when legalizing instructions.
Since we're deconstructing an instruction anyway, go ahead and resolve
any value aliases on its arguments before we construct the replacement
instructions.
2016-11-04 15:54:58 -07:00
Jakob Stoklund Olesen
7bbbe97d2f Resolve value aliases when legalizing instructions.
Since we're deconstructing an instruction anyway, go ahead and resolve
any value aliases on its arguments before we construct the replacement
instructions.
2016-11-04 15:54:58 -07:00