summaryrefslogtreecommitdiff
path: root/condense/CondenseVisitor.java
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-05-06 01:09:18 -0600
committerbd-912 <bdunahu@colostate.edu>2024-05-06 01:09:18 -0600
commit21f8331c41f268de77b4cc87f9e118effc6017cb (patch)
tree23f98b007138574e6a178cd5557153ee813eb752 /condense/CondenseVisitor.java
parent8e33e2828ffc62238afc32bb2593b8619f586077 (diff)
Condense epilogue, VCall, MemWrite
Diffstat (limited to 'condense/CondenseVisitor.java')
-rw-r--r--condense/CondenseVisitor.java13
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(),