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

Safe HaskellNone



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



data MUV Source

Untyped variables map.


type UeMap = (Hash, Bimap Int UeElem)Source

An entry in the Map.

type UeState a = State UeMap aSource

Wrapped in the State Monad.

recoverUE :: UeMap -> Hash -> UESource

Get a UE back out of the UeMap.

getUE :: Hash -> UeMap -> UeElemSource

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)Source

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)Source

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

maybeUpdate :: UeElem -> UeState HashSource

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]Source

The list of Hashes to adjacent upstream of a UE.

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

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

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

All array indexing subexpressions.