Mercurial > lcfOS
diff python/ir/instruction.py @ 259:ac603eb66b63
Added function call
author | Windel Bouwman |
---|---|
date | Mon, 05 Aug 2013 20:41:25 +0200 |
parents | 04c19282a5aa |
children | 444b9df2ed99 |
line wrap: on
line diff
--- a/python/ir/instruction.py Mon Aug 05 19:46:11 2013 +0200 +++ b/python/ir/instruction.py Mon Aug 05 20:41:25 2013 +0200 @@ -26,11 +26,7 @@ Used = IsUsed def onlyUsedInBlock(self, bb): - for use in self.used_by: - ins = use - if ins.parent != bb: - return False - return True + return all(use.Block is bb for use in self.used_by) def lastUse(self, ins): assert ins in self.used_by @@ -60,6 +56,7 @@ # What variables this instruction uses and defines: self.defs = [] self.uses = [] + def delete(self): while self.uses: use = self.uses.pop() @@ -106,7 +103,11 @@ assert isinstance(other, Instruction) if self.Block is other.Block: return other.Position > self.Position - return self.Block.precedes(other.Block) + else: + return self.Block.precedes(other.Block) + + def follows(self, other): + pass @property def Function(self): @@ -245,14 +246,14 @@ class Store(Instruction): def __init__(self, location, value): - super().__init__() - assert type(value) is Value, value - assert isinstance(location, Value), "Location must be a value" - self.location = location - self.value = value - self.addUse(value) - self.addUse(location) - + super().__init__() + assert type(value) is Value, value + assert isinstance(location, Value), "Location must be a value" + self.location = location + self.value = value + self.addUse(value) + self.addUse(location) + def __repr__(self): return '[{}] = {}'.format(self.location, self.value)