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

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.IR.Prop.Constants

Description

Possibly convenient facilities for constructing constants.

Synopsis

- class IsValue a where
  - value :: a -> PrimValue
- constant :: IsValue v => v -> SubExp
- intConst :: IntType -> Integer -> SubExp
- floatConst :: FloatType -> Double -> SubExp

# Documentation

class IsValue a where Source #

If a Haskell type is an instance of `IsValue`, it means that a value of that type can be converted to a Futhark `PrimValue`. This is intended to cut down on boilerplate when writing compiler code - for example, you'll quickly grow tired of writing `Constant (LogVal True) loc`.

Methods

value :: a -> PrimValue Source #

#### Instances

Instances details

IsValue Int16 Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: Int16 -> PrimValue Source #
IsValue Int32 Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: Int32 -> PrimValue Source #
IsValue Int64 Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: Int64 -> PrimValue Source #
IsValue Int8 Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: Int8 -> PrimValue Source #
IsValue Word16 Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: Word16 -> PrimValue Source #
IsValue Word32 Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: Word32 -> PrimValue Source #
IsValue Word64 Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: Word64 -> PrimValue Source #
IsValue Word8 Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: Word8 -> PrimValue Source #
IsValue FloatValue Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: FloatValue -> PrimValue Source #
IsValue IntValue Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: IntValue -> PrimValue Source #
IsValue PrimValue Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: PrimValue -> PrimValue Source #
IsValue Bool Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: Bool -> PrimValue Source #
IsValue Double Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: Double -> PrimValue Source #
IsValue Float Source # |
Instance details Defined in Futhark.IR.Prop.Constants Methods value :: Float -> PrimValue Source #

constant :: IsValue v => v -> SubExp Source #

Create a `Constant` `SubExp` containing the given value.

intConst :: IntType -> Integer -> SubExp Source #

Utility definition for reasons of type ambiguity.

floatConst :: FloatType -> Double -> SubExp Source #

Utility definition for reasons of type ambiguity.