Mercurial > lcfOS
comparison python/ir/basicblock.py @ 243:ef683881c64e
Remove various files
author | Windel Bouwman |
---|---|
date | Tue, 23 Jul 2013 16:50:02 +0200 |
parents | 63bb40758066 |
children | c4370696ccc7 |
comparison
equal
deleted
inserted
replaced
242:c94965418684 | 243:ef683881c64e |
---|---|
9 return 'BasicBlock {0}'.format(self.name) | 9 return 'BasicBlock {0}'.format(self.name) |
10 | 10 |
11 def addInstruction(self, i): | 11 def addInstruction(self, i): |
12 i.parent = self | 12 i.parent = self |
13 self.instructions.append(i) | 13 self.instructions.append(i) |
14 addIns = addInstruction | |
15 | 14 |
16 def replaceInstruction(self, i1, i2): | 15 def replaceInstruction(self, i1, i2): |
17 idx = self.instructions.index(i1) | 16 idx = self.instructions.index(i1) |
18 i1.parent = None | 17 i1.parent = None |
19 i1.delete() | 18 i1.delete() |
24 i.parent = None | 23 i.parent = None |
25 self.instructions.remove(i) | 24 self.instructions.remove(i) |
26 | 25 |
27 def getInstructions(self): | 26 def getInstructions(self): |
28 return self.instructions | 27 return self.instructions |
29 | 28 Instructions = property(getInstructions) |
30 def setInstructions(self, ins): | |
31 for i in self.instructions: | |
32 i.parent = None | |
33 self.instructions = ins | |
34 for i in self.instructions: | |
35 i.parent = self | |
36 Instructions = property(getInstructions, setInstructions) | |
37 | 29 |
38 def getLastIns(self): | 30 def getLastIns(self): |
39 return self.instructions[-1] | 31 return self.instructions[-1] |
40 LastInstruction = property(getLastIns) | 32 LastInstruction = property(getLastIns) |
41 | 33 |
44 return len(self.instructions) == 0 | 36 return len(self.instructions) == 0 |
45 | 37 |
46 @property | 38 @property |
47 def FirstInstruction(self): | 39 def FirstInstruction(self): |
48 return self.instructions[0] | 40 return self.instructions[0] |
49 FirstIns = FirstInstruction | |
50 | 41 |
51 def getSuccessors(self): | 42 def getSuccessors(self): |
52 if not self.Empty: | 43 if not self.Empty: |
53 i = self.LastInstruction | 44 i = self.LastInstruction |
54 return i.Targets | 45 return i.Targets |
55 return [] | 46 return [] |
56 Successors = property(getSuccessors) | 47 Successors = property(getSuccessors) |
57 | 48 |
58 def getPredecessors(self): | 49 def getPredecessors(self): |
59 preds = [] | 50 preds = [] |
60 for bb in self.parent.BasicBlocks: | 51 for bb in self.parent.BasicBlocks: |