view python/ir/function.py @ 211:99164160fb0b

Added another missing file
author Windel Bouwman
date Sat, 29 Jun 2013 10:10:45 +0200
parents d77cb5962cc5
children 88a1e0baef65
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
   BasicBlocks = property(getBBs)