comparison python/ppci/codegen/flowgraph.py @ 337:b00219172a42

Added cool lm3s811 qemu project
author Windel Bouwman
date Thu, 20 Feb 2014 20:04:52 +0100
parents 6753763d3bec
children
comparison
equal deleted inserted replaced
336:d1ecc493384e 337:b00219172a42
18 if self.defs: 18 if self.defs:
19 r += ' defs:' + ', '.join(str(d) for d in self.defs) 19 r += ' defs:' + ', '.join(str(d) for d in self.defs)
20 return r 20 return r
21 21
22 22
23
23 class FlowGraph(DiGraph): 24 class FlowGraph(DiGraph):
24 def __init__(self, instrs): 25 def __init__(self, instrs):
25 """ Create a flowgraph from a list of abstract instructions """ 26 """ Create a flowgraph from a list of abstract instructions """
26 super().__init__() 27 super().__init__()
27 self._map = {} 28 self._map = {}
28 # Add nodes: 29 # Add nodes:
29 for ins in instrs: 30 for ins in instrs:
30 n = FlowGraphNode(self, ins) 31 n = FlowGraphNode(self, ins)
31 self._map[ins] = n 32 self._map[ins] = n
32 self.addNode(n) 33 self.add_node(n)
33 34
34 # Make edges: 35 # Make edges:
35 prev = None 36 prev = None
36 for ins in instrs: 37 for ins in instrs:
37 n = self._map[ins] 38 n = self._map[ins]