Safe Haskell | None |
---|
Language.Atom.UeMap
Description
Sharing for UEs, based on IntMaps. The idea is to share subexpressions of UE
s.
- data UeElem
- = MUVRef !MUV
- | MUConst !Const
- | MUCast !Type !Hash
- | MUAdd !Hash !Hash
- | MUSub !Hash !Hash
- | MUMul !Hash !Hash
- | MUDiv !Hash !Hash
- | MUMod !Hash !Hash
- | MUNot !Hash
- | MUAnd [Hash]
- | MUBWNot !Hash
- | MUBWAnd !Hash !Hash
- | MUBWOr !Hash !Hash
- | MUShift !Hash !Int
- | MUEq !Hash !Hash
- | MULt !Hash !Hash
- | MUMux !Hash !Hash !Hash
- | MUF2B !Hash
- | MUD2B !Hash
- | MUB2F !Hash
- | MUB2D !Hash
- | MUPi
- | MUExp !Hash
- | MULog !Hash
- | MUSqrt !Hash
- | MUPow !Hash !Hash
- | MUSin !Hash
- | MUAsin !Hash
- | MUCos !Hash
- | MUAcos !Hash
- | MUSinh !Hash
- | MUCosh !Hash
- | MUAsinh !Hash
- | MUAcosh !Hash
- | MUAtan !Hash
- | MUAtanh !Hash
- data MUV
- type UeMap = (Hash, Bimap Int UeElem)
- emptyMap :: UeMap
- type Hash = Int
- typeOf :: Hash -> UeMap -> Type
- type UeState a = State UeMap a
- recoverUE :: UeMap -> Hash -> UE
- getUE :: Hash -> UeMap -> UeElem
- newUE :: UE -> UeMap -> (Hash, UeMap)
- newUV :: UV -> UeMap -> (MUV, UeMap)
- maybeUpdate :: UeElem -> UeState Hash
- ueUpstream :: Hash -> UeMap -> [Hash]
- nearestUVs :: Hash -> UeMap -> [MUV]
- arrayIndices :: Hash -> UeMap -> [(UA, Hash)]
- isMathHCall :: UeElem -> Bool
Documentation
data UeElem
Corresponds to UE
s --- the elements in the sharing structure.
Constructors
MUVRef !MUV | |
MUConst !Const | |
MUCast !Type !Hash | |
MUAdd !Hash !Hash | |
MUSub !Hash !Hash | |
MUMul !Hash !Hash | |
MUDiv !Hash !Hash | |
MUMod !Hash !Hash | |
MUNot !Hash | |
MUAnd [Hash] | |
MUBWNot !Hash | |
MUBWAnd !Hash !Hash | |
MUBWOr !Hash !Hash | |
MUShift !Hash !Int | |
MUEq !Hash !Hash | |
MULt !Hash !Hash | |
MUMux !Hash !Hash !Hash | |
MUF2B !Hash | |
MUD2B !Hash | |
MUB2F !Hash | |
MUB2D !Hash | |
MUPi | |
MUExp !Hash | |
MULog !Hash | |
MUSqrt !Hash | |
MUPow !Hash !Hash | |
MUSin !Hash | |
MUAsin !Hash | |
MUCos !Hash | |
MUAcos !Hash | |
MUSinh !Hash | |
MUCosh !Hash | |
MUAsinh !Hash | |
MUAcosh !Hash | |
MUAtan !Hash | |
MUAtanh !Hash |
data MUV
Untyped variables map.
getUE :: Hash -> UeMap -> UeElem
Get the element associated with a Hash
value. It's an error if the
element is not in the 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.
isMathHCall :: UeElem -> Bool