summaryrefslogtreecommitdiff
path: root/pp2cc.py
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2011-11-30 20:29:21 +0000
committerPeter Wu <lekensteyn@gmail.com>2011-11-30 20:29:21 +0000
commit4ac454608da0616f4727c10e19161e47570b54db (patch)
tree81e501452e64f1ce3b1bf0a46016c8ccac3bf01f /pp2cc.py
parent16eb62608bbec4781621b67550d3c2ebf9c00ff8 (diff)
downloadpp2cc-4ac454608da0616f4727c10e19161e47570b54db.tar.gz
Set correct label in ASM
Diffstat (limited to 'pp2cc.py')
-rwxr-xr-xpp2cc.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pp2cc.py b/pp2cc.py
index 78ce05d..11ff592 100755
--- a/pp2cc.py
+++ b/pp2cc.py
@@ -378,7 +378,9 @@ class LinkedNode(object):
return self.parent.getContinueNode()
return None
def setLabel(self, label_name):
- """Sets the label for this node"""
+ """Sets the label for this node and return the label name as it appears
+ in assembly
+ """
if self.parent:
function = self.parent.getFunctionNode()
if not self.parent or not function:
@@ -393,6 +395,7 @@ class LinkedNode(object):
i += 1
function.goto_labels[label_name] = label_asm
+ return label_asm
def lookupLabel(self, label_name):
"""Returns the label name as it appears in assembly for label_name"""
# get the nearest function for this node
@@ -1334,8 +1337,7 @@ class Parse(object):
return lines
def parseLabel(self, linked_node):
lines = []
- label_name = linked_node.node.name
- linked_node.setLabel(label_name)
+ label_name = linked_node.setLabel(linked_node.node.name)
lines.append(self.asm.noop(label_name))
lines += self.parseStatement(linked_node.node.stmt, linked_node)
return lines