diff python/ppci/target/arm/arm.brg @ 364:c49459768aaa

Work on globals
author Windel Bouwman
date Wed, 19 Mar 2014 20:24:03 +0100
parents b4ac28efcdf4
children
line wrap: on
line diff
--- a/python/ppci/target/arm/arm.brg	Sun Mar 16 11:28:47 2014 +0100
+++ b/python/ppci/target/arm/arm.brg	Wed Mar 19 20:24:03 2014 +0100
@@ -2,12 +2,13 @@
 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
+from ppci.target.basetarget import LabelAddress
 
 %%
 
 %terminal ADDI32 SUBI32 MULI32 ADR
 %terminal ORI32 SHLI32 SHRI32 ANDI32
-%terminal CONSTI32 CONSTDATA MEMI32 REGI32 CALL
+%terminal CONSTI32 CONSTDATA MEMI32 REGI32 CALL GLOBALADDRESS
 %terminal MOVI32
 
 %%
@@ -22,7 +23,7 @@
 
 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'
-
+reg: GLOBALADDRESS 21  'd = self.newTmp(); ln = self.selector.frame.add_constant(LabelAddress(tree.value)); self.emit(Ldr3, dst=[d], others=[ln]); return d'
 
 cn: CONSTI32 0 'return tree.value'