Commit Graph

11145 Commits

Author SHA1 Message Date
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
dc2afb24d9 Add a ref_slice module.
Utility functions for converting &T to an &[T] slice with a single
element.
2016-11-04 12:32:09 -07:00
Jakob Stoklund Olesen
c995cb6f43 Add a ref_slice module.
Utility functions for converting &T to an &[T] slice with a single
element.
2016-11-04 12:32:09 -07:00
Jakob Stoklund Olesen
b63d62c9e8 Advance the insertion cursor after replacinf an instruction.
When expanding iadd_cout, the original instruction is replaced with an
iadd, and an icmp is inserted after the iadd.

Make sure we advance the insertion position after replacing iadd_cout so
the icmp gets inserted *after* iadd.
2016-11-04 11:56:21 -07:00
Jakob Stoklund Olesen
2b8732ae13 Advance the insertion cursor after replacinf an instruction.
When expanding iadd_cout, the original instruction is replaced with an
iadd, and an icmp is inserted after the iadd.

Make sure we advance the insertion position after replacing iadd_cout so
the icmp gets inserted *after* iadd.
2016-11-04 11:56:21 -07:00
Jakob Stoklund Olesen
cb718b869c TestFile preamble comments apply to all functions.
Include the test file preamble comments when building a filecheck
instance for every function in the file.

This makes it possible to define common regex variables in the preamble
and use these definitions for all the functions.
2016-11-04 10:49:09 -07:00
Jakob Stoklund Olesen
a038279717 TestFile preamble comments apply to all functions.
Include the test file preamble comments when building a filecheck
instance for every function in the file.

This makes it possible to define common regex variables in the preamble
and use these definitions for all the functions.
2016-11-04 10:49:09 -07:00
Jakob Stoklund Olesen
8d6d59cc7a Gather comments in the preamble of a test file.
Comments preceding the first function are not associated with any
specific entity in the file. Put them in a TestFile::preamble_comments
field.
2016-11-04 10:42:31 -07:00
Jakob Stoklund Olesen
c1b7080bf6 Gather comments in the preamble of a test file.
Comments preceding the first function are not associated with any
specific entity in the file. Put them in a TestFile::preamble_comments
field.
2016-11-04 10:42:31 -07:00
Jakob Stoklund Olesen
a2b7769a51 Revisit expanded instructions for legalization.
When an illegal instruction is replaced with other instructions, back up
and revisit the expanded instructions. The new instructions need to have
encodings assigned too.

This also allows for expansions to contain illegal instructions that
need to be legalized themselves.
2016-11-04 09:44:11 -07:00
Jakob Stoklund Olesen
1641365f01 Revisit expanded instructions for legalization.
When an illegal instruction is replaced with other instructions, back up
and revisit the expanded instructions. The new instructions need to have
encodings assigned too.

This also allows for expansions to contain illegal instructions that
need to be legalized themselves.
2016-11-04 09:44:11 -07:00
Jakob Stoklund Olesen
1c57f43643 Add Cursor::set_position.
Make it possible to move a cursor to a new position.

In the current implementation of Layout and Cursor, this is a trivial
operation, but if we switch to a B-tree based function layout, this
involves navigating the tree.
2016-11-04 08:44:01 -07:00
Jakob Stoklund Olesen
63fc81541e Add Cursor::set_position.
Make it possible to move a cursor to a new position.

In the current implementation of Layout and Cursor, this is a trivial
operation, but if we switch to a B-tree based function layout, this
involves navigating the tree.
2016-11-04 08:44:01 -07:00
Jakob Stoklund Olesen
1a9abdd158 Add narrowing legalization patterns for bitwise ops.
RISC-V 32-bit tests for band.i64, bor.i64, bxor.i64.
2016-11-04 08:02:37 -07:00
Jakob Stoklund Olesen
9086c6c8f0 Add narrowing legalization patterns for bitwise ops.
RISC-V 32-bit tests for band.i64, bor.i64, bxor.i64.
2016-11-04 08:02:37 -07:00
Jakob Stoklund Olesen
e59b47c41a Return a Result from the TargetIsa::encode() method.
When an instruction can't be encoded, provide a viable legalization
action in the form of a Legalize enum.
2016-11-03 19:15:36 -07:00
Jakob Stoklund Olesen
e24291fe4c Return a Result from the TargetIsa::encode() method.
When an instruction can't be encoded, provide a viable legalization
action in the form of a Legalize enum.
2016-11-03 19:15:36 -07:00
Jakob Stoklund Olesen
9c02fe3553 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
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
814d1728aa Add a Value::unwrap_direct() method.
When it is known that a value is the first result of an instruction, it
is safe to unwrap the instruction reference.
2016-11-03 19:13:54 -07:00
Jakob Stoklund Olesen
3bb6efba6e Add a Value::unwrap_direct() method.
When it is known that a value is the first result of an instruction, it
is safe to unwrap the instruction reference.
2016-11-03 19:13:54 -07:00
Jakob Stoklund Olesen
0543bb049c Save a reference from a Var to its src and dst defs.
When a Var is used in an XForm, it can be defined in the src or dst or
both patterns, and it is classified accordingly. When a Var is defined,
it is also useful to be able to find the `Def` that defined it.

