Commit 0238a6c7 authored by Sergei Trofimovich's avatar Sergei Trofimovich Committed by Ben Gamari

UNREG: PprC: add support for of W32 literals

Today UNREG build fails to generate sub-word literals:
```
  rts_dist_HC rts/dist/build/StgStartup.o
ghc-stage1: panic! (the 'impossible' happened)
  (GHC version 8.5.20180612 for x86_64-unknown-linux):
        pprStatics: cannot emit a non-word-sized static literal
  W32
```

The change allows combining two subwords into one word.
Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>

Reviewers: simonmar, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #15237

Differential Revision: https://phabricator.haskell.org/D4837
parent ca7653a9
......@@ -538,6 +538,14 @@ pprStatics dflags (CmmStaticLit (CmmInt i W64) : rest)
CmmStaticLit (CmmInt q W32) : rest)
where r = i .&. 0xffffffff
q = i `shiftR` 32
pprStatics dflags (CmmStaticLit (CmmInt a W32) :
CmmStaticLit (CmmInt b W32) : rest)
| wordWidth dflags == W64
= if wORDS_BIGENDIAN dflags
then pprStatics dflags (CmmStaticLit (CmmInt ((shiftL a 32) .|. b) W64) :
rest)
else pprStatics dflags (CmmStaticLit (CmmInt ((shiftL b 32) .|. a) W64) :
rest)
pprStatics dflags (CmmStaticLit (CmmInt _ w) : _)
| w /= wordWidth dflags
= pprPanic "pprStatics: cannot emit a non-word-sized static literal" (ppr w)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment