Skip to content

Commit

Permalink
Assign stacks in build spec
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcere committed Sep 16, 2024
1 parent 7acabd9 commit 613b2cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/liveness/layout_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,12 +307,9 @@ def _construct_code_from_block(self, block: CFGBlock, input_stacks: Dict[str, Li
output_stacks[block_id] = output_stack

# We build the corresponding specification
block_json, out_idx, new_tag_idx = block.build_spec(self._tags_dict, self._tags_idx)
block_json, out_idx, new_tag_idx = block.build_spec(self._tags_dict, self._tags_idx, input_stack, output_stack)
self._tags_idx = new_tag_idx

block_json["src_ws"] = input_stack
block_json["tgt_ws"] = output_stack

return block_json

def _construct_code_from_block_list(self):
Expand Down
5 changes: 4 additions & 1 deletion src/parser/cfg_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,16 @@ def _include_jump_tag(self, block_spec: Dict, out_idx: int, block_tags_dict: Dic

# return specifications, block_tag_idx

def build_spec(self, block_tags_dict: Dict, block_tag_idx: int) -> Dict[str, Any]:
def build_spec(self, block_tags_dict: Dict, block_tag_idx: int, initial_stack: List[str],
final_stack: List[str]) -> Tuple[Dict[str, Any], int, int]:

map_instructions = {}

out_idx = 0

spec, out_idx, map_positions = self._build_spec_for_sequence(self._instructions, map_instructions, out_idx)
spec["src_ws"] = initial_stack
spec["tgt_ws"] = final_stack

sto_deps, mem_deps = self._process_dependences(self._instructions, map_positions)
spec["storage_dependences"] = sto_deps
Expand Down

0 comments on commit 613b2cc

Please sign in to comment.