More on the porting theme,

We've had an unregisterised alpha port in gentoo for some time and two
of our alpha devs with an interest in ghc decided to try to get the
registerised build working.

They started by turning off the mangler and trying to get the register
bit working. This is ghc-6.4.1.

It works up to building the libs and then gcc complains:

        unable to find a register to spill in class `R27_REG'

This looks like it's a similar to an error Ian found:
http://www.haskell.org/pipermail/glasgow-haskell-users/2003-September/005692.html

though in that example the error occurred while compiling C modules
where as here it's with a .hc file.

------------------------------------------------------------------------
==fptools== make all -wr;
 in /var/tmp/portage/ghc-6.4.1-r2/work/ghc-6.4.1/libraries/base
------------------------------------------------------------------------
../../ghc/compiler/ghc-inplace -H32m -O0 -fno-asm-mangling
-fglasgow-exts -cpp -Iinclude -"#include" HsBase.h -funbox-strict-fields
-ignore-package base -fgenerics  -fgenerics    -c GHC/Err.lhs-boot -o
GHC/Err.o-boot  -ohi GHC/Err.hi-boot
../../ghc/compiler/ghc-inplace -H32m -O0 -fno-asm-mangling
-fglasgow-exts -cpp -Iinclude -"#include" HsBase.h -funbox-strict-fields
-ignore-package base -fgenerics  -fgenerics    -c GHC/Base.lhs -o
GHC/Base.o  -ohi GHC/Base.hi
/tmp/ghc9727.hc: In function `s1BE_ret':
/tmp/ghc9727.hc:1688: error: unable to find a register to spill in class
`R27_REG'
/tmp/ghc9727.hc:1688: error: this is the insn:
(insn 24 23 26 1 (parallel [
            (set (reg/v:DI 14 $14 [ R1 ])
                (div:DI (reg:DI 24 $24 [77])
                    (reg:DI 25 $25 [78])))
            (clobber (reg:DI 23 $23))
            (clobber (reg:DI 28 $28))
        ]) 43 {*divmoddi_internal_er} (insn_list 22 (insn_list 21
(nil)))
    (expr_list:REG_UNUSED (reg:DI 23 $23)
        (expr_list:REG_UNUSED (reg:DI 28 $28)
            (expr_list:REG_DEAD (reg:DI 25 $25 [78])
                (expr_list:REG_DEAD (reg:DI 24 $24 [77])
                    (nil))))))
/tmp/ghc9727.hc:1688: confused by earlier errors, bailing out
make[2]: *** [GHC/Base.o] Error 1
make[1]: *** [all] Error 1
make[1]: Leaving directory
`/var/tmp/portage/ghc-6.4.1-r2/work/ghc-6.4.1/libraries'
make: *** [build] Error 1

We stared hard at the MachRegs.h file and the Alpha ABI documentation
for some time but couldn't see what would be wrong. We tried not using
so many registers (removing REG_R7 & REG_R8) but that did not make any
difference.

What is odd here is that the class is `R27_REG' rather than a more
general class. The R27 is used as:

        Procedure value (PV) register. In a standard call, the procedure
        value of the procedure being called is passed in this register.
        (See Section 2.2.) In a standard call, this register can be
        modified by the called procedure without being saved and
        restored. 

http://www.cs.arizona.edu/computer.help/policy/DIGITAL_unix/AA-PY8AC-TET1_html/callCH2.html#GENERAL-PURPOSE-INTEGER-REGISTER

And this is not a register that we're stealing. We were using gcc 3.4.4.
We did not try with gcc 2.95.

When looking at the MachRegs.h we found that the bit:
#  define NCG_Reserved_I1 22
#  define NCG_Reserved_I2 27
#  define NCG_Reserved_F1 f29
#  define NCG_Reserved_F2 f30

is no longer used anywhere. It was used in the NCG in ghc 5.x but not in
6.4.x.

Duncan

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to