summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBenedikt Böhm <bb@xnull.de>2009-07-06 18:15:46 +0200
committerBenedikt Böhm <bb@xnull.de>2009-07-06 18:15:46 +0200
commitf4ec2c9b488f83754a2361f3ece8543d0574d0fe (patch)
tree466b8c5c781821505b68f47da9d8c4b3753161a6 /src
parent8f00dd8b77df280f7456cd3dfe7a147916730434 (diff)
downloadswppy-f4ec2c9b488f83754a2361f3ece8543d0574d0fe.tar.gz
swppy-f4ec2c9b488f83754a2361f3ece8543d0574d0fe.tar.xz
swppy-f4ec2c9b488f83754a2361f3ece8543d0574d0fe.zip
fix generation of LW, SW opcodes
Diffstat (limited to 'src')
-rw-r--r--src/back/generator.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/back/generator.py b/src/back/generator.py
index 56a143c..414cf7b 100644
--- a/src/back/generator.py
+++ b/src/back/generator.py
@@ -72,7 +72,8 @@ class Generator(object):
self.emit("SUB r%d, r0, r%d" % (tac.arg1, tac.arg1))
elif tac.op in [Op.STORE, Op.LOAD]:
offset = Scope().get_variable_offset(tac.arg1)
- self.emit("%s bp, r%d, %d" % (tac.op, tac.arg2, offset * 4))
+ op = {Op.STORE: "SW", Op.LOAD: "LW"}[tac.op]
+ self.emit("%s bp, r%d, %d" % (op, tac.arg2, offset * 4))
elif tac.op == Op.MOV:
self.emit("MOV r%d, %d" % (tac.arg1, tac.arg2))
elif tac.op == Op.CMP: