Emit IL alongside raw IC10 for use in future optimization passes

This commit is contained in:
2025-12-12 15:51:36 -07:00
parent 1230f83951
commit 3fb04aef3b
23 changed files with 990 additions and 523 deletions

View File

@@ -20,10 +20,10 @@ fn test_if_statement() -> anyhow::Result<()> {
"
j main
main:
move r8 10 #a
move r8 10
sgt r1 r8 5
beq r1 0 L1
move r8 20 #a
beqz r1 L1
move r8 20
L1:
"
}
@@ -52,13 +52,13 @@ fn test_if_else_statement() -> anyhow::Result<()> {
"
j main
main:
move r8 0 #a
move r8 0
sgt r1 10 5
beq r1 0 L2
move r8 1 #a
beqz r1 L2
move r8 1
j L1
L2:
move r8 2 #a
move r8 2
L1:
"
}
@@ -89,18 +89,18 @@ fn test_if_else_if_statement() -> anyhow::Result<()> {
"
j main
main:
move r8 0 #a
move r8 0
seq r1 r8 1
beq r1 0 L2
move r8 10 #a
beqz r1 L2
move r8 10
j L1
L2:
seq r2 r8 2
beq r2 0 L4
move r8 20 #a
beqz r2 L4
move r8 20
j L3
L4:
move r8 30 #a
move r8 30
L3:
L1:
"
@@ -136,18 +136,18 @@ fn test_spilled_variable_update_in_branch() -> anyhow::Result<()> {
"
j main
main:
move r8 1 #a
move r9 2 #b
move r10 3 #c
move r11 4 #d
move r12 5 #e
move r13 6 #f
move r14 7 #g
push 8 #h
move r8 1
move r9 2
move r10 3
move r11 4
move r12 5
move r13 6
move r14 7
push 8
seq r1 r8 1
beq r1 0 L1
beqz r1 L1
sub r0 sp 1
put db r0 99 #h
put db r0 99
L1:
sub sp sp 1
"