From ec4499e5191f22304e50f8e738366a83b63db926 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sat, 16 Nov 2024 10:05:56 +0100 Subject: [PATCH] removing duplicate un instruction --- lang/src/son/hbvm/my_regalloc.rs | 2 +- lang/tests/son_tests_die.txt | 3 +-- lang/tests/son_tests_generic_type_mishap.txt | 3 +-- lang/tests/son_tests_null_check_in_the_loop.txt | 3 +-- lang/tests/son_tests_null_check_returning_small_global.txt | 4 +--- lang/tests/son_tests_nullable_types.txt | 4 +--- lang/tests/son_tests_optional_from_eca.txt | 4 +--- lang/tests/son_tests_returning_optional_issues.txt | 3 +-- lang/tests/son_tests_storing_into_nullable_struct.txt | 3 +-- 9 files changed, 9 insertions(+), 20 deletions(-) diff --git a/lang/src/son/hbvm/my_regalloc.rs b/lang/src/son/hbvm/my_regalloc.rs index f05d1072..1ef67b3f 100644 --- a/lang/src/son/hbvm/my_regalloc.rs +++ b/lang/src/son/hbvm/my_regalloc.rs @@ -200,7 +200,7 @@ impl HbvmBackend { None => {} } } - Kind::Die => self.emit(instrs::un()), + Kind::Die => {} Kind::CInt { .. } => alloc_buf.push(atr(nid)), Kind::UnOp { .. } => alloc_buf.extend([atr(nid), atr(node.inputs[1])]), Kind::BinOp { .. } if node.lock_rc != 0 => {} diff --git a/lang/tests/son_tests_die.txt b/lang/tests/son_tests_die.txt index 37bd5424..253b7cdc 100644 --- a/lang/tests/son_tests_die.txt +++ b/lang/tests/son_tests_die.txt @@ -1,6 +1,5 @@ main: UN - UN -code size: 10 +code size: 9 ret: 0 status: Err(Unreachable) diff --git a/lang/tests/son_tests_generic_type_mishap.txt b/lang/tests/son_tests_generic_type_mishap.txt index b83805ad..6037f7ec 100644 --- a/lang/tests/son_tests_generic_type_mishap.txt +++ b/lang/tests/son_tests_generic_type_mishap.txt @@ -20,7 +20,6 @@ process: JAL r31, r0, :opaque LD r35, r254, 0a, 1h ANDI r35, r35, 255d - ANDI r0, r0, 255d JEQ r35, r0, :2 JMP :3 2: ADDI64 r32, r32, -1d @@ -29,6 +28,6 @@ process: ADDI64 r254, r254, 64d JALA r0, r31, 0a timed out -code size: 262 +code size: 251 ret: 0 status: Ok(()) diff --git a/lang/tests/son_tests_null_check_in_the_loop.txt b/lang/tests/son_tests_null_check_in_the_loop.txt index a1389724..86070811 100644 --- a/lang/tests/son_tests_null_check_in_the_loop.txt +++ b/lang/tests/son_tests_null_check_in_the_loop.txt @@ -7,7 +7,6 @@ main: ST r1, r32, 0a, 6h LD r33, r254, 0a, 1h ANDI r33, r33, 255d - ANDI r0, r0, 255d JEQ r33, r0, :0 LI64 r32, 1d CP r1, r32 @@ -31,6 +30,6 @@ return_fn: LD r32, r254, 6a, 16h ADDI64 r254, r254, 22d JALA r0, r31, 0a -code size: 328 +code size: 317 ret: 1 status: Ok(()) diff --git a/lang/tests/son_tests_null_check_returning_small_global.txt b/lang/tests/son_tests_null_check_returning_small_global.txt index 754be3e5..750619ec 100644 --- a/lang/tests/son_tests_null_check_returning_small_global.txt +++ b/lang/tests/son_tests_null_check_returning_small_global.txt @@ -9,7 +9,6 @@ foo: ST r1, r32, 0a, 16h LD r33, r254, 64a, 1h ANDI r33, r33, 255d - ANDI r0, r0, 255d JNE r33, r0, :0 ADDI64 r32, r254, 48d ST r0, r254, 48a, 1h @@ -69,7 +68,6 @@ main: ST r1, r32, 0a, 16h LD r33, r254, 0a, 1h ANDI r33, r33, 255d - ANDI r0, r0, 255d JNE r33, r0, :0 LI64 r32, 100d CP r1, r32 @@ -79,6 +77,6 @@ main: 1: LD r31, r254, 16a, 32h ADDI64 r254, r254, 48d JALA r0, r31, 0a -code size: 793 +code size: 771 ret: 0 status: Ok(()) diff --git a/lang/tests/son_tests_nullable_types.txt b/lang/tests/son_tests_nullable_types.txt index 65a725dc..db311b25 100644 --- a/lang/tests/son_tests_nullable_types.txt +++ b/lang/tests/son_tests_nullable_types.txt @@ -36,7 +36,6 @@ main: 4: ST r0, r254, 56a, 1h 5: LD r32, r254, 56a, 1h ANDI r32, r32, 255d - ANDI r0, r0, 255d JEQ r32, r0, :6 LI64 r32, 42d CP r1, r32 @@ -96,7 +95,6 @@ main: 14: ST r0, r254, 16a, 1h 15: LD r34, r254, 16a, 1h ANDI r34, r34, 255d - ANDI r0, r0, 255d JEQ r34, r0, :16 LI64 r32, 420d CP r1, r32 @@ -152,6 +150,6 @@ use_foo: CP r0, r4 ADDI64 r254, r254, 16d JALA r0, r31, 0a -code size: 1274 +code size: 1252 ret: 0 status: Ok(()) diff --git a/lang/tests/son_tests_optional_from_eca.txt b/lang/tests/son_tests_optional_from_eca.txt index e3acc17f..633b996f 100644 --- a/lang/tests/son_tests_optional_from_eca.txt +++ b/lang/tests/son_tests_optional_from_eca.txt @@ -11,16 +11,14 @@ main: ST r1, r13, 0a, 16h LD r14, r254, 0a, 1h ANDI r14, r14, 255d - ANDI r0, r0, 255d JNE r14, r0, :0 UN - UN 0: LD r13, r254, 8a, 8h CP r1, r13 LD r32, r254, 16a, 16h ADDI64 r254, r254, 32d JALA r0, r31, 0a unknown ecall: 0 -code size: 165 +code size: 153 ret: 0 status: Ok(()) diff --git a/lang/tests/son_tests_returning_optional_issues.txt b/lang/tests/son_tests_returning_optional_issues.txt index aca43be3..2edae21b 100644 --- a/lang/tests/son_tests_returning_optional_issues.txt +++ b/lang/tests/son_tests_returning_optional_issues.txt @@ -20,7 +20,6 @@ main: ST r1, r32, 0a, 16h LD r33, r254, 0a, 1h ANDI r33, r33, 255d - ANDI r0, r0, 255d JNE r33, r0, :0 LI64 r32, 1d CP r1, r32 @@ -30,6 +29,6 @@ main: 1: LD r31, r254, 16a, 32h ADDI64 r254, r254, 48d JALA r0, r31, 0a -code size: 315 +code size: 304 ret: 0 status: Ok(()) diff --git a/lang/tests/son_tests_storing_into_nullable_struct.txt b/lang/tests/son_tests_storing_into_nullable_struct.txt index bf5ee430..00545ee7 100644 --- a/lang/tests/son_tests_storing_into_nullable_struct.txt +++ b/lang/tests/son_tests_storing_into_nullable_struct.txt @@ -33,7 +33,6 @@ main: ST r1, r33, 0a, 16h LD r33, r254, 0a, 1h ANDI r33, r33, 255d - ANDI r0, r0, 255d JNE r33, r0, :2 LI64 r32, 20d CP r1, r32 @@ -77,6 +76,6 @@ optionala: LD r32, r254, 48a, 32h ADDI64 r254, r254, 80d JALA r0, r31, 0a -code size: 684 +code size: 673 ret: 100 status: Ok(())