diff options
Diffstat (limited to 'compiler/cmm')
-rw-r--r-- | compiler/cmm/CmmType.hs | 17 | ||||
-rw-r--r-- | compiler/cmm/PprC.hs | 8 |
2 files changed, 13 insertions, 12 deletions
diff --git a/compiler/cmm/CmmType.hs b/compiler/cmm/CmmType.hs index 6988ae6905..acf06eb181 100644 --- a/compiler/cmm/CmmType.hs +++ b/compiler/cmm/CmmType.hs @@ -19,6 +19,7 @@ where import Constants import FastString import Outputable +import DynFlags import Data.Word import Data.Int @@ -197,14 +198,14 @@ widthInBytes W64 = 8 widthInBytes W128 = 16 widthInBytes W80 = 10 -widthFromBytes :: Int -> Width -widthFromBytes 1 = W8 -widthFromBytes 2 = W16 -widthFromBytes 4 = W32 -widthFromBytes 8 = W64 -widthFromBytes 16 = W128 -widthFromBytes 10 = W80 -widthFromBytes n = pprPanic "no width for given number of bytes" (ppr n) +widthFromBytes :: DynFlags -> Int -> Width +widthFromBytes _ 1 = W8 +widthFromBytes _ 2 = W16 +widthFromBytes _ 4 = W32 +widthFromBytes _ 8 = W64 +widthFromBytes _ 16 = W128 +widthFromBytes _ 10 = W80 +widthFromBytes dflags n = pprPanic dflags "no width for given number of bytes" (ppr n) -- log_2 of the width in bytes, useful for generating shifts. widthInLog :: Width -> Int diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs index 18b0d8274a..3bc10edd80 100644 --- a/compiler/cmm/PprC.hs +++ b/compiler/cmm/PprC.hs @@ -775,10 +775,10 @@ pprReg r = case r of CmmLocal local -> pprLocalReg local CmmGlobal global -> pprGlobalReg global -pprAsPtrReg :: CmmReg -> SDoc -pprAsPtrReg (CmmGlobal (VanillaReg n gcp)) - = WARN( gcp /= VGcPtr, ppr n ) char 'R' <> int n <> ptext (sLit ".p") -pprAsPtrReg other_reg = pprReg other_reg +pprAsPtrReg :: DynFlags -> CmmReg -> SDoc +pprAsPtrReg dflags (CmmGlobal (VanillaReg n gcp)) + = WARN( dflags, gcp /= VGcPtr, ppr n ) char 'R' <> int n <> ptext (sLit ".p") +pprAsPtrReg _ other_reg = pprReg other_reg pprGlobalReg :: GlobalReg -> SDoc pprGlobalReg gr = case gr of |