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.
74 lines
1.8 KiB
74 lines
1.8 KiB
@k = global i32 0
|
|
|
|
declare i32 @getint()
|
|
declare float @getfloat()
|
|
declare i32 @getarray(i32* %arg.a)
|
|
declare i32 @getfarray(float* %arg.a)
|
|
declare i32 @getch()
|
|
declare void @putint(i32 %arg.x)
|
|
declare void @putfloat(float %arg.x)
|
|
declare void @putarray(i32 %arg.n, i32* %arg.a)
|
|
declare void @putfarray(i32 %arg.n, float* %arg.a)
|
|
declare void @putch(i32 %arg.x)
|
|
declare void @starttime()
|
|
declare void @stoptime()
|
|
define i32 @main() {
|
|
entry:
|
|
%t6 = alloca i32
|
|
%t17 = alloca i32
|
|
%t18 = alloca i32
|
|
%t22 = alloca i32
|
|
store i32 3389, i32* @k
|
|
%t0 = load i32, i32* @k
|
|
%t1 = icmp slt i32 %t0, 10000
|
|
%t2 = zext i1 %t1 to i32
|
|
%t3 = icmp ne i32 %t2, 0
|
|
br i1 %t3, label %if.then.1, label %if.end.2
|
|
if.then.1:
|
|
%t4 = load i32, i32* @k
|
|
%t5 = add i32 %t4, 1
|
|
store i32 %t5, i32* @k
|
|
store i32 112, i32* %t6
|
|
br label %while.cond.3
|
|
if.end.2:
|
|
%t30 = load i32, i32* @k
|
|
ret i32 %t30
|
|
while.cond.3:
|
|
%t7 = load i32, i32* %t6
|
|
%t8 = icmp sgt i32 %t7, 10
|
|
%t9 = zext i1 %t8 to i32
|
|
%t10 = icmp ne i32 %t9, 0
|
|
br i1 %t10, label %while.body.4, label %while.end.5
|
|
while.body.4:
|
|
%t11 = load i32, i32* %t6
|
|
%t12 = sub i32 %t11, 88
|
|
store i32 %t12, i32* %t6
|
|
%t13 = load i32, i32* %t6
|
|
%t14 = icmp slt i32 %t13, 1000
|
|
%t15 = zext i1 %t14 to i32
|
|
%t16 = icmp ne i32 %t15, 0
|
|
br i1 %t16, label %if.then.6, label %if.end.7
|
|
while.end.5:
|
|
%t28 = load i32, i32* %t6
|
|
call void @putint(i32 %t28)
|
|
br label %if.end.2
|
|
if.then.6:
|
|
store i32 9, i32* %t17
|
|
store i32 11, i32* %t18
|
|
store i32 10, i32* %t17
|
|
%t19 = load i32, i32* %t6
|
|
%t20 = load i32, i32* %t17
|
|
%t21 = sub i32 %t19, %t20
|
|
store i32 %t21, i32* %t6
|
|
store i32 11, i32* %t22
|
|
%t23 = load i32, i32* %t6
|
|
%t24 = load i32, i32* %t22
|
|
%t25 = add i32 %t23, %t24
|
|
%t26 = load i32, i32* %t18
|
|
%t27 = add i32 %t25, %t26
|
|
store i32 %t27, i32* %t6
|
|
br label %if.end.7
|
|
if.end.7:
|
|
br label %while.cond.3
|
|
}
|