diff --git a/rust_compiler/libs/compiler/src/test/binary_expression.rs b/rust_compiler/libs/compiler/src/test/binary_expression.rs index 4ac0754..e4bef54 100644 --- a/rust_compiler/libs/compiler/src/test/binary_expression.rs +++ b/rust_compiler/libs/compiler/src/test/binary_expression.rs @@ -52,8 +52,8 @@ fn nested_binary_expressions() -> Result<()> { add r1 r10 r9 mul r2 r1 r8 move r15 r2 - j L1 - L1: + j __internal_L1 + __internal_L1: sub r0 sp 1 get ra db r0 sub sp sp 1 diff --git a/rust_compiler/libs/compiler/src/test/branching.rs b/rust_compiler/libs/compiler/src/test/branching.rs index 155c535..92f876b 100644 --- a/rust_compiler/libs/compiler/src/test/branching.rs +++ b/rust_compiler/libs/compiler/src/test/branching.rs @@ -22,9 +22,9 @@ fn test_if_statement() -> anyhow::Result<()> { main: move r8 10 sgt r1 r8 5 - beqz r1 L1 + beqz r1 __internal_L1 move r8 20 - L1: + __internal_L1: " } ); @@ -54,12 +54,12 @@ fn test_if_else_statement() -> anyhow::Result<()> { main: move r8 0 sgt r1 10 5 - beqz r1 L2 + beqz r1 __internal_L2 move r8 1 - j L1 - L2: + j __internal_L1 + __internal_L2: move r8 2 - L1: + __internal_L1: " } ); @@ -91,18 +91,18 @@ fn test_if_else_if_statement() -> anyhow::Result<()> { main: move r8 0 seq r1 r8 1 - beqz r1 L2 + beqz r1 __internal_L2 move r8 10 - j L1 - L2: + j __internal_L1 + __internal_L2: seq r2 r8 2 - beqz r2 L4 + beqz r2 __internal_L4 move r8 20 - j L3 - L4: + j __internal_L3 + __internal_L4: move r8 30 - L3: - L1: + __internal_L3: + __internal_L1: " } ); @@ -145,10 +145,10 @@ fn test_spilled_variable_update_in_branch() -> anyhow::Result<()> { move r14 7 push 8 seq r1 r8 1 - beqz r1 L1 + beqz r1 __internal_L1 sub r0 sp 1 put db r0 99 - L1: + __internal_L1: sub sp sp 1 " } diff --git a/rust_compiler/libs/compiler/src/test/declaration_function_invocation.rs b/rust_compiler/libs/compiler/src/test/declaration_function_invocation.rs index dbdfaca..e4e8fa7 100644 --- a/rust_compiler/libs/compiler/src/test/declaration_function_invocation.rs +++ b/rust_compiler/libs/compiler/src/test/declaration_function_invocation.rs @@ -17,7 +17,7 @@ fn no_arguments() -> anyhow::Result<()> { j main doSomething: push ra - L1: + __internal_L1: sub r0 sp 1 get ra db r0 sub sp sp 1 @@ -59,14 +59,14 @@ fn let_var_args() -> anyhow::Result<()> { push ra mul r1 r8 2 move r15 r1 - j L1 - L1: + j __internal_L1 + __internal_L1: sub r0 sp 1 get ra db r0 sub sp sp 1 j ra main: - L2: + __internal_L2: move r8 123 push r8 push r8 @@ -77,8 +77,8 @@ fn let_var_args() -> anyhow::Result<()> { move r9 r15 pow r1 r9 2 move r9 r1 - j L2 - L3: + j __internal_L2 + __internal_L3: " } ); @@ -127,8 +127,8 @@ fn inline_literal_args() -> anyhow::Result<()> { pop r9 push ra move r15 5 - j L1 - L1: + j __internal_L1 + __internal_L1: sub r0 sp 1 get ra db r0 sub sp sp 1 @@ -170,7 +170,7 @@ fn mixed_args() -> anyhow::Result<()> { pop r8 pop r9 push ra - L1: + __internal_L1: sub r0 sp 1 get ra db r0 sub sp sp 1 @@ -214,8 +214,8 @@ fn with_return_statement() -> anyhow::Result<()> { pop r8 push ra move r15 456 - j L1 - L1: + j __internal_L1 + __internal_L1: sub r0 sp 1 get ra db r0 sub sp sp 1 @@ -251,7 +251,7 @@ fn with_negative_return_literal() -> anyhow::Result<()> { doSomething: push ra move r15 -1 - L1: + __internal_L1: sub r0 sp 1 get ra db r0 sub sp sp 1 diff --git a/rust_compiler/libs/compiler/src/test/declaration_literal.rs b/rust_compiler/libs/compiler/src/test/declaration_literal.rs index 550e332..58927c4 100644 --- a/rust_compiler/libs/compiler/src/test/declaration_literal.rs +++ b/rust_compiler/libs/compiler/src/test/declaration_literal.rs @@ -133,8 +133,8 @@ fn test_boolean_return() -> anyhow::Result<()> { getTrue: push ra move r15 1 - j L1 - L1: + j __internal_L1 + __internal_L1: sub r0 sp 1 get ra db r0 sub sp sp 1 diff --git a/rust_compiler/libs/compiler/src/test/function_declaration.rs b/rust_compiler/libs/compiler/src/test/function_declaration.rs index 18f5b84..2c909f6 100644 --- a/rust_compiler/libs/compiler/src/test/function_declaration.rs +++ b/rust_compiler/libs/compiler/src/test/function_declaration.rs @@ -21,7 +21,7 @@ fn test_function_declaration_with_spillover_params() -> anyhow::Result<()> { pop r13 pop r14 push ra - L1: + __internal_L1: sub r0 sp 1 get ra db r0 sub sp sp 3 @@ -54,12 +54,12 @@ fn test_early_return() -> anyhow::Result<()> { doSomething: push ra seq r1 1 1 - beqz r1 L2 - j L1 - L2: + beqz r1 __internal_L2 + j __internal_L1 + __internal_L2: move r8 3 - j L1 - L1: + j __internal_L1 + __internal_L1: sub r0 sp 1 get ra db r0 sub sp sp 1 @@ -90,7 +90,7 @@ fn test_function_declaration_with_register_params() -> anyhow::Result<()> { pop r8 pop r9 push ra - L1: + __internal_L1: sub r0 sp 1 get ra db r0 sub sp sp 1 diff --git a/rust_compiler/libs/compiler/src/test/loops.rs b/rust_compiler/libs/compiler/src/test/loops.rs index 83745f0..b803354 100644 --- a/rust_compiler/libs/compiler/src/test/loops.rs +++ b/rust_compiler/libs/compiler/src/test/loops.rs @@ -14,7 +14,7 @@ fn test_infinite_loop() -> anyhow::Result<()> { " }; - // Labels: L1 (start), L2 (end) + // __internal_Labels: L1 (start), L2 (end) assert_eq!( compiled, indoc! { @@ -22,11 +22,11 @@ fn test_infinite_loop() -> anyhow::Result<()> { j main main: move r8 0 - L1: + __internal_L1: add r1 r8 1 move r8 r1 - j L1 - L2: + j __internal_L1 + __internal_L2: " } ); @@ -49,7 +49,7 @@ fn test_loop_break() -> anyhow::Result<()> { " }; - // Labels: L1 (start), L2 (end), L3 (if end - implicit else label) + // __internal_Labels: L1 (start), L2 (end), L3 (if end - implicit else label) assert_eq!( compiled, indoc! { @@ -57,15 +57,15 @@ fn test_loop_break() -> anyhow::Result<()> { j main main: move r8 0 - L1: + __internal_L1: add r1 r8 1 move r8 r1 sgt r2 r8 10 - beqz r2 L3 - j L2 - L3: - j L1 - L2: + beqz r2 __internal_L3 + j __internal_L2 + __internal_L3: + j __internal_L1 + __internal_L2: " } ); @@ -85,7 +85,7 @@ fn test_while_loop() -> anyhow::Result<()> { " }; - // Labels: L1 (start), L2 (end) + // __internal_Labels: L1 (start), L2 (end) assert_eq!( compiled, indoc! { @@ -93,13 +93,13 @@ fn test_while_loop() -> anyhow::Result<()> { j main main: move r8 0 - L1: + __internal_L1: slt r1 r8 10 - beqz r1 L2 + beqz r1 __internal_L2 add r2 r8 1 move r8 r2 - j L1 - L2: + j __internal_L1 + __internal_L2: " } ); @@ -123,7 +123,7 @@ fn test_loop_continue() -> anyhow::Result<()> { "# }; - // Labels: L1 (start), L2 (end), L3 (if end) + // __internal_Labels: L1 (start), L2 (end), L3 (if end) assert_eq!( compiled, indoc! { @@ -131,16 +131,16 @@ fn test_loop_continue() -> anyhow::Result<()> { j main main: move r8 0 - L1: + __internal_L1: add r1 r8 1 move r8 r1 slt r2 r8 5 - beqz r2 L3 - j L1 - L3: - j L2 - j L1 - L2: + beqz r2 __internal_L3 + j __internal_L1 + __internal_L3: + j __internal_L2 + j __internal_L1 + __internal_L2: " } );