Mercurial > lcfOS
diff python/codegenarm.py @ 259:ac603eb66b63
Added function call
author | Windel Bouwman |
---|---|
date | Mon, 05 Aug 2013 20:41:25 +0200 |
parents | 04c19282a5aa |
children | 444b9df2ed99 |
line wrap: on
line diff
--- a/python/codegenarm.py Mon Aug 05 19:46:11 2013 +0200 +++ b/python/codegenarm.py Mon Aug 05 20:41:25 2013 +0200 @@ -39,6 +39,7 @@ # TODO: use label here: #self.emit(arm.dcd_ins(LabelRef('reset'))) # reset vector self.dcd(0x08000009) # reset vector, lsb indicates thumb mode + self.emit(arm.bl_ins(LabelRef('main'))) self.emit(Label('reset')) for f in ircode.Functions: @@ -132,7 +133,7 @@ else: r1 = self.getreg(ins.location) self.emit(arm.storeimm5_ins(r0, arm.MemR8Rel(r1, 0))) - self.freereg(ins.location, ins) + self.freereg(ins.location, ins) self.freereg(ins.value, ins) elif type(ins) is ir.Load: # TODO: differ global and local?? @@ -143,7 +144,7 @@ else: r2 = self.getreg(ins.location) self.emit(arm.loadimm5_ins(r0, arm.MemR8Rel(r2, 0))) - self.freereg(ins.location, ins) + self.freereg(ins.location, ins) elif type(ins) is ir.BinaryOperator: # Load operands: r0 = self.getreg(ins.value1) @@ -162,6 +163,9 @@ raise NotImplementedError('operation {} not implemented'.format(ins.operation)) self.freereg(ins.value1, ins) self.freereg(ins.value2, ins) + elif type(ins) is ir.Call: + # TODO: prep parameters: + self.emit(arm.bl_ins(LabelRef(ins.callee.name))) elif type(ins) is ir.Return: self.emit(arm.pop_ins(arm.RegisterSet({arm.r4, arm.r5, arm.r6, arm.r7, arm.pc}))) elif type(ins) is ir.ConditionalBranch: