2004-11-07 06:08:43 +00:00
|
|
|
; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
|
|
|
|
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
|
|
|
|
; RUN: diff %t1.ll %t2.ll
|
|
|
|
|
2003-05-08 03:46:51 +00:00
|
|
|
; Demonstrate all of the variable argument handling intrinsic functions plus
|
|
|
|
; the va_arg instruction.
|
2003-05-08 02:39:37 +00:00
|
|
|
|
2003-05-08 03:46:51 +00:00
|
|
|
implementation
|
2003-10-21 15:36:21 +00:00
|
|
|
declare sbyte* %llvm.va_start()
|
|
|
|
declare sbyte* %llvm.va_copy(sbyte*)
|
|
|
|
declare void %llvm.va_end(sbyte*)
|
2003-05-08 02:39:37 +00:00
|
|
|
|
|
|
|
int %test(int %X, ...) {
|
2003-10-21 15:36:21 +00:00
|
|
|
%ap = call sbyte* %llvm.va_start()
|
|
|
|
%aq = call sbyte* %llvm.va_copy(sbyte* %ap)
|
|
|
|
call void %llvm.va_end(sbyte* %aq)
|
2003-05-08 03:46:51 +00:00
|
|
|
|
2003-10-21 15:36:21 +00:00
|
|
|
%tmp = vaarg sbyte* %ap, int
|
|
|
|
%ap2 = vanext sbyte* %ap, int
|
2003-05-08 03:46:51 +00:00
|
|
|
|
2003-10-21 15:36:21 +00:00
|
|
|
call void %llvm.va_end(sbyte* %ap2)
|
2003-05-08 02:39:37 +00:00
|
|
|
ret int %tmp
|
|
|
|
}
|