removing needless copy into ret register
This commit is contained in:
parent
ec4499e519
commit
baa70d3f12
|
@ -238,11 +238,11 @@ impl HbvmBackend {
|
|||
};
|
||||
}
|
||||
|
||||
if node.ty.loc(tys) == Loc::Stack
|
||||
&& let Some(PLoc::Reg(r, ..) | PLoc::WideReg(r, ..) | PLoc::Ref(r, ..)) =
|
||||
ret
|
||||
{
|
||||
if node.ty.loc(tys) == Loc::Stack {
|
||||
alloc_buf.push(atr(*node.inputs.last().unwrap()));
|
||||
}
|
||||
|
||||
if let Some(PLoc::Ref(r, ..)) = ret {
|
||||
self.emit(instrs::cp(r, *alloc_buf.last().unwrap()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ main:
|
|||
ADDI64 r254, r254, -160d
|
||||
ST r31, r254, 80a, 80h
|
||||
LRA r32, r0, :glob_stru
|
||||
CP r1, r32
|
||||
JAL r31, r0, :new_stru
|
||||
ST r1, r32, 0a, 16h
|
||||
CP r33, r0
|
||||
|
@ -65,7 +64,6 @@ main:
|
|||
JMP :7
|
||||
3: MULI64 r39, r32, 16d
|
||||
ADD64 r39, r37, r39
|
||||
CP r1, r39
|
||||
JAL r31, r0, :new_stru
|
||||
ST r1, r39, 0a, 16h
|
||||
ADD64 r32, r32, r35
|
||||
|
@ -83,6 +81,6 @@ new_stru:
|
|||
LD r32, r254, 16a, 8h
|
||||
ADDI64 r254, r254, 24d
|
||||
JALA r0, r31, 0a
|
||||
code size: 797
|
||||
code size: 791
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
|
@ -2,8 +2,7 @@ main:
|
|||
ADDI64 r254, r254, -38d
|
||||
ST r31, r254, 6a, 32h
|
||||
ADDI64 r32, r254, 0d
|
||||
2: CP r1, r32
|
||||
JAL r31, r0, :return_fn
|
||||
2: JAL r31, r0, :return_fn
|
||||
ST r1, r32, 0a, 6h
|
||||
LD r33, r254, 0a, 1h
|
||||
ANDI r33, r33, 255d
|
||||
|
@ -30,6 +29,6 @@ return_fn:
|
|||
LD r32, r254, 6a, 16h
|
||||
ADDI64 r254, r254, 22d
|
||||
JALA r0, r31, 0a
|
||||
code size: 317
|
||||
code size: 314
|
||||
ret: 1
|
||||
status: Ok(())
|
||||
|
|
|
@ -4,7 +4,6 @@ foo:
|
|||
ADDI64 r32, r254, 64d
|
||||
LRA r33, r0, :some_file
|
||||
CP r3, r33
|
||||
CP r1, r32
|
||||
JAL r31, r0, :get
|
||||
ST r1, r32, 0a, 16h
|
||||
LD r33, r254, 64a, 1h
|
||||
|
@ -63,7 +62,6 @@ main:
|
|||
ADDI64 r254, r254, -48d
|
||||
ST r31, r254, 16a, 32h
|
||||
ADDI64 r32, r254, 0d
|
||||
CP r1, r32
|
||||
JAL r31, r0, :foo
|
||||
ST r1, r32, 0a, 16h
|
||||
LD r33, r254, 0a, 1h
|
||||
|
@ -77,6 +75,6 @@ main:
|
|||
1: LD r31, r254, 16a, 32h
|
||||
ADDI64 r254, r254, 48d
|
||||
JALA r0, r31, 0a
|
||||
code size: 771
|
||||
code size: 765
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
|
@ -7,7 +7,6 @@ main:
|
|||
CP r1, r33
|
||||
JAL r31, r0, :returner_bn
|
||||
ADDI64 r34, r254, 0d
|
||||
CP r1, r34
|
||||
JAL r31, r0, :returner_cn
|
||||
ST r1, r34, 0a, 2h
|
||||
LD r33, r254, 2a, 1h
|
||||
|
@ -62,6 +61,6 @@ returner_fn:
|
|||
LD r32, r254, 0a, 8h
|
||||
ADDI64 r254, r254, 8d
|
||||
JALA r0, r31, 0a
|
||||
code size: 566
|
||||
code size: 563
|
||||
ret: 1
|
||||
status: Ok(())
|
||||
|
|
|
@ -55,7 +55,6 @@ main:
|
|||
CP r1, r32
|
||||
JMP :3
|
||||
9: ADDI64 r33, r254, 40d
|
||||
CP r1, r33
|
||||
JAL r31, r0, :new_foo
|
||||
ST r1, r33, 0a, 16h
|
||||
LD r37, r254, 40a, 8h
|
||||
|
@ -68,7 +67,6 @@ main:
|
|||
LD r2, r33, 0a, 16h
|
||||
JAL r31, r0, :use_foo
|
||||
ADDI64 r33, r254, 0d
|
||||
CP r1, r33
|
||||
JAL r31, r0, :no_foo
|
||||
ST r1, r33, 0a, 16h
|
||||
JAL r31, r0, :decide
|
||||
|
@ -150,6 +148,6 @@ use_foo:
|
|||
CP r0, r4
|
||||
ADDI64 r254, r254, 16d
|
||||
JALA r0, r31, 0a
|
||||
code size: 1252
|
||||
code size: 1246
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
|
@ -6,7 +6,6 @@ main:
|
|||
CP r4, r0
|
||||
CP r5, r0
|
||||
CP r6, r0
|
||||
CP r1, r13
|
||||
ECA
|
||||
ST r1, r13, 0a, 16h
|
||||
LD r14, r254, 0a, 1h
|
||||
|
@ -19,6 +18,6 @@ main:
|
|||
ADDI64 r254, r254, 32d
|
||||
JALA r0, r31, 0a
|
||||
unknown ecall: 0
|
||||
code size: 153
|
||||
code size: 150
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
status: Err(Unreachable)
|
||||
|
|
|
@ -7,7 +7,6 @@ main:
|
|||
LI64 r34, 4d
|
||||
ST r34, r254, 0a, 8h
|
||||
ST r33, r254, 8a, 8h
|
||||
CP r1, r32
|
||||
JAL r31, r0, :opaque
|
||||
ST r1, r32, 0a, 16h
|
||||
LD r34, r254, 8a, 8h
|
||||
|
@ -31,6 +30,6 @@ opaque:
|
|||
LD r32, r254, 16a, 16h
|
||||
ADDI64 r254, r254, 32d
|
||||
JALA r0, r31, 0a
|
||||
code size: 339
|
||||
code size: 336
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
|
@ -2,7 +2,6 @@ main:
|
|||
ADDI64 r254, r254, -60d
|
||||
ST r31, r254, 4a, 56h
|
||||
ADDI64 r32, r254, 0d
|
||||
CP r1, r32
|
||||
JAL r31, r0, :random_color
|
||||
ST r1, r32, 0a, 4h
|
||||
LD r34, r254, 0a, 1h
|
||||
|
@ -28,6 +27,6 @@ random_color:
|
|||
LD r32, r254, 0a, 8h
|
||||
ADDI64 r254, r254, 8d
|
||||
JALA r0, r31, 0a
|
||||
code size: 295
|
||||
code size: 292
|
||||
ret: 1020
|
||||
status: Ok(())
|
||||
|
|
|
@ -15,7 +15,6 @@ main:
|
|||
ADDI64 r254, r254, -48d
|
||||
ST r31, r254, 16a, 32h
|
||||
ADDI64 r32, r254, 0d
|
||||
CP r1, r32
|
||||
JAL r31, r0, :get_format
|
||||
ST r1, r32, 0a, 16h
|
||||
LD r33, r254, 0a, 1h
|
||||
|
@ -29,6 +28,6 @@ main:
|
|||
1: LD r31, r254, 16a, 32h
|
||||
ADDI64 r254, r254, 48d
|
||||
JALA r0, r31, 0a
|
||||
code size: 304
|
||||
code size: 301
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
|
@ -17,7 +17,6 @@ main:
|
|||
ST r31, r254, 16a, 24h
|
||||
ADDI64 r32, r254, 0d
|
||||
CP r3, r0
|
||||
CP r1, r32
|
||||
JAL r31, r0, :constructor
|
||||
ST r1, r32, 0a, 16h
|
||||
LD r31, r254, 16a, 24h
|
||||
|
@ -35,6 +34,6 @@ opaque:
|
|||
LD r32, r254, 0a, 16h
|
||||
ADDI64 r254, r254, 16d
|
||||
JALA r0, r31, 0a
|
||||
code size: 330
|
||||
code size: 327
|
||||
ret: 255
|
||||
status: Ok(())
|
||||
|
|
|
@ -5,7 +5,6 @@ main:
|
|||
ADDI64 r33, r254, 0d
|
||||
LD r32, r32, 0a, 4h
|
||||
CP r2, r32
|
||||
CP r1, r33
|
||||
JAL r31, r0, :u32_to_color
|
||||
ST r1, r33, 0a, 4h
|
||||
LD r32, r254, 0a, 1h
|
||||
|
@ -35,6 +34,6 @@ u32_to_u32:
|
|||
LD r32, r254, 0a, 8h
|
||||
ADDI64 r254, r254, 8d
|
||||
JALA r0, r31, 0a
|
||||
code size: 332
|
||||
code size: 329
|
||||
ret: 255
|
||||
status: Ok(())
|
||||
|
|
|
@ -28,7 +28,6 @@ main:
|
|||
JAL r31, r0, :do_stuff
|
||||
CP r32, r1
|
||||
ADDI64 r33, r254, 0d
|
||||
CP r1, r33
|
||||
JAL r31, r0, :optional
|
||||
ST r1, r33, 0a, 16h
|
||||
LD r33, r254, 0a, 1h
|
||||
|
@ -76,6 +75,6 @@ optionala:
|
|||
LD r32, r254, 48a, 32h
|
||||
ADDI64 r254, r254, 80d
|
||||
JALA r0, r31, 0a
|
||||
code size: 673
|
||||
code size: 670
|
||||
ret: 100
|
||||
status: Ok(())
|
||||
|
|
|
@ -15,15 +15,12 @@ main:
|
|||
ADDI64 r254, r254, -96d
|
||||
ST r31, r254, 48a, 48h
|
||||
ADDI64 r32, r254, 32d
|
||||
CP r1, r32
|
||||
JAL r31, r0, :foo
|
||||
ST r1, r32, 0a, 16h
|
||||
ADDI64 r33, r254, 16d
|
||||
CP r1, r33
|
||||
JAL r31, r0, :foo
|
||||
ST r1, r33, 0a, 16h
|
||||
ADDI64 r34, r254, 0d
|
||||
CP r1, r34
|
||||
JAL r31, r0, :foo
|
||||
ST r1, r34, 0a, 16h
|
||||
LD r33, r254, 24a, 4h
|
||||
|
@ -39,6 +36,6 @@ main:
|
|||
LD r31, r254, 48a, 48h
|
||||
ADDI64 r254, r254, 96d
|
||||
JALA r0, r31, 0a
|
||||
code size: 393
|
||||
code size: 384
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
|
@ -7,7 +7,6 @@ main:
|
|||
LI64 r32, 3d
|
||||
ST r32, r254, 24a, 8h
|
||||
ADDI64 r34, r254, 0d
|
||||
CP r1, r34
|
||||
LD r3, r33, 0a, 16h
|
||||
JAL r31, r0, :odher_pass
|
||||
ST r1, r34, 0a, 16h
|
||||
|
@ -41,6 +40,6 @@ pass:
|
|||
LD r32, r254, 0a, 8h
|
||||
ADDI64 r254, r254, 8d
|
||||
JALA r0, r31, 0a
|
||||
code size: 390
|
||||
code size: 387
|
||||
ret: 4
|
||||
status: Ok(())
|
||||
|
|
|
@ -4,7 +4,6 @@ main:
|
|||
ADDI64 r32, r254, 0d
|
||||
CP r3, r0
|
||||
CP r4, r0
|
||||
CP r1, r32
|
||||
JAL r31, r0, :maina
|
||||
ST r1, r32, 0a, 16h
|
||||
LD r34, r254, 12a, 1h
|
||||
|
@ -21,7 +20,6 @@ maina:
|
|||
CP r0, r3
|
||||
CP r0, r4
|
||||
ADDI64 r32, r254, 16d
|
||||
CP r1, r32
|
||||
JAL r31, r0, :small_struct
|
||||
ST r1, r32, 0a, 4h
|
||||
ADDI64 r33, r254, 0d
|
||||
|
@ -57,6 +55,6 @@ small_struct:
|
|||
LD r32, r254, 4a, 8h
|
||||
ADDI64 r254, r254, 12d
|
||||
JALA r0, r31, 0a
|
||||
code size: 597
|
||||
code size: 591
|
||||
ret: 2
|
||||
status: Ok(())
|
||||
|
|
Loading…
Reference in a new issue