ghc-10.0.0.20260917: The GHC API
Safe HaskellNone
LanguageGHC2024

GHC.Core.Opt.Range

Description

Range analysis

See Note [Value range analysis]

Synopsis

Documentation

data Comparison Source #

Constructors

Gt 
Ge 
Lt 
Le 

Instances

Instances details
Show Comparison Source # 
Instance details

Defined in GHC.Core.Opt.Range

data Range Source #

A range (minBound,maxBound)

Bounds may not be known.

Constructors

MkRange 

Fields

Instances

Instances details
Eq Range Source # 
Instance details

Defined in GHC.Core.Opt.Range

Methods

(==) :: Range -> Range -> Bool Source #

(/=) :: Range -> Range -> Bool Source #

Show Range Source # 
Instance details

Defined in GHC.Core.Opt.Range

valueRange :: Platform -> CoreExpr -> Range Source #

Return the Integer range of an expression

rangeIntersect :: Range -> Range -> Range Source #

Compute the intersection of two overlapping ranges.

If the two ranges don't overlap, result is undefined.

rangeCastFrom :: Range -> Range -> Range Source #

Used for casts that share representation over a sub-range (e.g. [0,127] for Word8# ([0,255]) and Int8# ([-128,127]))

If from_range isn't fully included into to_range, then we return to_range. That's because for now we don't have a way to track disjoined ranges. E.g. if we wanted to cast -1,10 into 0,255, we would need to represent a range union: [0,10] U 255,255

We also use this function to ensure that the result of an arithmetic operation on ranges didn't overflow/underflow.

rangeCmp :: Comparison -> Range -> Range -> Maybe Bool Source #

Compare two ranges

See Note [Value range analysis]