Test the whole range of varargs handling stuff

llvm-svn: 6034
This commit is contained in:
Chris Lattner 2003-05-08 03:46:51 +00:00
parent 940ebf64d6
commit ff32eea8f2
1 changed files with 14 additions and 2 deletions

View File

@ -1,9 +1,21 @@
; Demonstrate all of the variable argument handling intrinsic functions plus
; the va_arg instruction.
implementation
declare void %llvm.va_start(sbyte**, ...)
declare void %llvm.va_copy(sbyte**, sbyte*)
declare void %llvm.va_end(sbyte**)
int %test(int %X, ...) {
%ap = alloca sbyte*
; This is not a legal testcase, it just shows the syntax for va_arg
%aq = alloca sbyte*
call void (sbyte**, ...)* %llvm.va_start(sbyte** %ap, int %X)
%apv = load sbyte** %ap
call void %llvm.va_copy(sbyte** %aq, sbyte* %apv)
call void %llvm.va_end(sbyte** %aq)
%tmp = va_arg sbyte** %ap, int
call void %llvm.va_end(sbyte** %ap)
ret int %tmp
}