fixing some other stuff that nerfs the code a bit (a lot)

This commit is contained in:
mlokr 2024-09-20 12:03:24 +02:00
parent b8ff503c14
commit 8e62bd747b
No known key found for this signature in database
GPG key ID: DEA147DDEE644993
19 changed files with 304 additions and 291 deletions

View file

@ -197,7 +197,8 @@ main := fn(): int {
b := Point.(3, 4) b := Point.(3, 4)
d := Rect.(a + b, b - a) d := Rect.(a + b, b - a)
d2 := Rect.(Point.(0, 0) - b, a) zp := Point.(0, 0)
d2 := Rect.(zp - b, a)
d2 += d d2 += d
c := d2.a + d2.b c := d2.a + d2.b

View file

@ -109,17 +109,15 @@ mod stack {
} }
pub fn free(&mut self, id: Id) { pub fn free(&mut self, id: Id) {
if id.is_ref() {
return;
}
let meta = &mut self.meta[id.index()];
std::mem::forget(id); std::mem::forget(id);
meta.rc -= 1; //if id.is_ref() {}
if meta.rc != 0 { //let meta = &mut self.meta[id.index()];
return; //meta.rc -= 1;
} //if meta.rc != 0 {
meta.offset = self.height; // return;
self.height -= meta.size; //}
//meta.offset = self.height;
//self.height -= meta.size;
} }
pub fn dup_id(&mut self, id: &Id) -> Id { pub fn dup_id(&mut self, id: &Id) -> Id {
@ -1367,13 +1365,7 @@ impl Codegen {
self.ci.vars.iter_mut().enumerate().find(|(_, v)| v.id == id) => self.ci.vars.iter_mut().enumerate().find(|(_, v)| v.id == id) =>
{ {
var.uses_left -= 1; var.uses_left -= 1;
let loc = match var.uses_left == 0 let loc = var.value.loc.as_ref();
&& !self.ci.loops.last().is_some_and(|l| l.var_count > var_index as u32)
{
true => std::mem::take(&mut var.value.loc),
false => var.value.loc.as_ref(),
};
Some(Value { ty: self.ci.vars[var_index].value.ty, loc }) Some(Value { ty: self.ci.vars[var_index].value.ty, loc })
} }
E::Ident { id, name, .. } => match self E::Ident { id, name, .. } => match self

View file

@ -269,6 +269,10 @@ mod ty {
pub const fn repr(self) -> u32 { pub const fn repr(self) -> u32 {
self.0.get() self.0.get()
} }
pub(crate) fn is_struct(&self) -> bool {
matches!(self.expand(), Kind::Struct(_))
}
} }
impl From<u64> for Id { impl From<u64> for Id {

View file

@ -1,44 +1,45 @@
main: main:
ADDI64 r254, r254, -68d ADDI64 r254, r254, -80d
ST r31, r254, 28a, 40h ST r31, r254, 32a, 48h
LI64 r32, 511d LI64 r32, 511d
LI64 r33, 0d LI64 r33, 0d
ST r33, r254, 24a, 1h ST r33, r254, 0a, 1h
LI64 r33, 0d LI64 r33, 0d
ST r33, r254, 25a, 1h ST r33, r254, 1a, 1h
CP r33, r32 CP r33, r32
ANDI r33, r33, 255d ANDI r33, r33, 255d
ST r33, r254, 26a, 1h ST r33, r254, 2a, 1h
SRUI16 r32, r32, 8b CP r33, r32
ANDI r32, r32, 255d SRUI16 r33, r33, 8b
ST r32, r254, 27a, 1h ANDI r33, r33, 255d
CP r32, r0 ST r33, r254, 3a, 1h
LD r32, r254, 24a, 4h CP r33, r0
ST r32, r254, 0a, 4h LD r33, r254, 0a, 4h
ADDI64 r32, r254, 0d ST r33, r254, 4a, 4h
LI64 r33, 1d
ST r33, r254, 4a, 8h
LI64 r33, 2d
ST r33, r254, 12a, 8h
LI64 r33, 4d
ST r33, r254, 20a, 8h
ADDI64 r33, r254, 4d ADDI64 r33, r254, 4d
CP r2, r33 LI64 r34, 1d
ST r34, r254, 8a, 8h
LI64 r34, 2d
ST r34, r254, 16a, 8h
LI64 r34, 4d
ST r34, r254, 24a, 8h
ADDI64 r34, r254, 8d
CP r2, r34
JAL r31, r0, :pass JAL r31, r0, :pass
CP r33, r1 CP r34, r1
ADDI64 r34, r254, 0d ADDI64 r35, r254, 4d
LI64 r35, 3d LI64 r36, 3d
ADD64 r34, r34, r35 ADD64 r35, r35, r36
CP r35, r0 CP r36, r0
LD r35, r34, 0a, 1h LD r36, r35, 4a, 1h
SXT8 r35, r35 SXT8 r36, r36
ADD64 r1, r33, r35 ADD64 r1, r34, r36
LD r31, r254, 28a, 40h LD r31, r254, 32a, 48h
ADDI64 r254, r254, 68d ADDI64 r254, r254, 80d
JALA r0, r31, 0a JALA r0, r31, 0a
pass: pass:
ADDI64 r254, r254, -40d ADDI64 r254, r254, -48d
ST r31, r254, 0a, 40h ST r31, r254, 0a, 48h
CP r32, r2 CP r32, r2
CP r33, r32 CP r33, r32
LI64 r34, 0d LI64 r34, 0d
@ -52,17 +53,18 @@ pass:
LD r35, r33, 0a, 8h LD r35, r33, 0a, 8h
ADD64 r34, r34, r35 ADD64 r34, r34, r35
CP r33, r32 CP r33, r32
LI64 r35, 1d CP r35, r32
MULI64 r35, r35, 8d LI64 r36, 1d
ADD64 r32, r32, r35 MULI64 r36, r36, 8d
LD r35, r32, 0a, 8h ADD64 r35, r35, r36
MULI64 r35, r35, 8d LD r36, r35, 0a, 8h
ADD64 r33, r33, r35 MULI64 r36, r36, 8d
LD r35, r33, 0a, 8h ADD64 r33, r33, r36
ADD64 r1, r34, r35 LD r36, r33, 0a, 8h
LD r31, r254, 0a, 40h ADD64 r1, r34, r36
ADDI64 r254, r254, 40d LD r31, r254, 0a, 48h
ADDI64 r254, r254, 48d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 580 code size: 586
ret: 8 ret: 7
status: Ok(()) status: Ok(())

View file

@ -1,17 +1,17 @@
main: main:
ADDI64 r254, r254, -24d ADDI64 r254, r254, -40d
ST r31, r254, 0a, 24h ST r31, r254, 0a, 40h
LRA r32, r0, :"abඞ\n\r\t56789\0" LRA r32, r0, :"abඞ\n\r\t56789\0"
CP r2, r32 CP r2, r32
JAL r31, r0, :str_len JAL r31, r0, :str_len
CP r32, r1
LRA r33, r0, :"fff\0"
CP r2, r33
JAL r31, r0, :str_len
CP r33, r1 CP r33, r1
ADD64 r1, r33, r32 LRA r34, r0, :"fff\0"
LD r31, r254, 0a, 24h CP r2, r34
ADDI64 r254, r254, 24d JAL r31, r0, :str_len
CP r35, r1
ADD64 r1, r35, r33
LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
JALA r0, r31, 0a JALA r0, r31, 0a
str_len: str_len:
ADDI64 r254, r254, -48d ADDI64 r254, r254, -48d

View file

@ -1,6 +1,6 @@
main: main:
ADDI64 r254, r254, -44d ADDI64 r254, r254, -52d
ST r31, r254, 12a, 32h ST r31, r254, 12a, 40h
LI64 r32, 255d LI64 r32, 255d
ST r32, r254, 0a, 1h ST r32, r254, 0a, 1h
LI64 r32, 0d LI64 r32, 0d
@ -18,39 +18,39 @@ main:
CP r34, r32 CP r34, r32
MULI64 r34, r34, 4d MULI64 r34, r34, 4d
ADD64 r33, r33, r34 ADD64 r33, r33, r34
CP r32, r0 CP r34, r0
LD r32, r33, 0a, 4h LD r34, r33, 0a, 4h
LI64 r34, 2d LI64 r35, 2d
JEQ r32, r34, :0 JEQ r34, r35, :0
LI64 r1, 0d LI64 r1, 0d
JMP :1 JMP :1
0: ADDI64 r34, r254, 8d 0: ADDI64 r35, r254, 8d
ADDI64 r34, r34, -4d ADDI64 r35, r35, -4d
CP r32, r0 CP r34, r0
LD r32, r34, 0a, 4h LD r34, r35, 0a, 4h
LI64 r33, 0d LI64 r33, 0d
JEQ r32, r33, :2 JEQ r34, r33, :2
LI64 r1, 64d LI64 r1, 64d
JMP :1 JMP :1
2: CP r33, r0 2: CP r33, r0
LD r33, r254, 4a, 4h LD r33, r254, 4a, 4h
CP r32, r0 CP r34, r0
LD r32, r254, 8a, 4h LD r34, r254, 8a, 4h
ADD32 r33, r33, r32 ADD32 r33, r33, r34
CP r32, r0 CP r34, r0
LD r32, r254, 0a, 1h LD r34, r254, 0a, 1h
ADD32 r33, r33, r32 ADD32 r33, r33, r34
CP r32, r0 CP r34, r0
LD r32, r254, 1a, 1h LD r34, r254, 1a, 1h
ADD32 r33, r33, r32 ADD32 r33, r33, r34
CP r32, r0 CP r34, r0
LD r32, r254, 2a, 1h LD r34, r254, 2a, 1h
ADD32 r33, r33, r32 ADD32 r33, r33, r34
CP r32, r0 CP r34, r0
LD r32, r254, 3a, 1h LD r34, r254, 3a, 1h
ADD32 r1, r33, r32 ADD32 r1, r33, r34
1: LD r31, r254, 12a, 32h 1: LD r31, r254, 12a, 40h
ADDI64 r254, r254, 44d ADDI64 r254, r254, 52d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 474 code size: 474
ret: 512 ret: 512

View file

@ -1,27 +1,28 @@
main: main:
ADDI64 r254, r254, -80d ADDI64 r254, r254, -88d
ST r31, r254, 16a, 64h ST r31, r254, 16a, 72h
LI64 r32, 10d LI64 r32, 10d
LI64 r33, 30d LI64 r33, 30d
LI64 r34, 40d LI64 r34, 40d
LI64 r35, 16d CP r35, r34
LI64 r36, 8d LI64 r36, 16d
LI64 r37, 10d LI64 r37, 8d
LI64 r2, 1d
LI64 r38, 10d LI64 r38, 10d
ST r38, r254, 0a, 8h LI64 r2, 1d
LI64 r38, 20d LI64 r39, 10d
ST r38, r254, 8a, 8h ST r39, r254, 0a, 8h
LI64 r39, 20d
ST r39, r254, 8a, 8h
LD r3, r254, 0a, 16h LD r3, r254, 0a, 16h
LI64 r5, 5d LI64 r5, 5d
LI64 r6, 6d LI64 r6, 6d
ECA ECA
CP r38, r1 CP r39, r1
LI64 r1, 0d LI64 r1, 0d
LD r31, r254, 16a, 64h LD r31, r254, 16a, 72h
ADDI64 r254, r254, 80d ADDI64 r254, r254, 88d
JALA r0, r31, 0a JALA r0, r31, 0a
ev: Ecall ev: Ecall
code size: 230 code size: 233
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -8,7 +8,8 @@ deinit:
CP r3, r33 CP r3, r33
LI64 r4, 8d LI64 r4, 8d
JAL r31, r0, :free JAL r31, r0, :free
CP r1, r32 CP r33, r32
CP r1, r33
JAL r31, r0, :new JAL r31, r0, :new
LD r31, r254, 0a, 24h LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d ADDI64 r254, r254, 24d
@ -124,19 +125,19 @@ push:
LI64 r4, 8d LI64 r4, 8d
JAL r31, r0, :free JAL r31, r0, :free
8: ST r34, r32, 0a, 8h 8: ST r34, r32, 0a, 8h
0: LD r34, r32, 0a, 8h 0: LD r39, r32, 0a, 8h
LD r39, r32, 8a, 8h LD r38, r32, 8a, 8h
MULI64 r39, r39, 8d MULI64 r38, r38, 8d
ADD64 r34, r34, r39 ADD64 r39, r39, r38
CP r39, r34 CP r38, r39
ST r33, r39, 0a, 8h ST r33, r38, 0a, 8h
LD r39, r32, 8a, 8h LD r38, r32, 8a, 8h
ADDI64 r39, r39, 1d ADDI64 r38, r38, 1d
ST r39, r32, 8a, 8h ST r38, r32, 8a, 8h
CP r1, r34 CP r1, r39
4: LD r31, r254, 0a, 72h 4: LD r31, r254, 0a, 72h
ADDI64 r254, r254, 72d ADDI64 r254, r254, 72d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 1201 code size: 1204
ret: 69 ret: 69
status: Ok(()) status: Ok(())

View file

@ -1,28 +1,31 @@
main: main:
ADDI64 r254, r254, -40d ADDI64 r254, r254, -56d
ST r31, r254, 0a, 40h ST r31, r254, 0a, 56h
LI64 r32, 255d LI64 r32, 255d
LI64 r33, 255d LI64 r33, 255d
LI64 r34, 255d LI64 r34, 255d
LI64 r35, 255d LI64 r35, 255d
CMPS r32, r32, r33 CP r36, r32
CMPUI r32, r32, 0d CMPS r36, r36, r33
NOT r32, r32 CMPUI r36, r36, 0d
CMPS r34, r34, r33 NOT r36, r36
CMPUI r34, r34, 0d CP r37, r34
NOT r34, r34 CMPS r37, r37, r33
AND r32, r32, r34 CMPUI r37, r37, 0d
CMPS r35, r35, r33 NOT r37, r37
CMPUI r35, r35, 0d AND r36, r36, r37
NOT r35, r35 CP r37, r35
AND r32, r32, r35 CMPS r37, r37, r33
JEQ r32, r0, :0 CMPUI r37, r37, 0d
NOT r37, r37
AND r36, r36, r37
JEQ r36, r0, :0
LI64 r1, 0d LI64 r1, 0d
JMP :1 JMP :1
0: LI64 r1, 1d 0: LI64 r1, 1d
1: LD r31, r254, 0a, 40h 1: LD r31, r254, 0a, 56h
ADDI64 r254, r254, 40d ADDI64 r254, r254, 56d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 199 code size: 208
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,6 +1,6 @@
fib: fib:
ADDI64 r254, r254, -24d ADDI64 r254, r254, -32d
ST r31, r254, 0a, 24h ST r31, r254, 0a, 32h
CP r32, r2 CP r32, r2
LI64 r33, 2d LI64 r33, 2d
JGTS r32, r33, :0 JGTS r32, r33, :0
@ -11,13 +11,14 @@ fib:
CP r2, r33 CP r2, r33
JAL r31, r0, :fib JAL r31, r0, :fib
CP r33, r1 CP r33, r1
ADDI64 r32, r32, -2d CP r34, r32
CP r2, r32 ADDI64 r34, r34, -2d
CP r2, r34
JAL r31, r0, :fib JAL r31, r0, :fib
CP r32, r1 CP r34, r1
ADD64 r1, r33, r32 ADD64 r1, r33, r34
1: LD r31, r254, 0a, 24h 1: LD r31, r254, 0a, 32h
ADDI64 r254, r254, 24d ADDI64 r254, r254, 32d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -8d ADDI64 r254, r254, -8d
@ -27,6 +28,6 @@ main:
LD r31, r254, 0a, 8h LD r31, r254, 0a, 8h
ADDI64 r254, r254, 8d ADDI64 r254, r254, 8d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 231 code size: 234
ret: 55 ret: 55
status: Ok(()) status: Ok(())

View file

@ -52,9 +52,10 @@ integer:
OR r35, r35, r36 OR r35, r35, r36
JEQ r35, r0, :0 JEQ r35, r0, :0
CP r35, r34 CP r35, r34
SUB64 r33, r33, r32 CP r36, r33
ADDI64 r33, r33, 1d SUB64 r36, r36, r32
DIRS64 r0, r35, r35, r33 ADDI64 r36, r36, 1d
DIRS64 r0, r35, r35, r36
ADD64 r1, r35, r32 ADD64 r1, r35, r32
JMP :1 JMP :1
0: CP r1, r34 0: CP r1, r34
@ -64,27 +65,27 @@ integer:
line: line:
ADDI64 r254, r254, -80d ADDI64 r254, r254, -80d
ST r31, r254, 48a, 32h ST r31, r254, 48a, 32h
ST r2, r254, 16a, 16h ST r2, r254, 0a, 16h
ST r4, r254, 0a, 16h ST r4, r254, 16a, 16h
ST r6, r254, 32a, 16h ST r6, r254, 32a, 16h
CP r32, r8 CP r32, r8
LI64 r33, 1d LI64 r33, 1d
JEQ r33, r0, :0 JEQ r33, r0, :0
LD r33, r254, 16a, 8h LD r33, r254, 0a, 8h
LD r34, r254, 0a, 8h LD r34, r254, 16a, 8h
JGTS r33, r34, :1 JGTS r33, r34, :1
JMP :1 JMP :1
1: JMP :2 1: JMP :2
0: LD r34, r254, 24a, 8h 0: LD r34, r254, 8a, 8h
LD r33, r254, 8a, 8h LD r33, r254, 24a, 8h
JGTS r34, r33, :2 JGTS r34, r33, :2
JMP :2 JMP :2
2: LD r31, r254, 48a, 32h 2: LD r31, r254, 48a, 32h
ADDI64 r254, r254, 80d ADDI64 r254, r254, 80d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -64d ADDI64 r254, r254, -112d
ST r31, r254, 48a, 16h ST r31, r254, 96a, 16h
LI64 r32, 0d LI64 r32, 0d
ST r32, r254, 0a, 8h ST r32, r254, 0a, 8h
LI64 r32, 0d LI64 r32, 0d
@ -103,26 +104,26 @@ main:
LI64 r8, 10d LI64 r8, 10d
JAL r31, r0, :line JAL r31, r0, :line
LI64 r32, 0d LI64 r32, 0d
ST r32, r254, 0a, 8h ST r32, r254, 48a, 8h
LI64 r32, 0d LI64 r32, 0d
ST r32, r254, 8a, 8h ST r32, r254, 56a, 8h
LD r2, r254, 0a, 16h LD r2, r254, 48a, 16h
LI64 r32, 0d LI64 r32, 0d
ST r32, r254, 16a, 8h ST r32, r254, 64a, 8h
LI64 r32, 0d LI64 r32, 0d
ST r32, r254, 24a, 8h ST r32, r254, 72a, 8h
LD r4, r254, 16a, 16h LD r4, r254, 64a, 16h
LI64 r32, 0d LI64 r32, 0d
ST r32, r254, 32a, 8h ST r32, r254, 80a, 8h
LI64 r32, 0d LI64 r32, 0d
ST r32, r254, 40a, 8h ST r32, r254, 88a, 8h
LD r6, r254, 32a, 16h LD r6, r254, 80a, 16h
LI64 r8, 10d LI64 r8, 10d
JAL r31, r0, :rect_line JAL r31, r0, :rect_line
JAL r31, r0, :example JAL r31, r0, :example
LI64 r1, 0d LI64 r1, 0d
LD r31, r254, 48a, 16h LD r31, r254, 96a, 16h
ADDI64 r254, r254, 64d ADDI64 r254, r254, 112d
JALA r0, r31, 0a JALA r0, r31, 0a
rect_line: rect_line:
ADDI64 r254, r254, -112d ADDI64 r254, r254, -112d
@ -156,6 +157,6 @@ rect_line:
1: LD r31, r254, 48a, 64h 1: LD r31, r254, 48a, 64h
ADDI64 r254, r254, 112d ADDI64 r254, r254, 112d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 1400 code size: 1403
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,18 +1,19 @@
integer_range: integer_range:
ADDI64 r254, r254, -32d ADDI64 r254, r254, -40d
ST r31, r254, 0a, 32h ST r31, r254, 0a, 40h
CP r32, r2 CP r32, r2
CP r33, r3 CP r33, r3
LI64 r2, 3d LI64 r2, 3d
LI64 r3, 4d LI64 r3, 4d
ECA ECA
CP r34, r1 CP r34, r1
SUB64 r33, r33, r32 CP r35, r33
ADDI64 r33, r33, 1d SUB64 r35, r35, r32
DIRU64 r0, r34, r34, r33 ADDI64 r35, r35, 1d
DIRU64 r0, r34, r34, r35
ADD64 r1, r34, r32 ADD64 r1, r34, r32
LD r31, r254, 0a, 32h LD r31, r254, 0a, 40h
ADDI64 r254, r254, 32d ADDI64 r254, r254, 40d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -16d ADDI64 r254, r254, -16d
@ -24,6 +25,6 @@ main:
LD r31, r254, 0a, 16h LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 210 code size: 213
ret: 42 ret: 42
status: Ok(()) status: Ok(())

View file

@ -6,8 +6,8 @@ drop:
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -40d ADDI64 r254, r254, -48d
ST r31, r254, 8a, 32h ST r31, r254, 8a, 40h
LI64 r32, 1d LI64 r32, 1d
ST r32, r254, 0a, 8h ST r32, r254, 0a, 8h
ADDI64 r32, r254, 0d ADDI64 r32, r254, 0d
@ -16,20 +16,22 @@ main:
LD r2, r254, 0a, 8h LD r2, r254, 0a, 8h
JAL r31, r0, :drop JAL r31, r0, :drop
LI64 r33, 0d LI64 r33, 0d
LD r34, r32, 0a, 8h CP r34, r32
ADDI64 r1, r34, -2d LD r35, r34, 0a, 8h
LD r31, r254, 8a, 32h ADDI64 r1, r35, -2d
ADDI64 r254, r254, 40d LD r31, r254, 8a, 40h
ADDI64 r254, r254, 48d
JALA r0, r31, 0a JALA r0, r31, 0a
modify: modify:
ADDI64 r254, r254, -24d ADDI64 r254, r254, -32d
ST r31, r254, 0a, 24h ST r31, r254, 0a, 32h
CP r32, r2 CP r32, r2
LI64 r33, 2d CP r33, r32
ST r33, r32, 0a, 8h LI64 r34, 2d
LD r31, r254, 0a, 24h ST r34, r33, 0a, 8h
ADDI64 r254, r254, 24d LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 312 code size: 318
ret: 0 ret: 0
status: Ok(()) status: Ok(())

View file

@ -1,6 +1,6 @@
create_back_buffer: create_back_buffer:
ADDI64 r254, r254, -32d ADDI64 r254, r254, -40d
ST r31, r254, 0a, 32h ST r31, r254, 0a, 40h
CP r32, r2 CP r32, r2
LI64 r33, 255d LI64 r33, 255d
JGTS r32, r33, :0 JGTS r32, r33, :0
@ -10,24 +10,25 @@ create_back_buffer:
0: LI64 r2, 255d 0: LI64 r2, 255d
JAL r31, r0, :request_page JAL r31, r0, :request_page
CP r33, r1 CP r33, r1
ADDI64 r32, r32, -255d CP r34, r32
6: LI64 r34, 0d ADDI64 r34, r34, -255d
JGTS r32, r34, :2 6: LI64 r35, 0d
JGTS r34, r35, :2
JMP :3 JMP :3
2: LI64 r34, 255d 2: LI64 r35, 255d
JLTS r32, r34, :4 JLTS r34, r35, :4
LI64 r2, 255d LI64 r2, 255d
JAL r31, r0, :request_page JAL r31, r0, :request_page
CP r34, r1 CP r35, r1
JMP :5 JMP :5
4: CP r2, r32 4: CP r2, r34
JAL r31, r0, :request_page JAL r31, r0, :request_page
CP r34, r1 CP r35, r1
5: ADDI64 r32, r32, -255d 5: ADDI64 r34, r34, -255d
JMP :6 JMP :6
3: CP r1, r33 3: CP r1, r33
1: LD r31, r254, 0a, 32h 1: LD r31, r254, 0a, 40h
ADDI64 r254, r254, 32d ADDI64 r254, r254, 40d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -16d ADDI64 r254, r254, -16d
@ -39,21 +40,22 @@ main:
ADDI64 r254, r254, 16d ADDI64 r254, r254, 16d
JALA r0, r31, 0a JALA r0, r31, 0a
request_page: request_page:
ADDI64 r254, r254, -32d ADDI64 r254, r254, -40d
ST r31, r254, 0a, 32h ST r31, r254, 0a, 40h
CP r32, r2 CP r32, r2
LRA r33, r0, :"\0\u{1}xxxxxxxx\0" LRA r33, r0, :"\0\u{1}xxxxxxxx\0"
CP r34, r33 CP r34, r33
ADDI64 r34, r34, 1d ADDI64 r34, r34, 1d
ST r32, r34, 0a, 1h CP r35, r34
ST r32, r35, 0a, 1h
LI64 r2, 3d LI64 r2, 3d
LI64 r3, 2d LI64 r3, 2d
CP r4, r33 CP r4, r33
LI64 r5, 12d LI64 r5, 12d
ECA ECA
LD r31, r254, 0a, 32h LD r31, r254, 0a, 40h
ADDI64 r254, r254, 32d ADDI64 r254, r254, 40d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 443 code size: 449
ret: 42 ret: 42
status: Ok(()) status: Ok(())

View file

@ -1,74 +1,74 @@
main: main:
ADDI64 r254, r254, -136d ADDI64 r254, r254, -152d
ST r31, r254, 112a, 24h ST r31, r254, 128a, 24h
LI64 r32, 1d LI64 r32, 1d
ST r32, r254, 32a, 8h ST r32, r254, 0a, 8h
LI64 r32, 2d LI64 r32, 2d
ST r32, r254, 40a, 8h ST r32, r254, 8a, 8h
LI64 r32, 3d LI64 r32, 3d
ST r32, r254, 16a, 8h ST r32, r254, 16a, 8h
LI64 r32, 4d LI64 r32, 4d
ST r32, r254, 24a, 8h ST r32, r254, 24a, 8h
LD r32, r254, 32a, 8h LD r32, r254, 0a, 8h
LD r33, r254, 16a, 8h LD r33, r254, 16a, 8h
ADD64 r32, r32, r33 ADD64 r32, r32, r33
ST r32, r254, 48a, 8h ST r32, r254, 32a, 8h
LD r32, r254, 40a, 8h LD r32, r254, 8a, 8h
LD r33, r254, 24a, 8h LD r33, r254, 24a, 8h
ADD64 r32, r32, r33 ADD64 r32, r32, r33
ST r32, r254, 56a, 8h ST r32, r254, 40a, 8h
LD r32, r254, 16a, 8h LD r32, r254, 16a, 8h
LD r33, r254, 32a, 8h LD r33, r254, 0a, 8h
SUB64 r32, r32, r33 SUB64 r32, r32, r33
ST r32, r254, 64a, 8h ST r32, r254, 48a, 8h
LD r32, r254, 24a, 8h LD r32, r254, 24a, 8h
LD r33, r254, 40a, 8h LD r33, r254, 8a, 8h
SUB64 r32, r32, r33 SUB64 r32, r32, r33
ST r32, r254, 56a, 8h
LI64 r32, 0d
ST r32, r254, 64a, 8h
LI64 r32, 0d
ST r32, r254, 72a, 8h ST r32, r254, 72a, 8h
LI64 r32, 0d LD r32, r254, 64a, 8h
ST r32, r254, 0a, 8h
LI64 r32, 0d
ST r32, r254, 8a, 8h
LD r32, r254, 0a, 8h
LD r33, r254, 16a, 8h LD r33, r254, 16a, 8h
SUB64 r32, r32, r33 SUB64 r32, r32, r33
ST r32, r254, 80a, 8h ST r32, r254, 80a, 8h
LD r32, r254, 8a, 8h LD r32, r254, 72a, 8h
LD r33, r254, 24a, 8h LD r33, r254, 24a, 8h
SUB64 r32, r32, r33 SUB64 r32, r32, r33
ST r32, r254, 88a, 8h ST r32, r254, 88a, 8h
ADDI64 r32, r254, 32d ADDI64 r32, r254, 0d
ADDI64 r33, r254, 96d ADDI64 r33, r254, 96d
BMC r32, r33, 16h BMC r32, r33, 16h
LD r33, r254, 80a, 8h LD r33, r254, 80a, 8h
LD r32, r254, 48a, 8h LD r32, r254, 32a, 8h
ADD64 r33, r33, r32 ADD64 r33, r33, r32
ST r33, r254, 80a, 8h ST r33, r254, 80a, 8h
LD r33, r254, 88a, 8h LD r33, r254, 88a, 8h
LD r32, r254, 56a, 8h LD r32, r254, 40a, 8h
ADD64 r33, r33, r32 ADD64 r33, r33, r32
ST r33, r254, 88a, 8h ST r33, r254, 88a, 8h
LD r33, r254, 96a, 8h LD r33, r254, 96a, 8h
LD r32, r254, 64a, 8h LD r32, r254, 48a, 8h
ADD64 r33, r33, r32 ADD64 r33, r33, r32
ST r33, r254, 96a, 8h ST r33, r254, 96a, 8h
LD r33, r254, 104a, 8h LD r33, r254, 104a, 8h
LD r32, r254, 72a, 8h LD r32, r254, 56a, 8h
ADD64 r33, r33, r32 ADD64 r33, r33, r32
ST r33, r254, 104a, 8h ST r33, r254, 104a, 8h
LD r33, r254, 80a, 8h LD r33, r254, 80a, 8h
LD r32, r254, 96a, 8h LD r32, r254, 96a, 8h
ADD64 r33, r33, r32 ADD64 r33, r33, r32
ST r33, r254, 96a, 8h ST r33, r254, 112a, 8h
LD r33, r254, 88a, 8h LD r33, r254, 88a, 8h
LD r32, r254, 104a, 8h LD r32, r254, 104a, 8h
ADD64 r33, r33, r32 ADD64 r33, r33, r32
ST r33, r254, 104a, 8h ST r33, r254, 120a, 8h
LD r33, r254, 96a, 8h LD r33, r254, 112a, 8h
LD r32, r254, 104a, 8h LD r32, r254, 120a, 8h
ADD64 r1, r33, r32 ADD64 r1, r33, r32
LD r31, r254, 112a, 24h LD r31, r254, 128a, 24h
ADDI64 r254, r254, 136d ADDI64 r254, r254, 152d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 778 code size: 778
ret: 10 ret: 10

View file

@ -40,8 +40,8 @@ fib_iter:
ADDI64 r254, r254, 40d ADDI64 r254, r254, 40d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -26d ADDI64 r254, r254, -42d
ST r31, r254, 2a, 24h ST r31, r254, 2a, 40h
LI64 r32, 10d LI64 r32, 10d
ST r32, r254, 0a, 1h ST r32, r254, 0a, 1h
LI64 r32, 10d LI64 r32, 10d
@ -52,13 +52,13 @@ main:
LD r33, r254, 1a, 1h LD r33, r254, 1a, 1h
CP r2, r32 CP r2, r32
JAL r31, r0, :fib JAL r31, r0, :fib
CP r32, r1 CP r34, r1
CP r2, r33 CP r2, r33
JAL r31, r0, :fib_iter JAL r31, r0, :fib_iter
CP r33, r1 CP r35, r1
SUB64 r1, r32, r33 SUB64 r1, r34, r35
LD r31, r254, 2a, 24h LD r31, r254, 2a, 40h
ADDI64 r254, r254, 26d ADDI64 r254, r254, 42d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 452 code size: 452
ret: 0 ret: 0

View file

@ -12,27 +12,27 @@ foo:
ADDI64 r254, r254, 32d ADDI64 r254, r254, 32d
JALA r0, r31, 0a JALA r0, r31, 0a
main: main:
ADDI64 r254, r254, -40d ADDI64 r254, r254, -72d
ST r31, r254, 16a, 24h ST r31, r254, 48a, 24h
LI64 r32, 7d LI64 r32, 7d
JAL r31, r0, :foo JAL r31, r0, :foo
ST r1, r254, 0a, 16h ST r1, r254, 0a, 16h
LD r33, r254, 0a, 8h LD r33, r254, 0a, 8h
SUB64 r32, r32, r33 SUB64 r32, r32, r33
JAL r31, r0, :foo JAL r31, r0, :foo
ST r1, r254, 0a, 16h ST r1, r254, 16a, 16h
CP r33, r0 CP r33, r0
LD r33, r254, 8a, 4h LD r33, r254, 24a, 4h
SXT32 r33, r33 SXT32 r33, r33
SUB64 r32, r32, r33 SUB64 r32, r32, r33
JAL r31, r0, :foo JAL r31, r0, :foo
ST r1, r254, 0a, 16h ST r1, r254, 32a, 16h
CP r33, r0 CP r33, r0
LD r33, r254, 12a, 4h LD r33, r254, 44a, 4h
SXT32 r33, r33 SXT32 r33, r33
SUB64 r1, r32, r33 SUB64 r1, r32, r33
LD r31, r254, 16a, 24h LD r31, r254, 48a, 24h
ADDI64 r254, r254, 40d ADDI64 r254, r254, 72d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 341 code size: 341
ret: 0 ret: 0

View file

@ -1,6 +1,6 @@
main: main:
ADDI64 r254, r254, -48d ADDI64 r254, r254, -72d
ST r31, r254, 24a, 24h ST r31, r254, 48a, 24h
LI64 r32, 4d LI64 r32, 4d
ST r32, r254, 0a, 8h ST r32, r254, 0a, 8h
LI64 r32, 1d LI64 r32, 1d
@ -8,39 +8,41 @@ main:
LI64 r32, 3d LI64 r32, 3d
ST r32, r254, 16a, 8h ST r32, r254, 16a, 8h
ADDI64 r2, r254, 0d ADDI64 r2, r254, 0d
ADDI64 r1, r254, 0d ADDI64 r1, r254, 24d
JAL r31, r0, :odher_pass JAL r31, r0, :odher_pass
LD r32, r254, 16a, 8h LD r32, r254, 40a, 8h
LI64 r33, 3d LI64 r33, 3d
JNE r32, r33, :0 JNE r32, r33, :0
ADDI64 r33, r254, 0d ADDI64 r33, r254, 24d
CP r2, r33 CP r2, r33
JAL r31, r0, :pass JAL r31, r0, :pass
JMP :1 JMP :1
0: LI64 r1, 0d 0: LI64 r1, 0d
1: LD r31, r254, 24a, 24h 1: LD r31, r254, 48a, 24h
ADDI64 r254, r254, 48d ADDI64 r254, r254, 72d
JALA r0, r31, 0a JALA r0, r31, 0a
odher_pass: odher_pass:
ADDI64 r254, r254, -32d ADDI64 r254, r254, -40d
ST r31, r254, 0a, 32h ST r31, r254, 0a, 40h
CP r32, r2 CP r32, r2
CP r33, r1 CP r33, r1
CP r34, r33 CP r34, r32
BMC r32, r34, 24h CP r35, r33
LD r31, r254, 0a, 32h BMC r34, r35, 24h
ADDI64 r254, r254, 32d LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
JALA r0, r31, 0a JALA r0, r31, 0a
pass: pass:
ADDI64 r254, r254, -32d ADDI64 r254, r254, -40d
ST r31, r254, 0a, 32h ST r31, r254, 0a, 40h
CP r32, r2 CP r32, r2
LD r33, r32, 0a, 8h CP r33, r32
LD r34, r32, 8a, 8h LD r34, r33, 0a, 8h
SUB64 r1, r33, r34 LD r35, r33, 8a, 8h
LD r31, r254, 0a, 32h SUB64 r1, r34, r35
ADDI64 r254, r254, 32d LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
JALA r0, r31, 0a JALA r0, r31, 0a
code size: 394 code size: 400
ret: 3 ret: 3
status: Ok(()) status: Ok(())

View file

@ -1,32 +1,32 @@
main: main:
ADDI64 r254, r254, -48d ADDI64 r254, r254, -56d
ST r31, r254, 16a, 32h ST r31, r254, 24a, 32h
CP r32, r3 CP r32, r3
CP r33, r4 CP r33, r4
JAL r31, r0, :small_struct JAL r31, r0, :small_struct
CP r34, r1 CP r34, r1
LI64 r34, 0d LI64 r34, 0d
ST r34, r254, 8a, 1h ST r34, r254, 0a, 1h
LI64 r34, 0d LI64 r34, 0d
ST r34, r254, 9a, 1h ST r34, r254, 1a, 1h
LI64 r34, 0d LI64 r34, 0d
ST r34, r254, 10a, 1h ST r34, r254, 2a, 1h
LI64 r34, 0d LI64 r34, 0d
ST r34, r254, 11a, 1h ST r34, r254, 3a, 1h
LI64 r34, 0d LI64 r34, 0d
ST r34, r254, 12a, 1h ST r34, r254, 4a, 1h
LI64 r34, 0d LI64 r34, 0d
ST r34, r254, 13a, 1h ST r34, r254, 5a, 1h
LI64 r34, 0d LI64 r34, 0d
ST r34, r254, 14a, 1h ST r34, r254, 6a, 1h
LI64 r34, 0d LI64 r34, 0d
ST r34, r254, 15a, 1h ST r34, r254, 7a, 1h
LD r34, r254, 8a, 8h LD r34, r254, 0a, 8h
ST r34, r254, 0a, 8h
ST r34, r254, 8a, 8h ST r34, r254, 8a, 8h
LD r1, r254, 0a, 16h ST r34, r254, 16a, 8h
LD r31, r254, 16a, 32h LD r1, r254, 8a, 16h
ADDI64 r254, r254, 48d LD r31, r254, 24a, 32h
ADDI64 r254, r254, 56d
JALA r0, r31, 0a JALA r0, r31, 0a
small_struct: small_struct:
ADDI64 r254, r254, -20d ADDI64 r254, r254, -20d