Mercurial > lcfOS
diff python/cortexm3.py @ 234:83781bd10fdb
wip
author | Windel Bouwman |
---|---|
date | Sun, 14 Jul 2013 19:29:21 +0200 |
parents | e621e3ba78d2 |
children | ff40407c0240 |
line wrap: on
line diff
--- a/python/cortexm3.py Sun Jul 14 12:28:23 2013 +0200 +++ b/python/cortexm3.py Sun Jul 14 19:29:21 2013 +0200 @@ -1,6 +1,6 @@ import struct, types from target import Register, Instruction, Target, Imm8, Label, Imm3 -from asmnodes import ASymbol, ANumber, AUnop, ABinop, ALabel +from asmnodes import ASymbol, ANumber, AUnop, ABinop from ppci import CompilerError import ir @@ -36,7 +36,7 @@ if name in regs: r = regs[name] return cls(r.num) - + class Reg8Op: def __init__(self, num): assert num < 8 @@ -269,6 +269,10 @@ self.label = label self.offset = 0 + def resolve(self, f): + la = f(self.label) + self.offset = (la - self.address) + 4 + def encode(self): rt = self.rt.num assert rt < 8