atom-1.0.9: A DSL for embedded hard realtime applications.

Safe HaskellNone

Language.Atom.UeMap

Description

Sharing for UEs, based on IntMaps. The idea is to share subexpressions of UEs.

Synopsis

Documentation

data MUV

Untyped variables map.

Instances

type UeMap = (Hash, Bimap Int UeElem)

An entry in the Map.

type Hash = Int

type UeState a = State UeMap a

Wrapped in the State Monad.

recoverUE :: UeMap -> Hash -> UE

Get a UE back out of the UeMap.

getUE :: Hash -> UeMap -> UeElem

Get the element associated with a Hash value. It's an error if the element is not in the map.

newUE :: UE -> UeMap -> (Hash, UeMap)

Put a new UE in the map, unless it's already in there, and return the hash pointing to the UE and a new map.

newUV :: UV -> UeMap -> (MUV, UeMap)

Transforms a UV into a MUV, returning the possibly updated map.

maybeUpdate :: UeElem -> UeState Hash

Lookup an element in the map, and if it's in there, do nothing, but return its hash value. Otherwise, update the map and return the new hash value for the inserted element.

ueUpstream :: Hash -> UeMap -> [Hash]

The list of Hashes to adjacent upstream of a UE.

nearestUVs :: Hash -> UeMap -> [MUV]

The list of all UVs that directly control the value of an expression.

arrayIndices :: Hash -> UeMap -> [(UA, Hash)]

All array indexing subexpressions.