Mercurial > lcfOS
diff python/target/basetarget.py @ 335:582a1aaa3983
Added long branch format
author | Windel Bouwman |
---|---|
date | Mon, 17 Feb 2014 20:41:30 +0100 |
parents | 6f4753202b9a |
children | 4d204f6f7d4e |
line wrap: on
line diff
--- a/python/target/basetarget.py Thu Feb 13 22:02:08 2014 +0100 +++ b/python/target/basetarget.py Mon Feb 17 20:41:30 2014 +0100 @@ -58,10 +58,13 @@ class Instruction: """ Base instruction class """ def encode(self): - raise NotImplementedError('Instruction {0} has no encode yet, TODO'.format(type(self))) + return bytes() - def resolve(self, f): - pass + def relocations(self): + return [] + + def symbols(self): + return [] class Nop(Instruction): @@ -77,13 +80,12 @@ class Label(PseudoInstruction): def __init__(self, name): self.name = name - self.address = 0 def __repr__(self): return '{}:'.format(self.name) - def encode(self): - return bytes() + def symbols(self): + return [self.name] @classmethod def Create(cls, vop): @@ -112,7 +114,8 @@ def encode(self): pad = [] - address = self.address + # TODO + address = 0 while (address % self.align) != 0: address += 1 pad.append(0) @@ -126,9 +129,6 @@ def __repr__(self): return 'DebugInfo: {}'.format(self.info) - def encode(self): - return bytes() - class Register(Operand): def __init__(self, name):