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.
nudt-compiler-cpp/test_outputs/09_func_defn.ll

38 lines
739 B

@a = global i32 0
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 @func(i32 %arg0) {
entry:
%t1 = alloca i32
%t2 = alloca i32
br label %bbt0
bbt0:
store i32 %arg0, i32* %t1
%t3 = load i32, i32* %t1
%t4 = sub i32 %t3, 1
store i32 %t4, i32* %t1
%t5 = load i32, i32* %t1
ret i32 %t5
}
define i32 @main() {
entry:
%t7 = alloca i32
%t8 = alloca i32
br label %bbt6
bbt6:
store i32 0, i32* %t8
store i32 10, i32* @a
%t9 = load i32, i32* @a
%t10 = call i32 @func(i32 %t9)
store i32 %t10, i32* %t8
%t11 = load i32, i32* %t8
ret i32 %t11
}