diff options
Diffstat (limited to 'condense')
-rw-r--r-- | condense/CondenseVisitor.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/condense/CondenseVisitor.java b/condense/CondenseVisitor.java index fd337d9..5713ded 100644 --- a/condense/CondenseVisitor.java +++ b/condense/CondenseVisitor.java @@ -180,9 +180,9 @@ public class CondenseVisitor extends VInstr.Visitor<RuntimeException>{ else if (op.equals("MulS")) ret += " mul"; else if (op.equals("Eq")) - ret += "NULL"; // fixme + ret += " and"; else if (op.equals("Lt")) - ; + ret += " slt"; else if (op.equals("LtS")) ret += " slt"; else if (op.equals("PrintIntS")) { @@ -223,12 +223,18 @@ public class CondenseVisitor extends VInstr.Visitor<RuntimeException>{ n.sourcePos.toString())); /////////////////////////////////////////////////////////////// String source = n.source.toString(); + if (this.isNumeric(source)) { + this.addMIPS(String.format(" li $t9 %s", + source)); + source = "$t9"; + } String dest; if (n.dest instanceof VMemRef.Stack) dest = this.curr.get(((VMemRef.Stack) n.dest)); else - dest = String.format("0(%s)", + dest = String.format("%d(%s)", + ((VMemRef.Global) n.dest).byteOffset, ((VMemRef.Global) n.dest).base.toString()); if (source.contains(":")) { this.addMIPS(String.format(" la $t9 %s", @@ -252,11 +258,15 @@ public class CondenseVisitor extends VInstr.Visitor<RuntimeException>{ String dest = n.dest.toString(); String source; - if (n.source instanceof VMemRef.Stack) + if (n.source instanceof VMemRef.Stack) { + MinimalLogger.info("Loading from stack..."); source = this.curr.get(((VMemRef.Stack) n.source)); - else - source = String.format("0(%s)", + } else { + MinimalLogger.info("Loading a const..."); + source = String.format("%d(%s)", + ((VMemRef.Global) n.source).byteOffset, ((VMemRef.Global) n.source).base.toString()); + } this.addMIPS(String.format(" lw %s %s", dest, source)); |