fixed a stack prelude postlude being needlesly generated + struct can now be compared

This commit is contained in:
Jakub Doka 2024-11-17 10:06:10 +01:00
parent 12bb7029b4
commit 397b2a4b1b
No known key found for this signature in database
GPG key ID: C6E9A89936B8C143
74 changed files with 468 additions and 607 deletions

View file

@ -313,9 +313,12 @@ Color := packed struct {b: u8, g: u8, r: u8, a: u8}
main := fn(): uint {
i := Color.(0, 0, 0, 0)
i += .(1, 1, 1, 1)
if i.r + i.g + i.b + i.a != 4 {
return 1008
}
if i.r + i.g + i.b + i.a != 4 return 1008
if Point.(1, 1) != Point.(1, 1) return 1009
if Point.(1, 2) == Point.(1, 1) return 1010
if Point.(1, 2) < Point.(1, 1) return 1011
if Point.(1, 1) > Point.(2, 1) return 1012
a := Point.(1, 2)
b := Point.(3, 4)

View file

@ -193,6 +193,10 @@ impl TokenKind {
matches!(self, S::Eq | S::Ne | S::Bor | S::Xor | S::Band | S::Add | S::Mul)
}
pub fn is_compatison(self) -> bool {
matches!(self, Self::Lt | Self::Gt | Self::Ge | Self::Le | Self::Ne | Self::Eq)
}
pub fn is_supported_float_op(self) -> bool {
matches!(
self,

View file

@ -386,10 +386,10 @@ pub mod ty {
pub const DINT: Self = Self::UINT;
pub fn bin_ret(self, op: TokenKind) -> Id {
use TokenKind as T;
match op {
T::Lt | T::Gt | T::Le | T::Ge | T::Ne | T::Eq => Id::BOOL,
_ => self,
if op.is_compatison() {
Self::BOOL
} else {
self
}
}

View file

@ -3066,15 +3066,7 @@ impl<'a> Codegen<'a> {
self.strip_var(&mut rhs);
self.implicit_unwrap(right.pos(), &mut rhs);
let (ty, aclass) = self.binop_ty(pos, &mut lhs, &mut rhs, op);
if matches!(
op,
TokenKind::Lt
| TokenKind::Gt
| TokenKind::Ge
| TokenKind::Le
| TokenKind::Ne
| TokenKind::Eq
) {
if op.is_compatison() {
if lhs.ty.is_float() {
} else {
self.ci.nodes.lock(rhs.id);
@ -3109,6 +3101,22 @@ impl<'a> Codegen<'a> {
self.struct_op(left.pos(), op, s, dst, lhs.id, rhs.id);
Some(Value::ptr(dst).ty(lhs.ty))
}
ty::Kind::Struct(s) if op.is_compatison() => {
let binding_op = match op {
TokenKind::Eq => TokenKind::Band,
_ => TokenKind::Bor,
};
self.ci.nodes.lock(lhs.id);
let rhs = self.raw_expr_ctx(right, Ctx::default().with_ty(lhs.ty));
self.ci.nodes.unlock(lhs.id);
let mut rhs = rhs?;
self.strip_var(&mut rhs);
self.assert_ty(pos, &mut rhs, lhs.ty, "struct operand");
self.struct_fold_op(left.pos(), op, binding_op, s, lhs.id, rhs.id)
.or(Value::NEVER)
}
_ => {
self.report(
pos,
@ -4149,6 +4157,67 @@ impl<'a> Codegen<'a> {
true
}
fn struct_fold_op(
&mut self,
pos: Pos,
op: TokenKind,
fold_op: TokenKind,
s: ty::Struct,
lhs: Nid,
rhs: Nid,
) -> Option<Value> {
debug_assert!(op.is_compatison());
let mut fold = None;
let mut offs = OffsetIter::new(s, self.tys);
while let Some((ty, off)) = offs.next_ty(self.tys) {
let lhs = self.offset(lhs, off);
let rhs = self.offset(rhs, off);
let vl = match ty.expand() {
_ if ty.is_pointer() || ty.is_integer() || ty == ty::Id::BOOL => {
let lhs = self.load_mem(lhs, ty);
let rhs = self.load_mem(rhs, ty);
self.ci.nodes.new_node(
ty::Id::BOOL,
Kind::BinOp { op },
[VOID, lhs, rhs],
self.tys,
)
}
ty::Kind::Struct(is) => match self.struct_fold_op(pos, op, fold_op, is, lhs, rhs) {
Some(v) => v.id,
None => {
self.report(
pos,
fa!("...when appliing '{0} {op} {0}'", self.ty_display(s.into())),
);
return None;
}
},
_ => {
self.report(pos, fa!("'{0} {op} {0}' is not supported", self.ty_display(ty)));
return None;
}
};
fold = Some(match fold {
None => vl,
Some(o) => self.ci.nodes.new_node(
ty::Id::BOOL,
Kind::BinOp { op: fold_op },
[VOID, o, vl],
self.tys,
),
});
}
match op {
_ if let Some(fold) = fold => Some(Value::new(fold).ty(ty::Id::BOOL)),
TokenKind::Eq => Some(self.ci.nodes.new_const_lit(ty::Id::BOOL, true)),
_ => Some(self.ci.nodes.new_const_lit(ty::Id::BOOL, false)),
}
}
fn compute_signature(&mut self, func: &mut ty::Func, pos: Pos, args: &[Expr]) -> Option<Sig> {
let Func { file, expr, sig, .. } = self.tys.ins.funcs[*func];
let fast = self.files[file.index()].clone();

View file

@ -301,10 +301,10 @@ impl HbvmBackend {
let bundle_count = self.ralloc.bundles.len() + (reg_offset as usize);
(
if tail {
bundle_count.saturating_sub(reg::RET_ADDR as _)
} else {
assert!(bundle_count < reg::STACK_PTR as usize, "TODO: spill memory");
self.ralloc.bundles.len()
} else {
bundle_count.saturating_sub(reg::RET_ADDR as _)
},
tail,
)

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
LI32 r32, 1148846080w
CP r2, r32
JAL r31, r0, :sin
@ -8,12 +8,10 @@ main:
FMUL32 r32, r33, r32
FTI32 r32, r32, 1b
CP r1, r32
LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
sin:
ADDI64 r254, r254, -56d
ST r32, r254, 0a, 56h
CP r13, r2
LI32 r14, 1124073472w
LI32 r15, 1078530011w
@ -44,9 +42,7 @@ sin:
FMUL32 r13, r14, r13
FADD32 r13, r15, r13
CP r1, r13
LD r32, r254, 0a, 56h
ADDI64 r254, r254, 56d
JALA r0, r31, 0a
code size: 1363
code size: 1315
ret: 826
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -64d
ST r31, r254, 24a, 40h
ADDI64 r254, r254, -56d
ST r31, r254, 24a, 32h
LI64 r32, 1d
ADDI64 r33, r254, 0d
ST r32, r254, 0a, 8h
@ -13,12 +13,10 @@ main:
CP r33, r1
ADD64 r32, r33, r32
CP r1, r32
LD r31, r254, 24a, 40h
ADDI64 r254, r254, 64d
LD r31, r254, 24a, 32h
ADDI64 r254, r254, 56d
JALA r0, r31, 0a
pass:
ADDI64 r254, r254, -32d
ST r32, r254, 0a, 32h
CP r13, r2
LD r14, r13, 8a, 8h
MULI64 r15, r14, 8d
@ -28,9 +26,7 @@ pass:
LD r13, r13, 0a, 8h
ADD64 r13, r13, r14
CP r1, r13
LD r32, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
code size: 294
code size: 246
ret: 8
status: Ok(())

View file

@ -1,12 +1,8 @@
main:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LRA r13, r0, :SIN_TABLE
LD r13, r13, 80a, 8h
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 818
code size: 770
ret: 1736
status: Ok(())

View file

@ -1,6 +1,4 @@
main:
ADDI64 r254, r254, -16d
ST r32, r254, 0a, 16h
CP r14, r2
LI64 r13, 1d
JNE r14, r13, :0
@ -10,9 +8,7 @@ main:
JMP :1
2: LI64 r13, 3d
1: CP r1, r13
LD r32, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 123
code size: 75
ret: 2
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
LRA r32, r0, :"abඞ\n\r\t56789\0"
CP r2, r32
JAL r31, r0, :str_len
@ -11,12 +11,10 @@ main:
CP r33, r1
ADD64 r32, r33, r32
CP r1, r32
LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
str_len:
ADDI64 r254, r254, -32d
ST r32, r254, 0a, 32h
CP r15, r2
CP r14, r0
CP r13, r14
@ -28,9 +26,7 @@ str_len:
0: ADDI64 r15, r15, 1d
ADDI64 r13, r13, 1d
JMP :2
1: LD r32, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
code size: 264
1: JALA r0, r31, 0a
code size: 216
ret: 16
status: Ok(())

View file

@ -1,12 +1,12 @@
foo:
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -16d
ST r31, r254, 0a, 16h
ADDI64 r254, r254, -8d
ST r31, r254, 0a, 8h
JAL r31, r0, :foo
CP r1, r0
LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d
LD r31, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 88
ret: 0

View file

@ -1,12 +1,8 @@
main:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LRA r13, r0, :a
LD r13, r13, 0a, 8h
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 98
code size: 50
ret: 50
status: Ok(())

View file

@ -1,12 +1,8 @@
main:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LRA r13, r0, :a
LD r13, r13, 0a, 8h
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 98
code size: 50
ret: 50
status: Ok(())

View file

@ -2,8 +2,8 @@ cond:
CP r1, r0
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
JAL r31, r0, :cond
CP r33, r1
CP r32, r0
@ -11,8 +11,8 @@ main:
JMP :1
0: LI64 r32, 2d
1: CP r1, r32
LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
code size: 117
ret: 0

View file

@ -1,11 +1,7 @@
main:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LI32 r13, 69w
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 76
code size: 28
ret: 69
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -152d
ST r31, r254, 80a, 72h
ADDI64 r254, r254, -144d
ST r31, r254, 80a, 64h
LRA r32, r0, :glob_stru
JAL r31, r0, :new_stru
ST r1, r32, 0a, 16h
@ -68,19 +68,17 @@ main:
ST r1, r34, 0a, 16h
ADD64 r32, r32, r35
JMP :8
1: LD r31, r254, 80a, 72h
ADDI64 r254, r254, 152d
1: LD r31, r254, 80a, 64h
ADDI64 r254, r254, 144d
JALA r0, r31, 0a
new_stru:
ADDI64 r254, r254, -24d
ST r32, r254, 16a, 8h
ADDI64 r254, r254, -16d
ADDI64 r13, r254, 0d
ST r0, r254, 0a, 8h
ST r0, r254, 8a, 8h
LD r1, r13, 0a, 16h
LD r32, r254, 16a, 8h
ADDI64 r254, r254, 24d
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 791
code size: 765
ret: 0
status: Ok(())

View file

@ -1,6 +1,5 @@
main:
ADDI64 r254, r254, -36d
ST r32, r254, 12a, 24h
ADDI64 r254, r254, -12d
LI8 r13, 255b
ST r13, r254, 0a, 1h
ST r0, r254, 1a, 1h
@ -23,9 +22,8 @@ main:
JMP :1
2: LI64 r13, 512d
CP r1, r13
1: LD r32, r254, 12a, 24h
ADDI64 r254, r254, 36d
1: ADDI64 r254, r254, 12d
JALA r0, r31, 0a
code size: 261
code size: 235
ret: 512
status: Ok(())

View file

@ -1,6 +1,5 @@
main:
ADDI64 r254, r254, -48d
ST r32, r254, 16a, 32h
ADDI64 r254, r254, -16d
LI64 r13, 10d
ADDI64 r14, r254, 0d
ST r13, r254, 0a, 8h
@ -15,10 +14,9 @@ main:
LD r3, r14, 0a, 16h
ECA
CP r1, r0
LD r32, r254, 16a, 32h
ADDI64 r254, r254, 48d
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
ev: Ecall
code size: 180
code size: 154
ret: 0
status: Ok(())

View file

@ -1,6 +1,4 @@
continue_and_state_change:
ADDI64 r254, r254, -48d
ST r32, r254, 0a, 48h
CP r13, r2
CP r15, r0
LI64 r16, 3d
@ -18,12 +16,10 @@ continue_and_state_change:
JMP :5
4: ADDI64 r13, r13, 1d
3: JMP :6
5: LD r32, r254, 0a, 48h
ADDI64 r254, r254, 48d
JALA r0, r31, 0a
5: JALA r0, r31, 0a
infinite_loop:
ADDI64 r254, r254, -40d
ST r31, r254, 0a, 40h
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
LI64 r34, 1d
CP r33, r0
CP r32, r33
@ -33,12 +29,12 @@ infinite_loop:
JAL r31, r0, :continue_and_state_change
CP r32, r1
JMP :1
LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -48d
ST r31, r254, 0a, 48h
ADDI64 r254, r254, -40d
ST r31, r254, 0a, 40h
CP r2, r0
JAL r31, r0, :multiple_breaks
CP r32, r1
@ -84,12 +80,10 @@ main:
JMP :1
6: JAL r31, r0, :infinite_loop
CP r1, r0
1: LD r31, r254, 0a, 48h
ADDI64 r254, r254, 48d
1: LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
JALA r0, r31, 0a
multiple_breaks:
ADDI64 r254, r254, -24d
ST r32, r254, 0a, 24h
CP r13, r2
LI64 r14, 3d
LI64 r15, 10d
@ -100,12 +94,8 @@ multiple_breaks:
1: CP r1, r13
JMP :3
2: JMP :4
3: LD r32, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
3: JALA r0, r31, 0a
state_change_in_break:
ADDI64 r254, r254, -24d
ST r32, r254, 0a, 24h
CP r13, r2
LI64 r14, 3d
LI64 r15, 10d
@ -117,10 +107,8 @@ state_change_in_break:
JMP :3
2: ADDI64 r13, r13, 1d
JMP :4
3: LD r32, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
3: JALA r0, r31, 0a
timed out
code size: 811
code size: 667
ret: 10
status: Ok(())

View file

@ -1,15 +1,15 @@
check_platform:
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
ADDI64 r254, r254, -16d
ST r31, r254, 0a, 16h
JAL r31, r0, :x86_fb_ptr
CP r32, r1
CP r1, r32
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -64d
ST r31, r254, 0a, 64h
ADDI64 r254, r254, -56d
ST r31, r254, 0a, 56h
JAL r31, r0, :check_platform
CP r33, r0
LI64 r36, 30d
@ -35,29 +35,21 @@ main:
0: ADDI64 r35, r35, 1d
ADDI64 r32, r32, 1d
4: JMP :5
2: LD r31, r254, 0a, 64h
ADDI64 r254, r254, 64d
2: LD r31, r254, 0a, 56h
ADDI64 r254, r254, 56d
JALA r0, r31, 0a
set_pixel:
ADDI64 r254, r254, -24d
ST r32, r254, 0a, 24h
CP r13, r2
CP r14, r3
CP r15, r4
MUL64 r14, r14, r15
ADD64 r13, r14, r13
CP r1, r13
LD r32, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
x86_fb_ptr:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LI64 r13, 100d
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 425
code size: 329
ret: 3000
status: Ok(())

View file

@ -1,11 +1,7 @@
main:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LI32 r13, 3212836864w
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 76
code size: 28
ret: 3212836864
status: Ok(())

View file

@ -1,24 +1,16 @@
add_one:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
CP r13, r2
ADDI64 r13, r13, 1d
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
add_two:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
CP r13, r2
ADDI64 r13, r13, 2d
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
LI64 r32, 10d
CP r2, r32
JAL r31, r0, :add_one
@ -29,9 +21,9 @@ main:
CP r33, r1
ADD64 r32, r33, r32
CP r1, r32
LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
code size: 272
code size: 176
ret: 33
status: Ok(())

View file

@ -1,26 +1,18 @@
add:
ADDI64 r254, r254, -16d
ST r32, r254, 0a, 16h
CP r13, r2
CP r14, r3
ADD64 r13, r13, r14
CP r1, r13
LD r32, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
add:
ADDI64 r254, r254, -16d
ST r32, r254, 0a, 16h
CP r13, r2
CP r14, r3
ADD32 r13, r13, r14
CP r1, r13
LD r32, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -40d
ST r31, r254, 0a, 40h
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
LI32 r32, 2w
CP r2, r32
CP r3, r32
@ -35,9 +27,9 @@ main:
ANDI r32, r32, 4294967295d
SUB64 r32, r32, r33
CP r1, r32
LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
code size: 287
code size: 191
ret: 0
status: Ok(())

View file

@ -1,15 +1,15 @@
main:
ADDI64 r254, r254, -16d
ST r31, r254, 0a, 16h
ADDI64 r254, r254, -8d
ST r31, r254, 0a, 8h
JAL r31, r0, :process
LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d
LD r31, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
opaque:
JALA r0, r31, 0a
process:
ADDI64 r254, r254, -56d
ST r31, r254, 16a, 40h
ADDI64 r254, r254, -48d
ST r31, r254, 16a, 32h
LI64 r32, 1000d
ADDI64 r33, r254, 0d
ST r0, r254, 0a, 1h
@ -23,8 +23,8 @@ process:
JMP :3
2: ADDI64 r32, r32, -1d
1: JMP :4
3: LD r31, r254, 16a, 40h
ADDI64 r254, r254, 56d
3: LD r31, r254, 16a, 32h
ADDI64 r254, r254, 48d
JALA r0, r31, 0a
timed out
code size: 248

View file

@ -1,6 +1,6 @@
deinit:
ADDI64 r254, r254, -48d
ST r31, r254, 0a, 48h
ADDI64 r254, r254, -40d
ST r31, r254, 0a, 40h
CP r32, r2
LD r33, r32, 16a, 8h
LI64 r34, 8d
@ -12,12 +12,10 @@ deinit:
JAL r31, r0, :free
CP r1, r32
JAL r31, r0, :new
LD r31, r254, 0a, 48h
ADDI64 r254, r254, 48d
LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
JALA r0, r31, 0a
free:
ADDI64 r254, r254, -32d
ST r32, r254, 0a, 32h
CP r13, r2
CP r14, r3
CP r15, r4
@ -28,12 +26,10 @@ free:
CP r4, r14
CP r5, r15
ECA
LD r32, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -64d
ST r31, r254, 24a, 40h
ADDI64 r254, r254, -56d
ST r31, r254, 24a, 32h
ADDI64 r32, r254, 0d
CP r1, r32
JAL r31, r0, :new
@ -47,12 +43,10 @@ main:
CP r2, r32
JAL r31, r0, :deinit
CP r1, r33
LD r31, r254, 24a, 40h
ADDI64 r254, r254, 64d
LD r31, r254, 24a, 32h
ADDI64 r254, r254, 56d
JALA r0, r31, 0a
malloc:
ADDI64 r254, r254, -24d
ST r32, r254, 0a, 24h
CP r13, r2
CP r14, r3
LRA r15, r0, :MALLOC_SYS_CALL
@ -63,24 +57,20 @@ malloc:
ECA
CP r13, r1
CP r1, r13
LD r32, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
new:
ADDI64 r254, r254, -32d
ST r32, r254, 24a, 8h
ADDI64 r254, r254, -24d
CP r14, r1
ADDI64 r13, r254, 0d
ST r0, r254, 0a, 8h
ST r0, r254, 8a, 8h
ST r0, r254, 16a, 8h
BMC r13, r14, 24h
LD r32, r254, 24a, 8h
ADDI64 r254, r254, 32d
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
push:
ADDI64 r254, r254, -112d
ST r31, r254, 0a, 112h
ADDI64 r254, r254, -104d
ST r31, r254, 0a, 104h
CP r38, r2
CP r39, r3
LI64 r37, 1d
@ -132,9 +122,9 @@ push:
ADD64 r32, r32, r37
ST r32, r38, 8a, 8h
CP r1, r33
4: LD r31, r254, 0a, 112h
ADDI64 r254, r254, 112d
4: LD r31, r254, 0a, 104h
ADDI64 r254, r254, 104d
JALA r0, r31, 0a
code size: 1045
code size: 923
ret: 69
status: Ok(())

View file

@ -1,23 +1,19 @@
clobber:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LRA r13, r0, :var
ST r0, r13, 0a, 8h
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
LRA r32, r0, :var
LI64 r33, 2d
ST r33, r32, 0a, 8h
JAL r31, r0, :clobber
LD r32, r32, 0a, 8h
CP r1, r32
LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
code size: 207
code size: 159
ret: 0
status: Ok(())

View file

@ -2,8 +2,8 @@ inb:
CP r1, r0
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -40d
ST r31, r254, 0a, 40h
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
LRA r32, r0, :ports
LD r33, r32, 0a, 1h
ANDI r33, r33, 255d
@ -15,8 +15,8 @@ main:
CMPUI r34, r34, 0d
NOT r34, r34
ST r34, r32, 0a, 1h
1: LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
1: LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
code size: 164
ret: 0

View file

@ -1,14 +1,10 @@
main:
ADDI64 r254, r254, -16d
ST r32, r254, 0a, 16h
LRA r13, r0, :complex_global_var
LD r14, r13, 0a, 8h
ADDI64 r14, r14, 5d
ST r14, r13, 0a, 8h
CP r1, r14
LD r32, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 122
code size: 74
ret: 55
status: Ok(())

View file

@ -1,6 +1,5 @@
main:
ADDI64 r254, r254, -176d
ST r32, r254, 128a, 48h
ADDI64 r254, r254, -128d
LI8 r15, 69b
LI64 r16, 128d
CP r13, r0
@ -15,9 +14,8 @@ main:
ST r15, r13, 0a, 1h
CP r13, r14
JMP :2
1: LD r32, r254, 128a, 48h
ADDI64 r254, r254, 176d
1: ADDI64 r254, r254, 128d
JALA r0, r31, 0a
code size: 167
code size: 141
ret: 69
status: Ok(())

View file

@ -1,6 +1,6 @@
fib:
ADDI64 r254, r254, -40d
ST r31, r254, 0a, 40h
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
CP r32, r2
LI64 r33, 1d
LI64 r34, 2d
@ -17,19 +17,19 @@ fib:
CP r32, r1
ADD64 r32, r32, r33
CP r1, r32
1: LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
1: LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
ADDI64 r254, r254, -16d
ST r31, r254, 0a, 16h
LI64 r32, 10d
CP r2, r32
JAL r31, r0, :fib
CP r32, r1
CP r1, r32
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 229
ret: 55

View file

@ -1,13 +1,9 @@
main:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
CP r13, r0
0: ADDI64 r13, r13, 1d
JMP :0
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
timed out
code size: 86
code size: 38
ret: 0
status: Ok(())

View file

@ -1,6 +1,4 @@
main:
ADDI64 r254, r254, -16d
ST r32, r254, 0a, 16h
LI64 r13, 8d
CP r2, r13
ECA
@ -17,9 +15,7 @@ main:
0: LI64 r13, 1d
1: SUB64 r13, r13, r14
CP r1, r13
LD r32, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 179
code size: 131
ret: 0
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
ADDI64 r254, r254, -16d
ST r31, r254, 0a, 16h
JAL r31, r0, :scalar_values
CP r32, r1
JEQ r32, r0, :0
@ -15,8 +15,8 @@ main:
CP r1, r32
JMP :1
2: CP r1, r0
1: LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
1: LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
scalar_values:
CP r1, r0

View file

@ -1,11 +1,7 @@
main:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LI64 r13, 10d
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 80
code size: 32
ret: 10
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -130d
ST r31, r254, 58a, 72h
ADDI64 r254, r254, -122d
ST r31, r254, 58a, 64h
ADDI64 r32, r254, 33d
ADDI64 r33, r254, 34d
ADDI64 r34, r254, 1d
@ -22,12 +22,11 @@ main:
LD r5, r34, 0a, 16h
LD r7, r37, 0a, 1h
JAL r31, r0, :put_filled_rect
LD r31, r254, 58a, 72h
ADDI64 r254, r254, 130d
LD r31, r254, 58a, 64h
ADDI64 r254, r254, 122d
JALA r0, r31, 0a
put_filled_rect:
ADDI64 r254, r254, -236d
ST r32, r254, 108a, 128h
ADDI64 r254, r254, -108d
CP r14, r2
ST r3, r254, 92a, 16h
ADDI64 r3, r254, 92d
@ -98,9 +97,8 @@ put_filled_rect:
ADD64 r14, r27, r14
SUB64 r13, r13, r18
JMP :3
2: LD r32, r254, 108a, 128h
ADDI64 r254, r254, 236d
2: ADDI64 r254, r254, 108d
JALA r0, r31, 0a
code size: 901
code size: 875
ret: 0
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -56d
ST r31, r254, 16a, 40h
ADDI64 r254, r254, -48d
ST r31, r254, 16a, 32h
ADDI64 r32, r254, 0d
ADDI64 r33, r254, 8d
ST r0, r254, 0a, 8h
@ -13,17 +13,13 @@ main:
CP r32, r1
ANDI r32, r32, 4294967295d
CP r1, r32
LD r31, r254, 16a, 40h
ADDI64 r254, r254, 56d
LD r31, r254, 16a, 32h
ADDI64 r254, r254, 48d
JALA r0, r31, 0a
set:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
CP r13, r4
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 223
code size: 175
ret: 1024
status: Ok(())

View file

@ -1,6 +1,4 @@
integer_range:
ADDI64 r254, r254, -32d
ST r32, r254, 0a, 32h
CP r13, r2
CP r14, r3
LI64 r15, 4d
@ -14,19 +12,17 @@ integer_range:
DIRU64 r0, r14, r15, r14
ADD64 r13, r14, r13
CP r1, r13
LD r32, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
ADDI64 r254, r254, -16d
ST r31, r254, 0a, 16h
LI64 r32, 1000d
CP r2, r0
CP r3, r32
JAL r31, r0, :integer_range
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 212
code size: 164
ret: 42
status: Ok(())

View file

@ -1,6 +1,5 @@
main:
ADDI64 r254, r254, -16d
ST r32, r254, 8a, 8h
ADDI64 r254, r254, -8d
LI64 r13, 10d
ST r13, r254, 0a, 8h
2: LD r13, r254, 0a, 8h
@ -10,9 +9,8 @@ main:
0: ADDI64 r13, r13, -1d
ST r13, r254, 0a, 8h
JMP :2
1: LD r32, r254, 8a, 8h
ADDI64 r254, r254, 16d
1: ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 145
code size: 119
ret: 0
status: Ok(())

View file

@ -1,6 +1,4 @@
fib:
ADDI64 r254, r254, -40d
ST r32, r254, 0a, 40h
CP r13, r2
LI64 r17, 1d
CP r15, r0
@ -13,20 +11,18 @@ fib:
SUB64 r13, r13, r17
SWA r14, r16
JMP :2
1: LD r32, r254, 0a, 40h
ADDI64 r254, r254, 40d
JALA r0, r31, 0a
1: JALA r0, r31, 0a
main:
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
ADDI64 r254, r254, -16d
ST r31, r254, 0a, 16h
LI64 r32, 10d
CP r2, r32
JAL r31, r0, :fib
CP r32, r1
CP r1, r32
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 203
code size: 155
ret: 55
status: Ok(())

View file

@ -1,11 +1,7 @@
main:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LI64 r13, 1d
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 80
code size: 32
ret: 1
status: Ok(())

View file

@ -1,6 +1,5 @@
decide:
ADDI64 r254, r254, -40d
ST r32, r254, 24a, 16h
ADDI64 r254, r254, -24d
CP r14, r2
CP r15, r1
ADDI64 r13, r254, 0d
@ -8,12 +7,11 @@ decide:
ST r0, r254, 8a, 8h
ST r0, r254, 16a, 8h
BMC r13, r15, 24h
LD r32, r254, 24a, 16h
ADDI64 r254, r254, 40d
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -128d
ST r31, r254, 72a, 56h
ADDI64 r254, r254, -120d
ST r31, r254, 72a, 48h
ADDI64 r32, r254, 48d
CP r2, r0
CP r1, r32
@ -30,9 +28,9 @@ main:
LD r33, r254, 0a, 8h
ADD64 r32, r33, r32
CP r1, r32
LD r31, r254, 72a, 56h
ADDI64 r254, r254, 128d
LD r31, r254, 72a, 48h
ADDI64 r254, r254, 120d
JALA r0, r31, 0a
code size: 299
code size: 273
ret: 1
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
JAL r31, r0, :opaque
CP r33, r1
JAL r31, r0, :opaque
@ -12,8 +12,8 @@ main:
LD r32, r33, 0a, 8h
JMP :2
2: CP r1, r32
LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
opaque:
CP r1, r0

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -38d
ST r31, r254, 6a, 32h
ADDI64 r254, r254, -30d
ST r31, r254, 6a, 24h
ADDI64 r32, r254, 0d
2: JAL r31, r0, :return_fn
ST r1, r32, 0a, 6h
@ -11,12 +11,11 @@ main:
CP r1, r32
JMP :1
0: JMP :2
1: LD r31, r254, 6a, 32h
ADDI64 r254, r254, 38d
1: LD r31, r254, 6a, 24h
ADDI64 r254, r254, 30d
JALA r0, r31, 0a
return_fn:
ADDI64 r254, r254, -22d
ST r32, r254, 6a, 16h
ADDI64 r254, r254, -6d
LI8 r13, 1b
ADDI64 r14, r254, 0d
ST r13, r254, 0a, 1h
@ -26,9 +25,8 @@ return_fn:
ST r0, r254, 4a, 1h
ST r0, r254, 5a, 1h
LD r1, r14, 0a, 6h
LD r32, r254, 6a, 16h
ADDI64 r254, r254, 22d
ADDI64 r254, r254, 6d
JALA r0, r31, 0a
code size: 314
code size: 288
ret: 1
status: Ok(())

View file

@ -1,6 +1,6 @@
foo:
ADDI64 r254, r254, -120d
ST r31, r254, 80a, 40h
ADDI64 r254, r254, -112d
ST r31, r254, 80a, 32h
ADDI64 r32, r254, 64d
LRA r33, r0, :some_file
CP r3, r33
@ -34,12 +34,11 @@ foo:
3: ADDI64 r32, r254, 0d
ST r0, r254, 0a, 1h
LD r1, r32, 0a, 16h
1: LD r31, r254, 80a, 40h
ADDI64 r254, r254, 120d
1: LD r31, r254, 80a, 32h
ADDI64 r254, r254, 112d
JALA r0, r31, 0a
get:
ADDI64 r254, r254, -56d
ST r32, r254, 32a, 24h
ADDI64 r254, r254, -32d
CP r13, r3
LD r13, r13, 0a, 1h
LRA r14, r0, :MAGIC
@ -55,12 +54,11 @@ get:
0: ADDI64 r13, r254, 0d
ST r0, r254, 0a, 1h
LD r1, r13, 0a, 16h
1: LD r32, r254, 32a, 24h
ADDI64 r254, r254, 56d
1: ADDI64 r254, r254, 32d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -48d
ST r31, r254, 16a, 32h
ADDI64 r254, r254, -40d
ST r31, r254, 16a, 24h
ADDI64 r32, r254, 0d
JAL r31, r0, :foo
ST r1, r32, 0a, 16h
@ -72,9 +70,9 @@ main:
JMP :1
0: LD r32, r254, 8a, 8h
CP r1, r32
1: LD r31, r254, 16a, 32h
ADDI64 r254, r254, 48d
1: LD r31, r254, 16a, 24h
ADDI64 r254, r254, 40d
JALA r0, r31, 0a
code size: 765
code size: 739
ret: 0
status: Ok(())

View file

@ -2,8 +2,8 @@ get_ptr:
CP r1, r0
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -40d
ST r31, r254, 0a, 40h
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
JAL r31, r0, :get_ptr
CP r32, r1
JNE r32, r0, :0
@ -16,8 +16,8 @@ main:
ST r34, r32, 0a, 8h
JMP :3
2: CP r1, r34
1: LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
1: LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
code size: 164
ret: 0

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -74d
ST r31, r254, 26a, 48h
ADDI64 r254, r254, -66d
ST r31, r254, 26a, 40h
JAL r31, r0, :returner_fn
CP r32, r1
ADDI64 r33, r254, 2d
@ -25,12 +25,11 @@ main:
JMP :1
0: LI64 r32, 1d
CP r1, r32
1: LD r31, r254, 26a, 48h
ADDI64 r254, r254, 74d
1: LD r31, r254, 26a, 40h
ADDI64 r254, r254, 66d
JALA r0, r31, 0a
returner_bn:
ADDI64 r254, r254, -40d
ST r32, r254, 24a, 16h
ADDI64 r254, r254, -24d
CP r15, r1
LI8 r14, 1b
ADDI64 r13, r254, 0d
@ -38,29 +37,22 @@ returner_bn:
ST r0, r254, 8a, 8h
ST r0, r254, 16a, 8h
BMC r13, r15, 24h
LD r32, r254, 24a, 16h
ADDI64 r254, r254, 40d
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
returner_cn:
ADDI64 r254, r254, -18d
ST r32, r254, 2a, 16h
ADDI64 r254, r254, -2d
LI8 r13, 1b
ADDI64 r14, r254, 0d
ST r13, r254, 0a, 1h
ST r0, r254, 1a, 1h
LD r1, r14, 0a, 2h
LD r32, r254, 2a, 16h
ADDI64 r254, r254, 18d
ADDI64 r254, r254, 2d
JALA r0, r31, 0a
returner_fn:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LD r13, r254, 0a, 0h
ORI r13, r13, 128d
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 563
code size: 463
ret: 1
status: Ok(())

View file

@ -1,14 +1,10 @@
decide:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LI8 r13, 1b
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -136d
ST r31, r254, 80a, 56h
ADDI64 r254, r254, -128d
ST r31, r254, 80a, 48h
JAL r31, r0, :decide
CP r32, r1
CP r33, r0
@ -102,12 +98,11 @@ main:
ANDI r32, r32, 65535d
SUB64 r32, r32, r33
CP r1, r32
3: LD r31, r254, 80a, 56h
ADDI64 r254, r254, 136d
3: LD r31, r254, 80a, 48h
ADDI64 r254, r254, 128d
JALA r0, r31, 0a
new_bar:
ADDI64 r254, r254, -48d
ST r32, r254, 24a, 24h
ADDI64 r254, r254, -24d
CP r14, r2
CP r16, r1
LI8 r15, 1b
@ -117,28 +112,23 @@ new_bar:
LI64 r14, 1d
ST r14, r254, 16a, 8h
BMC r13, r16, 24h
LD r32, r254, 24a, 24h
ADDI64 r254, r254, 48d
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
new_foo:
ADDI64 r254, r254, -40d
ST r32, r254, 24a, 16h
ADDI64 r254, r254, -24d
ADDI64 r13, r254, 0d
ADDI64 r14, r254, 8d
ST r13, r254, 8a, 8h
ST r0, r254, 16a, 8h
LD r1, r14, 0a, 16h
LD r32, r254, 24a, 16h
ADDI64 r254, r254, 40d
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
no_foo:
ADDI64 r254, r254, -24d
ST r32, r254, 16a, 8h
ADDI64 r254, r254, -16d
ADDI64 r13, r254, 0d
ST r0, r254, 0a, 8h
LD r1, r13, 0a, 16h
LD r32, r254, 16a, 8h
ADDI64 r254, r254, 24d
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
use_foo:
ADDI64 r254, r254, -16d
@ -146,6 +136,6 @@ use_foo:
ADDI64 r2, r254, 0d
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 1240
code size: 1114
ret: 0
status: Ok(())

View file

@ -1,14 +1,10 @@
inb:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
CP r13, r2
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
LI64 r32, 100d
4: CP r2, r32
JAL r31, r0, :inb
@ -28,11 +24,11 @@ main:
JMP :2
1: JMP :3
0: JMP :4
2: LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
2: LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
outb:
JALA r0, r31, 0a
code size: 251
code size: 203
ret: 1
status: Ok(())

View file

@ -1,6 +1,5 @@
main:
ADDI64 r254, r254, -32d
ST r32, r254, 16a, 16h
ADDI64 r254, r254, -16d
ADDI64 r13, r254, 0d
CP r3, r0
CP r4, r0
@ -14,10 +13,9 @@ main:
UN
0: LD r13, r254, 8a, 8h
CP r1, r13
LD r32, r254, 16a, 16h
ADDI64 r254, r254, 32d
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
unknown ecall: 0
code size: 150
code size: 124
ret: 0
status: Err(Unreachable)

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -72d
ST r31, r254, 24a, 48h
ADDI64 r254, r254, -64d
ST r31, r254, 24a, 40h
ADDI64 r32, r254, 0d
LI64 r33, 1d
ST r33, r254, 16a, 8h
@ -15,21 +15,19 @@ main:
LD r32, r254, 0a, 8h
SUB64 r32, r32, r34
CP r1, r32
LD r31, r254, 24a, 48h
ADDI64 r254, r254, 72d
LD r31, r254, 24a, 40h
ADDI64 r254, r254, 64d
JALA r0, r31, 0a
opaque:
ADDI64 r254, r254, -32d
ST r32, r254, 16a, 16h
ADDI64 r254, r254, -16d
LI64 r13, 3d
ADDI64 r14, r254, 0d
ST r13, r254, 0a, 8h
LI64 r13, 2d
ST r13, r254, 8a, 8h
LD r1, r14, 0a, 16h
LD r32, r254, 16a, 16h
ADDI64 r254, r254, 32d
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 336
code size: 310
ret: 0
status: Ok(())

View file

@ -1,15 +1,11 @@
clobber:
ADDI64 r254, r254, -16d
ST r32, r254, 0a, 16h
CP r13, r2
LI64 r14, 4d
ST r14, r13, 0a, 8h
LD r32, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -40d
ST r31, r254, 8a, 32h
ADDI64 r254, r254, -32d
ST r31, r254, 8a, 24h
ADDI64 r32, r254, 0d
LI64 r33, 2d
ST r33, r254, 0a, 8h
@ -19,9 +15,9 @@ main:
LI64 r33, 4d
SUB64 r32, r33, r32
CP r1, r32
LD r31, r254, 8a, 32h
ADDI64 r254, r254, 40d
LD r31, r254, 8a, 24h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
code size: 226
code size: 178
ret: 0
status: Ok(())

View file

@ -1,8 +1,8 @@
drop:
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -40d
ST r31, r254, 8a, 32h
ADDI64 r254, r254, -32d
ST r31, r254, 8a, 24h
ADDI64 r32, r254, 0d
LI64 r33, 1d
ST r33, r254, 0a, 8h
@ -13,18 +13,14 @@ main:
LD r32, r254, 0a, 8h
ADDI64 r32, r32, -2d
CP r1, r32
LD r31, r254, 8a, 32h
ADDI64 r254, r254, 40d
LD r31, r254, 8a, 24h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
modify:
ADDI64 r254, r254, -16d
ST r32, r254, 0a, 16h
CP r13, r2
LI64 r14, 2d
ST r14, r13, 0a, 8h
LD r32, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 244
code size: 196
ret: 0
status: Ok(())

View file

@ -1,6 +1,6 @@
create_back_buffer:
ADDI64 r254, r254, -48d
ST r31, r254, 0a, 48h
ADDI64 r254, r254, -40d
ST r31, r254, 0a, 40h
CP r32, r2
LI64 r33, 255d
JGTS r32, r33, :0
@ -25,21 +25,19 @@ create_back_buffer:
JAL r31, r0, :request_page
4: SUB64 r32, r32, r33
JMP :5
1: LD r31, r254, 0a, 48h
ADDI64 r254, r254, 48d
1: LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
ADDI64 r254, r254, -16d
ST r31, r254, 0a, 16h
LI64 r32, 400d
CP r2, r32
JAL r31, r0, :create_back_buffer
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
request_page:
ADDI64 r254, r254, -32d
ST r32, r254, 0a, 32h
CP r13, r2
LRA r14, r0, :"\0\u{1}xxxxxxxx\0"
ST r13, r14, 1a, 1h
@ -53,9 +51,7 @@ request_page:
ECA
CP r13, r1
CP r1, r13
LD r32, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
code size: 399
code size: 351
ret: 42
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -60d
ST r31, r254, 4a, 56h
ADDI64 r254, r254, -52d
ST r31, r254, 4a, 48h
ADDI64 r32, r254, 0d
JAL r31, r0, :random_color
ST r1, r32, 0a, 4h
@ -16,17 +16,13 @@ main:
ADD64 r33, r34, r33
ADD64 r32, r33, r32
CP r1, r32
LD r31, r254, 4a, 56h
ADDI64 r254, r254, 60d
LD r31, r254, 4a, 48h
ADDI64 r254, r254, 52d
JALA r0, r31, 0a
random_color:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LRA r13, r0, :white
LD r1, r13, 0a, 4h
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 292
code size: 244
ret: 1020
status: Ok(())

View file

@ -1,6 +1,5 @@
get_format:
ADDI64 r254, r254, -40d
ST r32, r254, 16a, 24h
ADDI64 r254, r254, -16d
LI8 r13, 1b
ADDI64 r14, r254, 0d
LRA r15, r0, :BMP
@ -8,12 +7,11 @@ get_format:
LD r13, r15, 0a, 8h
ST r13, r254, 8a, 8h
LD r1, r14, 0a, 16h
LD r32, r254, 16a, 24h
ADDI64 r254, r254, 40d
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -48d
ST r31, r254, 16a, 32h
ADDI64 r254, r254, -40d
ST r31, r254, 16a, 24h
ADDI64 r32, r254, 0d
JAL r31, r0, :get_format
ST r1, r32, 0a, 16h
@ -25,9 +23,9 @@ main:
JMP :1
0: LD r32, r254, 8a, 8h
CP r1, r32
1: LD r31, r254, 16a, 32h
ADDI64 r254, r254, 48d
1: LD r31, r254, 16a, 24h
ADDI64 r254, r254, 40d
JALA r0, r31, 0a
code size: 301
code size: 275
ret: 0
status: Ok(())

View file

@ -1,6 +1,6 @@
constructor:
ADDI64 r254, r254, -48d
ST r31, r254, 16a, 32h
ADDI64 r254, r254, -40d
ST r31, r254, 16a, 24h
CP r32, r3
CP r2, r32
JAL r31, r0, :opaque
@ -9,31 +9,27 @@ constructor:
ST r32, r254, 0a, 8h
ST r32, r254, 8a, 8h
LD r1, r33, 0a, 16h
LD r31, r254, 16a, 32h
ADDI64 r254, r254, 48d
LD r31, r254, 16a, 24h
ADDI64 r254, r254, 40d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -40d
ST r31, r254, 16a, 24h
ADDI64 r254, r254, -32d
ST r31, r254, 16a, 16h
ADDI64 r32, r254, 0d
CP r3, r0
JAL r31, r0, :constructor
ST r1, r32, 0a, 16h
LD r31, r254, 16a, 24h
ADDI64 r254, r254, 40d
LD r31, r254, 16a, 16h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
opaque:
ADDI64 r254, r254, -16d
ST r32, r254, 0a, 16h
CP r13, r2
LRA r14, r0, :file
ADD64 r13, r14, r13
LD r13, r13, 0a, 1h
ANDI r13, r13, 255d
CP r1, r13
LD r32, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
code size: 327
code size: 279
ret: 255
status: Ok(())

View file

@ -1,11 +1,7 @@
main:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LI64 r13, 1d
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 80
code size: 32
ret: 1
status: Ok(())

View file

@ -1,15 +1,13 @@
main:
ADDI64 r254, r254, -20d
ST r32, r254, 4a, 16h
ADDI64 r254, r254, -4d
LRA r13, r0, :white
ADDI64 r14, r254, 0d
BMC r13, r14, 4h
LD r13, r254, 3a, 1h
ANDI r13, r13, 255d
CP r1, r13
LD r32, r254, 4a, 16h
ADDI64 r254, r254, 20d
ADDI64 r254, r254, 4d
JALA r0, r31, 0a
code size: 121
code size: 95
ret: 255
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -36d
ST r31, r254, 4a, 32h
ADDI64 r254, r254, -28d
ST r31, r254, 4a, 24h
LRA r32, r0, :white
ADDI64 r33, r254, 0d
LD r32, r32, 0a, 4h
@ -10,12 +10,12 @@ main:
LD r32, r254, 0a, 1h
ANDI r32, r32, 255d
CP r1, r32
LD r31, r254, 4a, 32h
ADDI64 r254, r254, 36d
LD r31, r254, 4a, 24h
ADDI64 r254, r254, 28d
JALA r0, r31, 0a
u32_to_color:
ADDI64 r254, r254, -36d
ST r31, r254, 4a, 32h
ADDI64 r254, r254, -28d
ST r31, r254, 4a, 24h
CP r32, r2
CP r2, r32
JAL r31, r0, :u32_to_u32
@ -23,17 +23,13 @@ u32_to_color:
ADDI64 r33, r254, 0d
ST r32, r254, 0a, 4h
LD r1, r33, 0a, 4h
LD r31, r254, 4a, 32h
ADDI64 r254, r254, 36d
LD r31, r254, 4a, 24h
ADDI64 r254, r254, 28d
JALA r0, r31, 0a
u32_to_u32:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
CP r13, r2
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 329
code size: 281
ret: 255
status: Ok(())

View file

@ -1,9 +1,9 @@
main:
ADDI64 r254, r254, -16d
ST r31, r254, 0a, 16h
ADDI64 r254, r254, -8d
ST r31, r254, 0a, 8h
JAL r31, r0, :some_func
LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d
LD r31, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
some_func:
JALA r0, r31, 0a

View file

@ -1,17 +1,15 @@
main:
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
ADDI64 r254, r254, -16d
ST r31, r254, 0a, 16h
LI64 r32, 100d
CP r2, r32
JAL r31, r0, :sqrt
CP r32, r1
CP r1, r32
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
sqrt:
ADDI64 r254, r254, -48d
ST r32, r254, 0a, 48h
CP r13, r2
LI64 r16, 15d
LI64 r15, 32768d
@ -30,9 +28,7 @@ sqrt:
JMP :2
2: SRUI64 r15, r15, 1b
JMP :3
1: LD r32, r254, 0a, 48h
ADDI64 r254, r254, 48d
JALA r0, r31, 0a
code size: 244
1: JALA r0, r31, 0a
code size: 196
ret: 14
status: Ok(())

View file

@ -1,16 +1,12 @@
do_stuff:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
CP r13, r2
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
just_read:
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -88d
ST r31, r254, 48a, 40h
ADDI64 r254, r254, -80d
ST r31, r254, 48a, 32h
ADDI64 r32, r254, 16d
CP r1, r32
JAL r31, r0, :optionala
@ -41,24 +37,21 @@ main:
CP r33, r1
ADD64 r32, r33, r32
CP r1, r32
1: LD r31, r254, 48a, 40h
ADDI64 r254, r254, 88d
1: LD r31, r254, 48a, 32h
ADDI64 r254, r254, 80d
JALA r0, r31, 0a
optional:
ADDI64 r254, r254, -32d
ST r32, r254, 16a, 16h
ADDI64 r254, r254, -16d
LI8 r13, 1b
ADDI64 r14, r254, 0d
ST r13, r254, 0a, 1h
LI64 r13, 10d
ST r13, r254, 8a, 8h
LD r1, r14, 0a, 16h
LD r32, r254, 16a, 16h
ADDI64 r254, r254, 32d
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
optionala:
ADDI64 r254, r254, -80d
ST r32, r254, 48a, 32h
ADDI64 r254, r254, -48d
CP r17, r1
ADDI64 r14, r254, 8d
ADDI64 r15, r254, 16d
@ -71,9 +64,8 @@ optionala:
ST r0, r254, 8a, 8h
ST r0, r254, 40a, 8h
BMC r15, r17, 32h
LD r32, r254, 48a, 32h
ADDI64 r254, r254, 80d
ADDI64 r254, r254, 48d
JALA r0, r31, 0a
code size: 667
code size: 567
ret: 100
status: Ok(())

View file

@ -1,6 +1,5 @@
main:
ADDI64 r254, r254, -128d
ST r32, r254, 40a, 88h
ADDI64 r254, r254, -40d
LI64 r17, 1d
LI64 r16, 4d
CP r14, r0
@ -40,9 +39,8 @@ main:
ST r13, r19, 0a, 8h
CP r13, r15
JMP :6
2: LD r32, r254, 40a, 88h
ADDI64 r254, r254, 128d
2: ADDI64 r254, r254, 40d
JALA r0, r31, 0a
code size: 296
code size: 270
ret: 0
status: Ok(())

View file

@ -1,15 +1,13 @@
main:
ADDI64 r254, r254, -20d
ST r32, r254, 4a, 16h
ADDI64 r254, r254, -4d
LRA r13, r0, :MAGENTA
ADDI64 r14, r254, 0d
BMC r13, r14, 4h
LD r13, r254, 2a, 1h
ANDI r13, r13, 255d
CP r1, r13
LD r32, r254, 4a, 16h
ADDI64 r254, r254, 20d
ADDI64 r254, r254, 4d
JALA r0, r31, 0a
code size: 121
code size: 95
ret: 205
status: Ok(())

View file

@ -1,11 +1,7 @@
main:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LI64 r13, 10d
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 80
code size: 32
ret: 10
status: Ok(())

View file

@ -1,6 +1,6 @@
fib:
ADDI64 r254, r254, -40d
ST r31, r254, 0a, 40h
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
CP r32, r2
LI64 r33, 2d
JLTU r32, r33, :0
@ -16,12 +16,10 @@ fib:
CP r1, r32
JMP :1
0: CP r1, r32
1: LD r31, r254, 0a, 40h
ADDI64 r254, r254, 40d
1: LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
JALA r0, r31, 0a
fib_iter:
ADDI64 r254, r254, -40d
ST r32, r254, 0a, 40h
CP r13, r2
LI64 r17, 1d
CP r15, r0
@ -34,12 +32,10 @@ fib_iter:
SUB64 r13, r13, r17
SWA r14, r16
JMP :2
1: LD r32, r254, 0a, 40h
ADDI64 r254, r254, 40d
JALA r0, r31, 0a
1: JALA r0, r31, 0a
main:
ADDI64 r254, r254, -32d
ST r31, r254, 0a, 32h
ADDI64 r254, r254, -24d
ST r31, r254, 0a, 24h
LI64 r32, 10d
CP r2, r32
JAL r31, r0, :fib
@ -49,9 +45,9 @@ main:
CP r32, r1
SUB64 r32, r33, r32
CP r1, r32
LD r31, r254, 0a, 32h
ADDI64 r254, r254, 32d
LD r31, r254, 0a, 24h
ADDI64 r254, r254, 24d
JALA r0, r31, 0a
code size: 353
code size: 305
ret: 0
status: Ok(())

View file

@ -1,6 +1,5 @@
foo:
ADDI64 r254, r254, -32d
ST r32, r254, 16a, 16h
ADDI64 r254, r254, -16d
LI64 r13, 3d
ADDI64 r14, r254, 0d
ST r13, r254, 0a, 8h
@ -8,12 +7,11 @@ foo:
ST r13, r254, 8a, 4h
ST r13, r254, 12a, 4h
LD r1, r14, 0a, 16h
LD r32, r254, 16a, 16h
ADDI64 r254, r254, 32d
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -96d
ST r31, r254, 48a, 48h
ADDI64 r254, r254, -88d
ST r31, r254, 48a, 40h
ADDI64 r32, r254, 32d
JAL r31, r0, :foo
ST r1, r32, 0a, 16h
@ -33,9 +31,9 @@ main:
LI64 r33, 7d
SUB64 r32, r33, r32
CP r1, r32
LD r31, r254, 48a, 48h
ADDI64 r254, r254, 96d
LD r31, r254, 48a, 40h
ADDI64 r254, r254, 88d
JALA r0, r31, 0a
code size: 384
code size: 358
ret: 0
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -72d
ST r31, r254, 32a, 40h
ADDI64 r254, r254, -64d
ST r31, r254, 32a, 32h
LI64 r32, 4d
ADDI64 r33, r254, 16d
ST r32, r254, 16a, 8h
@ -18,28 +18,22 @@ main:
CP r1, r32
JMP :1
0: CP r1, r0
1: LD r31, r254, 32a, 40h
ADDI64 r254, r254, 72d
1: LD r31, r254, 32a, 32h
ADDI64 r254, r254, 64d
JALA r0, r31, 0a
odher_pass:
ADDI64 r254, r254, -24d
ST r32, r254, 16a, 8h
ADDI64 r254, r254, -16d
ST r3, r254, 0a, 16h
ADDI64 r3, r254, 0d
CP r13, r3
LD r1, r13, 0a, 16h
LD r32, r254, 16a, 8h
ADDI64 r254, r254, 24d
ADDI64 r254, r254, 16d
JALA r0, r31, 0a
pass:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
CP r13, r2
LD r13, r13, 0a, 8h
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
code size: 387
code size: 313
ret: 4
status: Ok(())

View file

@ -1,6 +1,5 @@
main:
ADDI64 r254, r254, -10288d
ST r32, r254, 10240a, 48h
ADDI64 r254, r254, -10240d
LI64 r14, 1d
LI8 r16, 64b
LI64 r17, 1024d
@ -25,9 +24,8 @@ main:
ST r16, r13, 0a, 1h
CP r13, r15
JMP :4
2: LD r32, r254, 10240a, 48h
ADDI64 r254, r254, 10288d
2: ADDI64 r254, r254, 10240d
JALA r0, r31, 0a
code size: 220
code size: 194
ret: 64
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -72d
ST r31, r254, 0a, 72h
ADDI64 r254, r254, -64d
ST r31, r254, 0a, 64h
CP r34, r0
LI64 r37, 65536d
LI8 r35, 1b
@ -25,18 +25,14 @@ main:
6: JMP :7
4: ADDI64 r33, r33, 1d
JMP :8
1: LD r31, r254, 0a, 72h
ADDI64 r254, r254, 72d
1: LD r31, r254, 0a, 64h
ADDI64 r254, r254, 64d
JALA r0, r31, 0a
opaque:
ADDI64 r254, r254, -8d
ST r32, r254, 0a, 8h
LI64 r13, 2147483648d
CP r1, r13
LD r32, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
timed out
code size: 268
code size: 220
ret: 2147483648
status: Ok(())

View file

@ -1,6 +1,27 @@
main:
CP r1, r0
JALA r0, r31, 0a
code size: 22
ret: 0
LI64 r16, 4621819117588971520d
LI64 r17, 1d
LI64 r18, 3d
CP r14, r0
CP r15, r14
3: JNE r15, r18, :0
CP r1, r17
JMP :1
0: ITF64 r19, r15
CP r13, r14
5: JNE r13, r18, :2
ADD64 r15, r15, r17
JMP :3
2: ITF64 r20, r13
FMUL64 r20, r20, r19
FCMPLT64 r20, r20, r16
NOT r20, r20
ANDI r20, r20, 255d
JNE r20, r0, :4
ADD64 r13, r13, r17
JMP :5
4: CP r1, r14
1: JALA r0, r31, 0a
code size: 130
ret: 1
status: Ok(())

View file

@ -1,6 +1,6 @@
main:
ADDI64 r254, r254, -56d
ST r31, r254, 16a, 40h
ADDI64 r254, r254, -48d
ST r31, r254, 16a, 32h
ADDI64 r32, r254, 0d
CP r3, r0
CP r4, r0
@ -11,12 +11,12 @@ main:
SUB8 r32, r32, r34
ANDI r32, r32, 255d
CP r1, r32
LD r31, r254, 16a, 40h
ADDI64 r254, r254, 56d
LD r31, r254, 16a, 32h
ADDI64 r254, r254, 48d
JALA r0, r31, 0a
maina:
ADDI64 r254, r254, -68d
ST r31, r254, 20a, 48h
ADDI64 r254, r254, -60d
ST r31, r254, 20a, 40h
ADDI64 r32, r254, 16d
JAL r31, r0, :small_struct
ST r1, r32, 0a, 4h
@ -40,19 +40,17 @@ maina:
ST r0, r254, 14a, 1h
ST r0, r254, 15a, 1h
LD r1, r33, 0a, 16h
LD r31, r254, 20a, 48h
ADDI64 r254, r254, 68d
LD r31, r254, 20a, 40h
ADDI64 r254, r254, 60d
JALA r0, r31, 0a
small_struct:
ADDI64 r254, r254, -12d
ST r32, r254, 4a, 8h
ADDI64 r254, r254, -4d
ADDI64 r13, r254, 0d
ST r0, r254, 0a, 2h
ST r0, r254, 2a, 2h
LD r1, r13, 0a, 4h
LD r32, r254, 4a, 8h
ADDI64 r254, r254, 12d
ADDI64 r254, r254, 4d
JALA r0, r31, 0a
code size: 585
code size: 559
ret: 2
status: Ok(())

View file

@ -1,12 +1,12 @@
inl:
JALA r0, r31, 0a
main:
ADDI64 r254, r254, -16d
ST r31, r254, 0a, 16h
ADDI64 r254, r254, -8d
ST r31, r254, 0a, 8h
JAL r31, r0, :outl
JAL r31, r0, :inl
LD r31, r254, 0a, 16h
ADDI64 r254, r254, 16d
LD r31, r254, 0a, 8h
ADDI64 r254, r254, 8d
JALA r0, r31, 0a
outl:
JALA r0, r31, 0a

View file

@ -1,6 +1,5 @@
main:
ADDI64 r254, r254, -41d
ST r32, r254, 1a, 40h
ADDI64 r254, r254, -1d
LI64 r14, 255d
LI8 r13, 1b
ST r0, r254, 0a, 1h
@ -20,10 +19,9 @@ main:
1: ADD8 r15, r15, r13
ST r15, r254, 0a, 1h
JMP :2
LD r32, r254, 1a, 40h
ADDI64 r254, r254, 41d
ADDI64 r254, r254, 1d
JALA r0, r31, 0a
timed out
code size: 204
code size: 178
ret: 0
status: Ok(())