comparison python/ir/instruction.py @ 176:5fd02aa38b42

Added while loop code generation
author Windel Bouwman
date Sat, 20 Apr 2013 12:00:51 +0200
parents a51b3c956386
children 460db5669efa
comparison
equal deleted inserted replaced
175:a51b3c956386 176:5fd02aa38b42
4 class Value: 4 class Value:
5 """ Temporary SSA value (value that is assigned only once! """ 5 """ Temporary SSA value (value that is assigned only once! """
6 def __init__(self, name): 6 def __init__(self, name):
7 # TODO: add typing? for now only handle integers 7 # TODO: add typing? for now only handle integers
8 self.name = name 8 self.name = name
9 self.interferes = set()
10 self.reg = None
11 self.used_by = [] 9 self.used_by = []
12 def __repr__(self): 10 def __repr__(self):
13 if self.reg: 11 return '{0}'.format(self.name) # + str(self.IsUsed)
14 n = self.reg
15 else:
16 n = self.name
17 return '{0}'.format(n) # + str(self.IsUsed)
18 @property 12 @property
19 def IsUsed(self): 13 def IsUsed(self):
20 return len(self.used_by) > 0 14 return len(self.used_by) > 0
21 15
22 class Use: 16 class Use: