view 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 source


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]