diff python/ir/basicblock.py @ 268:5ec7580976d9

Op naar tree-IR
author Windel Bouwman
date Wed, 14 Aug 2013 20:12:40 +0200
parents 04c19282a5aa
children 5f8c04a8d26b
line wrap: on
line diff
--- a/python/ir/basicblock.py	Mon Aug 12 20:14:47 2013 +0200
+++ b/python/ir/basicblock.py	Wed Aug 14 20:12:40 2013 +0200
@@ -1,14 +1,19 @@
 
-class BasicBlock:
-    """ Uninterrupted sequence of instructions. """
+# from .instruction import Statement
+
+class Block:
+    """ 
+        Uninterrupted sequence of instructions with a label at the start.
+    """
     def __init__(self, name):
         self.name = name
         self.instructions = []
 
     def __repr__(self):
-        return 'BasicBlock {0}'.format(self.name)
+        return 'Block {0}'.format(self.name)
 
     def addInstruction(self, i):
+        #assert isinstance(i, Statement)
         i.parent = self
         self.instructions.append(i)
 
@@ -42,8 +47,7 @@
 
     def getSuccessors(self):
         if not self.Empty:
-            i = self.LastInstruction
-            return i.Targets
+            return self.LastInstruction.Targets
         return []
     Successors = property(getSuccessors)
 
@@ -59,6 +63,5 @@
         raise NotImplementedError()
 
     def check(self):
-        for ins in self.Instructions:
-            ins.check()
+        pass