diff python/flowgraph.py @ 278:9fca39eebe50

First implementation of regalloc with coalsesc
author Windel Bouwman
date Sun, 29 Sep 2013 14:08:15 +0200
parents 046017431c6a
children
line wrap: on
line diff
--- a/python/flowgraph.py	Thu Sep 26 21:14:25 2013 +0200
+++ b/python/flowgraph.py	Sun Sep 29 14:08:15 2013 +0200
@@ -1,7 +1,7 @@
 import graph
 
 
-class FlowGraphNode(graph.Node):
+class FlowGraphNode(graph.DiNode):
     """ A node in the flow graph """
     def __init__(self, g, ins):
         super().__init__(g)
@@ -20,14 +20,16 @@
         return r
 
 
-class FlowGraph(graph.Graph):
+class FlowGraph(graph.DiGraph):
     def __init__(self, instrs):
         """ Create a flowgraph from a list of abstract instructions """
-        super().__init__(True)
+        super().__init__()
         self._map = {}
         # Add nodes:
         for ins in instrs:
-            n = self.newNode(ins)
+            n = FlowGraphNode(self, ins)
+            self._map[ins] = n
+            self.addNode(n)
 
         # Make edges:
         prev = None
@@ -43,11 +45,4 @@
             else:
                 prev = n
 
-    def newNode(self, ins):
-        """ Override new node to make flow graph node """
-        n = FlowGraphNode(self, ins)
-        self._map[ins] = n
-        self.addNode(n)
-        return n
 
-