def default(self, n): if isinstance(n, ArithInstr): klass = n.__class__ return [klass(self.dispatch(n.lhs),\ [self.dispatch(a) for a in n.rhs])] else: Visitor.default(self, n)
def default(self, n): if isinstance(n, ArithInstr): klass = n.__class__ if len(n.rhs) > 0: return make_arith(self.color, klass, n.lhs, n.rhs[0]) else: return [n] else: Visitor.default(self, n)
def default(self, n, live): n.live = live if isinstance(n, ArithInstr): return live | free_vars(n.lhs) \ | reduce(lambda a,b: a | b, [free_vars(r) for r in n.rhs], set([])) else: return Visitor.default(self, n, live)
def default(self, n): if isinstance(n, ArithInstr): if n.lhs: lhs = n.lhs.name else: lhs = None if isinstance(n, IntMoveInstr) and isinstance(n.rhs[0], Name): rhs = n.rhs[0].name for v in n.live: if lhs and v != full_reg(lhs) and v != rhs: self.add_interference(v, full_reg(lhs)) self.add_move(full_reg(lhs), rhs) else: for v in n.live: if lhs and v != full_reg(lhs): self.add_interference(v, full_reg(lhs)) else: Visitor.default(self, n)
def default(self, n): if False: print 'visiting ' + repr(n) if isinstance(n, ArithInstr): if n.lhs: lhs = n.lhs.name else: lhs = None if isinstance(n, IntMoveInstr) \ and (isinstance(n.rhs[0], Name) \ or isinstance(n.rhs[0], Register)): rhs = n.rhs[0].name for v in n.live: if lhs and v != full_reg(lhs) and v != rhs: self.add_interference(v, full_reg(lhs)) self.add_move(full_reg(lhs), rhs) else: for v in n.live: if lhs and v != full_reg(lhs): self.add_interference(v, full_reg(lhs)) else: Visitor.default(self, n)
def __init__(self): Visitor.__init__(self)
def __init__(self, registers): Visitor.__init__(self) self.interference_graph = {} self.move_graph = {} self.registers = registers
def __init__(self): Visitor.__init__(self) self.var_map = {}
def __init__(self, color): Visitor.__init__(self) self.color = color