Mercurial > lcfOS
view python/ir/function.py @ 237:81752b0f85a5
Added burn led test program
author | Windel Bouwman |
---|---|
date | Wed, 17 Jul 2013 22:31:54 +0200 |
parents | 88a1e0baef65 |
children | 63bb40758066 |
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)