From f4ec2c9b488f83754a2361f3ece8543d0574d0fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20B=C3=B6hm?= Date: Mon, 6 Jul 2009 18:15:46 +0200 Subject: fix generation of LW, SW opcodes --- src/back/generator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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: -- cgit v1.2.3