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

Safe HaskellNone
LanguageHaskell2010

Futhark.Analysis.AlgSimplify

Synopsis

Documentation

data ScalExp Source #

Representation of a scalar expression, which is:

(i) an algebraic expression, e.g., min(a+b, a*b),

(ii) a relational expression: a+b < 5,

(iii) a logical expression: e1 and (not (a+b>5)

Instances
Eq ScalExp Source # 
Instance details

Defined in Futhark.Analysis.ScalExp

Methods

(==) :: ScalExp -> ScalExp -> Bool #

(/=) :: ScalExp -> ScalExp -> Bool #

Num ScalExp Source # 
Instance details

Defined in Futhark.Analysis.ScalExp

Ord ScalExp Source # 
Instance details

Defined in Futhark.Analysis.ScalExp

Show ScalExp Source # 
Instance details

Defined in Futhark.Analysis.ScalExp

Pretty ScalExp Source # 
Instance details

Defined in Futhark.Analysis.ScalExp

Methods

ppr :: ScalExp -> Doc #

pprPrec :: Int -> ScalExp -> Doc #

pprList :: [ScalExp] -> Doc #

FreeIn ScalExp Source # 
Instance details

Defined in Futhark.Analysis.ScalExp

Methods

freeIn :: ScalExp -> Names Source #

Substitute ScalExp Source # 
Instance details

Defined in Futhark.Analysis.ScalExp

Rename ScalExp Source # 
Instance details

Defined in Futhark.Analysis.ScalExp

simplify :: ScalExp -> RangesRep -> ScalExp Source #

Applies Simplification at Expression level:

mkSuffConds :: ScalExp -> RangesRep -> Either Error [[ScalExp]] Source #

Extracts sufficient conditions for a LTH0 relation to hold

type RangesRep = Map VName (Int, Maybe ScalExp, Maybe ScalExp) Source #

Ranges are inclusive.

ppRangesRep :: RangesRep -> String Source #

Prettyprint a RangesRep. Do not rely on the format of this string. Does not include the loop nesting depth information.

linFormScalE :: VName -> ScalExp -> RangesRep -> Either Error (Maybe (ScalExp, ScalExp)) Source #

Given a symbol i and a scalar expression e, it decomposes e = a*i + b and returns (a,b) if possible, otherwise Nothing.