comparison python/ir/basicblock.py @ 205:d77cb5962cc5

Added some handcoded arm code generation
author Windel Bouwman
date Sun, 23 Jun 2013 18:23:18 +0200
parents 460db5669efa
children 1fa3e0050b49
comparison
equal deleted inserted replaced
204:de3a68f677a5 205:d77cb5962cc5
8 return 'BasicBlock {0}'.format(self.name) 8 return 'BasicBlock {0}'.format(self.name)
9 def addInstruction(self, i): 9 def addInstruction(self, i):
10 i.parent = self 10 i.parent = self
11 self.instructions.append(i) 11 self.instructions.append(i)
12 addIns = addInstruction 12 addIns = addInstruction
13
13 def replaceInstruction(self, i1, i2): 14 def replaceInstruction(self, i1, i2):
14 idx = self.instructions.index(i1) 15 idx = self.instructions.index(i1)
15 i1.parent = None 16 i1.parent = None
16 i1.delete() 17 i1.delete()
17 i2.parent = self 18 i2.parent = self
18 self.instructions[idx] = i2 19 self.instructions[idx] = i2
20
19 def removeInstruction(self, i): 21 def removeInstruction(self, i):
20 i.parent = None 22 i.parent = None
21 self.instructions.remove(i) 23 self.instructions.remove(i)
24
22 def getInstructions(self): 25 def getInstructions(self):
23 return self.instructions 26 return self.instructions
27
24 def setInstructions(self, ins): 28 def setInstructions(self, ins):
25 for i in self.instructions: 29 for i in self.instructions:
26 i.parent = None 30 i.parent = None
27 self.instructions = ins 31 self.instructions = ins
28 for i in self.instructions: 32 for i in self.instructions:
29 i.parent = self 33 i.parent = self
30 Instructions = property(getInstructions, setInstructions) 34 Instructions = property(getInstructions, setInstructions)
35
31 def getLastIns(self): 36 def getLastIns(self):
32 return self.instructions[-1] 37 return self.instructions[-1]
33 LastInstruction = property(getLastIns) 38 LastInstruction = property(getLastIns)
34 @property 39 @property
35 def Empty(self): 40 def Empty(self):