def make_bcode_block_cfg(instructions):
dbs = {b.offset: b for b in instructions}
cfg = nx.DiGraph([(b.offset, dbs[j].offset, {'stack_effect': stack_effect})
for b in dbs.values()
for (j, stack_effect) in b.next_list() if dbs.get(j)])
nx.set_node_attributes(cfg, name='BCode', values=dbs)
update_stackdepth(cfg)
# each node will hold a block of dictionaries - bcode and stack_depth
basic_block_cfg = gu.contract_chains(cfg, blockname=BLOCKNAME)
return basic_block_cfg
评论列表
文章目录