172
|
1 from .basicblock import BasicBlock
|
|
2
|
|
3 class Function:
|
|
4 def __init__(self, name):
|
|
5 self.name = name
|
|
6 self.bbs = []
|
|
7 self.entry = None
|
205
|
8
|
172
|
9 def __repr__(self):
|
173
|
10 return 'Function {0}'.format(self.name)
|
205
|
11
|
172
|
12 def addBB(self, bb):
|
|
13 self.bbs.append(bb)
|
177
|
14 bb.parent = self
|
205
|
15 addBasicBlock = addBB
|
|
16
|
177
|
17 def removeBasicBlock(self, bb):
|
|
18 self.bbs.remove(bb)
|
|
19 bb.parent = None
|
205
|
20
|
172
|
21 def getBBs(self):
|
|
22 return self.bbs
|
|
23 BasicBlocks = property(getBBs)
|
|
24
|
|
25
|