diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-05-07 17:33:31 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-05-07 17:33:31 -0600 |
commit | 306e2b87b3d0e4ab211e2a95796b2b2081b89e38 (patch) | |
tree | 31404f3917c91e45e272a8a926f7a2223f7d320d | |
parent | 362fa7c02b5a36a351c1d1c11a7d3c3f28fb67a5 (diff) |
Condense bugfixes wave 3
-rw-r--r-- | condense/CondenseVisitor.java | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/condense/CondenseVisitor.java b/condense/CondenseVisitor.java index 05b5880..480a7d5 100644 --- a/condense/CondenseVisitor.java +++ b/condense/CondenseVisitor.java @@ -122,9 +122,14 @@ public class CondenseVisitor extends VInstr.Visitor<RuntimeException>{ n.getClass().getSimpleName(), n.sourcePos.toString())); /////////////////////////////////////////////////////////////// - this.addMIPS(String.format(" move $%s %s", - ((VVarRef.Register) n.dest).ident, - n.source.toString())); + if (this.isNumeric(n.source.toString())) + this.addMIPS(String.format(" li $%s %s", + ((VVarRef.Register) n.dest).ident, + n.source.toString())); + else + this.addMIPS(String.format(" move $%s %s", + ((VVarRef.Register) n.dest).ident, + n.source.toString())); /////////////////////////////////////////////////////////////// MinimalLogger.info(String.format("<-%s (%s)", n.getClass().getSimpleName(), @@ -180,8 +185,10 @@ public class CondenseVisitor extends VInstr.Visitor<RuntimeException>{ ; else if (op.equals("LtS")) ret += " slti"; - else if (op.equals("PrintIntS")) + else if (op.equals("PrintIntS")) { ret += " jal _print"; + done = true; + } else if (op.equals("HeapAllocZ")) { this.addMIPS(" jal _heapAlloc"); if (n.dest != null) |