Replace the three tables instructions, extended_basic_blocks, and
extended_values with a single 'dfg' public member.
Clients using Function are changed to refer to func.layout and func.dfg
respectively.
The DFG keeps track of instruction definitions, values, and EBBs.
Store the primary definition of each instruction: Opcode and operands.
Track SSA values as either the result of an instruction or EBB arguments.
There are two kinds of entity maps:
- A primary map is used to allocate entity references and store the primary
entity data. This map only grows when adding new entities with 'push'.
- A secondary map contains additional information about entities in a primary
map. This map always grows with 'ensure', making default entries for any
unknown primary entities.
Only require the 'Default + Clone' traits for values stored in a secondary map.
Also remove the 'grow automatically' feature of the IndexMut implementation.
This means that clients need to call 'ensure' whenever using a potentially
unknown entity reference.
The 'grow automatically' feature could not be implemented for the Index trait,
and it seems unfortunate to have different semantics for Index and IndexMut.
The Layout also handles EBB layout, so new append_ebb calls are necessary.
- Rewrite callers to use the public data member 'layout'.
- Implement Debug for Function in terms of the write module to avoid deriving
it.
This is the opposite of unwrap(). It converts the ad-hoc null references like
NO_EBB and NO_INST into the more standard Option<Ebb> type which unfortunately
takes twice as much space in data structures.
This supports the pattern of creating structs wrapping a u32 and using them as
indexes into a vector of entities. These entity references should implement the
EntityRef trait.
The EntityMap is a generic map from an EntityRef to some value type. It expects
densely indexed entities and uses a Vec to represent the mapping compactly.
This was supposed to make verification fast, but WebAssembly is no longer in
this form since it's blocks can produce values.
Also, computing a flow graph and dominator tree is really fast anyway.
It is possible to return multiple values from a function, so ReturnData contains
a VariableArgs instance.
We don't want return instructions to appear as 'return (v1)', so tweak the
printing of VariableArgs so the parantheses are added externally.
We llow forward references to values and EBBs, so it is not possible to rewrite
these from the source domain to the in-memory domain during parsing.
Instead go through all the instructions after parsing everything and rewrite the
value and EBB references when everything has been created and mapped.
The latest Sphinx 1.4.4 produces lots of warnings about four-column indices.
We'll wait for Read the Docs to upgrade their systems before moving to the newer
Sphinx version.
Naming is interesting here. Since 'truncate' refers to removing the least
significant digits, use 'ireduce' instead. The 'extend' use is fairly
established. Don't abbreviate, avoid unfortunate modern vernacular.
Move test-all.sh to the top level directory, and also run the parser tests from
this script.
Use a release build of cton-util to run the parser tests. As we accumulate many
tests in the tests directory tree, this will mean they can still be run quickly.
Point Travis config to the new test script.
This instruction uses two type variables: input and output. Make sure that our
parser can handle it. The output type variable annotation is mandatory.
Add a ValueTypeSet::example() method which is used to provide better diagnostics
for a missing type variable.
Add new intcc and floatcc operand types for the immediate condition codes on
these instructions.
Add new IntCompare and FloatCompare instruction formats.
Add a generic match_enum() parser function that can match any identifier-like
enumerated operand kind that implements FromStr.
Define the icmp and fcmp instructions in case.py. Include documentation for the
condition codes with these two instructions.
The icmp and fmp instructions use different kinds of condition codes because
integers and floating point values behave differently.
Add a CondCode trait implementing shared behavior.
These instruction formats take immediate lane index operands. We store these as
u8 fields and require them to be in decimal format in the source. No hexadecimal
lane indexes are supported.