예제 #1
0
 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)
예제 #2
0
 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 free_vars(n):
    if isinstance(n, Const):
        return set([])
    elif isinstance(n, Name):
        return set([n.name])
    elif isinstance(n, FunName):
        return set([])
    elif isinstance(n, Register): #?? -JGS
        return set([full_reg(n.name)])
    else:
        return set([])
예제 #4
0
def free_vars(n):
    if isinstance(n, Const):
        return set([])
    elif isinstance(n, Name):
        return set([n.name])
    # elif isinstance(n, FunName):
    #     return set([])
    elif isinstance(n, Register):  #?? -JGS
        return set([full_reg(n.name)])
    else:
        return set([])
 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 visitPopValue(self, n):
     lhs = n.target.name
     for v in n.live:
         if lhs and v != full_reg(lhs):
             self.add_interference(v, full_reg(lhs))
예제 #7
0
 def visitPopValue(self, n):
     lhs = n.target.name
     for v in n.live:
         if lhs and v != full_reg(lhs):
             self.add_interference(v, full_reg(lhs))