Commit Graph

11145 Commits

Author SHA1 Message Date
Keith Yeung
e1d17b2acf Make value aliases during references rewriting 2017-03-14 11:56:09 -07:00
Keith Yeung
8e38c7907d Create alias HashMap in parser context 2017-03-14 11:56:09 -07:00
Keith Yeung
a18ad5a306 Create alias HashMap in parser context 2017-03-14 11:56:09 -07:00
Keith Yeung
50e043477e Parse instruction results separately from instructions 2017-03-14 11:56:09 -07:00
Keith Yeung
ce1ad37863 Parse instruction results separately from instructions 2017-03-14 11:56:09 -07:00
Jakob Stoklund Olesen
010861d58e Upgrade to rustfmt 0.8.0.
Lots of changes this time.

Worked around what looks like a rustfmt bug in parse_inst_operands where
a large match was nested inside Ok().
2017-03-14 10:48:05 -07:00
Jakob Stoklund Olesen
32709a56ca Upgrade to rustfmt 0.8.0.
Lots of changes this time.

Worked around what looks like a rustfmt bug in parse_inst_operands where
a large match was nested inside Ok().
2017-03-14 10:48:05 -07:00
Angus Holder
477fb4d5da Expanded instruction integrity checking in the verifier, now verifying result types and entity references. 2017-03-14 09:12:33 -07:00
Angus Holder
849f3f3e9b Expanded instruction integrity checking in the verifier, now verifying result types and entity references. 2017-03-14 09:12:33 -07:00
Jakob Stoklund Olesen
d3df198747 Add a grow_at() method to EntityList.
This method opens up a hole in the middle of a list where new elements
can be written.
2017-03-13 16:37:48 -07:00
Jakob Stoklund Olesen
d9a0c0d056 Add a grow_at() method to EntityList.
This method opens up a hole in the middle of a list where new elements
can be written.
2017-03-13 16:37:48 -07:00
Jakob Stoklund Olesen
1baedc3ca5 Add take_value_list and put_value_list methods.
Any code that needs to manipulate a variable argument list on an
instruction will need to remove the instruction's value list first,
change the list, and then put it back on the instruction. This is
required to avoid fighting the borrow checker over mutable locks on the
DataFlowGraph and its value list pool.

Add a generated InstructionData::take_value_list() method which lifts
out and existing value list and returns it, levaing an empty list in its
place, like Option::take() does it.

Add a generated InstructionData::put_value_list() which puts it back,
verifying that no existing value list is overwritten.
2017-03-13 14:07:14 -07:00
Jakob Stoklund Olesen
5f2e37e05c Add take_value_list and put_value_list methods.
Any code that needs to manipulate a variable argument list on an
instruction will need to remove the instruction's value list first,
change the list, and then put it back on the instruction. This is
required to avoid fighting the borrow checker over mutable locks on the
DataFlowGraph and its value list pool.

Add a generated InstructionData::take_value_list() method which lifts
out and existing value list and returns it, levaing an empty list in its
place, like Option::take() does it.

Add a generated InstructionData::put_value_list() which puts it back,
verifying that no existing value list is overwritten.
2017-03-13 14:07:14 -07:00
Angus Holder
1e1a1a8797 Added ControlFlowGraph::recompute_ebb for incremental CFG updates. 2017-03-13 09:01:13 -07:00
Angus Holder
404a88f581 Added ControlFlowGraph::recompute_ebb for incremental CFG updates. 2017-03-13 09:01:13 -07:00
Angus Holder
11a0daa7fd Define boolean conversion instructions. 2017-03-11 10:25:55 -08:00
Angus Holder
27e7945f63 Define boolean conversion instructions. 2017-03-11 10:25:55 -08:00
Davide Italiano
46525b0153 [B-tree] Initial comment to describe the design choices. 2017-03-10 12:48:32 -08:00
Davide Italiano
1ebf0fd815 [B-tree] Initial comment to describe the design choices. 2017-03-10 12:48:32 -08:00
Jakob Stoklund Olesen
667d6f9381 Remove the value_list and boxed_storage format flags.
The value_list flag can be inferred from the presence of VARIABLE_ARGS
in the operand list.

The boxed_storage flag is obsolete. We don't need boxed storage anywhere
no that we have value lists instead.
2017-03-10 12:43:05 -08:00
Jakob Stoklund Olesen
1b6702ceba Remove the value_list and boxed_storage format flags.
The value_list flag can be inferred from the presence of VARIABLE_ARGS
in the operand list.

The boxed_storage flag is obsolete. We don't need boxed storage anywhere
no that we have value lists instead.
2017-03-10 12:43:05 -08:00
Jakob Stoklund Olesen
910e4e6174 Coalesce some formats into MultiAry.
Allow some flexibility in the signature matching for instruction
formats. In particular, look for a value list format as a second chance
option.

