functions.uir 807 Bytes
Newer Older
Kunshan Wang's avatar
Kunshan Wang committed
1 2 3 4 5
.typedef @i8  = int<8>
.typedef @i16 = int<16>
.typedef @i32 = int<32>
.typedef @i64 = int<64>
.typedef @void = void
6

Kunshan Wang's avatar
Kunshan Wang committed
7 8
.typedef @ii8 = iref<@i8>
.typedef @iii8 = iref<@ii8>
9

Kunshan Wang's avatar
Kunshan Wang committed
10
.funcsig @foo = () -> ()
11

Kunshan Wang's avatar
Kunshan Wang committed
12
.funcsig @bar = (@i32 @i16) -> (@i64)
Kunshan Wang's avatar
Kunshan Wang committed
13

Kunshan Wang's avatar
Kunshan Wang committed
14
.funcsig @baz = (@i32 @iii8) -> (@i32)
Kunshan Wang's avatar
Kunshan Wang committed
15

Kunshan Wang's avatar
Kunshan Wang committed
16
.funcsig @sig_fs = (@i32) -> ()
17

Kunshan Wang's avatar
Kunshan Wang committed
18
.typedef @sig_t = funcref<@sig_fs>
19

Kunshan Wang's avatar
Kunshan Wang committed
20
.funcsig @signal_sig = (@i32 @sig_t) -> (@sig_t)
Kunshan Wang's avatar
Kunshan Wang committed
21
.funcdecl @signal <@signal_sig>
22

Kunshan Wang's avatar
Kunshan Wang committed
23
.const @zero <@i32> = 0
24

Kunshan Wang's avatar
Kunshan Wang committed
25 26 27
.funcsig @multi.sig = () -> (@i8 @i16 @i32)
.funcdecl @multi <@multi.sig>

Kunshan Wang's avatar
Kunshan Wang committed
28 29
.funcdef @main VERSION %v1 <@baz> {
    %entry(<@i32> %argc <@iii8> %argv):
Kunshan Wang's avatar
Kunshan Wang committed
30 31 32
        %sum = [%add] ADD <@i32> %argc @zero
        (%x %y %z) = [%call] CALL <@multi.sig> @multi ()
        [%ret] RET %sum
33 34
}

35 36 37
.const @zero64 <@i64> = 0

.expose @main_native = @main #DEFAULT @zero64