Mercurial > lcfOS
comparison python/x86.py @ 173:c1d2b6b9f9a7
Rework into passes
author | Windel Bouwman |
---|---|
date | Fri, 19 Apr 2013 12:42:21 +0200 |
parents | 3eb9b9e2958d |
children | 3eb06f5fb987 |
comparison
equal
deleted
inserted
replaced
172:5a7d37d615ee | 173:c1d2b6b9f9a7 |
---|---|
1 import ppci | 1 import ppci |
2 import ir | 2 import ir |
3 import registerallocator | |
3 | 4 |
4 class AsmLabel: | 5 class AsmLabel: |
5 def __init__(self, lab): | 6 def __init__(self, lab): |
6 self.lab = lab | 7 self.lab = lab |
7 def __repr__(self): | 8 def __repr__(self): |
31 self.asm.append(i) | 32 self.asm.append(i) |
32 | 33 |
33 def genBin(self, ir): | 34 def genBin(self, ir): |
34 self.asm = [] | 35 self.asm = [] |
35 # Allocate registers: | 36 # Allocate registers: |
36 ir.registerAllocate(self.regs) | 37 ra = registerallocator.RegisterAllocator() |
38 ra.registerAllocate(ir, self.regs) | |
37 self.genModule(ir) | 39 self.genModule(ir) |
38 return self.asm | 40 return self.asm |
39 | 41 |
40 def genModule(self, ir): | 42 def genModule(self, ir): |
41 #for f in ir.Functions: | 43 #for f in ir.Functions: |