diff python/flowgraph.py @ 277:046017431c6a

Started register allocator
author Windel Bouwman
date Thu, 26 Sep 2013 21:14:25 +0200
parents ea93e0a7a31e
children 9fca39eebe50
line wrap: on
line diff
--- a/python/flowgraph.py	Mon Sep 16 21:51:17 2013 +0200
+++ b/python/flowgraph.py	Thu Sep 26 21:14:25 2013 +0200
@@ -1,6 +1,5 @@
-
+import graph
 
-import graph
 
 class FlowGraphNode(graph.Node):
     """ A node in the flow graph """
@@ -24,12 +23,11 @@
 class FlowGraph(graph.Graph):
     def __init__(self, instrs):
         """ Create a flowgraph from a list of abstract instructions """
-        super().__init__()
+        super().__init__(True)
         self._map = {}
         # Add nodes:
         for ins in instrs:
             n = self.newNode(ins)
-            self._map[ins] = n
 
         # Make edges:
         prev = None
@@ -48,8 +46,8 @@
     def newNode(self, ins):
         """ Override new node to make flow graph node """
         n = FlowGraphNode(self, ins)
-        self.nodes.append(n)
+        self._map[ins] = n
+        self.addNode(n)
         return n
 
 
-