The Return, ReturnReg, and TernaryOverflow formats all fit the single
MultiAry catch-all format for instructions without immediate operands.
2017-03-10 12:32:44 -08:00
Jakob Stoklund Olesen
519eb1934b Coalesce some formats into MultiAry.
Allow some flexibility in the signature matching for instruction
formats. In particular, look for a value list format as a second chance
option.

The Return, ReturnReg, and TernaryOverflow formats all fit the single
MultiAry catch-all format for instructions without immediate operands.
2017-03-10 12:32:44 -08:00
Jakob Stoklund Olesen
9fbfd0d2a6 Remove the vconst instruction and the UnaryImmVector format.
No instruction sets actually have single instructions for materializing
vector constants. You always need to use a constant pool.

Cretonne doesn't have constant pools yet, but it will in the future, and
that is how vector constants should be represented.
2017-03-10 11:57:49 -08:00
Jakob Stoklund Olesen
6021da8e1c Remove the vconst instruction and the UnaryImmVector format.
No instruction sets actually have single instructions for materializing
vector constants. You always need to use a constant pool.

Cretonne doesn't have constant pools yet, but it will in the future, and
that is how vector constants should be represented.
2017-03-10 11:57:49 -08:00
Jakob Stoklund Olesen
c50e5f3f66 Separate immediate and value operands in the instruction format.
Instruction formats are now identified by a signature that doesn't
include the ordering of value operands relative to immediate operands.

This means that the BinaryRev instruction format becomes redundant, so
delete it. The isub_imm instruction was the only one using that format.
Rename it to irsub_imm to make it clear what it does now that it is
printed as 'irsub_imm v2, 45'.
2017-03-10 11:20:39 -08:00
Jakob Stoklund Olesen
60daf3e76b Separate immediate and value operands in the instruction format.
Instruction formats are now identified by a signature that doesn't
include the ordering of value operands relative to immediate operands.

This means that the BinaryRev instruction format becomes redundant, so
delete it. The isub_imm instruction was the only one using that format.
Rename it to irsub_imm to make it clear what it does now that it is
printed as 'irsub_imm v2, 45'.
2017-03-10 11:20:39 -08:00
Jakob Stoklund Olesen
dcdaeee4af Eliminate InstructionFormat.value_operands and .kinds.
Part of the refactoring of instruction formats. This list is now stored
in the instruction itself as value_opnums.
2017-03-10 10:46:45 -08:00
Jakob Stoklund Olesen
c480f2264a Eliminate InstructionFormat.value_operands and .kinds.
Part of the refactoring of instruction formats. This list is now stored
in the instruction itself as value_opnums.
2017-03-10 10:46:45 -08:00
Jakob Stoklund Olesen
cdb4cce3dc Change index domain for typevar_operand.
An instruction format is now seen as having two separate operand lists:
immediates and values. Change InstructionFormat.typevar_operand to be a
pure index into the value list.
2017-03-10 10:41:39 -08:00
Jakob Stoklund Olesen
405cc14522 Change index domain for typevar_operand.
An instruction format is now seen as having two separate operand lists:
immediates and values. Change InstructionFormat.typevar_operand to be a
pure index into the value list.
2017-03-10 10:41:39 -08:00
Jakob Stoklund Olesen
da693f72e2 Eliminate InstructionFormat.members.
This field is no longer needed. We can use imm_members to get the names
of immediate fields, and num_value_operands to access values.
2017-03-10 10:04:30 -08:00
Jakob Stoklund Olesen
2c845ad65c Eliminate InstructionFormat.members.
This field is no longer needed. We can use imm_members to get the names
of immediate fields, and num_value_operands to access values.
2017-03-10 10:04:30 -08:00
Jakob Stoklund Olesen
af3fa6b83d Avoid using 'members' and 'value_operands' in the legalizer.
Use the new Instruction fields instead.
2017-03-10 09:56:37 -08:00
Jakob Stoklund Olesen
c1fa8fbb61 Avoid using 'members' and 'value_operands' in the legalizer.
Use the new Instruction fields instead.
2017-03-10 09:56:37 -08:00
Jakob Stoklund Olesen
d9c61373e2 Change InstBuilder low-level format constructor signatures.
The per-instruction format low-level constructors in InstBuilder should
be independent of the relative ordering of value and immediate operands
in order to prepare for the future instruction format merger.

Reorder their arguments such that all the immediate operands are placed
before the value operands.

