comparison python/ppci/ir.py @ 312:2c9768114877

Added cool logging formatter
author Windel Bouwman
date Mon, 16 Dec 2013 17:58:15 +0100
parents e95e5572cd6d
children e30a77ae359b
comparison
equal deleted inserted replaced
311:ff665880a6b0 312:2c9768114877
164 164
165 def getSuccessors(self): 165 def getSuccessors(self):
166 if not self.Empty: 166 if not self.Empty:
167 return self.LastInstruction.Targets 167 return self.LastInstruction.Targets
168 return [] 168 return []
169
169 Successors = property(getSuccessors) 170 Successors = property(getSuccessors)
170 171
171 def getPredecessors(self): 172 def getPredecessors(self):
172 preds = [] 173 preds = []
173 for bb in self.parent.Blocks: 174 for bb in self.parent.Blocks:
174 if self in bb.Successors: 175 if self in bb.Successors:
175 preds.append(bb) 176 preds.append(bb)
176 return preds 177 return preds
178
177 Predecessors = property(getPredecessors) 179 Predecessors = property(getPredecessors)
178 180
179 def precedes(self, other): 181 def precedes(self, other):
180 raise NotImplementedError() 182 raise NotImplementedError()
181 183
324 return '[{}]'.format(self.e) 326 return '[{}]'.format(self.e)
325 327
326 328
327 class Statement: 329 class Statement:
328 """ Base class for all instructions. """ 330 """ Base class for all instructions. """
329 pass 331 @property
332 def IsTerminator(self):
333 return isinstance(self, LastStatement)
330 334
331 335
332 class Move(Statement): 336 class Move(Statement):
333 """ Move source to destination """ 337 """ Move source to destination """
334 def __init__(self, dst, src): 338 def __init__(self, dst, src):