Mercurial > lcfOS
diff python/codegen/registerallocator.py @ 300:158068af716c
yafm
author | Windel Bouwman |
---|---|
date | Tue, 03 Dec 2013 18:00:22 +0100 |
parents | 9417caea2eb3 |
children |
line wrap: on
line diff
--- a/python/codegen/registerallocator.py Sun Dec 01 18:37:23 2013 +0100 +++ b/python/codegen/registerallocator.py Tue Dec 03 18:00:22 2013 +0100 @@ -4,6 +4,7 @@ # Nifty first function: first = lambda x: next(iter(x)) + class RegisterAllocator: """ Target independent register allocator. @@ -67,7 +68,7 @@ def NodeMoves(self, n): return n.moves & (self.activeMoves | self.worklistMoves) - + def MoveRelated(self, n): return bool(self.NodeMoves(n)) @@ -108,7 +109,7 @@ if m in self.activeMoves: self.activeMoves.remove(m) self.worklistMoves.add(m) - + def Coalesc(self): """ Coalesc conservative. """ m = first(self.worklistMoves) @@ -126,7 +127,7 @@ self.f.ig.Combine(u, v) else: self.activeMoves.add(m) - + def Conservative(self, u, v): """ Briggs conservative criteria for coalesc """ nodes = u.Adjecent | v.Adjecent @@ -149,14 +150,14 @@ self.frozenMoves.add(m) # Check other part of the move for still being move related: v = m.src[0] if u is m.dst[0] else m.dst[0] - + def SelectSpill(self): # TODO pass def AssignColors(self): """ Add nodes back to the graph to color it. """ - # Add nodes back to the graph: + # Add nodes back to the graph: while self.selectStack: n = self.selectStack.pop(-1) self.f.ig.addNode(n)