summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-05-07 18:43:51 -0600
committerbd-912 <bdunahu@colostate.edu>2024-05-07 18:43:51 -0600
commitaaafaee0d5f8eafff3680f5443e6e8a66d7a2545 (patch)
treea1870830f4555227536330387e5ae856cec49e2d
parent9a025aeaeb4104d6a66baaa575c669231d5d76bc (diff)
Fix calling Labels Condense
-rw-r--r--condense/CondenseVisitor.java8
-rw-r--r--output/BubbleSort.s2
-rw-r--r--output/LinearSearch.s2
-rw-r--r--output/QuickSort.s2
-rw-r--r--output/ex45.s2
-rw-r--r--output/ex47.s2
-rw-r--r--output/ex51.s2
-rw-r--r--output/ex99.s2
8 files changed, 13 insertions, 9 deletions
diff --git a/condense/CondenseVisitor.java b/condense/CondenseVisitor.java
index 5713ded..3ded2e8 100644
--- a/condense/CondenseVisitor.java
+++ b/condense/CondenseVisitor.java
@@ -141,8 +141,12 @@ public class CondenseVisitor extends VInstr.Visitor<RuntimeException>{
n.getClass().getSimpleName(),
n.sourcePos.toString()));
///////////////////////////////////////////////////////////////
- this.addMIPS(String.format(" jalr $%s",
- n.addr.toString().substring(1)));
+ if (n.addr.toString().contains(":"))
+ this.addMIPS(String.format(" jal %s",
+ n.addr.toString().substring(1)));
+ else
+ this.addMIPS(String.format(" jalr %s",
+ n.addr.toString()));
///////////////////////////////////////////////////////////////
MinimalLogger.info(String.format("<-%s (%s)",
n.getClass().getSimpleName(),
diff --git a/output/BubbleSort.s b/output/BubbleSort.s
index af87d40..621b43d 100644
--- a/output/BubbleSort.s
+++ b/output/BubbleSort.s
@@ -866,7 +866,7 @@ BBS_Init:
sw $t7 -60($fp)
sw $t8 -64($fp)
move $a0 $s6
- jalr $AllocArray
+ jal AllocArray
lw $t3 -44($fp)
lw $t4 -48($fp)
lw $t5 -52($fp)
diff --git a/output/LinearSearch.s b/output/LinearSearch.s
index af16f11..064e8cf 100644
--- a/output/LinearSearch.s
+++ b/output/LinearSearch.s
@@ -674,7 +674,7 @@ LS_Init:
sw $t7 -60($fp)
sw $t8 -64($fp)
move $a0 $s6
- jalr $AllocArray
+ jal AllocArray
lw $t3 -44($fp)
lw $t4 -48($fp)
lw $t5 -52($fp)
diff --git a/output/QuickSort.s b/output/QuickSort.s
index 88e6ab2..ea68899 100644
--- a/output/QuickSort.s
+++ b/output/QuickSort.s
@@ -1184,7 +1184,7 @@ QS_Init:
sw $t7 -60($fp)
sw $t8 -64($fp)
move $a0 $s6
- jalr $AllocArray
+ jal AllocArray
lw $t3 -44($fp)
lw $t4 -48($fp)
lw $t5 -52($fp)
diff --git a/output/ex45.s b/output/ex45.s
index e5d3aba..29acb9c 100644
--- a/output/ex45.s
+++ b/output/ex45.s
@@ -87,7 +87,7 @@ A_run:
sw $t7 -60($fp)
sw $t8 -64($fp)
move $a0 $s5
- jalr $AllocArray
+ jal AllocArray
lw $t3 -44($fp)
lw $t4 -48($fp)
lw $t5 -52($fp)
diff --git a/output/ex47.s b/output/ex47.s
index 12d5e13..5023f58 100644
--- a/output/ex47.s
+++ b/output/ex47.s
@@ -112,7 +112,7 @@ A_set:
sw $t7 -60($fp)
sw $t8 -64($fp)
move $a0 $s4
- jalr $AllocArray
+ jal AllocArray
lw $t3 -44($fp)
lw $t4 -48($fp)
lw $t5 -52($fp)
diff --git a/output/ex51.s b/output/ex51.s
index 61b05a0..0fde62b 100644
--- a/output/ex51.s
+++ b/output/ex51.s
@@ -180,7 +180,7 @@ Test_start:
sw $t7 -60($fp)
sw $t8 -64($fp)
move $a0 $s4
- jalr $AllocArray
+ jal AllocArray
lw $t3 -44($fp)
lw $t4 -48($fp)
lw $t5 -52($fp)
diff --git a/output/ex99.s b/output/ex99.s
index d75bb99..f401cf2 100644
--- a/output/ex99.s
+++ b/output/ex99.s
@@ -19,7 +19,7 @@ foo:
add $s1 $a0 $t9
sw $s0 -28($fp)
sw $s1 -24($fp)
- jalr $bar
+ jal bar
move $a0 $v0
move $t9 $v0
add $s2 $a0 $t9