mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 06:58:50 +00:00
68 lines
1.1 KiB
Plaintext
68 lines
1.1 KiB
Plaintext
|
|
fun i32 @foo {
|
|
init:
|
|
bid: b0
|
|
allocations:
|
|
%l0:i32:i
|
|
%l1:i32:j
|
|
%l2:i32:k
|
|
|
|
block b0:
|
|
%b0:i0:unit = store %b0:p0:i32 %l0:*i32
|
|
%b0:i1:unit = store %b0:p1:i32 %l1:*i32
|
|
%b0:i2:unit = store %b0:p2:i32 %l2:*i32
|
|
%b0:i3:i32 = load %l0:*i32
|
|
%b0:i4:i32 = load %l1:*i32
|
|
%b0:i5:i32 = add %b0:i3:i32 %b0:i4:i32
|
|
%b0:i6:i32 = load %l2:*i32
|
|
%b0:i7:i32 = add %b0:i5:i32 %b0:i6:i32
|
|
ret %b0:i7:i32
|
|
|
|
block b1:
|
|
ret undef:i32
|
|
}
|
|
|
|
fun *i32 (i32, i32, i32) @foo2 {
|
|
init:
|
|
bid: b0
|
|
allocations:
|
|
|
|
|
|
block b0:
|
|
ret @foo:*i32 (i32, i32, i32)
|
|
|
|
block b1:
|
|
ret undef:*i32 (i32, i32, i32)
|
|
}
|
|
|
|
fun **i32 (i32, i32, i32) () @foo3 {
|
|
init:
|
|
bid: b0
|
|
allocations:
|
|
|
|
|
|
block b0:
|
|
ret @foo2:**i32 (i32, i32, i32) ()
|
|
|
|
block b1:
|
|
ret undef:**i32 (i32, i32, i32) ()
|
|
}
|
|
|
|
fun i32 @main {
|
|
init:
|
|
bid: b0
|
|
allocations:
|
|
|
|
|
|
block b0:
|
|
%b0:i0:**i32 (i32, i32, i32) () = call @foo3()
|
|
%b0:i1:*i32 (i32, i32, i32) = call %b0:i0()
|
|
%b0:i2:i32 = call %b0:i1(2:i32, 2:i32, 2:i32)
|
|
%b0:i3:u1 = cmp eq %b0:i2:i32 6:i32
|
|
%b0:i4:i32 = typecast %b0:i3:u1 to i32
|
|
ret %b0:i4:i32
|
|
|
|
block b1:
|
|
ret 0:i32
|
|
}
|