Mercurial > lcfOS
view python/ppci/target/arm/arm.brg @ 359:b4ac28efcdf4
Reorganize files
author | Windel Bouwman |
---|---|
date | Fri, 14 Mar 2014 15:41:55 +0100 |
parents | 818be710e13d |
children | c49459768aaa |
line wrap: on
line source
from ppci.target.arm.instructions import Add1, Add2, Sub1, Mul1 from ppci.target.arm.instructions import Ldr1, Ldr3, Adr from ppci.target.arm.instructions import And1, Lsr1, Lsl1, Mov1 %% %terminal ADDI32 SUBI32 MULI32 ADR %terminal ORI32 SHLI32 SHRI32 ANDI32 %terminal CONSTI32 CONSTDATA MEMI32 REGI32 CALL %terminal MOVI32 %% reg: ADDI32(reg, reg) 2 'd = self.newTmp(); self.emit(Add1, dst=[d], src=[c0, c1]); return d' reg: ADDI32(reg, cn) 2 'return tree.children[1].value < 256' 'd = self.newTmp(); self.emit(Add2, dst=[d], src=[c0], others=[c1]); return d' reg: ADDI32(cn, reg) 2 'return tree.children[0].value < 256' 'd = self.newTmp(); self.emit(Add2, dst=[d], src=[c1], others=[c0]); return d' reg: SUBI32(reg, reg) 2 'd = self.newTmp(); self.emit(Sub1, dst=[d], src=[c0, c1]); return d' reg: MULI32(reg, reg) 2 'd = self.newTmp(); self.emit(Mul1, dst=[d], src=[c0, c1]); return d' reg: ANDI32(reg, reg) 2 'd = self.newTmp(); self.emit(And1, dst=[d], src=[c0, c1]); return d' reg: SHRI32(reg, reg) 2 'd = self.newTmp(); self.emit(Lsr1, dst=[d], src=[c0, c1]); return d' reg: MEMI32(ADDI32(reg, cn)) 2 'd = self.newTmp(); self.emit(Ldr1, dst=[d], src=[c0], others=[c1]); return d' reg: MEMI32(reg) 2 'd = self.newTmp(); self.emit(Ldr1, dst=[d], src=[c0], others=[0]); return d' cn: CONSTI32 0 'return tree.value' reg: CONSTI32 6 'd = self.newTmp(); ln = self.selector.frame.add_constant(tree.value); self.emit(Ldr3, dst=[d], others=[ln]); return d' reg: CONSTI32 2 'return (type(tree.value) is int) and (tree.value < 256)' 'd = self.newTmp(); self.emit(Mov1, dst=[d], others=[tree.value]); return d' reg: ADR(CONSTDATA) 2 'd = self.newTmp(); ln = self.selector.frame.add_constant(tree.children[0].value); self.emit(Adr, dst=[d], others=[ln]); return d' reg: REGI32 1 'return tree.value' reg: CALL 1 'return self.selector.munchCall(tree.value)'