summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lenharth <andrewl@lenharth.org>2005-06-18 18:30:37 +0000
committerAndrew Lenharth <andrewl@lenharth.org>2005-06-18 18:30:37 +0000
commit435054cd1b9c2b29bec2dfb9c292fa6997810e86 (patch)
tree01d3a410cc2cf0add8210eeb6c3d1acc2cf5c6ff
parent5fb787c6191598cbd0533051675509ab0416f3f1 (diff)
downloadbcm5719-llvm-435054cd1b9c2b29bec2dfb9c292fa6997810e86.tar.gz
bcm5719-llvm-435054cd1b9c2b29bec2dfb9c292fa6997810e86.zip
new vararg test
llvm-svn: 22252
-rw-r--r--llvm/test/Feature/varargs_new.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/test/Feature/varargs_new.ll b/llvm/test/Feature/varargs_new.ll
new file mode 100644
index 00000000000..df6b38e0cc0
--- /dev/null
+++ b/llvm/test/Feature/varargs_new.ll
@@ -0,0 +1,33 @@
+; 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
+
+; Demonstrate all of the variable argument handling intrinsic functions plus
+; the va_arg instruction.
+
+implementation ; Functions:
+declare void %llvm.va_start(sbyte**)
+declare void %llvm.va_copy(sbyte**, sbyte*)
+declare void %llvm.va_end(sbyte**)
+
+int %test(int %X, ...) {
+ ; Allocate two va_list items. On this target, va_list is of type sbyte*
+ %ap = alloca sbyte* ; <sbyte**> [#uses=4]
+ %aq = alloca sbyte* ; <sbyte**> [#uses=2]
+
+ ; Initialize variable argument processing
+ call void %llvm.va_start(sbyte** %ap)
+
+ ; Read a single integer argument
+ %tmp = vaarg sbyte** %ap, int ; <int> [#uses=1]
+
+ ; Demonstrate usage of llvm.va_copy and llvm_va_end
+ %apv = load sbyte** %ap ; <sbyte*> [#uses=1]
+ call void %llvm.va_copy(sbyte** %aq, sbyte* %apv)
+ call void %llvm.va_end(sbyte** %aq)
+
+ ; Stop processing of arguments.
+ call void %llvm.va_end(sbyte** %ap)
+ ret int %tmp
+
+}
OpenPOWER on IntegriCloud