[Haskell-cafe] Is this a known problem?
ok
ok at cs.otago.ac.nz
Thu Oct 4 18:04:06 EDT 2007
UltraSPARC II, Solaris 2.10, gcc 4.0.4 (gccfss),
Haskell GHC 6.6.1 binary release.
Trying to compile a simple file gives me oodles of errors because
ghc is generating something that makes gcc generate lots of these:
sethi %hi(<<some register>>),<<another register>>
For people unfamiliar with SPARC assembly code, the %hi(...) operation
returns the top bits of a *literal* address, it makes absolutely no
sense to give it a register.
I have tried this version of gccfss with lots of C code and have been
unable to make it generate this construction; it's only ghc's .hc files
that do it.
Running gcc by hand on the .hc file produces 8 warnings
...lib/ghc-6.6.1/include/Regs.h: ###: warning:
call-clobbered register used for global register variable
-DNO_GLOBAL_REG_DECLS eliminated that.
Comparing the .s file produced using 'ghc -S' with the .s file
produced by gcc'ing the .hc produced some illumination:
.section ".text",#slloc,#execinstr,#progbits
.align 4
#if GHC
.text
.align 4
#endif
s4AK_ret:
save %sp,-96,%sp
#if GHC
sethi %hi(%l1),%i2
add %i2,%lo(%l1),%i5
ld [%i2+%lo(%l1)],%i2
ld [%i2],%l7
lduh [%l7-2],%l6
...
#else
sethi %hi(MainCapability),%i5
add %i5,%lo(MainCapability),%i2
ld [%i2+8],%i5
ld [%i5],%i4
lduh [%i4-2],%i3
...
#endif
What with one thing and another, I'm not really sure that it's
gcc's fault.
More information about the Haskell-Cafe
mailing list