Dummy implementation of the pthread library.
[oota-llvm.git] / test / Feature / varargs.ll
index 13f3581fe3e1766809b45394944b739943a4f3c5..bf0c6f2ac6f4ad07e6cdf6b737116c2e78f0b6a1 100644 (file)
@@ -1,9 +1,19 @@
+; Demonstrate all of the variable argument handling intrinsic functions plus 
+; the va_arg instruction.
 
-
+implementation
+declare sbyte* %llvm.va_start()
+declare sbyte* %llvm.va_copy(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
-       %tmp = va_arg sbyte** %ap, int 
+       %ap = call sbyte* %llvm.va_start()
+       %aq = call sbyte* %llvm.va_copy(sbyte* %ap)
+       call void %llvm.va_end(sbyte* %aq)
+       
+       %tmp = vaarg sbyte* %ap, int 
+       %ap2 = vanext sbyte* %ap, int
+
+       call void %llvm.va_end(sbyte* %ap2)
        ret int %tmp
 }