def vinst(self, i): loc = get_loc(i) if self.skip_entry: if loc.loc_addr == self.end_loc.loc_addr: bn = 'BB_' + str(cfg.counter) cfg.counter += 1 b = Types.Bblock('', bn, loc, loc, i) self.bb_list.insert(0, b) else: self.entry_loc = loc self.entry_instr = i self.found_entry = True self.skip_entry = False self.last_loc = loc return self.help_exit( i) if Opcode_utils.is_control_transfer_op(i[0], i[1]) else i elif loc.loc_addr == self.end_loc.loc_addr: return self.help_exit(i) elif self.bb_entry(i): self.help_entry(i) return self.help_exit(i) if Opcode_utils.is_control_transfer_op( i[0], i[1]) else i elif isinstance(i, (Types.DoubleInstr, Types.SingleInstr)) and self.bb_exit(i[0], i[1]): return self.help_exit(i) self.last_loc = loc return i
def help_exit(self, i): loc = get_loc(i) if self.found_entry: self.last_loc = loc bn = 'BB_' + str(cfg.counter) cfg.counter += 1 b = Types.Bblock('', bn, self.entry_loc, self.last_loc, self.entry_instr) self.bb_list.insert(0, b) self.found_entry = False self.skip_entry = True elif loc.loc_addr == self.end_loc.loc_addr: bn = 'BB_' + str(cfg.counter) cfg.counter += 1 b = Types.Bblock('', bn, loc, loc, i) self.bb_list.insert(0, b) else: self.last_loc = loc return i
def help_entry(self, i): if self.found_entry: bn = 'BB_' + str(cfg.counter) cfg.counter += 1 b = Types.Bblock('', bn, self.entry_loc, self.last_loc, self.entry_instr) self.bb_list.insert(0, b) self.found_entry = True self.entry_instr = i self.entry_loc = get_loc(i) self.last_loc = self.entry_loc return i