futhark-0.9.1: An optimising compiler for a functional, array-oriented language.

Safe HaskellNone
LanguageHaskell2010

Futhark.Representation.AST.Attributes.Ranges

Description

Utility declarations for performing range analysis.

Synopsis

Documentation

type Bound = Maybe KnownBound Source #

A possibly undefined bound on a value.

data KnownBound Source #

A known bound on a value.

Constructors

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 ScalExp.

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
Eq KnownBound Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Ord KnownBound Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Show KnownBound Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Pretty KnownBound Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

FreeAttr KnownBound Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

FreeIn KnownBound Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Substitute KnownBound Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Rename KnownBound Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

RangeOf Range Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

rangeOf :: Range -> Range Source #

PrettyAnnot (PatElemT attr) => PrettyAnnot (PatElemT (Range, attr)) Source # 
Instance details

Defined in Futhark.Representation.Ranges

Methods

ppAnnot :: PatElemT (Range, attr) -> Maybe Doc Source #

RangesOf ([Range], attr) Source # 
Instance details

Defined in Futhark.Representation.Ranges

Methods

rangesOf :: ([Range], attr) -> [Range] Source #

RangeOf (Range, attr) Source # 
Instance details

Defined in Futhark.Representation.Ranges

Methods

rangeOf :: (Range, attr) -> Range Source #

boundToScalExp :: KnownBound -> Maybe ScalExp Source #

Convert the bound to a scalar expression if possible. This is possible for all bounds that do not contain VarBounds.

minimumBound :: Bound -> Bound -> Bound Source #

Construct a MinimumBound from two possibly known bounds. The resulting bound will be unknown unless both of the given Bounds 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.

type Range = (Bound, Bound) Source #

Upper and lower bound, both inclusive.

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.

Methods

rangeOf :: a -> Range Source #

The range of the argument element.

Instances
RangeOf SubExp Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

rangeOf :: SubExp -> Range Source #

RangeOf Range Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

rangeOf :: Range -> Range Source #

RangeOf attr => RangeOf (PatElemT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

rangeOf :: PatElemT attr -> Range Source #

RangeOf (Range, attr) Source # 
Instance details

Defined in Futhark.Representation.Ranges

Methods

rangeOf :: (Range, attr) -> Range Source #

RangeOf (VarWisdom, attr) Source # 
Instance details

Defined in Futhark.Optimise.Simplify.Lore

Methods

rangeOf :: (VarWisdom, attr) -> Range Source #

class RangesOf a where Source #

Something that contains range information for several things, most notably BodyT or PatternT.

Methods

rangesOf :: a -> [Range] Source #

The ranges of the argument.

Instances
RangeOf a => RangesOf [a] Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

rangesOf :: [a] -> [Range] Source #

Ranged lore => RangesOf (Body lore) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

rangesOf :: Body lore -> [Range] Source #

RangeOf attr => RangesOf (PatternT attr) Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

rangesOf :: PatternT attr -> [Range] Source #

RangesOf ([Range], attr) Source # 
Instance details

Defined in Futhark.Representation.Ranges

Methods

rangesOf :: ([Range], attr) -> [Range] Source #

expRanges :: Ranged lore => Exp lore -> [Range] Source #

Ranges of the value parts of the expression.

class IsOp op => RangedOp op where Source #

Methods

opRanges :: op -> [Range] Source #

Instances
RangedOp () Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Methods

opRanges :: () -> [Range] Source #

Ranged inner => RangedOp (SOAC inner) Source # 
Instance details

Defined in Futhark.Representation.SOACS.SOAC

Methods

opRanges :: SOAC inner -> [Range] Source #

Ranged inner => RangedOp (KernelExp inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.KernelExp

Methods

opRanges :: KernelExp inner -> [Range] Source #

Ranged inner => RangedOp (Kernel inner) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Methods

opRanges :: Kernel inner -> [Range] Source #

RangedOp inner => RangedOp (MemOp inner) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Methods

opRanges :: MemOp inner -> [Range] Source #

class RangedOp (OpWithRanges op) => CanBeRanged op where Source #

Associated Types

type OpWithRanges op :: * Source #

Instances
CanBeRanged () Source # 
Instance details

Defined in Futhark.Representation.AST.Attributes.Ranges

Associated Types

type OpWithRanges () :: Type Source #

(Attributes lore, CanBeRanged (Op lore)) => CanBeRanged (SOAC lore) Source # 
Instance details

Defined in Futhark.Representation.SOACS.SOAC

Associated Types

type OpWithRanges (SOAC lore) :: Type Source #

Methods

removeOpRanges :: OpWithRanges (SOAC lore) -> SOAC lore Source #

addOpRanges :: SOAC lore -> OpWithRanges (SOAC lore) Source #

(Attributes lore, Attributes (Ranges lore), CanBeRanged (Op lore)) => CanBeRanged (KernelExp lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.KernelExp

Associated Types

type OpWithRanges (KernelExp lore) :: Type Source #

(Attributes lore, CanBeRanged (Op lore)) => CanBeRanged (Kernel lore) Source # 
Instance details

Defined in Futhark.Representation.Kernels.Kernel

Associated Types

type OpWithRanges (Kernel lore) :: Type Source #

CanBeRanged inner => CanBeRanged (MemOp inner) Source # 
Instance details

Defined in Futhark.Representation.ExplicitMemory

Associated Types

type OpWithRanges (MemOp inner) :: Type Source #

Methods

removeOpRanges :: OpWithRanges (MemOp inner) -> MemOp inner Source #

addOpRanges :: MemOp inner -> OpWithRanges (MemOp inner) Source #