Commit 8d8369f8 by Andreas Tobler Committed by Andreas Tobler

darwin.S: Cleanup whitespaces, comment formatting.

2003-09-18  Andreas Tobler  <a.tobler@schweiz.ch>

	* src/powerpc/darwin.S: Cleanup whitespaces, comment formatting.
	* src/powerpc/darwin_closure.S: Likewise.
	* src/powerpc/ffi_darwin.c: Likewise.

From-SVN: r71533
parent a6a0f876
2003-09-18 Andreas Tobler <a.tobler@schweiz.ch> 2003-09-18 Andreas Tobler <a.tobler@schweiz.ch>
* src/powerpc/darwin.S: Cleanup whitespaces, comment formatting.
* src/powerpc/darwin_closure.S: Likewise.
* src/powerpc/ffi_darwin.c: Likewise.
2003-09-18 Andreas Tobler <a.tobler@schweiz.ch>
David Edelsohn <edelsohn@gnu.org> David Edelsohn <edelsohn@gnu.org>
* src/types.c (double): Add AIX and Darwin to the right TYPEDEF. * src/types.c (double): Add AIX and Darwin to the right TYPEDEF.
......
...@@ -73,13 +73,13 @@ LCFI2: ...@@ -73,13 +73,13 @@ LCFI2:
bctrl bctrl
lwz r2,20(r1) lwz r2,20(r1)
/* Now do the call. */ /* Now do the call.
/* Set up cr1 with bits 4-7 of the flags. */ Set up cr1 with bits 4-7 of the flags. */
mtcrf 0x40,r31 mtcrf 0x40,r31
/* Get the address to call into CTR. */ /* Get the address to call into CTR. */
mtctr r29 mtctr r29
/* Load all those argument registers. */ /* Load all those argument registers.
// We have set up a nice stack frame, just load it into registers. We have set up a nice stack frame, just load it into registers. */
lwz r3, 20+(1*4)(r1) lwz r3, 20+(1*4)(r1)
lwz r4, 20+(2*4)(r1) lwz r4, 20+(2*4)(r1)
lwz r5, 20+(3*4)(r1) lwz r5, 20+(3*4)(r1)
...@@ -111,7 +111,7 @@ L1: ...@@ -111,7 +111,7 @@ L1:
lfd f13,-16-(1*8)(r28) lfd f13,-16-(1*8)(r28)
L2: L2:
mr r12,r29 // Put the target address in r12 as specified. mr r12,r29 /* Put the target address in r12 as specified. */
mtctr r12 mtctr r12
nop nop
nop nop
...@@ -215,4 +215,3 @@ LASFDE1: ...@@ -215,4 +215,3 @@ LASFDE1:
.byte 0x1c ; uleb128 0x1c .byte 0x1c ; uleb128 0x1c
.align 2 .align 2
LEFDE1: LEFDE1:
...@@ -46,13 +46,13 @@ LCFI0: ...@@ -46,13 +46,13 @@ LCFI0:
168 Bytes */ 168 Bytes */
stwu r1,-176(r1) /* skip over caller save area stwu r1,-176(r1) /* skip over caller save area
keep stack aligned to 16 */ keep stack aligned to 16. */
LCFI1: LCFI1:
/* we want to build up an area for the parameters passed /* We want to build up an area for the parameters passed
in registers (both floating point and integer) */ in registers. (both floating point and integer) */
/* we store gpr 3 to gpr 10 (aligned to 4) /* We store gpr 3 to gpr 10 (aligned to 4)
in the parents outgoing area */ in the parents outgoing area. */
stw r3, 200(r1) stw r3, 200(r1)
stw r4, 204(r1) stw r4, 204(r1)
stw r5, 208(r1) stw r5, 208(r1)
...@@ -62,7 +62,7 @@ LCFI1: ...@@ -62,7 +62,7 @@ LCFI1:
stw r9, 224(r1) stw r9, 224(r1)
stw r10, 228(r1) stw r10, 228(r1)
/* we save fpr 1 to fpr 13 (aligned to 8) */ /* We save fpr 1 to fpr 13. (aligned to 8) */
stfd f1, 56(r1) stfd f1, 56(r1)
stfd f2, 64(r1) stfd f2, 64(r1)
stfd f3, 72(r1) stfd f3, 72(r1)
...@@ -77,39 +77,39 @@ LCFI1: ...@@ -77,39 +77,39 @@ LCFI1:
stfd f12, 144(r1) stfd f12, 144(r1)
stfd f13, 152(r1) stfd f13, 152(r1)
/* set up registers for the routine that actually does the work */ /* Set up registers for the routine that actually does the work
/* get the context pointer from the trampoline */ get the context pointer from the trampoline. */
mr r3,r11 mr r3,r11
/* now load up the pointer to the result storage */ /* Now load up the pointer to the result storage. */
addi r4,r1,160 addi r4,r1,160
/* now load up the pointer to the saved gpr registers */ /* Now load up the pointer to the saved gpr registers. */
addi r5,r1,200 addi r5,r1,200
/* now load up the pointer to the saved fpr registers */ /* Now load up the pointer to the saved fpr registers. */
addi r6,r1,56 addi r6,r1,56
/* make the call */ /* Make the call. */
bl Lffi_closure_helper_DARWIN$stub bl Lffi_closure_helper_DARWIN$stub
/* now r3 contains the return type */ /* Now r3 contains the return type
/* so use it to look up in a table */ so use it to look up in a table
/* so we know how to deal with each type */ so we know how to deal with each type. */
/* look up the proper starting point in table */ /* Look up the proper starting point in table
/* by using return type as offset */ by using return type as offset. */
addi r5,r1,160 /* get pointer to results area */ addi r5,r1,160 /* Get pointer to results area. */
bl Lget_ret_type0_addr /* get pointer to Lret_type0 into LR */ bl Lget_ret_type0_addr /* Get pointer to Lret_type0 into LR. */
mflr r4 /* move to r4 */ mflr r4 /* Move to r4. */
slwi r3,r3,4 /* now multiply return type by 16 */ slwi r3,r3,4 /* Now multiply return type by 16. */
add r3,r3,r4 /* add contents of table to table address */ add r3,r3,r4 /* Add contents of table to table address. */
mtctr r3 mtctr r3
bctr /* jump to it */ bctr /* Jump to it. */
LFE1: LFE1:
/* Each of the ret_typeX code fragments has to be exactly 16 bytes long */ /* Each of the ret_typeX code fragments has to be exactly 16 bytes long
/* (4 instructions). For cache effectiveness we align to a 16 byte boundary */ (4 instructions). For cache effectiveness we align to a 16 byte boundary
/* first. */ first. */
.align 4 .align 4
...@@ -226,9 +226,9 @@ Lret_type14: ...@@ -226,9 +226,9 @@ Lret_type14:
/* case done */ /* case done */
Lfinish: Lfinish:
addi r1,r1,176 /* restore stack pointer */ addi r1,r1,176 /* Restore stack pointer. */
lwz r0,8(r1) /* get return address */ lwz r0,8(r1) /* Get return address. */
mtlr r0 /* reset link register */ mtlr r0 /* Reset link register. */
blr blr
/* END(ffi_closure_ASM) */ /* END(ffi_closure_ASM) */
......
...@@ -93,7 +93,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned *const stack) ...@@ -93,7 +93,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned *const stack)
/* 'next_arg' grows up as we put parameters in it. */ /* 'next_arg' grows up as we put parameters in it. */
unsigned *next_arg = stack + 6; // 6 reserved posistions. unsigned *next_arg = stack + 6; /* 6 reserved posistions. */
int i = ecif->cif->nargs; int i = ecif->cif->nargs;
double double_tmp; double double_tmp;
...@@ -108,9 +108,10 @@ void ffi_prep_args(extended_cif *ecif, unsigned *const stack) ...@@ -108,9 +108,10 @@ void ffi_prep_args(extended_cif *ecif, unsigned *const stack)
FFI_ASSERT(((unsigned)(char *)stacktop & 0xF) == 0); FFI_ASSERT(((unsigned)(char *)stacktop & 0xF) == 0);
FFI_ASSERT((bytes & 0xF) == 0); FFI_ASSERT((bytes & 0xF) == 0);
/* Deal with return values that are actually pass-by-reference. */ /* Deal with return values that are actually pass-by-reference.
// Rule: Rule:
// Return values are referenced by r3, so r4 is the first parameter. Return values are referenced by r3, so r4 is the first parameter. */
if (flags & FLAG_RETVAL_REFERENCE) if (flags & FLAG_RETVAL_REFERENCE)
*next_arg++ = (unsigned)(char *)ecif->rvalue; *next_arg++ = (unsigned)(char *)ecif->rvalue;
...@@ -206,7 +207,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned *const stack) ...@@ -206,7 +207,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned *const stack)
//FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); //FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4);
} }
/* Perform machine dependent cif processing */ /* Perform machine dependent cif processing. */
ffi_status ffi_prep_cif_machdep(ffi_cif *cif) ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
{ {
/* All this is for the DARWIN ABI. */ /* All this is for the DARWIN ABI. */
...@@ -366,8 +367,8 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif, ...@@ -366,8 +367,8 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif,
ecif.cif = cif; ecif.cif = cif;
ecif.avalue = avalue; ecif.avalue = avalue;
/* If the return value is a struct and we don't have a return */ /* If the return value is a struct and we don't have a return
/* value address then we need to make one */ value address then we need to make one. */
if ((rvalue == NULL) && if ((rvalue == NULL) &&
(cif->rtype->type == FFI_TYPE_STRUCT)) (cif->rtype->type == FFI_TYPE_STRUCT))
...@@ -402,8 +403,8 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif, ...@@ -402,8 +403,8 @@ void ffi_call(/*@dependent@*/ ffi_cif *cif,
static void flush_icache(char *); static void flush_icache(char *);
static void flush_range(char *, int); static void flush_range(char *, int);
/* The layout of a function descriptor. A C function pointer really */ /* The layout of a function descriptor. A C function pointer really
/* points to one of these. */ points to one of these. */
typedef struct aix_fd_struct { typedef struct aix_fd_struct {
void *code_pointer; void *code_pointer;
...@@ -411,9 +412,9 @@ typedef struct aix_fd_struct { ...@@ -411,9 +412,9 @@ typedef struct aix_fd_struct {
} aix_fd; } aix_fd;
/* here I'd like to add the stack frame layout we use in darwin_closure.S /* here I'd like to add the stack frame layout we use in darwin_closure.S
* and aix_clsoure.S and aix_clsoure.S
*
* SP previous -> +---------------------------------------+ <--- child frame SP previous -> +---------------------------------------+ <--- child frame
| back chain to caller 4 | | back chain to caller 4 |
+---------------------------------------+ 4 +---------------------------------------+ 4
| saved CR 4 | | saved CR 4 |
...@@ -556,12 +557,11 @@ int ffi_closure_helper_DARWIN (ffi_closure*, void*, ...@@ -556,12 +557,11 @@ int ffi_closure_helper_DARWIN (ffi_closure*, void*,
unsigned long*, ffi_dblfl*); unsigned long*, ffi_dblfl*);
/* Basically the trampoline invokes ffi_closure_ASM, and on /* Basically the trampoline invokes ffi_closure_ASM, and on
* entry, r11 holds the address of the closure. entry, r11 holds the address of the closure.
* After storing the registers that could possibly contain After storing the registers that could possibly contain
* parameters to be passed into the stack frame and setting parameters to be passed into the stack frame and setting
* up space for a return value, ffi_closure_ASM invokes the up space for a return value, ffi_closure_ASM invokes the
* following helper function to do most of the work following helper function to do most of the work. */
*/
int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue, int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue,
unsigned long * pgr, ffi_dblfl * pfr) unsigned long * pgr, ffi_dblfl * pfr)
...@@ -574,8 +574,8 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue, ...@@ -574,8 +574,8 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue,
void ** avalue; void ** avalue;
ffi_type ** arg_types; ffi_type ** arg_types;
long i, avn; long i, avn;
long nf; /* number of floating registers already used */ long nf; /* number of floating registers already used. */
long ng; /* number of general registers already used */ long ng; /* number of general registers already used. */
ffi_cif * cif; ffi_cif * cif;
double temp; double temp;
unsigned size_al; unsigned size_al;
...@@ -652,10 +652,8 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue, ...@@ -652,10 +652,8 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue,
break; break;
case FFI_TYPE_FLOAT: case FFI_TYPE_FLOAT:
/* a float value consumes a GPR /* A float value consumes a GPR.
* There are 13 64bit floating point registers. */
* here are 13 64bit floating point registers.
*/
if (nf < NUM_FPR_ARG_REGISTERS) if (nf < NUM_FPR_ARG_REGISTERS)
{ {
temp = pfr->d; temp = pfr->d;
...@@ -673,10 +671,8 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue, ...@@ -673,10 +671,8 @@ int ffi_closure_helper_DARWIN (ffi_closure* closure, void * rvalue,
break; break;
case FFI_TYPE_DOUBLE: case FFI_TYPE_DOUBLE:
/* a double value consumes two GPRs /* A double value consumes two GPRs.
* There are 13 64bit floating point registers. */
* There are 13 64bit floating point registers.
*/
if (nf < NUM_FPR_ARG_REGISTERS) if (nf < NUM_FPR_ARG_REGISTERS)
{ {
avalue[i] = pfr; avalue[i] = pfr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment