From a90ffe0a21a3a813df4eb9a4dc23b06f50699cde Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 20 Mar 2015 16:43:14 +0100 Subject: Support va_arg for vararg arguments of composite (struct/union) types. ARM is done, IA32 and PowerPC remain to be updated. --- runtime/arm/vararg.S | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'runtime') diff --git a/runtime/arm/vararg.S b/runtime/arm/vararg.S index ae06e361..5e319b8b 100644 --- a/runtime/arm/vararg.S +++ b/runtime/arm/vararg.S @@ -75,3 +75,15 @@ FUNCTION(__compcert_va_float64) #endif bx lr ENDFUNCTION(__compcert_va_float64) + +FUNCTION(__compcert_va_composite) + @ r0 = ap parameter + @ r1 = size of the composite, in bytes + ldr r2, [r0, #0] @ r2 = pointer to next argument + ADD r3, r2, r1 @ advance by size + ADD r3, r3, #3 @ 4-align + BIC r3, r3, #3 + str r3, [r0, #0] @ update ap + mov r0, r2 @ result is pointer to composite in stack + bx lr +ENDFUNCTION(__compcert_va_composite) -- cgit From c1205952ab7e3be09cd1a0a9a4d4ee9ddeefe1ea Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 20 Mar 2015 16:51:55 +0100 Subject: Support va_arg for vararg arguments of composite (struct/union) types. Now for IA32 and PowerPC as well. --- runtime/ia32/vararg.S | 12 ++++++++++++ runtime/powerpc/vararg.s | 7 +++++++ 2 files changed, 19 insertions(+) (limited to 'runtime') diff --git a/runtime/ia32/vararg.S b/runtime/ia32/vararg.S index ec55a454..78666c70 100644 --- a/runtime/ia32/vararg.S +++ b/runtime/ia32/vararg.S @@ -67,3 +67,15 @@ FUNCTION(__compcert_va_float64) movl %edx, 0(%ecx) ret ENDFUNCTION(__compcert_va_float64) + +FUNCTION(__compcert_va_composite) + movl 4(%esp), %ecx // %ecx = ap parameter + movl 8(%esp), %edx // %edx = size of composite in bytes + movl 0(%ecx), %eax // %eax = current argument pointer + leal 3(%eax, %edx), %edx // advance by size + andl $0xfffffffc, %edx // and round up to multiple of 4 + movl %edx, 0(%ecx) // update argument pointer + ret +ENDFUNCTION(__compcert_va_composite) + + diff --git a/runtime/powerpc/vararg.s b/runtime/powerpc/vararg.s index 16681c1c..8d7e62c8 100644 --- a/runtime/powerpc/vararg.s +++ b/runtime/powerpc/vararg.s @@ -128,6 +128,13 @@ __compcert_va_float64: .type __compcert_va_float64, @function .size __compcert_va_float64, .-__compcert_va_int64 + .balign 16 + .globl __compcert_va_composite +__compcert_va_composite: + b __compcert_va_int32 + .type __compcert_va_composite, @function + .size __compcert_va_composite, .-__compcert_va_composite + # Save integer and FP registers at beginning of vararg function .balign 16 -- cgit