-- Local imports
import CoreShow
import Pretty
+import VHDLTypes -- For TypeState
data TransformState = TransformState {
tsUniqSupply_ :: UniqSupply.UniqSupply
, tsBindings_ :: Map.Map CoreBndr CoreExpr
, tsNormalized_ :: VarSet.VarSet -- ^ The binders that have been normalized
+ , tsType_ :: TypeState
}
+-- Create an (almost) empty TransformState, containing just a UniqSupply.
+emptyTransformState uniqSupply = TransformState uniqSupply Map.empty VarSet.emptyVarSet emptyTypeState
$( Data.Accessor.Template.deriveAccessors ''TransformState )
-- Adds a new global binding with the given value
addGlobalBind :: CoreBndr -> CoreExpr -> TransformSession ()
addGlobalBind bndr expr = modA tsBindings (Map.insert bndr expr)
+
+-- Returns a list of all global binders
+getGlobalBinders :: TransformSession [CoreBndr]
+getGlobalBinders = do
+ bindings <- getA tsBindings
+ return $ Map.keys bindings