171
|
1
|
|
2 class BasicBlock:
|
|
3 # Uninterrupted sequence of instructions.
|
|
4 def __init__(self, name):
|
|
5 self.name = name
|
|
6 self.instructions = []
|
|
7 def __repr__(self):
|
|
8 return 'BB {0}'.format(self.name)
|
|
9 def addIns(self, i):
|
|
10 self.instructions.append(i)
|
|
11 def getInstructions(self):
|
|
12 return self.instructions
|
|
13 Instructions = property(getInstructions)
|
|
14 def getLastIns(self):
|
|
15 return self.instructions[-1]
|
|
16 LastIns = property(getLastIns)
|
|
17 @property
|
|
18 def Empty(self):
|
|
19 return len(self.instructions) == 0
|
|
20 @property
|
|
21 def FirstIns(self):
|
|
22 return self.instructions[0]
|
|
23
|