GHC Alpha port?

Simon Marlow [email protected]
Wed, 11 Jul 2001 10:28:33 +0100


> > The relevant makefile code is in fptools/mk/bootstrap.mk - I'm sure
> > you'll be able to modify it to do the right thing.  When=20
> you've got it
> > working we'll think about how to set up the bootstrapping system so
> > mangling is optional.
>=20
> I wonder if it matters whether PLATFORM_CC_OPTS is set to -static in
> mk/bootstrap.mk?  The comments there say that the flags "should match
> the list in machdepCCOpts in ghc/compiler/DriverFlags.hs", and
> DriverFlags.hs does set -static for alpha.

I'm not sure whether -static is needed; try it without and see what
happens.

> (By the way, are *_hsc.[hc] files considered part of the ".hc
> distribution"?  I needed them for compiling, say, Directory.hc.)
>=20
> Anyway, the current hurdle is that
>         ghc/lib/std/PrelInt.hc doesn't compile
> because int64ToIntegerzh_fast is not declared
> because ghc/includes/PrimOps.h did not declare it
> because SUPPORT_LONG_LONGS is not defined in ghc/includes/StgTypes.h
> because SUPPORT_LONG_LONGS is defined in ghc/includes/StgTypes.h
>         if and only if HAVE_LONG_LONG && SIZEOF_VOID_P < 8,
>         and SIZEOF_VOID_P is 8.
>=20
> I'm not sure what the right fix is here.  Why does StgTypes.h not
> define SUPPORT_LONG_LONGS if SIZEOF_VOID_P >=3D 8, anyway?

I think it's right not to define SUPPORT_LONG_LONGS - as far as I can
tell, that symbol means "we need the long long type for
StgWord64/StgInt64 on this architecture", which isn't true on Alpha.

On a 64-bit machine, int64ToIntegerzh_fast and word64ToIntegerzh_fast
are identical to intToIntegerzh_fast and wordToIntegerzh_fast
respectively (as long as GMP is using a 64-bit limb type, which
fortunately it does).  The folllowing (untested) patch should be along
the right lines...

Cheers,
	Simon

*** PrimOps.hc  2001/07/06 14:11:38     1.79
--- PrimOps.hc  2001/07/11 09:24:29
***************
*** 594,601 ****
     FE_
  }
 =20
 =20
! #endif /* HAVE_LONG_LONG */
 =20
  /* ToDo: this is shockingly inefficient */
 =20
--- 594,616 ----
     FE_
  }
 =20
+ #elif SIZEOF_VOID_P =3D=3D 8
 =20
! FN_(word64ToIntegerzh_fast)
! {
!   FB_
!   JMP_(wordToIntegerzh_fast);
!   FE_
! }
!=20
! FN_(int64ToIntegerzh_fast)
! {
!   FB_
!   JMP_(intToIntegerzh_fast);
!   FE_
! }
!=20
! #endif /* SUPPORT_LONG_LONGS || SIZEOF_VOID_P =3D=3D 8 */
 =20
  /* ToDo: this is shockingly inefficient */
 =20