示例#1
0
def find_dominators(blocks):
    firstblk = min(blocks.keys())
    doms = {}
    for b in blocks:
        doms[b] = set()

    doms[firstblk].add(firstblk)
    allblks = set(blocks)

    remainblks = frozenset(blk.offset for blk in utils.dict_values(blocks)
                           if blk.offset != firstblk)
    for blk in remainblks:
        doms[blk] |= allblks

    changed = True
    while changed:
        changed = False
        for blk in remainblks:
            d = doms[blk]
            ps = [doms[p] for p in blocks[blk].incoming if p in doms]
            if not ps:
                p = set()
            else:
                p = functools.reduce(set.intersection, ps)
            new = set([blk]) | p
            if new != d:
                doms[blk] = new
                changed = True

    return doms
示例#2
0
def find_dominators(blocks):
    firstblk = min(blocks.keys())
    doms = {}
    for b in blocks:
        doms[b] = set()

    doms[firstblk].add(firstblk)
    allblks = set(blocks)

    remainblks = frozenset(blk.offset
                           for blk in utils.dict_values(blocks)
                           if blk.offset != firstblk)
    for blk in remainblks:
        doms[blk] |= allblks

    changed = True
    while changed:
        changed = False
        for blk in remainblks:
            d = doms[blk]
            ps = [doms[p] for p in blocks[blk].incoming if p in doms]
            if not ps:
                p = set()
            else:
                p = functools.reduce(set.intersection, ps)
            new = set([blk]) | p
            if new != d:
                doms[blk] = new
                changed = True

    return doms
示例#3
0
 def dump(self):
     print('---- type variables ----')
     pprint(utils.dict_values(self.typevars))
示例#4
0
 def dump(self):
     print('---- type variables ----')
     pprint(utils.dict_values(self.typevars))