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.
46 lines
1.1 KiB
46 lines
1.1 KiB
@a = global i32 0
|
|
@b = 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:
|
|
%t2 = alloca i32
|
|
%t0 = call i32 @getint()
|
|
store i32 %t0, i32* @a
|
|
%t1 = call i32 @getint()
|
|
store i32 %t1, i32* @b
|
|
store i32 0, i32* %t2
|
|
%t3 = load i32, i32* @a
|
|
%t4 = load i32, i32* @b
|
|
%t5 = icmp eq i32 %t3, %t4
|
|
%t6 = zext i1 %t5 to i32
|
|
%t7 = icmp ne i32 %t6, 0
|
|
br i1 %t7, label %land.rhs.4, label %if.else.2
|
|
if.then.1:
|
|
store i32 1, i32* %t2
|
|
br label %if.end.3
|
|
if.else.2:
|
|
store i32 0, i32* %t2
|
|
br label %if.end.3
|
|
if.end.3:
|
|
%t12 = load i32, i32* %t2
|
|
ret i32 %t12
|
|
land.rhs.4:
|
|
%t8 = load i32, i32* @a
|
|
%t9 = icmp ne i32 %t8, 3
|
|
%t10 = zext i1 %t9 to i32
|
|
%t11 = icmp ne i32 %t10, 0
|
|
br i1 %t11, label %if.then.1, label %if.else.2
|
|
}
|