mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 15:08:52 +00:00
106 lines
2.7 KiB
Plaintext
106 lines
2.7 KiB
Plaintext
struct %t0 : { b:[4 x [5 x i32]] }
|
|
struct %t1 : { a:i8, %anon:struct %t0, c:f64 }
|
|
|
|
fun unit @init (i32, i32, [5 x i32]*) {
|
|
init:
|
|
bid: b0
|
|
allocations:
|
|
%l0:i32:row
|
|
%l1:i32:col
|
|
%l2:[5 x i32]*:arr
|
|
%l3:i32:i
|
|
%l4:i32:j
|
|
|
|
block b0:
|
|
%b0:p0:i32:row
|
|
%b0:p1:i32:col
|
|
%b0:p2:[5 x i32]*:arr
|
|
%b0:i0:unit = nop
|
|
%b0:i1:unit = nop
|
|
%b0:i2:unit = nop
|
|
%b0:i3:unit = nop
|
|
j b2(0:i32, undef:i32)
|
|
|
|
block b2:
|
|
%b2:p0:i32:i
|
|
%b2:p1:i32:j
|
|
%b2:i0:unit = nop
|
|
%b2:i1:unit = nop
|
|
%b2:i2:u1 = cmp lt %b2:p0:i32 %b0:p0:i32
|
|
br %b2:i2:u1, b3(), b5()
|
|
|
|
block b3:
|
|
%b3:i0:unit = nop
|
|
j b7(0:i32)
|
|
|
|
block b5:
|
|
ret unit:unit
|
|
|
|
block b7:
|
|
%b7:p0:i32:j
|
|
%b7:i0:unit = nop
|
|
%b7:i1:unit = nop
|
|
%b7:i2:u1 = cmp lt %b7:p0:i32 %b0:p1:i32
|
|
br %b7:i2:u1, b8(), b10()
|
|
|
|
block b8:
|
|
%b8:i0:unit = nop
|
|
%b8:i1:unit = nop
|
|
%b8:i2:i64 = typecast %b2:p0:i32 to i64
|
|
%b8:i3:i64 = mul %b8:i2:i64 20:i64
|
|
%b8:i4:[5 x i32]* = getelementptr %b0:p2:[5 x i32]* offset %b8:i3:i64
|
|
%b8:i5:i32* = getelementptr %b8:i4:[5 x i32]* offset 0:i32
|
|
%b8:i6:unit = nop
|
|
%b8:i7:i64 = typecast %b7:p0:i32 to i64
|
|
%b8:i8:i64 = mul %b8:i7:i64 4:i64
|
|
%b8:i9:i32* = getelementptr %b8:i5:i32* offset %b8:i8:i64
|
|
%b8:i10:unit = nop
|
|
%b8:i11:unit = nop
|
|
%b8:i12:i32 = mul %b2:p0:i32 %b7:p0:i32
|
|
%b8:i13:unit = store %b8:i12:i32 %b8:i9:i32*
|
|
%b8:i14:unit = nop
|
|
%b8:i15:i32 = add %b7:p0:i32 1:i32
|
|
%b8:i16:unit = nop
|
|
j b7(%b8:i15:i32)
|
|
|
|
block b10:
|
|
%b10:i0:unit = nop
|
|
%b10:i1:i32 = add %b2:p0:i32 1:i32
|
|
%b10:i2:unit = nop
|
|
j b2(%b10:i1:i32, %b7:p0:i32)
|
|
}
|
|
|
|
fun i32 @main () {
|
|
init:
|
|
bid: b0
|
|
allocations:
|
|
%l0:struct %t1:temp
|
|
%l1:i32:row
|
|
%l2:i32:col
|
|
%l3:struct %t1:temp2
|
|
|
|
block b0:
|
|
%b0:i0:unit = nop
|
|
%b0:i1:unit = nop
|
|
%b0:i2:unit = nop
|
|
%b0:i3:unit = nop
|
|
%b0:i4:[4 x [5 x i32]]* = getelementptr %l0:struct %t1* offset 4:i64
|
|
%b0:i5:[5 x i32]* = getelementptr %b0:i4:[4 x [5 x i32]]* offset 0:i32
|
|
%b0:i6:unit = call @init:[ret:unit params:(i32, i32, [5 x i32]*)]*(4:i32, 5:i32, %b0:i5:[5 x i32]*)
|
|
%b0:i7:struct %t1 = load %l0:struct %t1*
|
|
%b0:i8:unit = store %b0:i7:struct %t1 %l3:struct %t1*
|
|
%b0:i9:[4 x [5 x i32]]* = getelementptr %l3:struct %t1* offset 4:i64
|
|
%b0:i10:[5 x i32]* = getelementptr %b0:i9:[4 x [5 x i32]]* offset 0:i32
|
|
%b0:i11:i64 = typecast 2:i32 to i64
|
|
%b0:i12:i64 = mul %b0:i11:i64 20:i64
|
|
%b0:i13:[5 x i32]* = getelementptr %b0:i10:[5 x i32]* offset %b0:i12:i64
|
|
%b0:i14:i32* = getelementptr %b0:i13:[5 x i32]* offset 0:i32
|
|
%b0:i15:i64 = typecast 3:i32 to i64
|
|
%b0:i16:i64 = mul %b0:i15:i64 4:i64
|
|
%b0:i17:i32* = getelementptr %b0:i14:i32* offset %b0:i16:i64
|
|
%b0:i18:i32 = load %b0:i17:i32*
|
|
%b0:i19:u1 = cmp eq %b0:i18:i32 6:i32
|
|
%b0:i20:i32 = typecast %b0:i19:u1 to i32
|
|
ret %b0:i20:i32
|
|
}
|