diff options
Diffstat (limited to 'condense')
-rw-r--r-- | condense/CondenseVisitor.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/condense/CondenseVisitor.java b/condense/CondenseVisitor.java index 4ca987c..96203be 100644 --- a/condense/CondenseVisitor.java +++ b/condense/CondenseVisitor.java @@ -40,6 +40,12 @@ public class CondenseVisitor extends VInstr.Visitor<RuntimeException>{ this.addMIPS(((VCodeLabel) n).ident + ":"); } + // epilogue + this.addMIPS(" lw $ra -4($fp)"); + this.addMIPS(" lw $fp -8($fp)"); + this.addMIPS(String.format(" addu $sp $sp %d", + this.curr.getFrameSize())); + this.addMIPS(" jr $ra"); } } @@ -85,7 +91,8 @@ public class CondenseVisitor extends VInstr.Visitor<RuntimeException>{ n.getClass().getSimpleName(), n.sourcePos.toString())); /////////////////////////////////////////////////////////////// - + this.addMIPS(String.format(" jal %s", + n.addr.toString().substring(1))); /////////////////////////////////////////////////////////////// MinimalLogger.info(String.format("<-%s (%s)", n.getClass().getSimpleName(), @@ -123,7 +130,9 @@ public class CondenseVisitor extends VInstr.Visitor<RuntimeException>{ n.getClass().getSimpleName(), n.sourcePos.toString())); /////////////////////////////////////////////////////////////// - + this.addMIPS(String.format(" lw %s %s", + n.dest.toString(), + this.curr.get(((VMemRef.Stack) n.source)))); /////////////////////////////////////////////////////////////// MinimalLogger.info(String.format("<-%s (%s)", n.getClass().getSimpleName(), |