From 1140db27ac6a6eeaf25e94e4cc2fff842e14b9e9 Mon Sep 17 00:00:00 2001 From: alexcere <48130030+alexcere@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:45:41 +0200 Subject: [PATCH] Filter split instruction blocks when generating the SFSs --- src/liveness/layout_generation.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/liveness/layout_generation.py b/src/liveness/layout_generation.py index c23524d7..f5fc6a20 100644 --- a/src/liveness/layout_generation.py +++ b/src/liveness/layout_generation.py @@ -344,7 +344,9 @@ def _construct_code_from_block_list(self): json_info[block_name] = block_specification successors = [possible_successor for possible_successor in - [current_block.get_jump_to(), current_block.get_falls_to()] if possible_successor is not None] + [current_block.get_jump_to(), current_block.get_falls_to()] + if possible_successor is not None] + for successor in successors: if successor not in traversed: heapq.heappush(pending_blocks, (self._block_depth[successor], real_depth + 1, successor)) @@ -362,6 +364,15 @@ def build_layout(self): self._block_list.blocks}) nx.nx_agraph.write_dot(renamed_graph, Path(self._dir.parent).joinpath(self._dir.stem + "_stacks.dot")) + + # Skip blocks with split instructions in the JSON information. We must remove + # then at this point because their specification is needed to generate the "_stacks" dot file + split_blocks = set(block_name for block_name, block in self._block_list.blocks.items() + if block.get_jump_type() == "split_instruction_block") + + json_info = {json_name: sfs for json_name, sfs in json_info.items() + if any(json_name in split_block for split_block in split_blocks)} + return json_info