summaryrefslogtreecommitdiff
path: root/condense
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-05-08 03:23:52 -0600
committerbd-912 <bdunahu@colostate.edu>2024-05-08 03:23:52 -0600
commitbf6c70d595e194e8688737b39f31d173436163d4 (patch)
treed8a84eb1b78c3c763472789414bc868c599d8378 /condense
parent6a27fdf4276772544d20074ab9abd02dab9c0a20 (diff)
Fix issue with assigning a label to a register in Condense
Diffstat (limited to 'condense')
-rw-r--r--condense/CondenseVisitor.java11
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(),