HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Moduleghc-lib-parser-9.14.1.20251220GHC2021

GHC.Cmm.Type

  • 5 types
  • 56 values
datadata CmmType
#
Instances2Show, Outputable
  • Show CmmTypeDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Cmm.Type
  • Outputable CmmTypeDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Cmm.Type
valuecmmCompatType :: CmmType -> CmmType -> Bool
#

A weaker notion of equality of CmmTypes than cmmEqType, used (only) in Cmm Lint.

Why "weaker"? Because:

  • we don't distinguish GcPtr vs NonGcPtr, because the the RTS files are not yet well-typed wrt pointers,

  • for vectors, we only compare the widths, because in practice things like X86 xmm registers support different types of data (e.g. 4xf32, 2xf64, 2xu64 etc).

datadata Width
#
Instances4Eq, Ord, Show, Outputable
  • Eq WidthDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Cmm.Type
  • Ord WidthDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Cmm.Type
  • Show WidthDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Cmm.Type
  • Outputable WidthDefined in ghc-lib-parser-9.14.1.20251220 · GHC.Cmm.Type
valuewidthInLog :: Width -> Int
#

log_2 of the width in bytes, useful for generating shifts.

valuenarrowU :: Width -> Integer -> Integer
#

Narrow a signed or unsigned value to the given width. The result will reside in [0, +2^width).

Example10 expressions
narrowU W8 256    == 256narrowU W8 255    == 255narrowU W8 128    == 128narrowU W8 127    == 127narrowU W8 0      == 0narrowU W8 (-127) == 129narrowU W8 (-128) == 128narrowU W8 (-129) == 127narrowU W8 (-255) == 1narrowU W8 (-256) == 0
valuenarrowS :: Width -> Integer -> Integer
#

Narrow a signed value to the given width. The result will reside in [-2^(width-1), +2^(width-1)).

Example10 expressions
narrowS W8 256    == 0narrowS W8 255    == -1narrowS W8 128    == -128narrowS W8 127    == 127narrowS W8 0      == 0narrowS W8 (-127) == -127narrowS W8 (-128) == -128narrowS W8 (-129) == 127narrowS W8 (-255) == 1narrowS W8 (-256) == 0