diff options
author | Benedikt Böhm <bb@xnull.de> | 2009-07-06 18:15:46 +0200 |
---|---|---|
committer | Benedikt Böhm <bb@xnull.de> | 2009-07-06 18:15:46 +0200 |
commit | f4ec2c9b488f83754a2361f3ece8543d0574d0fe (patch) | |
tree | 466b8c5c781821505b68f47da9d8c4b3753161a6 | |
parent | 8f00dd8b77df280f7456cd3dfe7a147916730434 (diff) | |
download | swppy-f4ec2c9b488f83754a2361f3ece8543d0574d0fe.tar.gz swppy-f4ec2c9b488f83754a2361f3ece8543d0574d0fe.tar.xz swppy-f4ec2c9b488f83754a2361f3ece8543d0574d0fe.zip |
fix generation of LW, SW opcodes
Diffstat (limited to '')
-rw-r--r-- | src/back/generator.py | 3 |
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: |