-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Methods for combining blocks after inlining
- Loading branch information
Showing
2 changed files
with
126 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
""" | ||
Preprocess the graph by performing inlining and splitting of blocks | ||
""" | ||
from liveness.liveness_analysis import dot_from_analysis | ||
from parser.cfg import CFG | ||
from cfg_methods.function_inlining import inline_functions | ||
from cfg_methods.sub_block_generation import combine_remove_blocks_cfg, split_blocks_cfg | ||
|
||
|
||
def preprocess_cfg(cfg: CFG, dot_file_dir): | ||
# First we inline the functions | ||
inline_functions(cfg) | ||
dot_file_dir.joinpath("inlined").mkdir(exist_ok=True, parents=True) | ||
liveness_info = dot_from_analysis(cfg, dot_file_dir.joinpath("inlined")) | ||
|
||
# Then we split by sub blocks | ||
split_blocks_cfg(cfg) | ||
dot_file_dir.joinpath("split").mkdir(exist_ok=True, parents=True) | ||
liveness_info = dot_from_analysis(cfg, dot_file_dir.joinpath("split")) | ||
|
||
# Then we combine and remove the blocks from the CFG | ||
combine_remove_blocks_cfg(cfg) | ||
dot_file_dir.joinpath("combined").mkdir(exist_ok=True, parents=True) | ||
liveness_info = dot_from_analysis(cfg, dot_file_dir.joinpath("combined")) | ||
|
||
# Finally, we introduce the jumps, tags and the stack requirements for each block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters