removing duplicate un instruction

This commit is contained in:
Jakub Doka 2024-11-16 10:05:56 +01:00
parent 085c593add
commit ec4499e519
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143
9 changed files with 9 additions and 20 deletions

View file

@ -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 => {}

View file

@ -1,6 +1,5 @@
main:
UN
UN
code size: 10
code size: 9
ret: 0
status: Err(Unreachable)

View file

@ -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(())

View file

@ -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(())

View file

@ -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(())

View file

@ -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(())

View file

@ -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(())

View file

@ -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(())

View file

@ -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(())