diff python/ir/basicblock.py @ 171:3eb9b9e2958d

Improved IR code
author Windel Bouwman
date Wed, 03 Apr 2013 22:20:20 +0200
parents
children c1d2b6b9f9a7
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/ir/basicblock.py	Wed Apr 03 22:20:20 2013 +0200
@@ -0,0 +1,23 @@
+
+class BasicBlock:
+   # Uninterrupted sequence of instructions.
+   def __init__(self, name):
+      self.name = name
+      self.instructions = []
+   def __repr__(self):
+      return 'BB {0}'.format(self.name)
+   def addIns(self, i):
+      self.instructions.append(i)
+   def getInstructions(self):
+      return self.instructions
+   Instructions = property(getInstructions)
+   def getLastIns(self):
+      return self.instructions[-1]
+   LastIns = property(getLastIns)
+   @property
+   def Empty(self):
+      return len(self.instructions) == 0
+   @property
+   def FirstIns(self):
+      return self.instructions[0]
+