comparison python/ppci/target/arm/arm.brg @ 354:5477e499b039

Added some sort of string functionality
author Windel Bouwman
date Thu, 13 Mar 2014 18:59:06 +0100
parents b8ad45b3a573
children 52492b304adf
comparison
equal deleted inserted replaced
353:b8ad45b3a573 354:5477e499b039
1 1
2 from ppci.target.arm.instructions import Add1, Sub1, Ldr1, Ldr3 2 from ppci.target.arm.instructions import Add1, Sub1, Mul1
3 from ppci.target.arm.instructions import Ldr1, Ldr3, Adr
3 4
4 %% 5 %%
5 6
6 %terminal ADDI32 SUBI32 MULI32 7 %terminal ADDI32 SUBI32 MULI32 ADR
7 %terminal ORI32 SHLI32 8 %terminal ORI32 SHLI32
8 %terminal CONSTI32 MEMI32 REGI32 CALL 9 %terminal CONSTI32 CONSTDATA MEMI32 REGI32 CALL
9 %terminal MOVI32 10 %terminal MOVI32
10 11
11 %% 12 %%
12 13
13 reg: ADDI32(reg, reg) 2 (. d = self.newTmp(); self.emit(Add1, dst=[d], src=[$1, $2]); return d .) 14 reg: ADDI32(reg, reg) 2 (. d = self.newTmp(); self.emit(Add1, dst=[d], src=[$1, $2]); return d .)
14 reg: SUBI32(reg, reg) 2 (. d = self.newTmp(); self.emit(Sub1, dst=[d], src=[$1, $2]); return d .) 15 reg: SUBI32(reg, reg) 2 (. d = self.newTmp(); self.emit(Sub1, dst=[d], src=[$1, $2]); return d .)
15 reg: SUBI32(reg, reg) 2 (. d = self.newTmp(); self.emit(Sub1, dst=[d], src=[$1, $2]); return d .) 16 reg: MULI32(reg, reg) 2 (. d = self.newTmp(); self.emit(Mul1, dst=[d], src=[$1, $2]); return d .)
17
16 reg: MEMI32(ADDI32(reg, cn)) 2 (. d = self.newTmp(); self.emit(Ldr1, dst=[d], src=[$1], others=[$2]); return d .) 18 reg: MEMI32(ADDI32(reg, cn)) 2 (. d = self.newTmp(); self.emit(Ldr1, dst=[d], src=[$1], others=[$2]); return d .)
17 reg: MEMI32(reg) 2 (. d = self.newTmp(); self.emit(Ldr1, dst=[d], src=[$1], others=[0]); return d .) 19 reg: MEMI32(reg) 2 (. d = self.newTmp(); self.emit(Ldr1, dst=[d], src=[$1], others=[0]); return d .)
18 20
19 21
20 cn: CONSTI32 0 (. return $$.value .) 22 cn: CONSTI32 0 (. return $$.value .)
21 23
22 reg: CONSTI32 3 (. d = self.newTmp(); ln = self.selector.frame.add_constant($$.value); self.emit(Ldr3, dst=[d], others=[ln]); return d .) 24 reg: CONSTI32 3 (. d = self.newTmp(); ln = self.selector.frame.add_constant($$.value); self.emit(Ldr3, dst=[d], others=[ln]); return d .)
25
26 reg: ADR(CONSTDATA) 2 (. d = self.newTmp(); ln = self.selector.frame.add_constant($$.children[0].value); self.emit(Adr, dst=[d], others=[ln]); return d .)
27
23 reg: REGI32 1 (. return $$.value .) 28 reg: REGI32 1 (. return $$.value .)
24 29
25 reg: CALL 1 (. return self.selector.munchCall($$.value) .) 30 reg: CALL 1 (. return self.selector.munchCall($$.value) .)