diff options
Diffstat (limited to 'condense/CondenseVisitor.java')
-rw-r--r-- | condense/CondenseVisitor.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/condense/CondenseVisitor.java b/condense/CondenseVisitor.java index 436ddfa..def8289 100644 --- a/condense/CondenseVisitor.java +++ b/condense/CondenseVisitor.java @@ -122,14 +122,19 @@ public class CondenseVisitor extends VInstr.Visitor<RuntimeException>{ n.getClass().getSimpleName(), n.sourcePos.toString())); /////////////////////////////////////////////////////////////// - if (this.isNumeric(n.source.toString())) + String source = n.source.toString(); + if (this.isNumeric(source)) this.addMIPS(String.format(" li $%s %s", ((VVarRef.Register) n.dest).ident, - n.source.toString())); + source)); + else if (source.contains(":")) + this.addMIPS(String.format(" la $%s %s", + ((VVarRef.Register) n.dest).ident, + source.substring(1))); else this.addMIPS(String.format(" move $%s %s", ((VVarRef.Register) n.dest).ident, - n.source.toString())); + source)); /////////////////////////////////////////////////////////////// MinimalLogger.info(String.format("<-%s (%s)", n.getClass().getSimpleName(), |