diff python/irmach.py @ 299:674789d9ff37

Added a doc
author Windel Bouwman
date Sun, 01 Dec 2013 18:37:23 +0100
parents 534b94b40aa8
children
line wrap: on
line diff
--- a/python/irmach.py	Sun Dec 01 17:45:22 2013 +0100
+++ b/python/irmach.py	Sun Dec 01 18:37:23 2013 +0100
@@ -7,8 +7,7 @@
   Instructions are selected and scheduled at this stage.
 """
 
-import ir
-import target
+from target import Instruction
 
 
 class Frame:
@@ -27,7 +26,7 @@
 
     def lower_to(self, outs):
         for im in self.instructions:
-            if isinstance(im.assem, target.Instruction):
+            if isinstance(im.assem, Instruction):
                 outs.emit(im.assem)
             else:
                 outs.emit(im.assem.fromim(im))
@@ -39,14 +38,13 @@
         abstraction of machine instructions.
     """
     def __init__(self, cls, ops=(), src=(), dst=(), jumps=(), others=(), ismove=False):
-        assert type(cls) is type or isinstance(cls, target.Instruction)
+        assert type(cls) is type or isinstance(cls, Instruction)
         self.assem = cls
         self.ops = tuple(ops)
         self.src = tuple(src)
         self.dst = tuple(dst)
         self.jumps = tuple(jumps)
         self.others = tuple(others)
-        c = lambda s: tuple(map(type, s)) == (ir.Temp, )
         self.ismove = ismove
 
     def __repr__(self):
@@ -67,3 +65,6 @@
             p = '%l{}'.format(i)
             x = x.replace(p, str(j))
         return x
+
+
+makeIns = AbstractInstruction