Move the CPUMode reference from EncRecipe to the Encoding itself, allowing
EncRecipes to be shared between CPU modes. At least RISC-V should be able to
share some recipes between RV32 and RV64 modes.
Require this trait on the value type stored in an EntityMap to 'unlock' the
methods intended for primary entity maps that are allowed to create references
with the 'push method.
This prevents accidentally depending on these methods in secondary maps.
This iterator enumerates all EBB references whether they are in the layout or
not. That is usually not what is needed when working with the CFG.
It is better to iterate over EBB referrences in layout order, or in reverse
post-order and then call the get_predecessors() method for each Ebb reference.
See the new implementation of print_cfg::cfg_connections().
Create a secondary entity map with space reserved for a known range of entity
references.
Add dfg.num_ebbs() and dfg.num_insts() methods to provide capacities.
Rather than switching on instruction formats to discover the destination of a
branch, use the analyze_branch method which returns a BranchInfo enum with just
the relevant information.
This makes CFG algorithms independent of future instruction formats for
branches. Only analyze_branch needs to be updated when adding a new format.
- Add a ir::jumptable module with a JumpTableData struct representing the vector
of destinations.
- Add an entity map of jump tables to the Function.
- Parse and write jump tables in the function preamble.
- Rewrite EBB references in jumptables after parsing.
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.