PowerPC backend fixes

db4
Slava Pestov 2008-11-08 20:36:14 -06:00
parent b9ee92e484
commit 65dea0aa26
3 changed files with 23 additions and 16 deletions

View File

@ -1,6 +1,7 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors system kernel alien.c-types cpu.architecture cpu.ppc ;
USING: accessors system kernel layouts
alien.c-types cpu.architecture cpu.ppc ;
IN: cpu.ppc.linux
<<
@ -8,12 +9,12 @@ t "longlong" c-type (>>stack-align?)
t "ulonglong" c-type (>>stack-align?)
>>
M: linux reserved-area-size 2 ;
M: linux reserved-area-size 2 cells ;
M: linux lr-save 1 ;
M: linux lr-save 1 cells ;
M: float-regs param-regs { 1 2 3 4 5 6 7 8 } ;
M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 } ;
M: ppc value-structs? drop f ;
M: ppc value-structs? f ;
M: ppc fp-shadows-int? drop f ;
M: ppc fp-shadows-int? f ;

View File

@ -1,6 +1,7 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors system kernel alien.c-types cpu.architecture cpu.ppc ;
USING: accessors system kernel layouts
alien.c-types cpu.architecture cpu.ppc ;
IN: cpu.ppc.macosx
<<
@ -9,12 +10,12 @@ IN: cpu.ppc.macosx
4 "double" c-type (>>align)
>>
M: macosx reserved-area-size 6 ;
M: macosx reserved-area-size 6 cells ;
M: macosx lr-save 2 ;
M: macosx lr-save 2 cells ;
M: float-regs param-regs { 1 2 3 4 5 6 7 8 9 10 11 12 13 } ;
M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 9 10 11 12 13 } ;
M: ppc value-structs? drop t ;
M: ppc value-structs? t ;
M: ppc fp-shadows-int? drop t ;
M: ppc fp-shadows-int? t ;

View File

@ -349,12 +349,17 @@ M: ppc %gc
"end" resolve-label ;
M: ppc %prologue ( n -- )
0 scratch-reg LOAD32 rc-absolute-ppc-2/2 rel-this
#! We use a volatile register (r11) here for scratch. Because
#! callback bodies have a prologue too, we cannot assume
#! that c_to_factor saved all non-volatile registers, so
#! we have to respect the C calling convention. Also, we
#! cannot touch any param-regs either.
0 11 LOAD32 rc-absolute-ppc-2/2 rel-this
0 MFLR
1 1 pick neg ADDI
scratch-reg 1 pick xt-save STW
dup scratch-reg LI
scratch-reg 1 pick next-save STW
11 1 pick xt-save STW
dup 11 LI
11 1 pick next-save STW
0 1 rot lr-save + STW ;
M: ppc %epilogue ( n -- )