Jakob Stoklund Olesen
11f65fff20
Remove the cfg::predecessors_iter() method and iterator.
...
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().
2016-08-01 15:18:34 -07:00
Morgan Phillips
967a7c64d4
Add a dominator tree implementation.
2016-07-31 21:40:11 -07:00
Morgan Phillips
a8beb542a5
Clean up the CFG representation.
2016-07-31 21:31:18 -07:00
Morgan Phillips
2f07a3b675
Remove innacurate comments.
2016-07-28 17:51:50 -07:00
Morgan Phillips
7936444e1f
Simplify the reverse_postorder_ebbs implementation.
2016-07-28 17:49:25 -07:00
Morgan Phillips
1027fc7472
Avoid cloning levels
2016-07-26 17:13:11 -07:00
Morgan Phillips
a9842ff363
Fix broken reverse_postorder_ebbs implementation.
...
The previous implementation was actually a reverse preorder walk.
2016-07-26 02:54:42 -07:00
Morgan Phillips
1f0e344b24
Cargo-fmt and cleanup.
2016-07-25 18:51:58 -07:00
Morgan Phillips
26c350833a
Change variable name to something more descriptive.
2016-07-25 01:05:15 -07:00
Morgan Phillips
aa730ec2c4
make postorder_ebbs into actually reverse_postorder_ebbs.
...
This is a more accurate description. Further return the ebbs in a
btreemap so that the index of each Ebb (its order of visitation) is
quick to lookup.
2016-07-25 00:41:34 -07:00
Jakob Stoklund Olesen
8d93fe9685
Add an analyze_branch method to InstructionData.
...
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.
2016-07-22 15:38:53 -07:00
Jakob Stoklund Olesen
8296e92ddc
Move entry_block() into Layout.
...
The single entry block in a function is simply the first block in the layout.
Remove the 'entry' keyword from the textual IL, the lexer and parser.
2016-07-22 10:06:51 -07:00
Jakob Stoklund Olesen
27cb00ef42
Rename the 'repr' module to 'ir'.
...
This module and its submodules define the Intermidiate Representation of the
Cretonne IL.
2016-07-22 09:34:28 -07:00
Morgan Phillips
3d59a95b0d
Replace btreesets with vectors.
2016-07-21 22:44:13 -07:00
Morgan Phillips
4de89a7f96
Cargo-fmt fixes
2016-07-21 15:24:07 -07:00
Morgan Phillips
5037cc4db6
Add support for postorder traversal of the cfg.
2016-07-21 15:22:27 -07:00
Morgan Phillips
a4126108a0
Track predecessors as well as successors in the CFG
2016-07-21 12:36:51 -07:00
Morgan Phillips
505d49ec41
Use EntityMap instead of BTreeMap
2016-07-21 12:08:02 -07:00
Jakob Stoklund Olesen
28069ff2a0
Move IR modules under repr/.
...
Use the cretonne::repr module as a common namespace for sub-modules defining the
in-memory representation of Cretonn IL.
2016-07-19 14:10:30 -07:00
Jakob Stoklund Olesen
28804e0b41
Use DataFlowGraph in Function.
...
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.
2016-07-19 13:05:28 -07:00
Jakob Stoklund Olesen
652ebbdc27
Use EBB layout order almost everywhere.
...
The ebbs_numerically() function was a workaround for the unimplemented EBB layout
order.
2016-07-18 18:52:35 -07:00
Jakob Stoklund Olesen
d73c2c9dc0
Replace inst_order with Layout in Function.
...
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.
2016-07-18 18:23:32 -07:00
Morgan Phillips
ea3d2f0bbd
Move test utility functions to their own module
2016-07-18 14:28:00 -07:00
Jakob Stoklund Olesen
4358a4d96e
Implement EntityRef for most of the entities module.
...
The only exception is Value which has two dimensions.
2016-07-15 16:03:14 -07:00
Morgan Phillips
985606b12c
Replace Results with assertions in invariant cases.
...
It seems reasonable that certain non-recoverable errors during the building of the
CFG should crash.
2016-07-13 11:04:39 -07:00
Morgan Phillips
24b421bd68
Remove misleading test comments
2016-07-12 14:46:24 -07:00
Morgan Phillips
522227c965
Cargo-fmt fixes
2016-07-12 14:42:49 -07:00
Morgan Phillips
e4a9c5c13c
Add a Control Flow Graph representation.
...
The CFG must be instantiated against an existing function but may be
modified after creation
2016-07-12 14:37:37 -07:00