diff options
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: |