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

Safe Haskell | Safe-Inferred
Language | GHC2021

Futhark.Analysis.PrimExp.Table

Contents

- Extensibility
- Testing

Description

Compute a mapping from variables to their corresponding (fully expanded) PrimExps.

Synopsis

- primExpTable :: (PrimExpAnalysis rep, RepTypes rep) => Prog rep -> PrimExpTable
- type PrimExpTable = Map VName (Maybe (PrimExp VName))
- class PrimExpAnalysis rep where
  - opPrimExp :: Scope rep -> Op rep -> State PrimExpTable ()
- stmToPrimExps :: forall rep. (PrimExpAnalysis rep, RepTypes rep) => Scope rep -> Stm rep -> State PrimExpTable ()

# Documentation

primExpTable :: (PrimExpAnalysis rep, RepTypes rep) => Prog rep -> PrimExpTable Source #

type PrimExpTable = Map VName (Maybe (PrimExp VName)) Source #

Maps variables to maybe PrimExps. Will map to nothing if it cannot be resolved to a PrimExp. For all uses of this analysis atm. a variable can be considered inscrutable if it cannot be resolved to a primexp.

# Extensibility

class PrimExpAnalysis rep where Source #

A class for extracting PrimExps from what is inside an op.

Methods

opPrimExp :: Scope rep -> Op rep -> State PrimExpTable () Source #

#### Instances

Instances details

PrimExpAnalysis GPU Source # |
Instance details Defined in Futhark.Analysis.PrimExp.Table Methods opPrimExp :: Scope GPU -> Op GPU -> State PrimExpTable () Source #
PrimExpAnalysis MC Source # |
Instance details Defined in Futhark.Analysis.PrimExp.Table Methods opPrimExp :: Scope MC -> Op MC -> State PrimExpTable () Source #

# Testing

stmToPrimExps :: forall rep. (PrimExpAnalysis rep, RepTypes rep) => Scope rep -> Stm rep -> State PrimExpTable () Source #

Adds a statement to the PrimExpTable. If it can't be resolved as a `PrimExp`, it will be added as `Nothing`.