diff --git a/parser/cfg_block.py b/parser/cfg_block.py index 8b6417c4..96f6cc90 100644 --- a/parser/cfg_block.py +++ b/parser/cfg_block.py @@ -135,11 +135,14 @@ def _get_vars_spec(self, uninter_instructions): - def _build_spec_for_block(self, instructions): + def _build_spec_for_block(self, instructions, map_instructions: Dict): + """ + Builds the specification for a block. "map_instructions" is passed as an argument + to reuse declarations from other blocks, as we might have split the corresponding basic block + """ spec = {} uninter_functions = [] - map_instructions = {} instrs_idx = {} out_idx = 0 @@ -217,7 +220,7 @@ def _build_spec_for_block(self, instructions): def build_spec(self): ins_seq = [] - + map_instructions = {} specifications = {} cont = 0 @@ -227,7 +230,7 @@ def build_spec(self): ins = self._instructions[i] if ins.get_op_name().upper() in constants.split_block: if ins_seq != []: - r = self._build_spec_for_block(ins_seq) + r = self._build_spec_for_block(ins_seq, map_instructions) specifications["block"+str(self.block_id)+"_"+str(cont)] = r cont +=1 print("block"+str(self.block_id)+"_"+str(cont)) @@ -237,7 +240,7 @@ def build_spec(self): else: ins_seq.append(ins) - r = self._build_spec_for_block(ins_seq) + r = self._build_spec_for_block(ins_seq, map_instructions) specifications["block"+str(self.block_id)+"_"+str(cont)] = r print("block"+str(self.block_id)+"_"+str(cont)) print(json.dumps(r, indent=4))