Mercurial > lcfOS
view python/ir/function.py @ 242:c94965418684
Added tag burnchain for changeset ce6d390043a7
author | Windel Bouwman |
---|---|
date | Mon, 22 Jul 2013 22:56:51 +0200 |
parents | 63bb40758066 |
children | 74c6a20302d5 |
line wrap: on
line source
from .basicblock import BasicBlock class Function: def __init__(self, name): self.name = name self.bbs = [] self.entry = None def __repr__(self): return 'Function {0}'.format(self.name) def addBB(self, bb): self.bbs.append(bb) bb.parent = self addBasicBlock = addBB def removeBasicBlock(self, bb): self.bbs.remove(bb) bb.parent = None def getBBs(self): return self.bbs def findBasicBlock(self, name): for bb in self.bbs: if bb.name == name: return bb raise KeyError(name) BasicBlocks = property(getBBs) def check(self): for bb in self.BasicBlocks: bb.check()