Test the whole range of varargs handling stuff
authorChris Lattner <sabre@nondot.org>
Thu, 8 May 2003 03:46:51 +0000 (03:46 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 8 May 2003 03:46:51 +0000 (03:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6034 91177308-0d34-0410-b5e6-96231b3b80d8

test/Feature/varargs.ll

index 13f3581fe3e1766809b45394944b739943a4f3c5..defcd93cc668410881ce866a296f08e6635e0fd9 100644 (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
 }