diff python/ppci/target/arm/frame.py @ 364:c49459768aaa

Work on globals
author Windel Bouwman
date Wed, 19 Mar 2014 20:24:03 +0100
parents 5477e499b039
children
line wrap: on
line diff
--- a/python/ppci/target/arm/frame.py	Sun Mar 16 11:28:47 2014 +0100
+++ b/python/ppci/target/arm/frame.py	Wed Mar 19 20:24:03 2014 +0100
@@ -1,5 +1,5 @@
 from ... import ir
-from ..basetarget import Label, Alignment
+from ..basetarget import Label, Alignment, LabelAddress
 from ...irmach import AbstractInstruction, Frame
 from .instructions import Dcd, Add, Sub, Push, Pop, Mov, Db
 from .registers import R0, R1, R2, R3, R4, R5, R6, R7, R8, R11, LR, PC, SP
@@ -52,7 +52,7 @@
         return self.locVars[lvar]
 
     def add_constant(self, value):
-        assert type(value) in [int, bytes]
+        assert type(value) in [int, bytes, LabelAddress]
         lab_name = '{}_literal_{}'.format(self.name, len(self.constants))
         self.constants.append((lab_name, value))
         return lab_name
@@ -84,6 +84,8 @@
         for ln, v in self.constants:
             if isinstance(v, int):
                 post.extend([Label(ln), Dcd(v)])
+            elif isinstance(v, LabelAddress):
+                post.extend([Label(ln), Dcd(v)])
             elif isinstance(v, bytes):
                 post.append(Label(ln))
                 for c in v: