forked from AbleOS/holey-bytes
fixing some other stuff that nerfs the code a bit (a lot)
This commit is contained in:
parent
b8ff503c14
commit
8e62bd747b
|
@ -197,7 +197,8 @@ main := fn(): int {
|
|||
b := Point.(3, 4)
|
||||
|
||||
d := Rect.(a + b, b - a)
|
||||
d2 := Rect.(Point.(0, 0) - b, a)
|
||||
zp := Point.(0, 0)
|
||||
d2 := Rect.(zp - b, a)
|
||||
d2 += d
|
||||
|
||||
c := d2.a + d2.b
|
||||
|
|
|
@ -109,17 +109,15 @@ mod stack {
|
|||
}
|
||||
|
||||
pub fn free(&mut self, id: Id) {
|
||||
if id.is_ref() {
|
||||
return;
|
||||
}
|
||||
let meta = &mut self.meta[id.index()];
|
||||
std::mem::forget(id);
|
||||
meta.rc -= 1;
|
||||
if meta.rc != 0 {
|
||||
return;
|
||||
}
|
||||
meta.offset = self.height;
|
||||
self.height -= meta.size;
|
||||
//if id.is_ref() {}
|
||||
//let meta = &mut self.meta[id.index()];
|
||||
//meta.rc -= 1;
|
||||
//if meta.rc != 0 {
|
||||
// return;
|
||||
//}
|
||||
//meta.offset = self.height;
|
||||
//self.height -= meta.size;
|
||||
}
|
||||
|
||||
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) =>
|
||||
{
|
||||
var.uses_left -= 1;
|
||||
let loc = match var.uses_left == 0
|
||||
&& !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(),
|
||||
};
|
||||
|
||||
let loc = var.value.loc.as_ref();
|
||||
Some(Value { ty: self.ci.vars[var_index].value.ty, loc })
|
||||
}
|
||||
E::Ident { id, name, .. } => match self
|
||||
|
|
|
@ -269,6 +269,10 @@ mod ty {
|
|||
pub const fn repr(self) -> u32 {
|
||||
self.0.get()
|
||||
}
|
||||
|
||||
pub(crate) fn is_struct(&self) -> bool {
|
||||
matches!(self.expand(), Kind::Struct(_))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<u64> for Id {
|
||||
|
|
|
@ -1,44 +1,45 @@
|
|||
main:
|
||||
ADDI64 r254, r254, -68d
|
||||
ST r31, r254, 28a, 40h
|
||||
ADDI64 r254, r254, -80d
|
||||
ST r31, r254, 32a, 48h
|
||||
LI64 r32, 511d
|
||||
LI64 r33, 0d
|
||||
ST r33, r254, 24a, 1h
|
||||
ST r33, r254, 0a, 1h
|
||||
LI64 r33, 0d
|
||||
ST r33, r254, 25a, 1h
|
||||
ST r33, r254, 1a, 1h
|
||||
CP r33, r32
|
||||
ANDI r33, r33, 255d
|
||||
ST r33, r254, 26a, 1h
|
||||
SRUI16 r32, r32, 8b
|
||||
ANDI r32, r32, 255d
|
||||
ST r32, r254, 27a, 1h
|
||||
CP r32, r0
|
||||
LD r32, r254, 24a, 4h
|
||||
ST r32, r254, 0a, 4h
|
||||
ADDI64 r32, r254, 0d
|
||||
LI64 r33, 1d
|
||||
ST r33, r254, 4a, 8h
|
||||
LI64 r33, 2d
|
||||
ST r33, r254, 12a, 8h
|
||||
LI64 r33, 4d
|
||||
ST r33, r254, 20a, 8h
|
||||
ST r33, r254, 2a, 1h
|
||||
CP r33, r32
|
||||
SRUI16 r33, r33, 8b
|
||||
ANDI r33, r33, 255d
|
||||
ST r33, r254, 3a, 1h
|
||||
CP r33, r0
|
||||
LD r33, r254, 0a, 4h
|
||||
ST r33, r254, 4a, 4h
|
||||
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
|
||||
CP r33, r1
|
||||
ADDI64 r34, r254, 0d
|
||||
LI64 r35, 3d
|
||||
ADD64 r34, r34, r35
|
||||
CP r35, r0
|
||||
LD r35, r34, 0a, 1h
|
||||
SXT8 r35, r35
|
||||
ADD64 r1, r33, r35
|
||||
LD r31, r254, 28a, 40h
|
||||
ADDI64 r254, r254, 68d
|
||||
CP r34, r1
|
||||
ADDI64 r35, r254, 4d
|
||||
LI64 r36, 3d
|
||||
ADD64 r35, r35, r36
|
||||
CP r36, r0
|
||||
LD r36, r35, 4a, 1h
|
||||
SXT8 r36, r36
|
||||
ADD64 r1, r34, r36
|
||||
LD r31, r254, 32a, 48h
|
||||
ADDI64 r254, r254, 80d
|
||||
JALA r0, r31, 0a
|
||||
pass:
|
||||
ADDI64 r254, r254, -40d
|
||||
ST r31, r254, 0a, 40h
|
||||
ADDI64 r254, r254, -48d
|
||||
ST r31, r254, 0a, 48h
|
||||
CP r32, r2
|
||||
CP r33, r32
|
||||
LI64 r34, 0d
|
||||
|
@ -52,17 +53,18 @@ pass:
|
|||
LD r35, r33, 0a, 8h
|
||||
ADD64 r34, r34, r35
|
||||
CP r33, r32
|
||||
LI64 r35, 1d
|
||||
MULI64 r35, r35, 8d
|
||||
ADD64 r32, r32, r35
|
||||
LD r35, r32, 0a, 8h
|
||||
MULI64 r35, r35, 8d
|
||||
ADD64 r33, r33, r35
|
||||
LD r35, r33, 0a, 8h
|
||||
ADD64 r1, r34, r35
|
||||
LD r31, r254, 0a, 40h
|
||||
ADDI64 r254, r254, 40d
|
||||
CP r35, r32
|
||||
LI64 r36, 1d
|
||||
MULI64 r36, r36, 8d
|
||||
ADD64 r35, r35, r36
|
||||
LD r36, r35, 0a, 8h
|
||||
MULI64 r36, r36, 8d
|
||||
ADD64 r33, r33, r36
|
||||
LD r36, r33, 0a, 8h
|
||||
ADD64 r1, r34, r36
|
||||
LD r31, r254, 0a, 48h
|
||||
ADDI64 r254, r254, 48d
|
||||
JALA r0, r31, 0a
|
||||
code size: 580
|
||||
ret: 8
|
||||
code size: 586
|
||||
ret: 7
|
||||
status: Ok(())
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
main:
|
||||
ADDI64 r254, r254, -24d
|
||||
ST r31, r254, 0a, 24h
|
||||
ADDI64 r254, r254, -40d
|
||||
ST r31, r254, 0a, 40h
|
||||
LRA r32, r0, :"abඞ\n\r\t56789\0"
|
||||
CP r2, r32
|
||||
JAL r31, r0, :str_len
|
||||
CP r32, r1
|
||||
LRA r33, r0, :"fff\0"
|
||||
CP r2, r33
|
||||
JAL r31, r0, :str_len
|
||||
CP r33, r1
|
||||
ADD64 r1, r33, r32
|
||||
LD r31, r254, 0a, 24h
|
||||
ADDI64 r254, r254, 24d
|
||||
LRA r34, r0, :"fff\0"
|
||||
CP r2, r34
|
||||
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
|
||||
str_len:
|
||||
ADDI64 r254, r254, -48d
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
main:
|
||||
ADDI64 r254, r254, -44d
|
||||
ST r31, r254, 12a, 32h
|
||||
ADDI64 r254, r254, -52d
|
||||
ST r31, r254, 12a, 40h
|
||||
LI64 r32, 255d
|
||||
ST r32, r254, 0a, 1h
|
||||
LI64 r32, 0d
|
||||
|
@ -18,39 +18,39 @@ main:
|
|||
CP r34, r32
|
||||
MULI64 r34, r34, 4d
|
||||
ADD64 r33, r33, r34
|
||||
CP r32, r0
|
||||
LD r32, r33, 0a, 4h
|
||||
LI64 r34, 2d
|
||||
JEQ r32, r34, :0
|
||||
CP r34, r0
|
||||
LD r34, r33, 0a, 4h
|
||||
LI64 r35, 2d
|
||||
JEQ r34, r35, :0
|
||||
LI64 r1, 0d
|
||||
JMP :1
|
||||
0: ADDI64 r34, r254, 8d
|
||||
ADDI64 r34, r34, -4d
|
||||
CP r32, r0
|
||||
LD r32, r34, 0a, 4h
|
||||
0: ADDI64 r35, r254, 8d
|
||||
ADDI64 r35, r35, -4d
|
||||
CP r34, r0
|
||||
LD r34, r35, 0a, 4h
|
||||
LI64 r33, 0d
|
||||
JEQ r32, r33, :2
|
||||
JEQ r34, r33, :2
|
||||
LI64 r1, 64d
|
||||
JMP :1
|
||||
2: CP r33, r0
|
||||
LD r33, r254, 4a, 4h
|
||||
CP r32, r0
|
||||
LD r32, r254, 8a, 4h
|
||||
ADD32 r33, r33, r32
|
||||
CP r32, r0
|
||||
LD r32, r254, 0a, 1h
|
||||
ADD32 r33, r33, r32
|
||||
CP r32, r0
|
||||
LD r32, r254, 1a, 1h
|
||||
ADD32 r33, r33, r32
|
||||
CP r32, r0
|
||||
LD r32, r254, 2a, 1h
|
||||
ADD32 r33, r33, r32
|
||||
CP r32, r0
|
||||
LD r32, r254, 3a, 1h
|
||||
ADD32 r1, r33, r32
|
||||
1: LD r31, r254, 12a, 32h
|
||||
ADDI64 r254, r254, 44d
|
||||
CP r34, r0
|
||||
LD r34, r254, 8a, 4h
|
||||
ADD32 r33, r33, r34
|
||||
CP r34, r0
|
||||
LD r34, r254, 0a, 1h
|
||||
ADD32 r33, r33, r34
|
||||
CP r34, r0
|
||||
LD r34, r254, 1a, 1h
|
||||
ADD32 r33, r33, r34
|
||||
CP r34, r0
|
||||
LD r34, r254, 2a, 1h
|
||||
ADD32 r33, r33, r34
|
||||
CP r34, r0
|
||||
LD r34, r254, 3a, 1h
|
||||
ADD32 r1, r33, r34
|
||||
1: LD r31, r254, 12a, 40h
|
||||
ADDI64 r254, r254, 52d
|
||||
JALA r0, r31, 0a
|
||||
code size: 474
|
||||
ret: 512
|
||||
|
|
|
@ -1,27 +1,28 @@
|
|||
main:
|
||||
ADDI64 r254, r254, -80d
|
||||
ST r31, r254, 16a, 64h
|
||||
ADDI64 r254, r254, -88d
|
||||
ST r31, r254, 16a, 72h
|
||||
LI64 r32, 10d
|
||||
LI64 r33, 30d
|
||||
LI64 r34, 40d
|
||||
LI64 r35, 16d
|
||||
LI64 r36, 8d
|
||||
LI64 r37, 10d
|
||||
LI64 r2, 1d
|
||||
CP r35, r34
|
||||
LI64 r36, 16d
|
||||
LI64 r37, 8d
|
||||
LI64 r38, 10d
|
||||
ST r38, r254, 0a, 8h
|
||||
LI64 r38, 20d
|
||||
ST r38, r254, 8a, 8h
|
||||
LI64 r2, 1d
|
||||
LI64 r39, 10d
|
||||
ST r39, r254, 0a, 8h
|
||||
LI64 r39, 20d
|
||||
ST r39, r254, 8a, 8h
|
||||
LD r3, r254, 0a, 16h
|
||||
LI64 r5, 5d
|
||||
LI64 r6, 6d
|
||||
ECA
|
||||
CP r38, r1
|
||||
CP r39, r1
|
||||
LI64 r1, 0d
|
||||
LD r31, r254, 16a, 64h
|
||||
ADDI64 r254, r254, 80d
|
||||
LD r31, r254, 16a, 72h
|
||||
ADDI64 r254, r254, 88d
|
||||
JALA r0, r31, 0a
|
||||
ev: Ecall
|
||||
code size: 230
|
||||
code size: 233
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
|
@ -8,7 +8,8 @@ deinit:
|
|||
CP r3, r33
|
||||
LI64 r4, 8d
|
||||
JAL r31, r0, :free
|
||||
CP r1, r32
|
||||
CP r33, r32
|
||||
CP r1, r33
|
||||
JAL r31, r0, :new
|
||||
LD r31, r254, 0a, 24h
|
||||
ADDI64 r254, r254, 24d
|
||||
|
@ -124,19 +125,19 @@ push:
|
|||
LI64 r4, 8d
|
||||
JAL r31, r0, :free
|
||||
8: ST r34, r32, 0a, 8h
|
||||
0: LD r34, r32, 0a, 8h
|
||||
LD r39, r32, 8a, 8h
|
||||
MULI64 r39, r39, 8d
|
||||
ADD64 r34, r34, r39
|
||||
CP r39, r34
|
||||
ST r33, r39, 0a, 8h
|
||||
LD r39, r32, 8a, 8h
|
||||
ADDI64 r39, r39, 1d
|
||||
ST r39, r32, 8a, 8h
|
||||
CP r1, r34
|
||||
0: LD r39, r32, 0a, 8h
|
||||
LD r38, r32, 8a, 8h
|
||||
MULI64 r38, r38, 8d
|
||||
ADD64 r39, r39, r38
|
||||
CP r38, r39
|
||||
ST r33, r38, 0a, 8h
|
||||
LD r38, r32, 8a, 8h
|
||||
ADDI64 r38, r38, 1d
|
||||
ST r38, r32, 8a, 8h
|
||||
CP r1, r39
|
||||
4: LD r31, r254, 0a, 72h
|
||||
ADDI64 r254, r254, 72d
|
||||
JALA r0, r31, 0a
|
||||
code size: 1201
|
||||
code size: 1204
|
||||
ret: 69
|
||||
status: Ok(())
|
||||
|
|
|
@ -1,28 +1,31 @@
|
|||
main:
|
||||
ADDI64 r254, r254, -40d
|
||||
ST r31, r254, 0a, 40h
|
||||
ADDI64 r254, r254, -56d
|
||||
ST r31, r254, 0a, 56h
|
||||
LI64 r32, 255d
|
||||
LI64 r33, 255d
|
||||
LI64 r34, 255d
|
||||
LI64 r35, 255d
|
||||
CMPS r32, r32, r33
|
||||
CMPUI r32, r32, 0d
|
||||
NOT r32, r32
|
||||
CMPS r34, r34, r33
|
||||
CMPUI r34, r34, 0d
|
||||
NOT r34, r34
|
||||
AND r32, r32, r34
|
||||
CMPS r35, r35, r33
|
||||
CMPUI r35, r35, 0d
|
||||
NOT r35, r35
|
||||
AND r32, r32, r35
|
||||
JEQ r32, r0, :0
|
||||
CP r36, r32
|
||||
CMPS r36, r36, r33
|
||||
CMPUI r36, r36, 0d
|
||||
NOT r36, r36
|
||||
CP r37, r34
|
||||
CMPS r37, r37, r33
|
||||
CMPUI r37, r37, 0d
|
||||
NOT r37, r37
|
||||
AND r36, r36, r37
|
||||
CP r37, r35
|
||||
CMPS r37, r37, r33
|
||||
CMPUI r37, r37, 0d
|
||||
NOT r37, r37
|
||||
AND r36, r36, r37
|
||||
JEQ r36, r0, :0
|
||||
LI64 r1, 0d
|
||||
JMP :1
|
||||
0: LI64 r1, 1d
|
||||
1: LD r31, r254, 0a, 40h
|
||||
ADDI64 r254, r254, 40d
|
||||
1: LD r31, r254, 0a, 56h
|
||||
ADDI64 r254, r254, 56d
|
||||
JALA r0, r31, 0a
|
||||
code size: 199
|
||||
code size: 208
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
fib:
|
||||
ADDI64 r254, r254, -24d
|
||||
ST r31, r254, 0a, 24h
|
||||
ADDI64 r254, r254, -32d
|
||||
ST r31, r254, 0a, 32h
|
||||
CP r32, r2
|
||||
LI64 r33, 2d
|
||||
JGTS r32, r33, :0
|
||||
|
@ -11,13 +11,14 @@ fib:
|
|||
CP r2, r33
|
||||
JAL r31, r0, :fib
|
||||
CP r33, r1
|
||||
ADDI64 r32, r32, -2d
|
||||
CP r2, r32
|
||||
CP r34, r32
|
||||
ADDI64 r34, r34, -2d
|
||||
CP r2, r34
|
||||
JAL r31, r0, :fib
|
||||
CP r32, r1
|
||||
ADD64 r1, r33, r32
|
||||
1: LD r31, r254, 0a, 24h
|
||||
ADDI64 r254, r254, 24d
|
||||
CP r34, r1
|
||||
ADD64 r1, r33, r34
|
||||
1: LD r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, 32d
|
||||
JALA r0, r31, 0a
|
||||
main:
|
||||
ADDI64 r254, r254, -8d
|
||||
|
@ -27,6 +28,6 @@ main:
|
|||
LD r31, r254, 0a, 8h
|
||||
ADDI64 r254, r254, 8d
|
||||
JALA r0, r31, 0a
|
||||
code size: 231
|
||||
code size: 234
|
||||
ret: 55
|
||||
status: Ok(())
|
||||
|
|
|
@ -52,9 +52,10 @@ integer:
|
|||
OR r35, r35, r36
|
||||
JEQ r35, r0, :0
|
||||
CP r35, r34
|
||||
SUB64 r33, r33, r32
|
||||
ADDI64 r33, r33, 1d
|
||||
DIRS64 r0, r35, r35, r33
|
||||
CP r36, r33
|
||||
SUB64 r36, r36, r32
|
||||
ADDI64 r36, r36, 1d
|
||||
DIRS64 r0, r35, r35, r36
|
||||
ADD64 r1, r35, r32
|
||||
JMP :1
|
||||
0: CP r1, r34
|
||||
|
@ -64,27 +65,27 @@ integer:
|
|||
line:
|
||||
ADDI64 r254, r254, -80d
|
||||
ST r31, r254, 48a, 32h
|
||||
ST r2, r254, 16a, 16h
|
||||
ST r4, r254, 0a, 16h
|
||||
ST r2, r254, 0a, 16h
|
||||
ST r4, r254, 16a, 16h
|
||||
ST r6, r254, 32a, 16h
|
||||
CP r32, r8
|
||||
LI64 r33, 1d
|
||||
JEQ r33, r0, :0
|
||||
LD r33, r254, 16a, 8h
|
||||
LD r34, r254, 0a, 8h
|
||||
LD r33, r254, 0a, 8h
|
||||
LD r34, r254, 16a, 8h
|
||||
JGTS r33, r34, :1
|
||||
JMP :1
|
||||
1: JMP :2
|
||||
0: LD r34, r254, 24a, 8h
|
||||
LD r33, r254, 8a, 8h
|
||||
0: LD r34, r254, 8a, 8h
|
||||
LD r33, r254, 24a, 8h
|
||||
JGTS r34, r33, :2
|
||||
JMP :2
|
||||
2: LD r31, r254, 48a, 32h
|
||||
ADDI64 r254, r254, 80d
|
||||
JALA r0, r31, 0a
|
||||
main:
|
||||
ADDI64 r254, r254, -64d
|
||||
ST r31, r254, 48a, 16h
|
||||
ADDI64 r254, r254, -112d
|
||||
ST r31, r254, 96a, 16h
|
||||
LI64 r32, 0d
|
||||
ST r32, r254, 0a, 8h
|
||||
LI64 r32, 0d
|
||||
|
@ -103,26 +104,26 @@ main:
|
|||
LI64 r8, 10d
|
||||
JAL r31, r0, :line
|
||||
LI64 r32, 0d
|
||||
ST r32, r254, 0a, 8h
|
||||
ST r32, r254, 48a, 8h
|
||||
LI64 r32, 0d
|
||||
ST r32, r254, 8a, 8h
|
||||
LD r2, r254, 0a, 16h
|
||||
ST r32, r254, 56a, 8h
|
||||
LD r2, r254, 48a, 16h
|
||||
LI64 r32, 0d
|
||||
ST r32, r254, 16a, 8h
|
||||
ST r32, r254, 64a, 8h
|
||||
LI64 r32, 0d
|
||||
ST r32, r254, 24a, 8h
|
||||
LD r4, r254, 16a, 16h
|
||||
ST r32, r254, 72a, 8h
|
||||
LD r4, r254, 64a, 16h
|
||||
LI64 r32, 0d
|
||||
ST r32, r254, 32a, 8h
|
||||
ST r32, r254, 80a, 8h
|
||||
LI64 r32, 0d
|
||||
ST r32, r254, 40a, 8h
|
||||
LD r6, r254, 32a, 16h
|
||||
ST r32, r254, 88a, 8h
|
||||
LD r6, r254, 80a, 16h
|
||||
LI64 r8, 10d
|
||||
JAL r31, r0, :rect_line
|
||||
JAL r31, r0, :example
|
||||
LI64 r1, 0d
|
||||
LD r31, r254, 48a, 16h
|
||||
ADDI64 r254, r254, 64d
|
||||
LD r31, r254, 96a, 16h
|
||||
ADDI64 r254, r254, 112d
|
||||
JALA r0, r31, 0a
|
||||
rect_line:
|
||||
ADDI64 r254, r254, -112d
|
||||
|
@ -156,6 +157,6 @@ rect_line:
|
|||
1: LD r31, r254, 48a, 64h
|
||||
ADDI64 r254, r254, 112d
|
||||
JALA r0, r31, 0a
|
||||
code size: 1400
|
||||
code size: 1403
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
integer_range:
|
||||
ADDI64 r254, r254, -32d
|
||||
ST r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, -40d
|
||||
ST r31, r254, 0a, 40h
|
||||
CP r32, r2
|
||||
CP r33, r3
|
||||
LI64 r2, 3d
|
||||
LI64 r3, 4d
|
||||
ECA
|
||||
CP r34, r1
|
||||
SUB64 r33, r33, r32
|
||||
ADDI64 r33, r33, 1d
|
||||
DIRU64 r0, r34, r34, r33
|
||||
CP r35, r33
|
||||
SUB64 r35, r35, r32
|
||||
ADDI64 r35, r35, 1d
|
||||
DIRU64 r0, r34, r34, r35
|
||||
ADD64 r1, r34, r32
|
||||
LD r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, 32d
|
||||
LD r31, r254, 0a, 40h
|
||||
ADDI64 r254, r254, 40d
|
||||
JALA r0, r31, 0a
|
||||
main:
|
||||
ADDI64 r254, r254, -16d
|
||||
|
@ -24,6 +25,6 @@ main:
|
|||
LD r31, r254, 0a, 16h
|
||||
ADDI64 r254, r254, 16d
|
||||
JALA r0, r31, 0a
|
||||
code size: 210
|
||||
code size: 213
|
||||
ret: 42
|
||||
status: Ok(())
|
||||
|
|
|
@ -6,8 +6,8 @@ drop:
|
|||
ADDI64 r254, r254, 16d
|
||||
JALA r0, r31, 0a
|
||||
main:
|
||||
ADDI64 r254, r254, -40d
|
||||
ST r31, r254, 8a, 32h
|
||||
ADDI64 r254, r254, -48d
|
||||
ST r31, r254, 8a, 40h
|
||||
LI64 r32, 1d
|
||||
ST r32, r254, 0a, 8h
|
||||
ADDI64 r32, r254, 0d
|
||||
|
@ -16,20 +16,22 @@ main:
|
|||
LD r2, r254, 0a, 8h
|
||||
JAL r31, r0, :drop
|
||||
LI64 r33, 0d
|
||||
LD r34, r32, 0a, 8h
|
||||
ADDI64 r1, r34, -2d
|
||||
LD r31, r254, 8a, 32h
|
||||
ADDI64 r254, r254, 40d
|
||||
CP r34, r32
|
||||
LD r35, r34, 0a, 8h
|
||||
ADDI64 r1, r35, -2d
|
||||
LD r31, r254, 8a, 40h
|
||||
ADDI64 r254, r254, 48d
|
||||
JALA r0, r31, 0a
|
||||
modify:
|
||||
ADDI64 r254, r254, -24d
|
||||
ST r31, r254, 0a, 24h
|
||||
ADDI64 r254, r254, -32d
|
||||
ST r31, r254, 0a, 32h
|
||||
CP r32, r2
|
||||
LI64 r33, 2d
|
||||
ST r33, r32, 0a, 8h
|
||||
LD r31, r254, 0a, 24h
|
||||
ADDI64 r254, r254, 24d
|
||||
CP r33, r32
|
||||
LI64 r34, 2d
|
||||
ST r34, r33, 0a, 8h
|
||||
LD r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, 32d
|
||||
JALA r0, r31, 0a
|
||||
code size: 312
|
||||
code size: 318
|
||||
ret: 0
|
||||
status: Ok(())
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
create_back_buffer:
|
||||
ADDI64 r254, r254, -32d
|
||||
ST r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, -40d
|
||||
ST r31, r254, 0a, 40h
|
||||
CP r32, r2
|
||||
LI64 r33, 255d
|
||||
JGTS r32, r33, :0
|
||||
|
@ -10,24 +10,25 @@ create_back_buffer:
|
|||
0: LI64 r2, 255d
|
||||
JAL r31, r0, :request_page
|
||||
CP r33, r1
|
||||
ADDI64 r32, r32, -255d
|
||||
6: LI64 r34, 0d
|
||||
JGTS r32, r34, :2
|
||||
CP r34, r32
|
||||
ADDI64 r34, r34, -255d
|
||||
6: LI64 r35, 0d
|
||||
JGTS r34, r35, :2
|
||||
JMP :3
|
||||
2: LI64 r34, 255d
|
||||
JLTS r32, r34, :4
|
||||
2: LI64 r35, 255d
|
||||
JLTS r34, r35, :4
|
||||
LI64 r2, 255d
|
||||
JAL r31, r0, :request_page
|
||||
CP r34, r1
|
||||
CP r35, r1
|
||||
JMP :5
|
||||
4: CP r2, r32
|
||||
4: CP r2, r34
|
||||
JAL r31, r0, :request_page
|
||||
CP r34, r1
|
||||
5: ADDI64 r32, r32, -255d
|
||||
CP r35, r1
|
||||
5: ADDI64 r34, r34, -255d
|
||||
JMP :6
|
||||
3: CP r1, r33
|
||||
1: LD r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, 32d
|
||||
1: LD r31, r254, 0a, 40h
|
||||
ADDI64 r254, r254, 40d
|
||||
JALA r0, r31, 0a
|
||||
main:
|
||||
ADDI64 r254, r254, -16d
|
||||
|
@ -39,21 +40,22 @@ main:
|
|||
ADDI64 r254, r254, 16d
|
||||
JALA r0, r31, 0a
|
||||
request_page:
|
||||
ADDI64 r254, r254, -32d
|
||||
ST r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, -40d
|
||||
ST r31, r254, 0a, 40h
|
||||
CP r32, r2
|
||||
LRA r33, r0, :"\0\u{1}xxxxxxxx\0"
|
||||
CP r34, r33
|
||||
ADDI64 r34, r34, 1d
|
||||
ST r32, r34, 0a, 1h
|
||||
CP r35, r34
|
||||
ST r32, r35, 0a, 1h
|
||||
LI64 r2, 3d
|
||||
LI64 r3, 2d
|
||||
CP r4, r33
|
||||
LI64 r5, 12d
|
||||
ECA
|
||||
LD r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, 32d
|
||||
LD r31, r254, 0a, 40h
|
||||
ADDI64 r254, r254, 40d
|
||||
JALA r0, r31, 0a
|
||||
code size: 443
|
||||
code size: 449
|
||||
ret: 42
|
||||
status: Ok(())
|
||||
|
|
|
@ -1,74 +1,74 @@
|
|||
main:
|
||||
ADDI64 r254, r254, -136d
|
||||
ST r31, r254, 112a, 24h
|
||||
ADDI64 r254, r254, -152d
|
||||
ST r31, r254, 128a, 24h
|
||||
LI64 r32, 1d
|
||||
ST r32, r254, 32a, 8h
|
||||
ST r32, r254, 0a, 8h
|
||||
LI64 r32, 2d
|
||||
ST r32, r254, 40a, 8h
|
||||
ST r32, r254, 8a, 8h
|
||||
LI64 r32, 3d
|
||||
ST r32, r254, 16a, 8h
|
||||
LI64 r32, 4d
|
||||
ST r32, r254, 24a, 8h
|
||||
LD r32, r254, 32a, 8h
|
||||
LD r32, r254, 0a, 8h
|
||||
LD r33, r254, 16a, 8h
|
||||
ADD64 r32, r32, r33
|
||||
ST r32, r254, 48a, 8h
|
||||
LD r32, r254, 40a, 8h
|
||||
ST r32, r254, 32a, 8h
|
||||
LD r32, r254, 8a, 8h
|
||||
LD r33, r254, 24a, 8h
|
||||
ADD64 r32, r32, r33
|
||||
ST r32, r254, 56a, 8h
|
||||
ST r32, r254, 40a, 8h
|
||||
LD r32, r254, 16a, 8h
|
||||
LD r33, r254, 32a, 8h
|
||||
LD r33, r254, 0a, 8h
|
||||
SUB64 r32, r32, r33
|
||||
ST r32, r254, 64a, 8h
|
||||
ST r32, r254, 48a, 8h
|
||||
LD r32, r254, 24a, 8h
|
||||
LD r33, r254, 40a, 8h
|
||||
LD r33, r254, 8a, 8h
|
||||
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
|
||||
LI64 r32, 0d
|
||||
ST r32, r254, 0a, 8h
|
||||
LI64 r32, 0d
|
||||
ST r32, r254, 8a, 8h
|
||||
LD r32, r254, 0a, 8h
|
||||
LD r32, r254, 64a, 8h
|
||||
LD r33, r254, 16a, 8h
|
||||
SUB64 r32, r32, r33
|
||||
ST r32, r254, 80a, 8h
|
||||
LD r32, r254, 8a, 8h
|
||||
LD r32, r254, 72a, 8h
|
||||
LD r33, r254, 24a, 8h
|
||||
SUB64 r32, r32, r33
|
||||
ST r32, r254, 88a, 8h
|
||||
ADDI64 r32, r254, 32d
|
||||
ADDI64 r32, r254, 0d
|
||||
ADDI64 r33, r254, 96d
|
||||
BMC r32, r33, 16h
|
||||
LD r33, r254, 80a, 8h
|
||||
LD r32, r254, 48a, 8h
|
||||
LD r32, r254, 32a, 8h
|
||||
ADD64 r33, r33, r32
|
||||
ST r33, r254, 80a, 8h
|
||||
LD r33, r254, 88a, 8h
|
||||
LD r32, r254, 56a, 8h
|
||||
LD r32, r254, 40a, 8h
|
||||
ADD64 r33, r33, r32
|
||||
ST r33, r254, 88a, 8h
|
||||
LD r33, r254, 96a, 8h
|
||||
LD r32, r254, 64a, 8h
|
||||
LD r32, r254, 48a, 8h
|
||||
ADD64 r33, r33, r32
|
||||
ST r33, r254, 96a, 8h
|
||||
LD r33, r254, 104a, 8h
|
||||
LD r32, r254, 72a, 8h
|
||||
LD r32, r254, 56a, 8h
|
||||
ADD64 r33, r33, r32
|
||||
ST r33, r254, 104a, 8h
|
||||
LD r33, r254, 80a, 8h
|
||||
LD r32, r254, 96a, 8h
|
||||
ADD64 r33, r33, r32
|
||||
ST r33, r254, 96a, 8h
|
||||
ST r33, r254, 112a, 8h
|
||||
LD r33, r254, 88a, 8h
|
||||
LD r32, r254, 104a, 8h
|
||||
ADD64 r33, r33, r32
|
||||
ST r33, r254, 104a, 8h
|
||||
LD r33, r254, 96a, 8h
|
||||
LD r32, r254, 104a, 8h
|
||||
ST r33, r254, 120a, 8h
|
||||
LD r33, r254, 112a, 8h
|
||||
LD r32, r254, 120a, 8h
|
||||
ADD64 r1, r33, r32
|
||||
LD r31, r254, 112a, 24h
|
||||
ADDI64 r254, r254, 136d
|
||||
LD r31, r254, 128a, 24h
|
||||
ADDI64 r254, r254, 152d
|
||||
JALA r0, r31, 0a
|
||||
code size: 778
|
||||
ret: 10
|
||||
|
|
|
@ -40,8 +40,8 @@ fib_iter:
|
|||
ADDI64 r254, r254, 40d
|
||||
JALA r0, r31, 0a
|
||||
main:
|
||||
ADDI64 r254, r254, -26d
|
||||
ST r31, r254, 2a, 24h
|
||||
ADDI64 r254, r254, -42d
|
||||
ST r31, r254, 2a, 40h
|
||||
LI64 r32, 10d
|
||||
ST r32, r254, 0a, 1h
|
||||
LI64 r32, 10d
|
||||
|
@ -52,13 +52,13 @@ main:
|
|||
LD r33, r254, 1a, 1h
|
||||
CP r2, r32
|
||||
JAL r31, r0, :fib
|
||||
CP r32, r1
|
||||
CP r34, r1
|
||||
CP r2, r33
|
||||
JAL r31, r0, :fib_iter
|
||||
CP r33, r1
|
||||
SUB64 r1, r32, r33
|
||||
LD r31, r254, 2a, 24h
|
||||
ADDI64 r254, r254, 26d
|
||||
CP r35, r1
|
||||
SUB64 r1, r34, r35
|
||||
LD r31, r254, 2a, 40h
|
||||
ADDI64 r254, r254, 42d
|
||||
JALA r0, r31, 0a
|
||||
code size: 452
|
||||
ret: 0
|
||||
|
|
|
@ -12,27 +12,27 @@ foo:
|
|||
ADDI64 r254, r254, 32d
|
||||
JALA r0, r31, 0a
|
||||
main:
|
||||
ADDI64 r254, r254, -40d
|
||||
ST r31, r254, 16a, 24h
|
||||
ADDI64 r254, r254, -72d
|
||||
ST r31, r254, 48a, 24h
|
||||
LI64 r32, 7d
|
||||
JAL r31, r0, :foo
|
||||
ST r1, r254, 0a, 16h
|
||||
LD r33, r254, 0a, 8h
|
||||
SUB64 r32, r32, r33
|
||||
JAL r31, r0, :foo
|
||||
ST r1, r254, 0a, 16h
|
||||
ST r1, r254, 16a, 16h
|
||||
CP r33, r0
|
||||
LD r33, r254, 8a, 4h
|
||||
LD r33, r254, 24a, 4h
|
||||
SXT32 r33, r33
|
||||
SUB64 r32, r32, r33
|
||||
JAL r31, r0, :foo
|
||||
ST r1, r254, 0a, 16h
|
||||
ST r1, r254, 32a, 16h
|
||||
CP r33, r0
|
||||
LD r33, r254, 12a, 4h
|
||||
LD r33, r254, 44a, 4h
|
||||
SXT32 r33, r33
|
||||
SUB64 r1, r32, r33
|
||||
LD r31, r254, 16a, 24h
|
||||
ADDI64 r254, r254, 40d
|
||||
LD r31, r254, 48a, 24h
|
||||
ADDI64 r254, r254, 72d
|
||||
JALA r0, r31, 0a
|
||||
code size: 341
|
||||
ret: 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
main:
|
||||
ADDI64 r254, r254, -48d
|
||||
ST r31, r254, 24a, 24h
|
||||
ADDI64 r254, r254, -72d
|
||||
ST r31, r254, 48a, 24h
|
||||
LI64 r32, 4d
|
||||
ST r32, r254, 0a, 8h
|
||||
LI64 r32, 1d
|
||||
|
@ -8,39 +8,41 @@ main:
|
|||
LI64 r32, 3d
|
||||
ST r32, r254, 16a, 8h
|
||||
ADDI64 r2, r254, 0d
|
||||
ADDI64 r1, r254, 0d
|
||||
ADDI64 r1, r254, 24d
|
||||
JAL r31, r0, :odher_pass
|
||||
LD r32, r254, 16a, 8h
|
||||
LD r32, r254, 40a, 8h
|
||||
LI64 r33, 3d
|
||||
JNE r32, r33, :0
|
||||
ADDI64 r33, r254, 0d
|
||||
ADDI64 r33, r254, 24d
|
||||
CP r2, r33
|
||||
JAL r31, r0, :pass
|
||||
JMP :1
|
||||
0: LI64 r1, 0d
|
||||
1: LD r31, r254, 24a, 24h
|
||||
ADDI64 r254, r254, 48d
|
||||
1: LD r31, r254, 48a, 24h
|
||||
ADDI64 r254, r254, 72d
|
||||
JALA r0, r31, 0a
|
||||
odher_pass:
|
||||
ADDI64 r254, r254, -32d
|
||||
ST r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, -40d
|
||||
ST r31, r254, 0a, 40h
|
||||
CP r32, r2
|
||||
CP r33, r1
|
||||
CP r34, r33
|
||||
BMC r32, r34, 24h
|
||||
LD r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, 32d
|
||||
CP r34, r32
|
||||
CP r35, r33
|
||||
BMC r34, r35, 24h
|
||||
LD r31, r254, 0a, 40h
|
||||
ADDI64 r254, r254, 40d
|
||||
JALA r0, r31, 0a
|
||||
pass:
|
||||
ADDI64 r254, r254, -32d
|
||||
ST r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, -40d
|
||||
ST r31, r254, 0a, 40h
|
||||
CP r32, r2
|
||||
LD r33, r32, 0a, 8h
|
||||
LD r34, r32, 8a, 8h
|
||||
SUB64 r1, r33, r34
|
||||
LD r31, r254, 0a, 32h
|
||||
ADDI64 r254, r254, 32d
|
||||
CP r33, r32
|
||||
LD r34, r33, 0a, 8h
|
||||
LD r35, r33, 8a, 8h
|
||||
SUB64 r1, r34, r35
|
||||
LD r31, r254, 0a, 40h
|
||||
ADDI64 r254, r254, 40d
|
||||
JALA r0, r31, 0a
|
||||
code size: 394
|
||||
code size: 400
|
||||
ret: 3
|
||||
status: Ok(())
|
||||
|
|
|
@ -1,32 +1,32 @@
|
|||
main:
|
||||
ADDI64 r254, r254, -48d
|
||||
ST r31, r254, 16a, 32h
|
||||
ADDI64 r254, r254, -56d
|
||||
ST r31, r254, 24a, 32h
|
||||
CP r32, r3
|
||||
CP r33, r4
|
||||
JAL r31, r0, :small_struct
|
||||
CP r34, r1
|
||||
LI64 r34, 0d
|
||||
ST r34, r254, 8a, 1h
|
||||
ST r34, r254, 0a, 1h
|
||||
LI64 r34, 0d
|
||||
ST r34, r254, 9a, 1h
|
||||
ST r34, r254, 1a, 1h
|
||||
LI64 r34, 0d
|
||||
ST r34, r254, 10a, 1h
|
||||
ST r34, r254, 2a, 1h
|
||||
LI64 r34, 0d
|
||||
ST r34, r254, 11a, 1h
|
||||
ST r34, r254, 3a, 1h
|
||||
LI64 r34, 0d
|
||||
ST r34, r254, 12a, 1h
|
||||
ST r34, r254, 4a, 1h
|
||||
LI64 r34, 0d
|
||||
ST r34, r254, 13a, 1h
|
||||
ST r34, r254, 5a, 1h
|
||||
LI64 r34, 0d
|
||||
ST r34, r254, 14a, 1h
|
||||
ST r34, r254, 6a, 1h
|
||||
LI64 r34, 0d
|
||||
ST r34, r254, 15a, 1h
|
||||
LD r34, r254, 8a, 8h
|
||||
ST r34, r254, 0a, 8h
|
||||
ST r34, r254, 7a, 1h
|
||||
LD r34, r254, 0a, 8h
|
||||
ST r34, r254, 8a, 8h
|
||||
LD r1, r254, 0a, 16h
|
||||
LD r31, r254, 16a, 32h
|
||||
ADDI64 r254, r254, 48d
|
||||
ST r34, r254, 16a, 8h
|
||||
LD r1, r254, 8a, 16h
|
||||
LD r31, r254, 24a, 32h
|
||||
ADDI64 r254, r254, 56d
|
||||
JALA r0, r31, 0a
|
||||
small_struct:
|
||||
ADDI64 r254, r254, -20d
|
||||
|
|
Loading…
Reference in a new issue