Safe Haskell | None |
---|---|
Language | Haskell2010 |
Utility declarations for performing range analysis.
Synopsis
- type Bound = Maybe KnownBound
- data KnownBound
- boundToScalExp :: KnownBound -> Maybe ScalExp
- minimumBound :: Bound -> Bound -> Bound
- maximumBound :: Bound -> Bound -> Bound
- type Range = (Bound, Bound)
- unknownRange :: Range
- type ScalExpRange = (Maybe ScalExp, Maybe ScalExp)
- type Ranged lore = (Attributes lore, RangedOp (Op lore), RangeOf (LetAttr lore), RangesOf (BodyAttr lore))
- class RangeOf a where
- class RangesOf a where
- expRanges :: Ranged lore => Exp lore -> [Range]
- class IsOp op => RangedOp op where
- class RangedOp (OpWithRanges op) => CanBeRanged op where
- type OpWithRanges op :: *
- removeOpRanges :: OpWithRanges op -> op
- addOpRanges :: op -> OpWithRanges op
Documentation
type Bound = Maybe KnownBound Source #
A possibly undefined bound on a value.
data KnownBound Source #
A known bound on a value.
VarBound VName | Has the same bounds as this variable. VERY
IMPORTANT: this variable may be an array, so it
cannot be immediately translated to a |
MinimumBound KnownBound KnownBound | Bounded by the minimum of these two bounds. |
MaximumBound KnownBound KnownBound | Bounded by the maximum of these two bounds. |
ScalarBound ScalExp | Bounded by this scalar expression. |
Instances
boundToScalExp :: KnownBound -> Maybe ScalExp Source #
Convert the bound to a scalar expression if possible. This is
possible for all bounds that do not contain VarBound
s.
minimumBound :: Bound -> Bound -> Bound Source #
Construct a MinimumBound
from two possibly known bounds. The
resulting bound will be unknown unless both of the given Bound
s
are known. This may seem counterintuitive, but it actually makes
sense when you consider the task of combining the lower bounds for
two different flows of execution (like an if
expression). If we
only have knowledge about one of the branches, this means that we
have no useful information about the combined lower bound, as the
other branch may take any value.
maximumBound :: Bound -> Bound -> Bound Source #
Like minimumBound
, but constructs a MaximumBound
.
unknownRange :: Range Source #
A range in which both upper and lower bounds are 'Nothing.
type ScalExpRange = (Maybe ScalExp, Maybe ScalExp) Source #
The range as a pair of scalar expressions.
type Ranged lore = (Attributes lore, RangedOp (Op lore), RangeOf (LetAttr lore), RangesOf (BodyAttr lore)) Source #
The lore has embedded range information. Note that it may not be up to date, unless whatever maintains the syntax tree is careful.
class RangeOf a where Source #
Something that contains range information.
expRanges :: Ranged lore => Exp lore -> [Range] Source #
Ranges of the value parts of the expression.
class RangedOp (OpWithRanges op) => CanBeRanged op where Source #
type OpWithRanges op :: * Source #
removeOpRanges :: OpWithRanges op -> op Source #
addOpRanges :: op -> OpWithRanges op Source #