From 21f8331c41f268de77b4cc87f9e118effc6017cb Mon Sep 17 00:00:00 2001 From: bd-912 Date: Mon, 6 May 2024 01:09:18 -0600 Subject: Condense epilogue, VCall, MemWrite --- condense/CondenseVisitor.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'condense/CondenseVisitor.java') 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{ 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{ 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{ 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(), -- cgit v1.2.3