diff python/codegenarm.py @ 249:e41e4109addd

Added current position arrow
author Windel Bouwman
date Fri, 26 Jul 2013 20:26:05 +0200
parents ef683881c64e
children f5fba5b554d7
line wrap: on
line diff
--- a/python/codegenarm.py	Fri Jul 26 16:46:02 2013 +0200
+++ b/python/codegenarm.py	Fri Jul 26 20:26:05 2013 +0200
@@ -1,5 +1,5 @@
 import ir
-from target import Label, Comment, Alignment, LabelRef, Imm32
+from target import Label, Comment, Alignment, LabelRef, Imm32, DebugInfo
 import cortexm3 as arm
 from ppci import CompilerError
 
@@ -62,23 +62,34 @@
 
     def align(self):
         self.outs.emit(Alignment(4))
+
     # Helper functions:
     def getStack(self, v):
         off = self.stack_frame.index(v)
         return off * 4
+
     def addStack(self, v):
         self.stack_frame.append(v)
         return self.getStack(v)
+
     def getGlobal(self, r, g):
         _global_address = g.name + '__global'
         self.emit(arm.ldr_pcrel(r, LabelRef(_global_address)))
+
     def loadStack(self, reg, val):
         self.emit(arm.ldr_sprel(reg, arm.MemSpRel(self.getStack(val))))
+
     def comment(self, txt):
         self.emit(Comment(txt))
 
+    def debugInfo(self, loc):
+        if loc:
+            self.emit(DebugInfo(loc))
+
     def generateInstruction(self, ins):
         self.comment(str(ins))
+        if hasattr(ins, 'debugLoc'):
+            self.debugInfo(ins.debugLoc)
         if type(ins) is ir.Branch:
             tgt = LabelRef(ins.target.name)
             self.emit(arm.b_ins(tgt))