diff options
author | David Edelsohn <edelsohn@gnu.org> | 2009-12-02 04:21:08 +0000 |
---|---|---|
committer | David Edelsohn <dje@gcc.gnu.org> | 2009-12-01 23:21:08 -0500 |
commit | 6d518d3b72692a2874122c903e5994db27bf5500 (patch) | |
tree | b9991c60f54fd4d9bfdf966f8f61502208b440ce /libffi/src/powerpc/aix.S | |
parent | 5e87bf4a142f66750f05b6319bf07b2dbf2c9f24 (diff) | |
download | gcc-6d518d3b72692a2874122c903e5994db27bf5500.zip gcc-6d518d3b72692a2874122c903e5994db27bf5500.tar.gz gcc-6d518d3b72692a2874122c903e5994db27bf5500.tar.bz2 |
aix.S (ffi_call_AIX): Convert to more standard register usage.
* src/powerpc/aix.S (ffi_call_AIX): Convert to more standard
register usage. Call ffi_prep_args directly. Add long double
return value support.
* src/powerpc/ffi_darwin.c (ffi_prep_args): Double arg increment
applies to FFI_TYPE_DOUBLE. Correct fpr_base increment typo.
Separate FFI_TYPE_SINT32 and FFI_TYPE_UINT32 cases.
(ffi_prep_cif_machdep): Only 16 byte stack alignment in 64 bit
mode.
(ffi_closure_helper_DARWIN): Remove nf and ng counters. Move temp
into case.
* src/powerpc/aix_closure.S: Maintain 16 byte stack alignment.
Allocate result area between params and FPRs.
From-SVN: r154892
Diffstat (limited to 'libffi/src/powerpc/aix.S')
-rw-r--r-- | libffi/src/powerpc/aix.S | 77 |
1 files changed, 32 insertions, 45 deletions
diff --git a/libffi/src/powerpc/aix.S b/libffi/src/powerpc/aix.S index 7b73999..5b477ca 100644 --- a/libffi/src/powerpc/aix.S +++ b/libffi/src/powerpc/aix.S @@ -104,47 +104,34 @@ ffi_call_AIX: .llong .ffi_call_AIX, TOC[tc0], 0 .csect .text[PR] .ffi_call_AIX: - mr r12,r8 // We only need r12 until the call, so it doesn't have to be saved... - /* Save the old stack pointer as AP. */ - mr r8,r1 - - /* Allocate the stack space we need. */ - stdux r1,r1,r4 - /* Save registers we use. */ - mflr r9 + mflr r0 - std r28,-32(r8) - std r29,-24(r8) - std r30,-16(r8) - std r31, -8(r8) + std r28,-32(r1) + std r29,-24(r1) + std r30,-16(r1) + std r31, -8(r1) - std r9, 16(r8) - std r2, 40(r1) + std r0, 16(r1) + mr r28, r1 /* our AP. */ + stdux r1, r1, r4 /* Save arguments over call... */ - mr r31,r5 /* flags, */ - mr r30,r6 /* rvalue, */ - mr r29,r7 /* function address, */ - mr r28,r8 /* our AP. */ + mr r31, r5 /* flags, */ + mr r30, r6 /* rvalue, */ + mr r29, r7 /* function address. */ + std r2, 40(r1) /* Call ffi_prep_args. */ - mr r4,r1 - li r9,0 - - ld r2,8(r12) - ld r12,0(r12) - mtctr r12 // r12 holds address of _ffi_prep_args - bctrl - ld r2,40(r1) + mr r4, r1 + bl .ffi_prep_args /* Now do the call. */ - ld r12,0(r29) + ld r0, 0(r29) + ld r2, 8(r29) /* Set up cr1 with bits 4-7 of the flags. */ - mtcrf 0x40,r31 - std r2,40(r1) - mtctr r12 - ld r2,8(r29) + mtcrf 0x40, r31 + mtctr r0 /* Load all those argument registers. */ // We have set up a nice stack frame, just load it into registers. ld r3, 40+(1*8)(r1) @@ -180,33 +167,33 @@ L1: L2: /* Make the call. */ bctrl - ld r2,40(r1) + ld r2, 40(r1) /* Now, deal with the return value. */ - mtcrf 0x01,r31 + mtcrf 0x01, r31 - bt 30,L(done_return_value) - bt 29,L(fp_return_value) - std r3,0(r30) - bf 28,L(done_return_value) - std r4,4(r30) + bt 30, L(done_return_value) + bt 29, L(fp_return_value) + std r3, 0(r30) /* Fall through... */ L(done_return_value): /* Restore the registers we used and return. */ - ld r9,16(r28) - ld r31,-8(r28) - mtlr r9 - ld r30,-16(r28) - ld r29,-24(r28) - ld r28,-32(r28) - ld r1,0(r1) + mr r1, r28 + ld r0, 16(r28) + ld r28,-32(r1) + mtlr r0 + ld r29,-24(r1) + ld r30,-16(r1) + ld r31,-8(r1) blr L(fp_return_value): bf 28,L(float_return_value) stfd f1,0(r30) + bf 31,L(done_return_value) + stfd f2,8(r30) b L(done_return_value) L(float_return_value): stfs f1,0(r30) |