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.
36 lines
840 B
36 lines
840 B
@a = 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 @func(i32 %arg.p) {
|
|
entry:
|
|
%t0 = alloca i32
|
|
store i32 %arg.p, i32* %t0
|
|
%t1 = load i32, i32* %t0
|
|
%t2 = sub i32 %t1, 1
|
|
store i32 %t2, i32* %t0
|
|
%t3 = load i32, i32* %t0
|
|
ret i32 %t3
|
|
}
|
|
define i32 @main() {
|
|
entry:
|
|
%t4 = alloca i32
|
|
store i32 0, i32* %t4
|
|
store i32 10, i32* @a
|
|
%t5 = load i32, i32* @a
|
|
%t6 = call i32 @func(i32 %t5)
|
|
store i32 %t6, i32* %t4
|
|
%t7 = load i32, i32* %t4
|
|
ret i32 %t7
|
|
}
|