mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 23:18:48 +00:00
Add tests
This commit is contained in:
101
examples/ir2/temp2.ir
Normal file
101
examples/ir2/temp2.ir
Normal file
@@ -0,0 +1,101 @@
|
||||
struct color : { i32, i8 }
|
||||
|
||||
fun i32 @main () {
|
||||
init:
|
||||
bid: b0
|
||||
allocations:
|
||||
%l0:i32:temp
|
||||
%l1: struct color:c
|
||||
%l2:* struct color:cp
|
||||
%l3:i32:i
|
||||
%l4:i32:j
|
||||
%l5:u1:t0
|
||||
|
||||
block b0:
|
||||
%b0:i0:unit = nop
|
||||
%b0:i1:unit = nop
|
||||
%b0:i2:u64 = typecast 0:i32 to u64
|
||||
%b0:i3:u64 = add %b0:i2:u64 1:u64
|
||||
%b0:i4:i32 = typecast %b0:i3:u64 to i32
|
||||
%b0:i5:unit = nop
|
||||
%b0:i6:unit = nop
|
||||
%b0:i7:u64 = typecast %b0:i4:i32 to u64
|
||||
%b0:i8:u64 = add %b0:i7:u64 1:u64
|
||||
%b0:i9:i32 = typecast %b0:i8:u64 to i32
|
||||
%b0:i10:unit = nop
|
||||
%b0:i11:*i32 = getelementptr %l1:* struct color offset 0:i64
|
||||
%b0:i12:unit = store 1:i32 %b0:i11:*i32
|
||||
%b0:i13:*i8 = getelementptr %l1:* struct color offset 4:i64
|
||||
%b0:i14:i8 = typecast 2:i32 to i8
|
||||
%b0:i15:unit = store %b0:i14:i8 %b0:i13:*i8
|
||||
%b0:i16:unit = nop
|
||||
%b0:i17:*i8 = getelementptr %l1:* struct color offset 4:i64
|
||||
%b0:i18:i8 = load %b0:i17:*i8
|
||||
%b0:i19:i32 = typecast %b0:i18:i8 to i32
|
||||
%b0:i20:i32 = add %b0:i9:i32 %b0:i19:i32
|
||||
%b0:i21:unit = nop
|
||||
%b0:i22: struct color = load %l1:* struct color
|
||||
%b0:i23:unit = nop
|
||||
%b0:i24:unit = nop
|
||||
%b0:i25:unit = nop
|
||||
%b0:i26:*i8 = getelementptr %l1:* struct color offset 4:i64
|
||||
%b0:i27:i8 = load %b0:i26:*i8
|
||||
%b0:i28:i32 = typecast %b0:i27:i8 to i32
|
||||
%b0:i29:i32 = add %b0:i20:i32 %b0:i28:i32
|
||||
%b0:i30:unit = nop
|
||||
%b0:i31:unit = nop
|
||||
%b0:i32:unit = nop
|
||||
j b2(%b0:i29:i32, 0:i32)
|
||||
|
||||
block b2:
|
||||
%b2:p0:i32:temp
|
||||
%b2:p1:i32:i
|
||||
%b2:i0:unit = nop
|
||||
%b2:i1:u1 = cmp lt %b2:p1:i32 10:i32
|
||||
br %b2:i1:u1, b3(), b5()
|
||||
|
||||
block b3:
|
||||
%b3:i0:unit = nop
|
||||
%b3:i1:u1 = cmp eq %b2:p1:i32 2:i32
|
||||
br %b3:i1:u1, b9(), b10()
|
||||
|
||||
block b5:
|
||||
%b5:i0:unit = nop
|
||||
switch %b2:p0:i32 default b13(%b2:p0:i32) [
|
||||
1:i32 b14()
|
||||
]
|
||||
|
||||
block b7:
|
||||
%b7:i0:unit = nop
|
||||
%b7:i1:unit = nop
|
||||
%b7:i2:i32 = add %b2:p0:i32 %b2:p1:i32
|
||||
%b7:i3:unit = nop
|
||||
%b7:i4:unit = nop
|
||||
%b7:i5:i32 = add %b2:p1:i32 1:i32
|
||||
%b7:i6:unit = nop
|
||||
j b2(%b7:i2:i32, %b7:i5:i32)
|
||||
|
||||
block b9:
|
||||
%b9:i0:unit = nop
|
||||
%b9:i1:u1 = cmp eq 0:i32 0:i32
|
||||
%b9:i2:unit = nop
|
||||
j b11(%b9:i1:u1)
|
||||
|
||||
block b10:
|
||||
%b10:i0:unit = nop
|
||||
j b11(0:u1)
|
||||
|
||||
block b11:
|
||||
%b11:p0:u1:t0
|
||||
%b11:i0:unit = nop
|
||||
br %b11:p0:u1, b5(), b7()
|
||||
|
||||
block b13:
|
||||
%b13:p0:i32:temp
|
||||
%b13:i0:unit = nop
|
||||
ret %b13:p0:i32
|
||||
|
||||
block b14:
|
||||
%b14:i0:unit = nop
|
||||
j b13(0:i32)
|
||||
}
|
||||
Reference in New Issue
Block a user