forked from NUDT-compiler/nudt-compiler-cpp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
922 B
44 lines
922 B
declare i32 @getint()
|
|
declare i32 @getch()
|
|
declare void @putint(i32)
|
|
declare void @putch(i32)
|
|
declare i32 @getarray(i32*)
|
|
declare void @putarray(i32, i32*)
|
|
declare void @starttime()
|
|
declare void @stoptime()
|
|
define i32 @main() {
|
|
entry:
|
|
%t1 = alloca i32
|
|
%t2 = alloca i32
|
|
%t3 = alloca i32
|
|
br label %bbt0
|
|
bbt0:
|
|
store i32 0, i32* %t2
|
|
store i32 0, i32* %t2
|
|
store i32 0, i32* %t3
|
|
store i32 0, i32* %t3
|
|
br label %bbt4
|
|
bbt4:
|
|
%t7 = load i32, i32* %t2
|
|
%t8 = icmp slt i32 %t7, 100
|
|
br i1 %t8, label %bbt5, label %bbt6
|
|
bbt5:
|
|
%t11 = load i32, i32* %t2
|
|
%t12 = icmp eq i32 %t11, 50
|
|
br i1 %t12, label %bbt9, label %bbt10
|
|
bbt6:
|
|
%t18 = load i32, i32* %t3
|
|
ret i32 %t18
|
|
bbt9:
|
|
br label %bbt6
|
|
bbt10:
|
|
%t13 = load i32, i32* %t3
|
|
%t14 = load i32, i32* %t2
|
|
%t15 = add i32 %t13, %t14
|
|
store i32 %t15, i32* %t3
|
|
%t16 = load i32, i32* %t2
|
|
%t17 = add i32 %t16, 1
|
|
store i32 %t17, i32* %t2
|
|
br label %bbt4
|
|
}
|