annotate python/ppci/target/arm/arm.brg @ 393:6ae782a085e0

Added init program
author Windel Bouwman
date Sat, 17 May 2014 21:17:40 +0200
parents c49459768aaa
children
rev   line source
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents:
diff changeset
1
359
b4ac28efcdf4 Reorganize files
Windel Bouwman
parents: 357
diff changeset
2 from ppci.target.arm.instructions import Add1, Add2, Sub1, Mul1
354
5477e499b039 Added some sort of string functionality
Windel Bouwman
parents: 353
diff changeset
3 from ppci.target.arm.instructions import Ldr1, Ldr3, Adr
357
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
4 from ppci.target.arm.instructions import And1, Lsr1, Lsl1, Mov1
364
c49459768aaa Work on globals
Windel Bouwman
parents: 359
diff changeset
5 from ppci.target.basetarget import LabelAddress
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents:
diff changeset
6
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents:
diff changeset
7 %%
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents:
diff changeset
8
354
5477e499b039 Added some sort of string functionality
Windel Bouwman
parents: 353
diff changeset
9 %terminal ADDI32 SUBI32 MULI32 ADR
356
52492b304adf Added newline to print
Windel Bouwman
parents: 354
diff changeset
10 %terminal ORI32 SHLI32 SHRI32 ANDI32
364
c49459768aaa Work on globals
Windel Bouwman
parents: 359
diff changeset
11 %terminal CONSTI32 CONSTDATA MEMI32 REGI32 CALL GLOBALADDRESS
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents:
diff changeset
12 %terminal MOVI32
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents:
diff changeset
13
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents:
diff changeset
14 %%
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents:
diff changeset
15
357
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
16 reg: ADDI32(reg, reg) 2 'd = self.newTmp(); self.emit(Add1, dst=[d], src=[c0, c1]); return d'
359
b4ac28efcdf4 Reorganize files
Windel Bouwman
parents: 357
diff changeset
17 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'
b4ac28efcdf4 Reorganize files
Windel Bouwman
parents: 357
diff changeset
18 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'
357
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
19 reg: SUBI32(reg, reg) 2 'd = self.newTmp(); self.emit(Sub1, dst=[d], src=[c0, c1]); return d'
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
20 reg: MULI32(reg, reg) 2 'd = self.newTmp(); self.emit(Mul1, dst=[d], src=[c0, c1]); return d'
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
21 reg: ANDI32(reg, reg) 2 'd = self.newTmp(); self.emit(And1, dst=[d], src=[c0, c1]); return d'
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
22 reg: SHRI32(reg, reg) 2 'd = self.newTmp(); self.emit(Lsr1, dst=[d], src=[c0, c1]); return d'
354
5477e499b039 Added some sort of string functionality
Windel Bouwman
parents: 353
diff changeset
23
357
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
24 reg: MEMI32(ADDI32(reg, cn)) 2 'd = self.newTmp(); self.emit(Ldr1, dst=[d], src=[c0], others=[c1]); return d'
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
25 reg: MEMI32(reg) 2 'd = self.newTmp(); self.emit(Ldr1, dst=[d], src=[c0], others=[0]); return d'
364
c49459768aaa Work on globals
Windel Bouwman
parents: 359
diff changeset
26 reg: GLOBALADDRESS 21 'd = self.newTmp(); ln = self.selector.frame.add_constant(LabelAddress(tree.value)); self.emit(Ldr3, dst=[d], others=[ln]); return d'
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents:
diff changeset
27
357
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
28 cn: CONSTI32 0 'return tree.value'
346
3bb7dcfe5529 expanded arm target
Windel Bouwman
parents:
diff changeset
29
357
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
30 reg: CONSTI32 6 'd = self.newTmp(); ln = self.selector.frame.add_constant(tree.value); self.emit(Ldr3, dst=[d], others=[ln]); return d'
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
31
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
32 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'
354
5477e499b039 Added some sort of string functionality
Windel Bouwman
parents: 353
diff changeset
33
357
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
34 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'
354
5477e499b039 Added some sort of string functionality
Windel Bouwman
parents: 353
diff changeset
35
357
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
36 reg: REGI32 1 'return tree.value'
352
899ae3aea803 First kernel run for vexpressA9
Windel Bouwman
parents: 346
diff changeset
37
357
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
38 reg: CALL 1 'return self.selector.munchCall(tree.value)'
818be710e13d Added acceptance function to burg
Windel Bouwman
parents: 356
diff changeset
39