mirror of
https://github.com/kmc7468/cs420.git
synced 2025-12-15 23:18:48 +00:00
Bump
This commit is contained in:
39
examples/ir2/switch-in-loop.ir
Normal file
39
examples/ir2/switch-in-loop.ir
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
fun i32 @main () {
|
||||
init:
|
||||
bid: b0
|
||||
allocations:
|
||||
%l0:i32:i
|
||||
%l1:i32:c
|
||||
|
||||
block b0:
|
||||
%b0:i0:unit = nop
|
||||
%b0:i1:unit = nop
|
||||
j b1(0:i32, 0:i32)
|
||||
|
||||
block b1:
|
||||
%b1:p0:i32:i
|
||||
%b1:p1:i32:c
|
||||
%b1:i0:unit = nop
|
||||
%b1:i1:u1 = cmp lt %b1:p0:i32 10:i32
|
||||
br %b1:i1:u1, b2(), b3()
|
||||
|
||||
block b2:
|
||||
%b2:i0:unit = nop
|
||||
%b2:i1:i32 = add %b1:p0:i32 1:i32
|
||||
%b2:i2:unit = nop
|
||||
%b2:i3:unit = nop
|
||||
switch %b2:i1:i32 default b7() [
|
||||
1:i32 b1(%b2:i1:i32, %b1:p1:i32)
|
||||
]
|
||||
|
||||
block b3:
|
||||
%b3:i0:unit = nop
|
||||
ret %b1:p1:i32
|
||||
|
||||
block b7:
|
||||
%b7:i0:unit = nop
|
||||
%b7:i1:i32 = add %b1:p1:i32 1:i32
|
||||
%b7:i2:unit = nop
|
||||
j b1(%b2:i1:i32, %b7:i1:i32)
|
||||
}
|
||||
Reference in New Issue
Block a user