eliminating more useless operations
This commit is contained in:
parent
39588579a8
commit
45e1c6743a
|
@ -4019,15 +4019,17 @@ impl<'a> Function<'a> {
|
|||
self.add_instr(nid, ops);
|
||||
}
|
||||
Kind::Stck
|
||||
if node.ty.loc(self.tys) == Loc::Reg && node.outputs.iter().all(|&n| {
|
||||
matches!(self.nodes[n].kind, Kind::Stre | Kind::Load)
|
||||
if node.outputs.iter().all(|&n| {
|
||||
matches!(self.nodes[n].kind, Kind::Stre | Kind::Load
|
||||
if self.nodes[n].ty.loc(self.tys) == Loc::Reg)
|
||||
|| matches!(self.nodes[n].kind, Kind::BinOp { op: TokenKind::Add }
|
||||
if self.nodes.is_const(self.nodes[n].inputs[2])
|
||||
&& self.nodes[n]
|
||||
.outputs
|
||||
.iter()
|
||||
.all(|&n| matches!(self.nodes[n].kind, Kind::Stre | Kind::Load)))
|
||||
}) => {}
|
||||
.all(|&n| matches!(self.nodes[n].kind, Kind::Stre | Kind::Load
|
||||
if self.nodes[n].ty.loc(self.tys) == Loc::Reg)))
|
||||
}) => self.nodes.lock(nid),
|
||||
Kind::Stck if self.tys.size_of(node.ty) == 0 => self.nodes.lock(nid),
|
||||
Kind::Stck => {
|
||||
let ops = vec![self.drg(nid)];
|
||||
|
|
|
@ -2,24 +2,23 @@ main:
|
|||
ADDI64 r254, r254, -36d
|
||||
ST r31, r254, 28a, 8h
|
||||
LI8 r1, 0b
|
||||
ADDI64 r5, r254, 0d
|
||||
ST r1, r254, 0a, 1h
|
||||
ST r1, r254, 1a, 1h
|
||||
LI8 r6, 255b
|
||||
ST r6, r254, 2a, 1h
|
||||
LI8 r9, 1b
|
||||
ST r9, r254, 3a, 1h
|
||||
LI64 r1, 1d
|
||||
LI8 r5, 255b
|
||||
ST r5, r254, 2a, 1h
|
||||
LI8 r8, 1b
|
||||
ST r8, r254, 3a, 1h
|
||||
LI64 r11, 1d
|
||||
ADDI64 r2, r254, 4d
|
||||
ST r1, r254, 4a, 8h
|
||||
LI64 r5, 2d
|
||||
ST r5, r254, 12a, 8h
|
||||
LI64 r8, 4d
|
||||
ST r8, r254, 20a, 8h
|
||||
ST r11, r254, 4a, 8h
|
||||
LI64 r3, 2d
|
||||
ST r3, r254, 12a, 8h
|
||||
LI64 r6, 4d
|
||||
ST r6, r254, 20a, 8h
|
||||
JAL r31, r0, :pass
|
||||
LD r2, r254, 3a, 1h
|
||||
ANDI r4, r2, 255d
|
||||
ADD64 r1, r1, r4
|
||||
LD r12, r254, 3a, 1h
|
||||
ANDI r2, r12, 255d
|
||||
ADD64 r1, r1, r2
|
||||
LD r31, r254, 28a, 8h
|
||||
ADDI64 r254, r254, 36d
|
||||
JALA r0, r31, 0a
|
||||
|
@ -32,6 +31,6 @@ pass:
|
|||
LD r11, r11, 0a, 8h
|
||||
ADD64 r1, r11, r10
|
||||
JALA r0, r31, 0a
|
||||
code size: 327
|
||||
code size: 316
|
||||
ret: 8
|
||||
status: Ok(())
|
||||
|
|
|
@ -23,29 +23,25 @@ scalar_values:
|
|||
JALA r0, r31, 0a
|
||||
structs:
|
||||
ADDI64 r254, r254, -48d
|
||||
ADDI64 r1, r254, 40d
|
||||
LI64 r3, 0d
|
||||
ST r3, r254, 40a, 8h
|
||||
ADDI64 r7, r254, 0d
|
||||
LI64 r9, 20d
|
||||
ST r9, r254, 0a, 8h
|
||||
LI64 r1, 5d
|
||||
ADDI64 r2, r254, 8d
|
||||
ST r1, r254, 8a, 8h
|
||||
ST r1, r254, 16a, 8h
|
||||
LD r6, r254, 0a, 8h
|
||||
LD r8, r254, 8a, 8h
|
||||
ADD64 r11, r8, r6
|
||||
SUB64 r11, r11, r1
|
||||
ADDI64 r5, r254, 24d
|
||||
ST r11, r254, 24a, 8h
|
||||
ST r9, r254, 32a, 8h
|
||||
LD r5, r254, 40a, 8h
|
||||
LD r7, r254, 24a, 8h
|
||||
ADD64 r10, r7, r5
|
||||
SUB64 r1, r10, r9
|
||||
LI64 r1, 0d
|
||||
ST r1, r254, 40a, 8h
|
||||
LI64 r4, 20d
|
||||
ST r4, r254, 0a, 8h
|
||||
LI64 r7, 5d
|
||||
ST r7, r254, 8a, 8h
|
||||
ST r7, r254, 16a, 8h
|
||||
LD r11, r254, 0a, 8h
|
||||
LD r1, r254, 8a, 8h
|
||||
ADD64 r5, r1, r11
|
||||
SUB64 r5, r5, r7
|
||||
ST r5, r254, 24a, 8h
|
||||
ST r4, r254, 32a, 8h
|
||||
LD r9, r254, 40a, 8h
|
||||
LD r11, r254, 24a, 8h
|
||||
ADD64 r2, r11, r9
|
||||
SUB64 r1, r2, r4
|
||||
ADDI64 r254, r254, 48d
|
||||
JALA r0, r31, 0a
|
||||
code size: 417
|
||||
code size: 373
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
|
@ -15,17 +15,16 @@ main:
|
|||
set:
|
||||
ADDI64 r254, r254, -25d
|
||||
LI8 r7, 5b
|
||||
ADDI64 r11, r254, 0d
|
||||
ST r7, r254, 0a, 1h
|
||||
ANDI r11, r4, 4294967295d
|
||||
ST r11, r254, 1a, 4h
|
||||
LI32 r4, 8w
|
||||
ST r4, r254, 5a, 4h
|
||||
ANDI r10, r4, 4294967295d
|
||||
ST r10, r254, 1a, 4h
|
||||
LI32 r1, 8w
|
||||
ST r1, r254, 5a, 4h
|
||||
ST r2, r254, 9a, 8h
|
||||
ST r3, r254, 17a, 8h
|
||||
LD r1, r254, 1a, 4h
|
||||
ADDI64 r254, r254, 25d
|
||||
JALA r0, r31, 0a
|
||||
code size: 295
|
||||
code size: 284
|
||||
ret: 1024
|
||||
status: Ok(())
|
||||
|
|
|
@ -1,118 +1,113 @@
|
|||
main:
|
||||
ADDI64 r254, r254, -168d
|
||||
LI8 r1, 0b
|
||||
ADDI64 r3, r254, 148d
|
||||
ST r1, r254, 148a, 1h
|
||||
ST r1, r254, 149a, 1h
|
||||
ST r1, r254, 150a, 1h
|
||||
ST r1, r254, 151a, 1h
|
||||
LI8 r10, 1b
|
||||
ADDI64 r11, r254, 144d
|
||||
ST r10, r254, 144a, 1h
|
||||
ST r10, r254, 145a, 1h
|
||||
ST r10, r254, 146a, 1h
|
||||
ST r10, r254, 147a, 1h
|
||||
LD r6, r254, 144a, 1h
|
||||
LD r7, r254, 148a, 1h
|
||||
ADD8 r9, r6, r7
|
||||
ST r9, r254, 148a, 1h
|
||||
LD r1, r254, 145a, 1h
|
||||
LD r2, r254, 149a, 1h
|
||||
ADD8 r4, r2, r1
|
||||
ST r4, r254, 149a, 1h
|
||||
LD r8, r254, 146a, 1h
|
||||
LD r9, r254, 150a, 1h
|
||||
ADD8 r11, r9, r8
|
||||
ST r11, r254, 150a, 1h
|
||||
LD r3, r254, 147a, 1h
|
||||
LD r4, r254, 151a, 1h
|
||||
ADD8 r6, r4, r3
|
||||
ST r6, r254, 151a, 1h
|
||||
LD r10, r254, 149a, 1h
|
||||
LD r11, r254, 150a, 1h
|
||||
ADD8 r1, r11, r10
|
||||
LI8 r7, 1b
|
||||
ST r7, r254, 144a, 1h
|
||||
ST r7, r254, 145a, 1h
|
||||
ST r7, r254, 146a, 1h
|
||||
ST r7, r254, 147a, 1h
|
||||
LD r2, r254, 144a, 1h
|
||||
LD r3, r254, 148a, 1h
|
||||
ADD8 r7, r3, r1
|
||||
LI8 r8, 4b
|
||||
ADD8 r7, r7, r6
|
||||
ANDI r7, r7, 255d
|
||||
ANDI r8, r8, 255d
|
||||
JEQ r7, r8, :0
|
||||
ADD8 r5, r2, r3
|
||||
ST r5, r254, 148a, 1h
|
||||
LD r9, r254, 145a, 1h
|
||||
LD r10, r254, 149a, 1h
|
||||
ADD8 r12, r10, r9
|
||||
ST r12, r254, 149a, 1h
|
||||
LD r4, r254, 146a, 1h
|
||||
LD r5, r254, 150a, 1h
|
||||
ADD8 r7, r5, r4
|
||||
ST r7, r254, 150a, 1h
|
||||
LD r11, r254, 147a, 1h
|
||||
LD r12, r254, 151a, 1h
|
||||
ADD8 r2, r12, r11
|
||||
ST r2, r254, 151a, 1h
|
||||
LD r6, r254, 149a, 1h
|
||||
LD r7, r254, 150a, 1h
|
||||
ADD8 r9, r7, r6
|
||||
LD r11, r254, 148a, 1h
|
||||
ADD8 r3, r11, r9
|
||||
LI8 r4, 4b
|
||||
ADD8 r3, r3, r2
|
||||
ANDI r3, r3, 255d
|
||||
ANDI r4, r4, 255d
|
||||
JEQ r3, r4, :0
|
||||
LI64 r1, 1008d
|
||||
JMP :1
|
||||
0: LI64 r3, 1d
|
||||
ADDI64 r6, r254, 80d
|
||||
ST r3, r254, 80a, 8h
|
||||
LI64 r7, 2d
|
||||
ST r7, r254, 88a, 8h
|
||||
LI64 r11, 3d
|
||||
ADDI64 r2, r254, 32d
|
||||
ST r11, r254, 32a, 8h
|
||||
LI64 r3, 4d
|
||||
ST r3, r254, 40a, 8h
|
||||
LD r10, r254, 32a, 8h
|
||||
LD r11, r254, 80a, 8h
|
||||
ADDI64 r9, r254, 0d
|
||||
ADD64 r1, r10, r11
|
||||
ST r1, r254, 0a, 8h
|
||||
LD r5, r254, 40a, 8h
|
||||
LD r7, r254, 88a, 8h
|
||||
ADD64 r8, r5, r7
|
||||
ST r8, r254, 8a, 8h
|
||||
LD r12, r254, 80a, 8h
|
||||
LD r1, r254, 32a, 8h
|
||||
SUB64 r3, r1, r12
|
||||
ST r3, r254, 16a, 8h
|
||||
LD r7, r254, 88a, 8h
|
||||
LD r8, r254, 40a, 8h
|
||||
SUB64 r10, r8, r7
|
||||
ST r10, r254, 24a, 8h
|
||||
ADDI64 r1, r254, 112d
|
||||
BMC r9, r1, 32h
|
||||
LI64 r4, 0d
|
||||
ADDI64 r7, r254, 96d
|
||||
ST r4, r254, 96a, 8h
|
||||
ST r4, r254, 104a, 8h
|
||||
LD r11, r254, 32a, 8h
|
||||
LD r12, r254, 96a, 8h
|
||||
ADDI64 r7, r254, 48d
|
||||
0: LI64 r11, 1d
|
||||
ADDI64 r2, r254, 80d
|
||||
ST r11, r254, 80a, 8h
|
||||
LI64 r3, 2d
|
||||
ST r3, r254, 88a, 8h
|
||||
LI64 r7, 3d
|
||||
ST r7, r254, 32a, 8h
|
||||
LI64 r10, 4d
|
||||
ST r10, r254, 40a, 8h
|
||||
LD r4, r254, 32a, 8h
|
||||
LD r5, r254, 80a, 8h
|
||||
ADDI64 r3, r254, 0d
|
||||
ADD64 r7, r4, r5
|
||||
ST r7, r254, 0a, 8h
|
||||
LD r11, r254, 40a, 8h
|
||||
LD r12, r254, 88a, 8h
|
||||
ADD64 r4, r11, r12
|
||||
ST r4, r254, 8a, 8h
|
||||
LD r6, r254, 80a, 8h
|
||||
LD r7, r254, 32a, 8h
|
||||
SUB64 r9, r7, r6
|
||||
ST r9, r254, 16a, 8h
|
||||
LD r1, r254, 88a, 8h
|
||||
LD r4, r254, 40a, 8h
|
||||
SUB64 r4, r4, r1
|
||||
ST r4, r254, 24a, 8h
|
||||
ADDI64 r7, r254, 112d
|
||||
BMC r3, r7, 32h
|
||||
LI64 r10, 0d
|
||||
ST r10, r254, 96a, 8h
|
||||
ST r10, r254, 104a, 8h
|
||||
LD r3, r254, 32a, 8h
|
||||
LD r4, r254, 96a, 8h
|
||||
ADDI64 r10, r254, 48d
|
||||
SUB64 r7, r4, r3
|
||||
ST r7, r254, 48a, 8h
|
||||
LD r11, r254, 40a, 8h
|
||||
LD r12, r254, 104a, 8h
|
||||
SUB64 r3, r12, r11
|
||||
ST r3, r254, 48a, 8h
|
||||
LD r8, r254, 40a, 8h
|
||||
LD r9, r254, 104a, 8h
|
||||
SUB64 r10, r9, r8
|
||||
ST r10, r254, 56a, 8h
|
||||
ADDI64 r8, r7, 16d
|
||||
BMC r6, r8, 16h
|
||||
LD r5, r254, 112a, 8h
|
||||
LD r6, r254, 48a, 8h
|
||||
ADD64 r8, r6, r5
|
||||
ST r8, r254, 48a, 8h
|
||||
LD r12, r254, 120a, 8h
|
||||
LD r1, r254, 56a, 8h
|
||||
ADD64 r3, r12, r1
|
||||
ST r3, r254, 56a, 8h
|
||||
LD r8, r254, 128a, 8h
|
||||
LD r9, r254, 64a, 8h
|
||||
ADD64 r11, r8, r9
|
||||
ST r11, r254, 64a, 8h
|
||||
LD r3, r254, 136a, 8h
|
||||
LD r4, r254, 72a, 8h
|
||||
ADD64 r6, r3, r4
|
||||
ST r6, r254, 72a, 8h
|
||||
LD r10, r254, 64a, 8h
|
||||
LD r11, r254, 48a, 8h
|
||||
ADDI64 r5, r254, 152d
|
||||
ADD64 r2, r10, r11
|
||||
ST r2, r254, 152a, 8h
|
||||
LD r6, r254, 72a, 8h
|
||||
LD r7, r254, 56a, 8h
|
||||
ADD64 r9, r6, r7
|
||||
ST r9, r254, 160a, 8h
|
||||
LD r1, r254, 152a, 8h
|
||||
ADD64 r1, r1, r9
|
||||
ADDI64 r12, r10, 16d
|
||||
BMC r2, r12, 16h
|
||||
LD r9, r254, 112a, 8h
|
||||
LD r10, r254, 48a, 8h
|
||||
ADD64 r12, r10, r9
|
||||
ST r12, r254, 48a, 8h
|
||||
LD r4, r254, 120a, 8h
|
||||
LD r5, r254, 56a, 8h
|
||||
ADD64 r7, r4, r5
|
||||
ST r7, r254, 56a, 8h
|
||||
LD r12, r254, 128a, 8h
|
||||
LD r1, r254, 64a, 8h
|
||||
ADD64 r3, r12, r1
|
||||
ST r3, r254, 64a, 8h
|
||||
LD r7, r254, 136a, 8h
|
||||
LD r8, r254, 72a, 8h
|
||||
ADD64 r10, r7, r8
|
||||
ST r10, r254, 72a, 8h
|
||||
LD r2, r254, 64a, 8h
|
||||
LD r3, r254, 48a, 8h
|
||||
ADD64 r5, r2, r3
|
||||
ST r5, r254, 152a, 8h
|
||||
LD r9, r254, 72a, 8h
|
||||
LD r10, r254, 56a, 8h
|
||||
ADD64 r12, r9, r10
|
||||
ST r12, r254, 160a, 8h
|
||||
LD r3, r254, 152a, 8h
|
||||
ADD64 r1, r3, r12
|
||||
1: ADDI64 r254, r254, 168d
|
||||
JALA r0, r31, 0a
|
||||
code size: 1200
|
||||
code size: 1145
|
||||
ret: 10
|
||||
status: Ok(())
|
||||
|
|
|
@ -35,20 +35,19 @@ main:
|
|||
ADDI64 r254, r254, -26d
|
||||
ST r31, r254, 2a, 24h
|
||||
LI8 r32, 10b
|
||||
ADDI64 r3, r254, 0d
|
||||
ST r32, r254, 0a, 1h
|
||||
ST r32, r254, 1a, 1h
|
||||
LD r7, r254, 0a, 1h
|
||||
ANDI r2, r7, 255d
|
||||
LD r5, r254, 0a, 1h
|
||||
ANDI r2, r5, 255d
|
||||
JAL r31, r0, :fib
|
||||
CP r33, r1
|
||||
ANDI r2, r32, 255d
|
||||
JAL r31, r0, :fib_iter
|
||||
CP r6, r33
|
||||
SUB64 r1, r6, r1
|
||||
CP r4, r33
|
||||
SUB64 r1, r4, r1
|
||||
LD r31, r254, 2a, 24h
|
||||
ADDI64 r254, r254, 26d
|
||||
JALA r0, r31, 0a
|
||||
code size: 362
|
||||
code size: 351
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
Loading…
Reference in a new issue