Cannot build ghc HEAD with LLVM ARM due to globalRegMaybe

Moritz Angermann moritz at lichtzwerge.de
Fri Sep 12 18:53:19 UTC 2014


Hi, 

when trying to compile a ghc HEAD on LLVM ARM, I end up getting an
exception:

    ghc-stage1: panic! (the 'impossible' happened)
      (GHC version 7.9.20140911 for arm-apple-ios): 
        globalRegMaybe

After some digging I found that a new call to globalRegMaybe was introduced here:
http://git.haskell.org/ghc.git/blob/HEAD:/compiler/cmm/CmmSink.hs#l231 
on 2014-04-29 in commit: http://git.haskell.org/ghc.git/commitdiff/83a003fcaec93dbfd5b46837f2bf3353412b9877

In a similar timeframe (since 2014-05-02) /include/CodeGen.Platform.hs was changed:
http://git.haskell.org/ghc.git/blobdiff/b0534f78a73f972e279eed4447a5687bd6a8308e..HEAD:/includes/CodeGen.Platform.hs

introducing a set of new ifdef/elif/endif pairs. Especially for MACHREGS_NO_REGS, namely:

    -#endif
     globalRegMaybe _                        = Nothing
    +#elif MACHREGS_NO_REGS
    +globalRegMaybe _ = Nothing
    +#else
    +globalRegMaybe = panic "globalRegMaybe not defined for this platform"
    +#endif

ARM.hs (http://git.haskell.org/ghc.git/blob/23892440032fcab8a6a753916d506857674169ec:/compiler/codeGen/CodeGen/Platform/ARM.hs) however, has:

    #define MACHREGS_NO_REGS 0
    #define MACHREGS_arm 1

where MACHREGS_arm 1 has no effect on the subsequently imported CodeGen.Platform.hs.

Therefore I propose that a change to ARM.hs is made to set
MACHREGS_NO_REGS to 1.

Cheers,
 Moritz


More information about the ghc-devs mailing list