From aaafaee0d5f8eafff3680f5443e6e8a66d7a2545 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Tue, 7 May 2024 18:43:51 -0600 Subject: Fix calling Labels Condense --- condense/CondenseVisitor.java | 8 ++++++-- output/BubbleSort.s | 2 +- output/LinearSearch.s | 2 +- output/QuickSort.s | 2 +- output/ex45.s | 2 +- output/ex47.s | 2 +- output/ex51.s | 2 +- output/ex99.s | 2 +- 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{ 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 -- cgit v1.2.3