Commit Graph

8918 Commits

Author SHA1 Message Date
Morgan Phillips
283f3ea48e Remove uses of EntityMap::len. 2016-08-01 18:04:25 -07:00
Morgan Phillips
80abf8b1f0 Remove uses of EntityMap::len. 2016-08-01 18:04:25 -07:00
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
Jakob Stoklund Olesen
2c1e80b0e0 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
Jakob Stoklund Olesen
bf24ae229c Print CFG edges from func.layout instead of cfg.predecessors_iter.
EBBs not in the layout should never be printed as part of the CFG.
2016-08-01 15:18:34 -07:00
Jakob Stoklund Olesen
02c1bb8f2c Print CFG edges from func.layout instead of cfg.predecessors_iter.
EBBs not in the layout should never be printed as part of the CFG.
2016-08-01 15:18:34 -07:00
Morgan Phillips
e22efd2748 Improve the structure and comments of the module. 2016-08-01 15:00:08 -07:00
Morgan Phillips
e9cfcf4f78 Improve the structure and comments of the module. 2016-08-01 15:00:08 -07:00
Morgan Phillips
f2e9c88b45 Remove println\! 2016-08-01 12:15:08 -07:00
Morgan Phillips
5a38ca2db7 Remove println\! 2016-08-01 12:15:08 -07:00
Morgan Phillips
967a7c64d4 Add a dominator tree implementation. 2016-07-31 21:40:11 -07:00
Morgan Phillips
19a47d57b3 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
0ce01c1b8d Clean up the CFG representation. 2016-07-31 21:31:18 -07:00
Jakob Stoklund Olesen
dae349371f Add EntityMap::with_capacity.
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.
2016-07-29 15:59:09 -07:00
Jakob Stoklund Olesen
bbdae39cb9 Add EntityMap::with_capacity.
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.
2016-07-29 15:59:09 -07:00
Jakob Stoklund Olesen
0ef28f5bde Use sub-shells instead of pushd / popd.
The push and pop commands print the directory stack to stdout, while subshells
and cd is quiet.
2016-07-29 12:35:56 -07:00
Jakob Stoklund Olesen
14027660c5 Use sub-shells instead of pushd / popd.
The push and pop commands print the directory stack to stdout, while subshells
and cd is quiet.
2016-07-29 12:35:56 -07:00
Morgan Phillips
2f07a3b675 Remove innacurate comments. 2016-07-28 17:51:50 -07:00
Morgan Phillips
a9748dff02 Remove innacurate comments. 2016-07-28 17:51:50 -07:00
Morgan Phillips
7abb532fd6 Merge branch 'master' of github.com:stoklund/cretonne into bleh 2016-07-28 17:49:48 -07:00
Morgan Phillips
858d756631 Merge branch 'master' of github.com:stoklund/cretonne into bleh 2016-07-28 17:49:48 -07:00
Morgan Phillips
7936444e1f Simplify the reverse_postorder_ebbs implementation. 2016-07-28 17:49:25 -07:00
Morgan Phillips
82ff64820c Simplify the reverse_postorder_ebbs implementation. 2016-07-28 17:49:25 -07:00
Jakob Stoklund Olesen
0e046dcbcb Documentation typos. 2016-07-27 16:10:02 -07:00
Jakob Stoklund Olesen
ad79ad753d Documentation typos. 2016-07-27 16:10:02 -07:00
Morgan Phillips
1027fc7472 Avoid cloning levels 2016-07-26 17:13:11 -07:00
Morgan Phillips
e94d7c2a99 Avoid cloning levels 2016-07-26 17:13:11 -07:00
Morgan Phillips
b67d07e87a Give the test module a more apt name. 2016-07-26 12:07:18 -07:00
Morgan Phillips
1cd6e35a42 Give the test module a more apt name. 2016-07-26 12:07:18 -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
42b9835363 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
9e19326c30 Fix the test-all script so that it works with directories 2016-07-25 19:19:46 -07:00
Morgan Phillips
71bf589af3 Fix the test-all script so that it works with directories 2016-07-25 19:19:46 -07:00
Morgan Phillips
1f0e344b24 Cargo-fmt and cleanup. 2016-07-25 18:51:58 -07:00
Morgan Phillips
400504d321 Cargo-fmt and cleanup. 2016-07-25 18:51:58 -07:00
Morgan Phillips
d137529bd5 Use cton_reader to simplify cfg traversal tests. 2016-07-25 18:49:39 -07:00
Morgan Phillips
63b58214f7 Use cton_reader to simplify cfg traversal tests. 2016-07-25 18:49:39 -07:00
Morgan Phillips
26c350833a Change variable name to something more descriptive. 2016-07-25 01:05:15 -07:00
Morgan Phillips
bb7ecc8753 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
Morgan Phillips
91ced8df90 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
ae98edf8cc 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
28a5f007c4 Parse the BranchTable instruction format.
Resolve the jump table reference immediately since all jump tables are declared
in the preamble.
2016-07-22 15:16:14 -07:00
Jakob Stoklund Olesen
20fc675fc0 Parse the BranchTable instruction format.
Resolve the jump table reference immediately since all jump tables are declared
in the preamble.
2016-07-22 15:16:14 -07:00
Jakob Stoklund Olesen
f054d32f50 Implement jump tables.
- 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.
2016-07-22 14:48:53 -07:00
Jakob Stoklund Olesen
274671d12a Implement jump tables.
- 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.
2016-07-22 14:48:53 -07:00
Jakob Stoklund Olesen
ba76f444ab Add a keys() iterator to EntityMap. 2016-07-22 14:48:53 -07:00
Jakob Stoklund Olesen
410c1390d1 Add a keys() iterator to EntityMap. 2016-07-22 14:48:53 -07:00