comparison python/ir/basicblock.py @ 177:460db5669efa

Added clean pass for IR
author Windel Bouwman
date Mon, 22 Apr 2013 23:54:54 +0200
parents 3eb06f5fb987
children d77cb5962cc5
comparison
equal deleted inserted replaced
176:5fd02aa38b42 177:460db5669efa
39 return self.instructions[0] 39 return self.instructions[0]
40 FirstIns = FirstInstruction 40 FirstIns = FirstInstruction
41 def getSuccessors(self): 41 def getSuccessors(self):
42 if not self.Empty: 42 if not self.Empty:
43 i = self.LastInstruction 43 i = self.LastInstruction
44 print(i)
44 return i.Targets 45 return i.Targets
45 return [] 46 return []
46 Successors = property(getSuccessors) 47 Successors = property(getSuccessors)
47 def getPredecessors(self): 48 def getPredecessors(self):
48 return [] 49 preds = []
50 for bb in self.parent.BasicBlocks:
51 if self in bb.Successors:
52 preds.append(bb)
53 return preds
49 Predecessors = property(getPredecessors) 54 Predecessors = property(getPredecessors)
50 55