diff options
-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) |