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.
207 lines
7.0 KiB
207 lines
7.0 KiB
@b = global i32 5
|
|
@c = global [4 x i32] [i32 6, i32 7, i32 8, i32 9]
|
|
|
|
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:
|
|
%t0 = alloca i32
|
|
%t1 = alloca i32
|
|
%t13 = alloca i32
|
|
%t22 = alloca i32, i32 16
|
|
%t39 = alloca i32
|
|
%t43 = alloca i32, i32 35
|
|
store i32 0, i32* %t0
|
|
store i32 1, i32* %t0
|
|
store i32 0, i32* %t1
|
|
store i32 2, i32* %t1
|
|
store i32 3, i32* %t1
|
|
%t2 = load i32, i32* %t1
|
|
call void @putint(i32 %t2)
|
|
%t4 = load i32, i32* %t1
|
|
call void @putint(i32 %t4)
|
|
%t6 = load i32, i32* %t0
|
|
call void @putint(i32 %t6)
|
|
call void @putch(i32 10)
|
|
br label %while.cond.1
|
|
while.cond.1:
|
|
%t9 = load i32, i32* %t0
|
|
%t10 = icmp slt i32 %t9, 5
|
|
%t11 = zext i1 %t10 to i32
|
|
%t12 = icmp ne i32 %t11, 0
|
|
br i1 %t12, label %while.body.2, label %while.end.3
|
|
while.body.2:
|
|
store i32 0, i32* %t13
|
|
%t14 = load i32, i32* %t13
|
|
%t15 = add i32 %t14, 1
|
|
store i32 %t15, i32* %t13
|
|
%t16 = load i32, i32* %t13
|
|
%t17 = icmp ne i32 %t16, 0
|
|
br i1 %t17, label %if.then.4, label %if.end.5
|
|
while.end.3:
|
|
%t18 = load i32, i32* %t0
|
|
call void @putint(i32 %t18)
|
|
call void @putch(i32 10)
|
|
%t21 = getelementptr inbounds [4 x i32], [4 x i32]* @c, i32 0, i32 2
|
|
store i32 1, i32* %t21
|
|
%t23 = getelementptr inbounds i32, i32* %t22, i32 0
|
|
store i32 0, i32* %t23
|
|
%t24 = getelementptr inbounds i32, i32* %t22, i32 1
|
|
store i32 9, i32* %t24
|
|
%t25 = getelementptr inbounds i32, i32* %t22, i32 2
|
|
store i32 0, i32* %t25
|
|
%t26 = getelementptr inbounds i32, i32* %t22, i32 3
|
|
store i32 0, i32* %t26
|
|
%t27 = getelementptr inbounds i32, i32* %t22, i32 4
|
|
store i32 0, i32* %t27
|
|
%t28 = getelementptr inbounds i32, i32* %t22, i32 5
|
|
store i32 0, i32* %t28
|
|
%t29 = getelementptr inbounds i32, i32* %t22, i32 6
|
|
store i32 0, i32* %t29
|
|
%t30 = getelementptr inbounds i32, i32* %t22, i32 7
|
|
store i32 0, i32* %t30
|
|
%t31 = getelementptr inbounds i32, i32* %t22, i32 8
|
|
store i32 8, i32* %t31
|
|
%t32 = getelementptr inbounds i32, i32* %t22, i32 9
|
|
store i32 3, i32* %t32
|
|
%t33 = getelementptr inbounds i32, i32* %t22, i32 10
|
|
store i32 0, i32* %t33
|
|
%t34 = getelementptr inbounds i32, i32* %t22, i32 11
|
|
store i32 0, i32* %t34
|
|
%t35 = getelementptr inbounds i32, i32* %t22, i32 12
|
|
store i32 0, i32* %t35
|
|
%t36 = getelementptr inbounds i32, i32* %t22, i32 13
|
|
store i32 0, i32* %t36
|
|
%t37 = getelementptr inbounds i32, i32* %t22, i32 14
|
|
store i32 0, i32* %t37
|
|
%t38 = getelementptr inbounds i32, i32* %t22, i32 15
|
|
store i32 0, i32* %t38
|
|
store i32 2, i32* %t39
|
|
%t40 = getelementptr inbounds [4 x i32], [4 x i32]* @c, i32 0, i32 2
|
|
%t41 = load i32, i32* %t40
|
|
%t42 = icmp ne i32 %t41, 0
|
|
br i1 %t42, label %if.then.6, label %if.end.7
|
|
if.then.4:
|
|
br label %while.end.3
|
|
if.end.5:
|
|
br label %while.cond.1
|
|
if.then.6:
|
|
%t44 = getelementptr inbounds i32, i32* %t43, i32 0
|
|
store i32 0, i32* %t44
|
|
%t45 = getelementptr inbounds i32, i32* %t43, i32 1
|
|
store i32 0, i32* %t45
|
|
%t46 = getelementptr inbounds i32, i32* %t43, i32 2
|
|
store i32 0, i32* %t46
|
|
%t47 = getelementptr inbounds i32, i32* %t43, i32 3
|
|
store i32 0, i32* %t47
|
|
%t48 = getelementptr inbounds i32, i32* %t43, i32 4
|
|
store i32 0, i32* %t48
|
|
%t49 = getelementptr inbounds i32, i32* %t43, i32 5
|
|
store i32 0, i32* %t49
|
|
%t50 = getelementptr inbounds i32, i32* %t43, i32 6
|
|
store i32 0, i32* %t50
|
|
%t51 = getelementptr inbounds i32, i32* %t43, i32 7
|
|
store i32 0, i32* %t51
|
|
%t52 = getelementptr inbounds i32, i32* %t43, i32 8
|
|
store i32 0, i32* %t52
|
|
%t53 = getelementptr inbounds i32, i32* %t43, i32 9
|
|
store i32 0, i32* %t53
|
|
%t54 = getelementptr inbounds i32, i32* %t43, i32 10
|
|
store i32 2, i32* %t54
|
|
%t55 = getelementptr inbounds i32, i32* %t43, i32 11
|
|
store i32 1, i32* %t55
|
|
%t56 = getelementptr inbounds i32, i32* %t43, i32 12
|
|
store i32 8, i32* %t56
|
|
%t57 = getelementptr inbounds i32, i32* %t43, i32 13
|
|
store i32 0, i32* %t57
|
|
%t58 = getelementptr inbounds i32, i32* %t43, i32 14
|
|
store i32 0, i32* %t58
|
|
%t59 = getelementptr inbounds i32, i32* %t43, i32 15
|
|
store i32 0, i32* %t59
|
|
%t60 = getelementptr inbounds i32, i32* %t43, i32 16
|
|
store i32 0, i32* %t60
|
|
%t61 = getelementptr inbounds i32, i32* %t43, i32 17
|
|
store i32 0, i32* %t61
|
|
%t62 = getelementptr inbounds i32, i32* %t43, i32 18
|
|
store i32 0, i32* %t62
|
|
%t63 = getelementptr inbounds i32, i32* %t43, i32 19
|
|
store i32 0, i32* %t63
|
|
%t64 = getelementptr inbounds i32, i32* %t43, i32 20
|
|
store i32 0, i32* %t64
|
|
%t65 = getelementptr inbounds i32, i32* %t43, i32 21
|
|
store i32 0, i32* %t65
|
|
%t66 = getelementptr inbounds i32, i32* %t43, i32 22
|
|
store i32 0, i32* %t66
|
|
%t67 = getelementptr inbounds i32, i32* %t43, i32 23
|
|
store i32 0, i32* %t67
|
|
%t68 = getelementptr inbounds i32, i32* %t43, i32 24
|
|
store i32 0, i32* %t68
|
|
%t69 = getelementptr inbounds i32, i32* %t43, i32 25
|
|
store i32 0, i32* %t69
|
|
%t70 = getelementptr inbounds i32, i32* %t43, i32 26
|
|
store i32 0, i32* %t70
|
|
%t71 = getelementptr inbounds i32, i32* %t43, i32 27
|
|
store i32 0, i32* %t71
|
|
%t72 = getelementptr inbounds i32, i32* %t43, i32 28
|
|
store i32 0, i32* %t72
|
|
%t73 = getelementptr inbounds i32, i32* %t43, i32 29
|
|
store i32 0, i32* %t73
|
|
%t74 = getelementptr inbounds i32, i32* %t43, i32 30
|
|
store i32 0, i32* %t74
|
|
%t75 = getelementptr inbounds i32, i32* %t43, i32 31
|
|
store i32 0, i32* %t75
|
|
%t76 = getelementptr inbounds i32, i32* %t43, i32 32
|
|
store i32 0, i32* %t76
|
|
%t77 = getelementptr inbounds i32, i32* %t43, i32 33
|
|
store i32 0, i32* %t77
|
|
%t78 = getelementptr inbounds i32, i32* %t43, i32 34
|
|
store i32 0, i32* %t78
|
|
%t79 = load i32, i32* %t39
|
|
%t80 = mul i32 %t79, 5
|
|
%t81 = getelementptr inbounds i32, i32* %t43, i32 %t80
|
|
%t82 = load i32, i32* %t81
|
|
call void @putint(i32 %t82)
|
|
%t84 = load i32, i32* %t39
|
|
%t85 = mul i32 %t84, 5
|
|
%t86 = add i32 %t85, 1
|
|
%t87 = getelementptr inbounds i32, i32* %t43, i32 %t86
|
|
%t88 = load i32, i32* %t87
|
|
call void @putint(i32 %t88)
|
|
%t90 = load i32, i32* %t39
|
|
%t91 = mul i32 %t90, 5
|
|
%t92 = add i32 %t91, 2
|
|
%t93 = getelementptr inbounds i32, i32* %t43, i32 %t92
|
|
%t94 = load i32, i32* %t93
|
|
call void @putint(i32 %t94)
|
|
br label %if.end.7
|
|
if.end.7:
|
|
call void @putch(i32 10)
|
|
%t97 = load i32, i32* @b
|
|
call void @putint(i32 %t97)
|
|
call void @putch(i32 10)
|
|
%t100 = getelementptr inbounds [4 x i32], [4 x i32]* @c, i32 0, i32 0
|
|
%t101 = load i32, i32* %t100
|
|
call void @putint(i32 %t101)
|
|
%t103 = getelementptr inbounds [4 x i32], [4 x i32]* @c, i32 0, i32 1
|
|
%t104 = load i32, i32* %t103
|
|
call void @putint(i32 %t104)
|
|
%t106 = getelementptr inbounds [4 x i32], [4 x i32]* @c, i32 0, i32 2
|
|
%t107 = load i32, i32* %t106
|
|
call void @putint(i32 %t107)
|
|
%t109 = getelementptr inbounds [4 x i32], [4 x i32]* @c, i32 0, i32 3
|
|
%t110 = load i32, i32* %t109
|
|
call void @putint(i32 %t110)
|
|
call void @putch(i32 10)
|
|
ret i32 0
|
|
}
|