Commit Graph

8 Commits

Author SHA1 Message Date
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
152aabbfc0 Add arguments() and arguments_mut() methods.
Provide a generic way of accessing the value arguments on an
instruction. This is provided as two slice references. One for the fixed
arguments and one for any VariableArgs.

The arguments() methods return an array of two slices which is a bit
awkward. Also provide an each_arg() method which passes each argument
value to a closure.
2016-11-04 14:16:49 -07:00
Jakob Stoklund Olesen
125fe64121 Legalization pattern emission WIP.
Begin emitting legalization patterns in the form of two functions,
'expand' and 'narrow' that are included in legalizer.rs.

The generated code compiles, but it is not fully working yet. We need to
deal with the special cases of instructions producing multiple results.
2016-11-03 19:13:54 -07:00
Jakob Stoklund Olesen
3da569de06 Require documentation on cretonne public items. 2016-10-26 19:10:06 -07:00
Jakob Stoklund Olesen
61f5eeee2f Properly infer result type for single-result instructions.
Polymorphic single-result instructions don't always return the
controlling type variable as their first result. They may use a derived
type variable, as for example icmp does.
2016-10-21 11:10:26 -07:00
Jakob Stoklund Olesen
6db94bb980 Switch InstrBuilder to the one-shot builder pattern.
All the InstrBuilder methods now consume the builder, and the non-leaf
methods return the dfg mutable reference they were holding.

This makes it possible to construct instruction builders that are only
safe to use once because they are doing more advanced value rewriting.
2016-10-19 19:33:48 -07:00
Jakob Stoklund Olesen
58168bcd07 Generate an InstBuilder trait.
All of the instruction format an opcode methods are emitted as an
InstBuilder trait instead of adding them to the Bulder struct directly.
The methods only make use of the InstBuilderBase methods to create new
instructions.

This makes it possible to reuse the InstBuilder trait for different ways
of inserting instructions.
2016-10-19 18:21:17 -07:00
Jakob Stoklund Olesen
e7f30a40b4 Move the 'meta' dir to 'lib/cretonne/meta'.
The 'lib/cretonne' directory will be the new root of a stand-alone
cretonne crate containg both Python and Rust sources.

This is in preparation for publishing crates on crates.io.
2016-10-17 14:19:23 -07:00