From bf6c70d595e194e8688737b39f31d173436163d4 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Wed, 8 May 2024 03:23:52 -0600 Subject: Fix issue with assigning a label to a register in Condense --- condense/CondenseVisitor.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'condense') 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{ 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(), -- cgit v1.2.3