Add src_def and dst_def reference members to Var, and initialize them in
the private Var copies that XForm creates for itself.

These two members also replace the defctx bitmask.
2016-11-03 12:37:24 -07:00
Jakob Stoklund Olesen
026c899042 Save a reference from a Var to its src and dst defs.
When a Var is used in an XForm, it can be defined in the src or dst or
both patterns, and it is classified accordingly. When a Var is defined,
it is also useful to be able to find the `Def` that defined it.

Add src_def and dst_def reference members to Var, and initialize them in
the private Var copies that XForm creates for itself.

These two members also replace the defctx bitmask.
2016-11-03 12:37:24 -07:00
Jakob Stoklund Olesen
f652dcffe4 Set expectations. 2016-11-02 14:41:48 -07:00
Jakob Stoklund Olesen
f2c7a1d57b Set expectations. 2016-11-02 14:41:48 -07:00
Jakob Stoklund Olesen
318e3b9b33 Classify Vars in patterns.
There's 4 classes of variables, depending on whether they have defs in
the source and destination patterns.

Add more XForm verification: In a legalize XForm, all source defs must
be outputs.

Fix a legalize pattern bug caught by this.
2016-11-02 14:34:48 -07:00
Jakob Stoklund Olesen
1ba8e9e05b Classify Vars in patterns.
There's 4 classes of variables, depending on whether they have defs in
the source and destination patterns.

Add more XForm verification: In a legalize XForm, all source defs must
be outputs.

Fix a legalize pattern bug caught by this.
2016-11-02 14:34:48 -07:00
Jakob Stoklund Olesen
c7d1f90b71 Canonicalize the objects in an RTL list.
Any Apply objects in the input are converted to Defs with empty def
lists.
2016-11-02 14:28:37 -07:00
Jakob Stoklund Olesen
88cbd5a43b Canonicalize the objects in an RTL list.
Any Apply objects in the input are converted to Defs with empty def
lists.
2016-11-02 14:28:37 -07:00
Jakob Stoklund Olesen
e1dae95828 Fix inconsistent instruction name.
The 'fpromote' instruction was renamed from 'fcvt_ftof', but the name
argument was not changed.
2016-11-02 10:45:59 -07:00
Jakob Stoklund Olesen
22e75b1271 Fix inconsistent instruction name.
The 'fpromote' instruction was renamed from 'fcvt_ftof', but the name
argument was not changed.
2016-11-02 10:45:59 -07:00
Jakob Stoklund Olesen
a5675b6138 Add glossary entries for IL and IR. 2016-11-02 09:58:02 -07:00
Jakob Stoklund Olesen
0b7010e367 Add glossary entries for IL and IR. 2016-11-02 09:58:02 -07:00
Jakob Stoklund Olesen
ececaa902d Add type annotations to TypeVar 2016-11-01 14:23:41 -07:00
Jakob Stoklund Olesen
bfeb9e4839 Add type annotations to TypeVar 2016-11-01 14:23:41 -07:00
Jakob Stoklund Olesen
679448af72 Run unittests with Python 3 if it is available.
The check.sh script always runs the Python unittests with 'python', but
if 'python3' is in the path, run it with that too.

Fix a Python 3 compat issue and avoid passing None to max() and min().
Use an explicit intersect() function instead to intersect intervals.
2016-11-01 12:01:40 -07:00
Jakob Stoklund Olesen
b7634ae5c3 Run unittests with Python 3 if it is available.
The check.sh script always runs the Python unittests with 'python', but
if 'python3' is in the path, run it with that too.

Fix a Python 3 compat issue and avoid passing None to max() and min().
Use an explicit intersect() function instead to intersect intervals.
2016-11-01 12:01:40 -07:00
Jakob Stoklund Olesen
cf9ce038e9 Typo 2016-10-28 11:49:35 -07:00
Jakob Stoklund Olesen
c2dc400572 Typo 2016-10-28 11:49:35 -07:00
Benjamin Bouvier
419e686581 Fix a few typos in the docs; 2016-10-28 11:31:22 -07:00
Benjamin Bouvier
de10910324 Fix a few typos in the docs; 2016-10-28 11:31:22 -07:00
Sean Gillespie
4d729bf986 Use items instead of iteritems for Python 3 compatibility 2016-10-28 08:45:37 -07:00
Sean Gillespie
409ce91513 Use items instead of iteritems for Python 3 compatibility 2016-10-28 08:45:37 -07:00
Joel Gallant
65052b8450 Typo fix 2016-10-28 08:38:23 -07:00
Joel Gallant
72479b53ff Typo fix 2016-10-28 08:38:23 -07:00
Benjamin Bouvier
18f32f8b56 Add build instructions in the REAME; 2016-10-28 08:36:21 -07:00
Benjamin Bouvier
2cb126341b Add build instructions in the REAME; 2016-10-28 08:36:21 -07:00
Jakob Stoklund Olesen
baf9195080 Add a document comparing Cretonne and LLVM. 2016-10-27 13:41:39 -07:00
Jakob Stoklund Olesen
2fa707bc4f Add a document comparing Cretonne and LLVM. 2016-10-27 13:41:39 -07:00
Jakob Stoklund Olesen
80823b5fc4 Require documentation on cretonne public items. 2016-10-26 19:10:06 -07:00