For instruction formats that use a value list representation, just take
a single ValueList argument. The value lists are created by the
individual instruction constructors. This means that the format
constructor doesn't care how many of the instructions operands are
'fixed' and how many are 'variable' arguments.
2017-03-10 09:34:30 -08:00
Jakob Stoklund Olesen
be7ff71b15 Change InstBuilder low-level format constructor signatures.
The per-instruction format low-level constructors in InstBuilder should
be independent of the relative ordering of value and immediate operands
in order to prepare for the future instruction format merger.

Reorder their arguments such that all the immediate operands are placed
before the value operands.

For instruction formats that use a value list representation, just take
a single ValueList argument. The value lists are created by the
individual instruction constructors. This means that the format
constructor doesn't care how many of the instructions operands are
'fixed' and how many are 'variable' arguments.
2017-03-10 09:34:30 -08:00
Jakob Stoklund Olesen
054edeb765 Add value_opnums and imm_opnums fields to Instruction.
These two tuples contain operand indexes of the explicit value operands
and immediate operands respectively. We can no longer use the
instruction format value_operands field.
2017-03-10 09:34:30 -08:00
Jakob Stoklund Olesen
2b209c791d Add value_opnums and imm_opnums fields to Instruction.
These two tuples contain operand indexes of the explicit value operands
and immediate operands respectively. We can no longer use the
instruction format value_operands field.
2017-03-10 09:34:30 -08:00
Jakob Stoklund Olesen
515e34f221 Clean up lifetimes a bit.
No functional change.
2017-03-10 09:34:30 -08:00
Jakob Stoklund Olesen
e217b04347 Clean up lifetimes a bit.
No functional change.
2017-03-10 09:34:30 -08:00
Davide Italiano
4ad8362e09 Initial B-tree interface. 2017-03-10 09:15:14 -08:00
Davide Italiano
f4d43101d0 Initial B-tree interface. 2017-03-10 09:15:14 -08:00
Jakob Stoklund Olesen
618fefb7da Simplify the arguments() return type.
Now that variable arguments are always stored in a value list with the
fixed arguments, we no longer need the arcane [&[Value]; 2] return type.

Arguments are always stored contiguously, so just return a &[Value]
slice.

Also remove the each_arg() methods which were just trying to make it
easier to work with the old slice pair.
2017-03-09 22:09:22 -08:00
Jakob Stoklund Olesen
f451cf42c8 Simplify the arguments() return type.
Now that variable arguments are always stored in a value list with the
fixed arguments, we no longer need the arcane [&[Value]; 2] return type.

Arguments are always stored contiguously, so just return a &[Value]
slice.

Also remove the each_arg() methods which were just trying to make it
easier to work with the old slice pair.
2017-03-09 22:09:22 -08:00
Jakob Stoklund Olesen
f3d7485494 Python InstructionFormat refactoring.
Make some changes that will make it easier to get rid of the
'value_operands' and 'members' fields in the Python InstructionFormat
class. This is necessary to be able to combine instruction formats that
all use a value list representation, but with different fixed value
operands. The goal is to eventually identify formats by a new signature:

   (multiple_results, imm_kinds, num_value_operands)

Start by adding new fields:

- imm_members and imm_kinds are lists describing the format operands,
  excluding any values and variable_args operands.
- num_value_operands is the number of fixed value operands, or None in a
  has_value-list format.

Use these new members in preference to the old ones where possible.
2017-03-09 21:54:22 -08:00
Jakob Stoklund Olesen
703762a67c Python InstructionFormat refactoring.
Make some changes that will make it easier to get rid of the
'value_operands' and 'members' fields in the Python InstructionFormat
class. This is necessary to be able to combine instruction formats that
all use a value list representation, but with different fixed value
operands. The goal is to eventually identify formats by a new signature:

   (multiple_results, imm_kinds, num_value_operands)

Start by adding new fields:

- imm_members and imm_kinds are lists describing the format operands,
  excluding any values and variable_args operands.
- num_value_operands is the number of fixed value operands, or None in a
  has_value-list format.

Use these new members in preference to the old ones where possible.
2017-03-09 21:54:22 -08:00
Jakob Stoklund Olesen
ec5ee70a5c Remove some has_value_list workarounds.
Now that all variable_args formats use has_value_list, we can remove
some workarounds that allowed the old boxed_storage form.
2017-03-09 19:12:00 -08:00
Jakob Stoklund Olesen
cd06b176ac Remove some has_value_list workarounds.
Now that all variable_args formats use has_value_list, we can remove
some workarounds that allowed the old boxed_storage form.
2017-03-09 19:12:00 -08:00
Jakob Stoklund Olesen
d301fb9f2b Convert return formats to value lists.
With the Return and ReturnReg formats converted to using value lists for
storing their arguments, thee are no remaining instruction formats with
variable argument lists in boxed storage.

The Return and ReturnReg formats are also going to be merged since
they are identical now.
2017-03-09 15:56:33 -08:00