aboutsummaryrefslogtreecommitdiffstats
path: root/test/Feature/varargs.ll
blob: bf0c6f2ac6f4ad07e6cdf6b737116c2e78f0b6a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 = 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
}