{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable, StandaloneDeriving, DeriveGeneric, TupleSections #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module Language.Fortran.Analysis
( initAnalysis, stripAnalysis, Analysis(..), Constant(..)
, varName, srcName, lvVarName, lvSrcName, isNamedExpression
, genVar, puName, puSrcName, blockRhsExprs, rhsExprs
, ModEnv, NameType(..), IDType(..), ConstructType(..), BaseType(..)
, lhsExprs, isLExpr, allVars, analyseAllLhsVars, analyseAllLhsVars1, allLhsVars
, blockVarUses, blockVarDefs
, BB, BBNode, BBGr(..), bbgrMap, bbgrMapM, bbgrEmpty
, TransFunc, TransFuncM )
where
import Prelude hiding (exp)
import Language.Fortran.Util.Position (SrcSpan)
import Data.Generics.Uniplate.Data
import Data.Data
import Language.Fortran.AST
import Language.Fortran.LValue
import Data.Graph.Inductive (Node, empty)
import Data.Graph.Inductive.PatriciaTree (Gr)
import Text.PrettyPrint.GenericPretty
import Text.PrettyPrint hiding (empty, isEmpty)
import qualified Data.Map.Strict as M
import Data.Maybe
import Data.Binary
import Language.Fortran.Intrinsics (getIntrinsicDefsUses, allIntrinsics)
import Data.Bifunctor (first)
type BB a = [Block a]
data BBGr a = BBGr { BBGr a -> Gr (BB a) ()
bbgrGr :: Gr (BB a) ()
, BBGr a -> [Node]
bbgrEntries :: [Node]
, BBGr a -> [Node]
bbgrExits :: [Node]
}
deriving (Typeable (BBGr a)
DataType
Constr
Typeable (BBGr a)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BBGr a -> c (BBGr a))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BBGr a))
-> (BBGr a -> Constr)
-> (BBGr a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (BBGr a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (BBGr a)))
-> ((forall b. Data b => b -> b) -> BBGr a -> BBGr a)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BBGr a -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BBGr a -> r)
-> (forall u. (forall d. Data d => d -> u) -> BBGr a -> [u])
-> (forall u. Node -> (forall d. Data d => d -> u) -> BBGr a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a))
-> Data (BBGr a)
BBGr a -> DataType
BBGr a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (BBGr a))
(forall b. Data b => b -> b) -> BBGr a -> BBGr a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BBGr a -> c (BBGr a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BBGr a)
forall a. Data a => Typeable (BBGr a)
forall a. Data a => BBGr a -> DataType
forall a. Data a => BBGr a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> BBGr a -> BBGr a
forall a u.
Data a =>
Node -> (forall d. Data d => d -> u) -> BBGr a -> u
forall a u. Data a => (forall d. Data d => d -> u) -> BBGr a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BBGr a -> r
forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BBGr a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BBGr a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BBGr a -> c (BBGr a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (BBGr a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (BBGr a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Node -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Node -> (forall d. Data d => d -> u) -> BBGr a -> u
forall u. (forall d. Data d => d -> u) -> BBGr a -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BBGr a -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BBGr a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BBGr a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BBGr a -> c (BBGr a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (BBGr a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (BBGr a))
$cBBGr :: Constr
$tBBGr :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a)
gmapMp :: (forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a)
gmapM :: (forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> BBGr a -> m (BBGr a)
gmapQi :: Node -> (forall d. Data d => d -> u) -> BBGr a -> u
$cgmapQi :: forall a u.
Data a =>
Node -> (forall d. Data d => d -> u) -> BBGr a -> u
gmapQ :: (forall d. Data d => d -> u) -> BBGr a -> [u]
$cgmapQ :: forall a u. Data a => (forall d. Data d => d -> u) -> BBGr a -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BBGr a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BBGr a -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BBGr a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BBGr a -> r
gmapT :: (forall b. Data b => b -> b) -> BBGr a -> BBGr a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> BBGr a -> BBGr a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (BBGr a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (BBGr a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (BBGr a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (BBGr a))
dataTypeOf :: BBGr a -> DataType
$cdataTypeOf :: forall a. Data a => BBGr a -> DataType
toConstr :: BBGr a -> Constr
$ctoConstr :: forall a. Data a => BBGr a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BBGr a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (BBGr a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BBGr a -> c (BBGr a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BBGr a -> c (BBGr a)
$cp1Data :: forall a. Data a => Typeable (BBGr a)
Data, Node -> BBGr a -> ShowS
[BBGr a] -> ShowS
BBGr a -> String
(Node -> BBGr a -> ShowS)
-> (BBGr a -> String) -> ([BBGr a] -> ShowS) -> Show (BBGr a)
forall a. Show a => Node -> BBGr a -> ShowS
forall a. Show a => [BBGr a] -> ShowS
forall a. Show a => BBGr a -> String
forall a.
(Node -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BBGr a] -> ShowS
$cshowList :: forall a. Show a => [BBGr a] -> ShowS
show :: BBGr a -> String
$cshow :: forall a. Show a => BBGr a -> String
showsPrec :: Node -> BBGr a -> ShowS
$cshowsPrec :: forall a. Show a => Node -> BBGr a -> ShowS
Show, BBGr a -> BBGr a -> Bool
(BBGr a -> BBGr a -> Bool)
-> (BBGr a -> BBGr a -> Bool) -> Eq (BBGr a)
forall a. Eq a => BBGr a -> BBGr a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BBGr a -> BBGr a -> Bool
$c/= :: forall a. Eq a => BBGr a -> BBGr a -> Bool
== :: BBGr a -> BBGr a -> Bool
$c== :: forall a. Eq a => BBGr a -> BBGr a -> Bool
Eq, (forall x. BBGr a -> Rep (BBGr a) x)
-> (forall x. Rep (BBGr a) x -> BBGr a) -> Generic (BBGr a)
forall x. Rep (BBGr a) x -> BBGr a
forall x. BBGr a -> Rep (BBGr a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (BBGr a) x -> BBGr a
forall a x. BBGr a -> Rep (BBGr a) x
$cto :: forall a x. Rep (BBGr a) x -> BBGr a
$cfrom :: forall a x. BBGr a -> Rep (BBGr a) x
Generic)
type BBNode = Int
bbgrEmpty :: BBGr a
bbgrEmpty :: BBGr a
bbgrEmpty = Gr (BB a) () -> [Node] -> [Node] -> BBGr a
forall a. Gr (BB a) () -> [Node] -> [Node] -> BBGr a
BBGr Gr (BB a) ()
forall (gr :: * -> * -> *) a b. Graph gr => gr a b
empty [] []
bbgrMap :: (Gr (BB a) () -> Gr (BB b) ()) -> BBGr a -> BBGr b
bbgrMap :: (Gr (BB a) () -> Gr (BB b) ()) -> BBGr a -> BBGr b
bbgrMap Gr (BB a) () -> Gr (BB b) ()
f BBGr a
bb = BBGr a
bb { bbgrGr :: Gr (BB b) ()
bbgrGr = Gr (BB a) () -> Gr (BB b) ()
f (BBGr a -> Gr (BB a) ()
forall a. BBGr a -> Gr (BB a) ()
bbgrGr BBGr a
bb) }
bbgrMapM :: Monad m => (Gr (BB a1) () -> m (Gr (BB a2) ())) -> BBGr a1 -> m (BBGr a2)
bbgrMapM :: (Gr (BB a1) () -> m (Gr (BB a2) ())) -> BBGr a1 -> m (BBGr a2)
bbgrMapM Gr (BB a1) () -> m (Gr (BB a2) ())
f BBGr a1
bb = do
Gr (BB a2) ()
x <- Gr (BB a1) () -> m (Gr (BB a2) ())
f (BBGr a1 -> Gr (BB a1) ()
forall a. BBGr a -> Gr (BB a) ()
bbgrGr BBGr a1
bb)
BBGr a2 -> m (BBGr a2)
forall (m :: * -> *) a. Monad m => a -> m a
return (BBGr a2 -> m (BBGr a2)) -> BBGr a2 -> m (BBGr a2)
forall a b. (a -> b) -> a -> b
$ BBGr a1
bb { bbgrGr :: Gr (BB a2) ()
bbgrGr = Gr (BB a2) ()
x }
deriving instance (Typeable a, Typeable b) => Typeable (Gr a b)
instance (Typeable a, Typeable b) => Data (Gr a b) where
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Gr a b -> c (Gr a b)
gfoldl forall d b. Data d => c (d -> b) -> d -> c b
_k forall g. g -> c g
z = Gr a b -> c (Gr a b)
forall g. g -> c g
z
toConstr :: Gr a b -> Constr
toConstr Gr a b
_ = String -> Constr
forall a. HasCallStack => String -> a
error String
"toConstr"
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Gr a b)
gunfold forall b r. Data b => c (b -> r) -> c r
_ forall r. r -> c r
_ = String -> Constr -> c (Gr a b)
forall a. HasCallStack => String -> a
error String
"gunfold"
dataTypeOf :: Gr a b -> DataType
dataTypeOf Gr a b
_ = String -> DataType
mkNoRepType String
"Gr"
type TransFunc f g a = (f (Analysis a) -> f (Analysis a)) -> g (Analysis a) -> g (Analysis a)
type TransFuncM m f g a = (f (Analysis a) -> m (f (Analysis a))) -> g (Analysis a) -> m (g (Analysis a))
data NameType = NTSubprogram | NTVariable | NTIntrinsic deriving (Node -> NameType -> ShowS
[NameType] -> ShowS
NameType -> String
(Node -> NameType -> ShowS)
-> (NameType -> String) -> ([NameType] -> ShowS) -> Show NameType
forall a.
(Node -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NameType] -> ShowS
$cshowList :: [NameType] -> ShowS
show :: NameType -> String
$cshow :: NameType -> String
showsPrec :: Node -> NameType -> ShowS
$cshowsPrec :: Node -> NameType -> ShowS
Show, NameType -> NameType -> Bool
(NameType -> NameType -> Bool)
-> (NameType -> NameType -> Bool) -> Eq NameType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NameType -> NameType -> Bool
$c/= :: NameType -> NameType -> Bool
== :: NameType -> NameType -> Bool
$c== :: NameType -> NameType -> Bool
Eq, Eq NameType
Eq NameType
-> (NameType -> NameType -> Ordering)
-> (NameType -> NameType -> Bool)
-> (NameType -> NameType -> Bool)
-> (NameType -> NameType -> Bool)
-> (NameType -> NameType -> Bool)
-> (NameType -> NameType -> NameType)
-> (NameType -> NameType -> NameType)
-> Ord NameType
NameType -> NameType -> Bool
NameType -> NameType -> Ordering
NameType -> NameType -> NameType
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: NameType -> NameType -> NameType
$cmin :: NameType -> NameType -> NameType
max :: NameType -> NameType -> NameType
$cmax :: NameType -> NameType -> NameType
>= :: NameType -> NameType -> Bool
$c>= :: NameType -> NameType -> Bool
> :: NameType -> NameType -> Bool
$c> :: NameType -> NameType -> Bool
<= :: NameType -> NameType -> Bool
$c<= :: NameType -> NameType -> Bool
< :: NameType -> NameType -> Bool
$c< :: NameType -> NameType -> Bool
compare :: NameType -> NameType -> Ordering
$ccompare :: NameType -> NameType -> Ordering
$cp1Ord :: Eq NameType
Ord, Typeable NameType
DataType
Constr
Typeable NameType
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameType -> c NameType)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameType)
-> (NameType -> Constr)
-> (NameType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NameType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameType))
-> ((forall b. Data b => b -> b) -> NameType -> NameType)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r)
-> (forall u. (forall d. Data d => d -> u) -> NameType -> [u])
-> (forall u.
Node -> (forall d. Data d => d -> u) -> NameType -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType)
-> Data NameType
NameType -> DataType
NameType -> Constr
(forall b. Data b => b -> b) -> NameType -> NameType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameType -> c NameType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameType
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Node -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Node -> (forall d. Data d => d -> u) -> NameType -> u
forall u. (forall d. Data d => d -> u) -> NameType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameType -> c NameType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NameType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameType)
$cNTIntrinsic :: Constr
$cNTVariable :: Constr
$cNTSubprogram :: Constr
$tNameType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NameType -> m NameType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType
gmapMp :: (forall d. Data d => d -> m d) -> NameType -> m NameType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType
gmapM :: (forall d. Data d => d -> m d) -> NameType -> m NameType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NameType -> m NameType
gmapQi :: Node -> (forall d. Data d => d -> u) -> NameType -> u
$cgmapQi :: forall u. Node -> (forall d. Data d => d -> u) -> NameType -> u
gmapQ :: (forall d. Data d => d -> u) -> NameType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> NameType -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NameType -> r
gmapT :: (forall b. Data b => b -> b) -> NameType -> NameType
$cgmapT :: (forall b. Data b => b -> b) -> NameType -> NameType
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NameType)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c NameType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NameType)
dataTypeOf :: NameType -> DataType
$cdataTypeOf :: NameType -> DataType
toConstr :: NameType -> Constr
$ctoConstr :: NameType -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NameType
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameType -> c NameType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NameType -> c NameType
$cp1Data :: Typeable NameType
Data, Typeable, (forall x. NameType -> Rep NameType x)
-> (forall x. Rep NameType x -> NameType) -> Generic NameType
forall x. Rep NameType x -> NameType
forall x. NameType -> Rep NameType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NameType x -> NameType
$cfrom :: forall x. NameType -> Rep NameType x
Generic)
instance Binary NameType
instance Out NameType
type ModEnv = M.Map String (String, NameType)
data ConstructType =
CTFunction
| CTSubroutine
| CTExternal
| CTVariable
| CTArray [(Maybe Int, Maybe Int)]
| CTParameter
| CTIntrinsic
deriving (Eq ConstructType
Eq ConstructType
-> (ConstructType -> ConstructType -> Ordering)
-> (ConstructType -> ConstructType -> Bool)
-> (ConstructType -> ConstructType -> Bool)
-> (ConstructType -> ConstructType -> Bool)
-> (ConstructType -> ConstructType -> Bool)
-> (ConstructType -> ConstructType -> ConstructType)
-> (ConstructType -> ConstructType -> ConstructType)
-> Ord ConstructType
ConstructType -> ConstructType -> Bool
ConstructType -> ConstructType -> Ordering
ConstructType -> ConstructType -> ConstructType
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ConstructType -> ConstructType -> ConstructType
$cmin :: ConstructType -> ConstructType -> ConstructType
max :: ConstructType -> ConstructType -> ConstructType
$cmax :: ConstructType -> ConstructType -> ConstructType
>= :: ConstructType -> ConstructType -> Bool
$c>= :: ConstructType -> ConstructType -> Bool
> :: ConstructType -> ConstructType -> Bool
$c> :: ConstructType -> ConstructType -> Bool
<= :: ConstructType -> ConstructType -> Bool
$c<= :: ConstructType -> ConstructType -> Bool
< :: ConstructType -> ConstructType -> Bool
$c< :: ConstructType -> ConstructType -> Bool
compare :: ConstructType -> ConstructType -> Ordering
$ccompare :: ConstructType -> ConstructType -> Ordering
$cp1Ord :: Eq ConstructType
Ord, ConstructType -> ConstructType -> Bool
(ConstructType -> ConstructType -> Bool)
-> (ConstructType -> ConstructType -> Bool) -> Eq ConstructType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConstructType -> ConstructType -> Bool
$c/= :: ConstructType -> ConstructType -> Bool
== :: ConstructType -> ConstructType -> Bool
$c== :: ConstructType -> ConstructType -> Bool
Eq, Node -> ConstructType -> ShowS
[ConstructType] -> ShowS
ConstructType -> String
(Node -> ConstructType -> ShowS)
-> (ConstructType -> String)
-> ([ConstructType] -> ShowS)
-> Show ConstructType
forall a.
(Node -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConstructType] -> ShowS
$cshowList :: [ConstructType] -> ShowS
show :: ConstructType -> String
$cshow :: ConstructType -> String
showsPrec :: Node -> ConstructType -> ShowS
$cshowsPrec :: Node -> ConstructType -> ShowS
Show, Typeable ConstructType
DataType
Constr
Typeable ConstructType
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstructType -> c ConstructType)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConstructType)
-> (ConstructType -> Constr)
-> (ConstructType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ConstructType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ConstructType))
-> ((forall b. Data b => b -> b) -> ConstructType -> ConstructType)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstructType -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstructType -> r)
-> (forall u. (forall d. Data d => d -> u) -> ConstructType -> [u])
-> (forall u.
Node -> (forall d. Data d => d -> u) -> ConstructType -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConstructType -> m ConstructType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstructType -> m ConstructType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstructType -> m ConstructType)
-> Data ConstructType
ConstructType -> DataType
ConstructType -> Constr
(forall b. Data b => b -> b) -> ConstructType -> ConstructType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstructType -> c ConstructType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConstructType
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Node -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Node -> (forall d. Data d => d -> u) -> ConstructType -> u
forall u. (forall d. Data d => d -> u) -> ConstructType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstructType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstructType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConstructType -> m ConstructType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstructType -> m ConstructType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConstructType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstructType -> c ConstructType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ConstructType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ConstructType)
$cCTIntrinsic :: Constr
$cCTParameter :: Constr
$cCTArray :: Constr
$cCTVariable :: Constr
$cCTExternal :: Constr
$cCTSubroutine :: Constr
$cCTFunction :: Constr
$tConstructType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ConstructType -> m ConstructType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstructType -> m ConstructType
gmapMp :: (forall d. Data d => d -> m d) -> ConstructType -> m ConstructType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ConstructType -> m ConstructType
gmapM :: (forall d. Data d => d -> m d) -> ConstructType -> m ConstructType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ConstructType -> m ConstructType
gmapQi :: Node -> (forall d. Data d => d -> u) -> ConstructType -> u
$cgmapQi :: forall u.
Node -> (forall d. Data d => d -> u) -> ConstructType -> u
gmapQ :: (forall d. Data d => d -> u) -> ConstructType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ConstructType -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstructType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ConstructType -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstructType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ConstructType -> r
gmapT :: (forall b. Data b => b -> b) -> ConstructType -> ConstructType
$cgmapT :: (forall b. Data b => b -> b) -> ConstructType -> ConstructType
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ConstructType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ConstructType)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ConstructType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ConstructType)
dataTypeOf :: ConstructType -> DataType
$cdataTypeOf :: ConstructType -> DataType
toConstr :: ConstructType -> Constr
$ctoConstr :: ConstructType -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConstructType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ConstructType
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstructType -> c ConstructType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ConstructType -> c ConstructType
$cp1Data :: Typeable ConstructType
Data, Typeable, (forall x. ConstructType -> Rep ConstructType x)
-> (forall x. Rep ConstructType x -> ConstructType)
-> Generic ConstructType
forall x. Rep ConstructType x -> ConstructType
forall x. ConstructType -> Rep ConstructType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConstructType x -> ConstructType
$cfrom :: forall x. ConstructType -> Rep ConstructType x
Generic)
instance Out ConstructType
instance Binary ConstructType
data IDType = IDType
{ IDType -> Maybe BaseType
idVType :: Maybe BaseType
, IDType -> Maybe ConstructType
idCType :: Maybe ConstructType }
deriving (Eq IDType
Eq IDType
-> (IDType -> IDType -> Ordering)
-> (IDType -> IDType -> Bool)
-> (IDType -> IDType -> Bool)
-> (IDType -> IDType -> Bool)
-> (IDType -> IDType -> Bool)
-> (IDType -> IDType -> IDType)
-> (IDType -> IDType -> IDType)
-> Ord IDType
IDType -> IDType -> Bool
IDType -> IDType -> Ordering
IDType -> IDType -> IDType
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: IDType -> IDType -> IDType
$cmin :: IDType -> IDType -> IDType
max :: IDType -> IDType -> IDType
$cmax :: IDType -> IDType -> IDType
>= :: IDType -> IDType -> Bool
$c>= :: IDType -> IDType -> Bool
> :: IDType -> IDType -> Bool
$c> :: IDType -> IDType -> Bool
<= :: IDType -> IDType -> Bool
$c<= :: IDType -> IDType -> Bool
< :: IDType -> IDType -> Bool
$c< :: IDType -> IDType -> Bool
compare :: IDType -> IDType -> Ordering
$ccompare :: IDType -> IDType -> Ordering
$cp1Ord :: Eq IDType
Ord, IDType -> IDType -> Bool
(IDType -> IDType -> Bool)
-> (IDType -> IDType -> Bool) -> Eq IDType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IDType -> IDType -> Bool
$c/= :: IDType -> IDType -> Bool
== :: IDType -> IDType -> Bool
$c== :: IDType -> IDType -> Bool
Eq, Node -> IDType -> ShowS
[IDType] -> ShowS
IDType -> String
(Node -> IDType -> ShowS)
-> (IDType -> String) -> ([IDType] -> ShowS) -> Show IDType
forall a.
(Node -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IDType] -> ShowS
$cshowList :: [IDType] -> ShowS
show :: IDType -> String
$cshow :: IDType -> String
showsPrec :: Node -> IDType -> ShowS
$cshowsPrec :: Node -> IDType -> ShowS
Show, Typeable IDType
DataType
Constr
Typeable IDType
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IDType -> c IDType)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IDType)
-> (IDType -> Constr)
-> (IDType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IDType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IDType))
-> ((forall b. Data b => b -> b) -> IDType -> IDType)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> IDType -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> IDType -> r)
-> (forall u. (forall d. Data d => d -> u) -> IDType -> [u])
-> (forall u. Node -> (forall d. Data d => d -> u) -> IDType -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IDType -> m IDType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IDType -> m IDType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IDType -> m IDType)
-> Data IDType
IDType -> DataType
IDType -> Constr
(forall b. Data b => b -> b) -> IDType -> IDType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IDType -> c IDType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IDType
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Node -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Node -> (forall d. Data d => d -> u) -> IDType -> u
forall u. (forall d. Data d => d -> u) -> IDType -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IDType -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IDType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IDType -> m IDType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IDType -> m IDType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IDType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IDType -> c IDType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IDType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IDType)
$cIDType :: Constr
$tIDType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> IDType -> m IDType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IDType -> m IDType
gmapMp :: (forall d. Data d => d -> m d) -> IDType -> m IDType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> IDType -> m IDType
gmapM :: (forall d. Data d => d -> m d) -> IDType -> m IDType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> IDType -> m IDType
gmapQi :: Node -> (forall d. Data d => d -> u) -> IDType -> u
$cgmapQi :: forall u. Node -> (forall d. Data d => d -> u) -> IDType -> u
gmapQ :: (forall d. Data d => d -> u) -> IDType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> IDType -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IDType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IDType -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IDType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IDType -> r
gmapT :: (forall b. Data b => b -> b) -> IDType -> IDType
$cgmapT :: (forall b. Data b => b -> b) -> IDType -> IDType
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IDType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IDType)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c IDType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c IDType)
dataTypeOf :: IDType -> DataType
$cdataTypeOf :: IDType -> DataType
toConstr :: IDType -> Constr
$ctoConstr :: IDType -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IDType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c IDType
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IDType -> c IDType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> IDType -> c IDType
$cp1Data :: Typeable IDType
Data, Typeable, (forall x. IDType -> Rep IDType x)
-> (forall x. Rep IDType x -> IDType) -> Generic IDType
forall x. Rep IDType x -> IDType
forall x. IDType -> Rep IDType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IDType x -> IDType
$cfrom :: forall x. IDType -> Rep IDType x
Generic)
instance Out IDType
instance Binary IDType
data Constant
= ConstInt Integer
| ConstUninterpInt String
| ConstUninterpReal String
| ConstBinary BinaryOp Constant Constant
| ConstUnary UnaryOp Constant
deriving (Node -> Constant -> ShowS
[Constant] -> ShowS
Constant -> String
(Node -> Constant -> ShowS)
-> (Constant -> String) -> ([Constant] -> ShowS) -> Show Constant
forall a.
(Node -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Constant] -> ShowS
$cshowList :: [Constant] -> ShowS
show :: Constant -> String
$cshow :: Constant -> String
showsPrec :: Node -> Constant -> ShowS
$cshowsPrec :: Node -> Constant -> ShowS
Show, Eq Constant
Eq Constant
-> (Constant -> Constant -> Ordering)
-> (Constant -> Constant -> Bool)
-> (Constant -> Constant -> Bool)
-> (Constant -> Constant -> Bool)
-> (Constant -> Constant -> Bool)
-> (Constant -> Constant -> Constant)
-> (Constant -> Constant -> Constant)
-> Ord Constant
Constant -> Constant -> Bool
Constant -> Constant -> Ordering
Constant -> Constant -> Constant
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Constant -> Constant -> Constant
$cmin :: Constant -> Constant -> Constant
max :: Constant -> Constant -> Constant
$cmax :: Constant -> Constant -> Constant
>= :: Constant -> Constant -> Bool
$c>= :: Constant -> Constant -> Bool
> :: Constant -> Constant -> Bool
$c> :: Constant -> Constant -> Bool
<= :: Constant -> Constant -> Bool
$c<= :: Constant -> Constant -> Bool
< :: Constant -> Constant -> Bool
$c< :: Constant -> Constant -> Bool
compare :: Constant -> Constant -> Ordering
$ccompare :: Constant -> Constant -> Ordering
$cp1Ord :: Eq Constant
Ord, Constant -> Constant -> Bool
(Constant -> Constant -> Bool)
-> (Constant -> Constant -> Bool) -> Eq Constant
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Constant -> Constant -> Bool
$c/= :: Constant -> Constant -> Bool
== :: Constant -> Constant -> Bool
$c== :: Constant -> Constant -> Bool
Eq, Typeable, (forall x. Constant -> Rep Constant x)
-> (forall x. Rep Constant x -> Constant) -> Generic Constant
forall x. Rep Constant x -> Constant
forall x. Constant -> Rep Constant x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Constant x -> Constant
$cfrom :: forall x. Constant -> Rep Constant x
Generic, Typeable Constant
DataType
Constr
Typeable Constant
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Constant -> c Constant)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Constant)
-> (Constant -> Constr)
-> (Constant -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Constant))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Constant))
-> ((forall b. Data b => b -> b) -> Constant -> Constant)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Constant -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Constant -> r)
-> (forall u. (forall d. Data d => d -> u) -> Constant -> [u])
-> (forall u.
Node -> (forall d. Data d => d -> u) -> Constant -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Constant -> m Constant)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Constant -> m Constant)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Constant -> m Constant)
-> Data Constant
Constant -> DataType
Constant -> Constr
(forall b. Data b => b -> b) -> Constant -> Constant
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Constant -> c Constant
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Constant
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Node -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Node -> (forall d. Data d => d -> u) -> Constant -> u
forall u. (forall d. Data d => d -> u) -> Constant -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Constant -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Constant -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Constant -> m Constant
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Constant -> m Constant
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Constant
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Constant -> c Constant
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Constant)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Constant)
$cConstUnary :: Constr
$cConstBinary :: Constr
$cConstUninterpReal :: Constr
$cConstUninterpInt :: Constr
$cConstInt :: Constr
$tConstant :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Constant -> m Constant
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Constant -> m Constant
gmapMp :: (forall d. Data d => d -> m d) -> Constant -> m Constant
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Constant -> m Constant
gmapM :: (forall d. Data d => d -> m d) -> Constant -> m Constant
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Constant -> m Constant
gmapQi :: Node -> (forall d. Data d => d -> u) -> Constant -> u
$cgmapQi :: forall u. Node -> (forall d. Data d => d -> u) -> Constant -> u
gmapQ :: (forall d. Data d => d -> u) -> Constant -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Constant -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Constant -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Constant -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Constant -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Constant -> r
gmapT :: (forall b. Data b => b -> b) -> Constant -> Constant
$cgmapT :: (forall b. Data b => b -> b) -> Constant -> Constant
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Constant)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Constant)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Constant)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Constant)
dataTypeOf :: Constant -> DataType
$cdataTypeOf :: Constant -> DataType
toConstr :: Constant -> Constr
$ctoConstr :: Constant -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Constant
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Constant
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Constant -> c Constant
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Constant -> c Constant
$cp1Data :: Typeable Constant
Data)
instance Out Constant
instance Binary Constant
data Analysis a = Analysis
{ Analysis a -> a
prevAnnotation :: a
, Analysis a -> Maybe String
uniqueName :: Maybe String
, Analysis a -> Maybe String
sourceName :: Maybe String
, Analysis a -> Maybe (BBGr (Analysis a))
bBlocks :: Maybe (BBGr (Analysis a))
, Analysis a -> Maybe Node
insLabel :: Maybe Int
, Analysis a -> Maybe ModEnv
moduleEnv :: Maybe ModEnv
, Analysis a -> Maybe IDType
idType :: Maybe IDType
, Analysis a -> [String]
allLhsVarsAnn :: [Name]
, Analysis a -> Maybe Constant
constExp :: Maybe Constant
}
deriving (Typeable (Analysis a)
DataType
Constr
Typeable (Analysis a)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Analysis a -> c (Analysis a))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Analysis a))
-> (Analysis a -> Constr)
-> (Analysis a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Analysis a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Analysis a)))
-> ((forall b. Data b => b -> b) -> Analysis a -> Analysis a)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Analysis a -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Analysis a -> r)
-> (forall u. (forall d. Data d => d -> u) -> Analysis a -> [u])
-> (forall u.
Node -> (forall d. Data d => d -> u) -> Analysis a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a))
-> Data (Analysis a)
Analysis a -> DataType
Analysis a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (Analysis a))
(forall b. Data b => b -> b) -> Analysis a -> Analysis a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Analysis a -> c (Analysis a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Analysis a)
forall a. Data a => Typeable (Analysis a)
forall a. Data a => Analysis a -> DataType
forall a. Data a => Analysis a -> Constr
forall a.
Data a =>
(forall b. Data b => b -> b) -> Analysis a -> Analysis a
forall a u.
Data a =>
Node -> (forall d. Data d => d -> u) -> Analysis a -> u
forall a u.
Data a =>
(forall d. Data d => d -> u) -> Analysis a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Analysis a -> r
forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Analysis a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Analysis a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Analysis a -> c (Analysis a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Analysis a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Analysis a))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Node -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Node -> (forall d. Data d => d -> u) -> Analysis a -> u
forall u. (forall d. Data d => d -> u) -> Analysis a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Analysis a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Analysis a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Analysis a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Analysis a -> c (Analysis a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Analysis a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Analysis a))
$cAnalysis :: Constr
$tAnalysis :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a)
gmapMp :: (forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a)
gmapM :: (forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> Analysis a -> m (Analysis a)
gmapQi :: Node -> (forall d. Data d => d -> u) -> Analysis a -> u
$cgmapQi :: forall a u.
Data a =>
Node -> (forall d. Data d => d -> u) -> Analysis a -> u
gmapQ :: (forall d. Data d => d -> u) -> Analysis a -> [u]
$cgmapQ :: forall a u.
Data a =>
(forall d. Data d => d -> u) -> Analysis a -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Analysis a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Analysis a -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Analysis a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Analysis a -> r
gmapT :: (forall b. Data b => b -> b) -> Analysis a -> Analysis a
$cgmapT :: forall a.
Data a =>
(forall b. Data b => b -> b) -> Analysis a -> Analysis a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Analysis a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Analysis a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Analysis a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Analysis a))
dataTypeOf :: Analysis a -> DataType
$cdataTypeOf :: forall a. Data a => Analysis a -> DataType
toConstr :: Analysis a -> Constr
$ctoConstr :: forall a. Data a => Analysis a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Analysis a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Analysis a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Analysis a -> c (Analysis a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Analysis a -> c (Analysis a)
$cp1Data :: forall a. Data a => Typeable (Analysis a)
Data, Node -> Analysis a -> ShowS
[Analysis a] -> ShowS
Analysis a -> String
(Node -> Analysis a -> ShowS)
-> (Analysis a -> String)
-> ([Analysis a] -> ShowS)
-> Show (Analysis a)
forall a. Show a => Node -> Analysis a -> ShowS
forall a. Show a => [Analysis a] -> ShowS
forall a. Show a => Analysis a -> String
forall a.
(Node -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Analysis a] -> ShowS
$cshowList :: forall a. Show a => [Analysis a] -> ShowS
show :: Analysis a -> String
$cshow :: forall a. Show a => Analysis a -> String
showsPrec :: Node -> Analysis a -> ShowS
$cshowsPrec :: forall a. Show a => Node -> Analysis a -> ShowS
Show, Analysis a -> Analysis a -> Bool
(Analysis a -> Analysis a -> Bool)
-> (Analysis a -> Analysis a -> Bool) -> Eq (Analysis a)
forall a. Eq a => Analysis a -> Analysis a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Analysis a -> Analysis a -> Bool
$c/= :: forall a. Eq a => Analysis a -> Analysis a -> Bool
== :: Analysis a -> Analysis a -> Bool
$c== :: forall a. Eq a => Analysis a -> Analysis a -> Bool
Eq, (forall x. Analysis a -> Rep (Analysis a) x)
-> (forall x. Rep (Analysis a) x -> Analysis a)
-> Generic (Analysis a)
forall x. Rep (Analysis a) x -> Analysis a
forall x. Analysis a -> Rep (Analysis a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (Analysis a) x -> Analysis a
forall a x. Analysis a -> Rep (Analysis a) x
$cto :: forall a x. Rep (Analysis a) x -> Analysis a
$cfrom :: forall a x. Analysis a -> Rep (Analysis a) x
Generic)
instance Functor Analysis where
fmap :: (a -> b) -> Analysis a -> Analysis b
fmap a -> b
f Analysis a
analysis =
Analysis :: forall a.
a
-> Maybe String
-> Maybe String
-> Maybe (BBGr (Analysis a))
-> Maybe Node
-> Maybe ModEnv
-> Maybe IDType
-> [String]
-> Maybe Constant
-> Analysis a
Analysis
{ prevAnnotation :: b
prevAnnotation = a -> b
f (Analysis a -> a
forall a. Analysis a -> a
prevAnnotation Analysis a
analysis)
, uniqueName :: Maybe String
uniqueName = Analysis a -> Maybe String
forall a. Analysis a -> Maybe String
uniqueName Analysis a
analysis
, sourceName :: Maybe String
sourceName = Analysis a -> Maybe String
forall a. Analysis a -> Maybe String
sourceName Analysis a
analysis
, bBlocks :: Maybe (BBGr (Analysis b))
bBlocks = (BBGr (Analysis a) -> BBGr (Analysis b))
-> Maybe (BBGr (Analysis a)) -> Maybe (BBGr (Analysis b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Gr (BB (Analysis a)) () -> Gr (BB (Analysis b)) ())
-> BBGr (Analysis a) -> BBGr (Analysis b)
forall a b. (Gr (BB a) () -> Gr (BB b) ()) -> BBGr a -> BBGr b
bbgrMap ((BB (Analysis a) -> BB (Analysis b))
-> Gr (BB (Analysis a)) () -> Gr (BB (Analysis b)) ()
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first ((BB (Analysis a) -> BB (Analysis b))
-> Gr (BB (Analysis a)) () -> Gr (BB (Analysis b)) ())
-> ((a -> b) -> BB (Analysis a) -> BB (Analysis b))
-> (a -> b)
-> Gr (BB (Analysis a)) ()
-> Gr (BB (Analysis b)) ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Block (Analysis a) -> Block (Analysis b))
-> BB (Analysis a) -> BB (Analysis b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Block (Analysis a) -> Block (Analysis b))
-> BB (Analysis a) -> BB (Analysis b))
-> ((a -> b) -> Block (Analysis a) -> Block (Analysis b))
-> (a -> b)
-> BB (Analysis a)
-> BB (Analysis b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Analysis a -> Analysis b)
-> Block (Analysis a) -> Block (Analysis b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Analysis a -> Analysis b)
-> Block (Analysis a) -> Block (Analysis b))
-> ((a -> b) -> Analysis a -> Analysis b)
-> (a -> b)
-> Block (Analysis a)
-> Block (Analysis b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> b) -> Analysis a -> Analysis b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> b) -> Gr (BB (Analysis a)) () -> Gr (BB (Analysis b)) ())
-> (a -> b) -> Gr (BB (Analysis a)) () -> Gr (BB (Analysis b)) ()
forall a b. (a -> b) -> a -> b
$ a -> b
f)) (Maybe (BBGr (Analysis a)) -> Maybe (BBGr (Analysis b)))
-> (Analysis a -> Maybe (BBGr (Analysis a)))
-> Analysis a
-> Maybe (BBGr (Analysis b))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Analysis a -> Maybe (BBGr (Analysis a))
forall a. Analysis a -> Maybe (BBGr (Analysis a))
bBlocks (Analysis a -> Maybe (BBGr (Analysis b)))
-> Analysis a -> Maybe (BBGr (Analysis b))
forall a b. (a -> b) -> a -> b
$ Analysis a
analysis
, insLabel :: Maybe Node
insLabel = Analysis a -> Maybe Node
forall a. Analysis a -> Maybe Node
insLabel Analysis a
analysis
, moduleEnv :: Maybe ModEnv
moduleEnv = Analysis a -> Maybe ModEnv
forall a. Analysis a -> Maybe ModEnv
moduleEnv Analysis a
analysis
, idType :: Maybe IDType
idType = Analysis a -> Maybe IDType
forall a. Analysis a -> Maybe IDType
idType Analysis a
analysis
, allLhsVarsAnn :: [String]
allLhsVarsAnn = Analysis a -> [String]
forall a. Analysis a -> [String]
allLhsVarsAnn Analysis a
analysis
, constExp :: Maybe Constant
constExp = Analysis a -> Maybe Constant
forall a. Analysis a -> Maybe Constant
constExp Analysis a
analysis
}
instance Out (Analysis a) where
doc :: Analysis a -> Doc
doc Analysis a
a = Doc -> Doc
parens (Doc -> Doc)
-> ([(String, Maybe String)] -> Doc)
-> [(String, Maybe String)]
-> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Doc
text (String -> Doc)
-> ([(String, Maybe String)] -> String)
-> [(String, Maybe String)]
-> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> String
unwords ([String] -> String)
-> ([(String, Maybe String)] -> [String])
-> [(String, Maybe String)]
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((String, Maybe String) -> String)
-> [(String, Maybe String)] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map ((String -> ShowS) -> (String, String) -> String
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry String -> ShowS
forall a. [a] -> [a] -> [a]
(++) ((String, String) -> String)
-> ((String, Maybe String) -> (String, String))
-> (String, Maybe String)
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Maybe String -> String)
-> (String, Maybe String) -> (String, String)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Maybe String -> String
forall a. HasCallStack => Maybe a -> a
fromJust) ([(String, Maybe String)] -> [String])
-> ([(String, Maybe String)] -> [(String, Maybe String)])
-> [(String, Maybe String)]
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((String, Maybe String) -> Bool)
-> [(String, Maybe String)] -> [(String, Maybe String)]
forall a. (a -> Bool) -> [a] -> [a]
filter (Maybe String -> Bool
forall a. Maybe a -> Bool
isJust (Maybe String -> Bool)
-> ((String, Maybe String) -> Maybe String)
-> (String, Maybe String)
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String, Maybe String) -> Maybe String
forall a b. (a, b) -> b
snd) ([(String, Maybe String)] -> Doc)
-> [(String, Maybe String)] -> Doc
forall a b. (a -> b) -> a -> b
$
[ (String
"uniqueName: ", Analysis a -> Maybe String
forall a. Analysis a -> Maybe String
uniqueName Analysis a
a)
, (String
"sourceName: ", Analysis a -> Maybe String
forall a. Analysis a -> Maybe String
sourceName Analysis a
a)
, (String
"insLabel: ", (Node -> String) -> Maybe Node -> Maybe String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Node -> String
forall a. Show a => a -> String
show (Analysis a -> Maybe Node
forall a. Analysis a -> Maybe Node
insLabel Analysis a
a))
, (String
"idType: ", (IDType -> String) -> Maybe IDType -> Maybe String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap IDType -> String
forall a. Show a => a -> String
show (Analysis a -> Maybe IDType
forall a. Analysis a -> Maybe IDType
idType Analysis a
a)) ]
docPrec :: Node -> Analysis a -> Doc
docPrec Node
_ = Analysis a -> Doc
forall a. Out a => a -> Doc
doc
analysis0 :: a -> Analysis a
analysis0 :: a -> Analysis a
analysis0 a
a = Analysis :: forall a.
a
-> Maybe String
-> Maybe String
-> Maybe (BBGr (Analysis a))
-> Maybe Node
-> Maybe ModEnv
-> Maybe IDType
-> [String]
-> Maybe Constant
-> Analysis a
Analysis { prevAnnotation :: a
prevAnnotation = a
a
, uniqueName :: Maybe String
uniqueName = Maybe String
forall a. Maybe a
Nothing
, sourceName :: Maybe String
sourceName = Maybe String
forall a. Maybe a
Nothing
, bBlocks :: Maybe (BBGr (Analysis a))
bBlocks = Maybe (BBGr (Analysis a))
forall a. Maybe a
Nothing
, insLabel :: Maybe Node
insLabel = Maybe Node
forall a. Maybe a
Nothing
, moduleEnv :: Maybe ModEnv
moduleEnv = Maybe ModEnv
forall a. Maybe a
Nothing
, idType :: Maybe IDType
idType = Maybe IDType
forall a. Maybe a
Nothing
, allLhsVarsAnn :: [String]
allLhsVarsAnn = []
, constExp :: Maybe Constant
constExp = Maybe Constant
forall a. Maybe a
Nothing }
isNamedExpression :: Expression a -> Bool
isNamedExpression :: Expression a -> Bool
isNamedExpression (ExpValue a
_ SrcSpan
_ (ValVariable String
_)) = Bool
True
isNamedExpression (ExpValue a
_ SrcSpan
_ (ValIntrinsic String
_)) = Bool
True
isNamedExpression Expression a
_ = Bool
False
varName :: Expression (Analysis a) -> String
varName :: Expression (Analysis a) -> String
varName (ExpValue Analysis { uniqueName :: forall a. Analysis a -> Maybe String
uniqueName = Just String
n } SrcSpan
_ ValVariable{}) = String
n
varName (ExpValue Analysis { sourceName :: forall a. Analysis a -> Maybe String
sourceName = Just String
n } SrcSpan
_ ValVariable{}) = String
n
varName (ExpValue Analysis a
_ SrcSpan
_ (ValVariable String
n)) = String
n
varName (ExpValue Analysis { uniqueName :: forall a. Analysis a -> Maybe String
uniqueName = Just String
n } SrcSpan
_ ValIntrinsic{}) = String
n
varName (ExpValue Analysis { sourceName :: forall a. Analysis a -> Maybe String
sourceName = Just String
n } SrcSpan
_ ValIntrinsic{}) = String
n
varName (ExpValue Analysis a
_ SrcSpan
_ (ValIntrinsic String
n)) = String
n
varName Expression (Analysis a)
_ = ShowS
forall a. HasCallStack => String -> a
error String
"Use of varName on non-variable."
srcName :: Expression (Analysis a) -> String
srcName :: Expression (Analysis a) -> String
srcName (ExpValue Analysis { sourceName :: forall a. Analysis a -> Maybe String
sourceName = Just String
n } SrcSpan
_ ValVariable{}) = String
n
srcName (ExpValue Analysis a
_ SrcSpan
_ (ValVariable String
n)) = String
n
srcName (ExpValue Analysis { sourceName :: forall a. Analysis a -> Maybe String
sourceName = Just String
n } SrcSpan
_ ValIntrinsic{}) = String
n
srcName (ExpValue Analysis a
_ SrcSpan
_ (ValIntrinsic String
n)) = String
n
srcName Expression (Analysis a)
_ = ShowS
forall a. HasCallStack => String -> a
error String
"Use of srcName on non-variable."
lvVarName :: LValue (Analysis a) -> String
lvVarName :: LValue (Analysis a) -> String
lvVarName (LvSimpleVar Analysis { uniqueName :: forall a. Analysis a -> Maybe String
uniqueName = Just String
n } SrcSpan
_ String
_) = String
n
lvVarName (LvSimpleVar Analysis { sourceName :: forall a. Analysis a -> Maybe String
sourceName = Just String
n } SrcSpan
_ String
_) = String
n
lvVarName (LvSimpleVar Analysis a
_ SrcSpan
_ String
n) = String
n
lvVarName LValue (Analysis a)
_ = ShowS
forall a. HasCallStack => String -> a
error String
"Use of lvVarName on non-variable."
lvSrcName :: LValue (Analysis a) -> String
lvSrcName :: LValue (Analysis a) -> String
lvSrcName (LvSimpleVar Analysis { sourceName :: forall a. Analysis a -> Maybe String
sourceName = Just String
n } SrcSpan
_ String
_) = String
n
lvSrcName (LvSimpleVar Analysis a
_ SrcSpan
_ String
n) = String
n
lvSrcName LValue (Analysis a)
_ = ShowS
forall a. HasCallStack => String -> a
error String
"Use of lvSrcName on a non-variable"
genVar :: Analysis a -> SrcSpan -> String -> Expression (Analysis a)
genVar :: Analysis a -> SrcSpan -> String -> Expression (Analysis a)
genVar Analysis a
a SrcSpan
s String
n = Analysis a
-> SrcSpan -> Value (Analysis a) -> Expression (Analysis a)
forall a. a -> SrcSpan -> Value a -> Expression a
ExpValue (Analysis a
a { uniqueName :: Maybe String
uniqueName = String -> Maybe String
forall a. a -> Maybe a
Just String
n, sourceName :: Maybe String
sourceName = String -> Maybe String
forall a. a -> Maybe a
Just String
n }) SrcSpan
s Value (Analysis a)
forall a. Value a
v
where
v :: Value a
v | Just ConstructType
CTIntrinsic <- IDType -> Maybe ConstructType
idCType (IDType -> Maybe ConstructType)
-> Maybe IDType -> Maybe ConstructType
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Analysis a -> Maybe IDType
forall a. Analysis a -> Maybe IDType
idType Analysis a
a = String -> Value a
forall a. String -> Value a
ValIntrinsic String
n
| Bool
otherwise = String -> Value a
forall a. String -> Value a
ValVariable String
n
puName :: ProgramUnit (Analysis a) -> ProgramUnitName
puName :: ProgramUnit (Analysis a) -> ProgramUnitName
puName ProgramUnit (Analysis a)
pu
| Just String
n <- Analysis a -> Maybe String
forall a. Analysis a -> Maybe String
uniqueName (ProgramUnit (Analysis a) -> Analysis a
forall (f :: * -> *) a. Annotated f => f a -> a
getAnnotation ProgramUnit (Analysis a)
pu) = String -> ProgramUnitName
Named String
n
| Bool
otherwise = ProgramUnit (Analysis a) -> ProgramUnitName
forall a. Named a => a -> ProgramUnitName
getName ProgramUnit (Analysis a)
pu
puSrcName :: ProgramUnit (Analysis a) -> ProgramUnitName
puSrcName :: ProgramUnit (Analysis a) -> ProgramUnitName
puSrcName ProgramUnit (Analysis a)
pu
| Just String
n <- Analysis a -> Maybe String
forall a. Analysis a -> Maybe String
sourceName (ProgramUnit (Analysis a) -> Analysis a
forall (f :: * -> *) a. Annotated f => f a -> a
getAnnotation ProgramUnit (Analysis a)
pu) = String -> ProgramUnitName
Named String
n
| Bool
otherwise = ProgramUnit (Analysis a) -> ProgramUnitName
forall a. Named a => a -> ProgramUnitName
getName ProgramUnit (Analysis a)
pu
initAnalysis :: Functor b => b a -> b (Analysis a)
initAnalysis :: b a -> b (Analysis a)
initAnalysis = (a -> Analysis a) -> b a -> b (Analysis a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> Analysis a
forall a. a -> Analysis a
analysis0
stripAnalysis :: Functor b => b (Analysis a) -> b a
stripAnalysis :: b (Analysis a) -> b a
stripAnalysis = (Analysis a -> a) -> b (Analysis a) -> b a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Analysis a -> a
forall a. Analysis a -> a
prevAnnotation
lhsExprs :: forall a b . (Data a, Data (b a)) => b a -> [Expression a]
lhsExprs :: b a -> [Expression a]
lhsExprs b a
x = (Statement a -> [Expression a]) -> [Statement a] -> [Expression a]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Statement a -> [Expression a]
lhsOfStmt (b a -> [Statement a]
forall from to. Biplate from to => from -> [to]
universeBi b a
x)
where
lhsOfStmt :: Statement a -> [Expression a]
lhsOfStmt :: Statement a -> [Expression a]
lhsOfStmt (StExpressionAssign a
_ SrcSpan
_ Expression a
e Expression a
e') = Expression a
e Expression a -> [Expression a] -> [Expression a]
forall a. a -> [a] -> [a]
: Expression a -> [Expression a]
forall (c :: * -> *). (Data a, Data (c a)) => c a -> [Expression a]
onExprs Expression a
e'
lhsOfStmt (StCall a
_ SrcSpan
_ Expression a
_ (Just AList Argument a
aexps)) = (Expression a -> Bool) -> [Expression a] -> [Expression a]
forall a. (a -> Bool) -> [a] -> [a]
filter Expression a -> Bool
forall a. Expression a -> Bool
isLExpr [Expression a]
argExps [Expression a] -> [Expression a] -> [Expression a]
forall a. [a] -> [a] -> [a]
++ (Expression a -> [Expression a])
-> [Expression a] -> [Expression a]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Expression a -> [Expression a]
forall (c :: * -> *). (Data a, Data (c a)) => c a -> [Expression a]
onExprs [Expression a]
argExps
where argExps :: [Expression a]
argExps = (Argument a -> Expression a) -> [Argument a] -> [Expression a]
forall a b. (a -> b) -> [a] -> [b]
map Argument a -> Expression a
forall a. Argument a -> Expression a
extractExp ([Argument a] -> [Expression a])
-> (AList Argument a -> [Argument a])
-> AList Argument a
-> [Expression a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AList Argument a -> [Argument a]
forall (t :: * -> *) a. AList t a -> [t a]
aStrip (AList Argument a -> [Expression a])
-> AList Argument a -> [Expression a]
forall a b. (a -> b) -> a -> b
$ AList Argument a
aexps
lhsOfStmt Statement a
s = Statement a -> [Expression a]
forall (c :: * -> *). (Data a, Data (c a)) => c a -> [Expression a]
onExprs Statement a
s
onExprs :: (Data a, Data (c a)) => c a -> [Expression a]
onExprs :: c a -> [Expression a]
onExprs = (Expression a -> [Expression a])
-> [Expression a] -> [Expression a]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Expression a -> [Expression a]
lhsOfExp ([Expression a] -> [Expression a])
-> (c a -> [Expression a]) -> c a -> [Expression a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c a -> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi
lhsOfExp :: Expression a -> [Expression a]
lhsOfExp :: Expression a -> [Expression a]
lhsOfExp (ExpFunctionCall a
_ SrcSpan
_ Expression a
_ (Just AList Argument a
aexps)) = AList Argument a -> [Expression a]
forall a. AList Argument a -> [Expression a]
fstLvl AList Argument a
aexps
lhsOfExp Expression a
_ = []
fstLvl :: AList Argument a -> [Expression a]
fstLvl = (Expression a -> Bool) -> [Expression a] -> [Expression a]
forall a. (a -> Bool) -> [a] -> [a]
filter Expression a -> Bool
forall a. Expression a -> Bool
isLExpr ([Expression a] -> [Expression a])
-> (AList Argument a -> [Expression a])
-> AList Argument a
-> [Expression a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Argument a -> Expression a) -> [Argument a] -> [Expression a]
forall a b. (a -> b) -> [a] -> [b]
map Argument a -> Expression a
forall a. Argument a -> Expression a
extractExp ([Argument a] -> [Expression a])
-> (AList Argument a -> [Argument a])
-> AList Argument a
-> [Expression a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AList Argument a -> [Argument a]
forall (t :: * -> *) a. AList t a -> [t a]
aStrip
extractExp :: Argument a -> Expression a
extractExp (Argument a
_ SrcSpan
_ Maybe String
_ Expression a
exp) = Expression a
exp
rhsExprs :: (Data a, Data (b a)) => b a -> [Expression a]
rhsExprs :: b a -> [Expression a]
rhsExprs b a
x = [[Expression a]] -> [Expression a]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ Block a -> [Expression a]
forall a. Data a => Block a -> [Expression a]
blockRhsExprs Block a
b | Block a
b <- b a -> [Block a]
forall from to. Biplate from to => from -> [to]
universeBi b a
x ]
isLExpr :: Expression a -> Bool
isLExpr :: Expression a -> Bool
isLExpr (ExpValue a
_ SrcSpan
_ ValVariable {}) = Bool
True
isLExpr ExpSubscript{} = Bool
True
isLExpr Expression a
_ = Bool
False
allVars :: forall a b. (Data a, Data (b (Analysis a))) => b (Analysis a) -> [Name]
allVars :: b (Analysis a) -> [String]
allVars b (Analysis a)
b = [ Expression (Analysis a) -> String
forall a. Expression (Analysis a) -> String
varName Expression (Analysis a)
v | v :: Expression (Analysis a)
v@(ExpValue Analysis a
_ SrcSpan
_ (ValVariable String
_)) <- b (Analysis a) -> [Expression (Analysis a)]
forall from. Data from => from -> [Expression (Analysis a)]
uniBi b (Analysis a)
b ]
where
uniBi :: from -> [Expression (Analysis a)]
uniBi from
x = from -> [Expression (Analysis a)]
forall from to. Biplate from to => from -> [to]
universeBi from
x :: [Expression (Analysis a)]
analyseAllLhsVars :: forall a . Data a => ProgramFile (Analysis a) -> ProgramFile (Analysis a)
analyseAllLhsVars :: ProgramFile (Analysis a) -> ProgramFile (Analysis a)
analyseAllLhsVars = ((Block (Analysis a) -> Block (Analysis a))
-> ProgramFile (Analysis a) -> ProgramFile (Analysis a)
forall from to. Biplate from to => (to -> to) -> from -> from
transformBi :: TransFunc Block ProgramFile a) Block (Analysis a) -> Block (Analysis a)
forall (f :: * -> *) a.
(Annotated f, Data (f (Analysis a)), Data a) =>
f (Analysis a) -> f (Analysis a)
analyseAllLhsVars1 (ProgramFile (Analysis a) -> ProgramFile (Analysis a))
-> (ProgramFile (Analysis a) -> ProgramFile (Analysis a))
-> ProgramFile (Analysis a)
-> ProgramFile (Analysis a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((Statement (Analysis a) -> Statement (Analysis a))
-> ProgramFile (Analysis a) -> ProgramFile (Analysis a)
forall from to. Biplate from to => (to -> to) -> from -> from
transformBi :: TransFunc Statement ProgramFile a) Statement (Analysis a) -> Statement (Analysis a)
forall (f :: * -> *) a.
(Annotated f, Data (f (Analysis a)), Data a) =>
f (Analysis a) -> f (Analysis a)
analyseAllLhsVars1 (ProgramFile (Analysis a) -> ProgramFile (Analysis a))
-> (ProgramFile (Analysis a) -> ProgramFile (Analysis a))
-> ProgramFile (Analysis a)
-> ProgramFile (Analysis a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
((DoSpecification (Analysis a) -> DoSpecification (Analysis a))
-> ProgramFile (Analysis a) -> ProgramFile (Analysis a)
forall from to. Biplate from to => (to -> to) -> from -> from
transformBi :: TransFunc DoSpecification ProgramFile a) DoSpecification (Analysis a) -> DoSpecification (Analysis a)
forall (f :: * -> *) a.
(Annotated f, Data (f (Analysis a)), Data a) =>
f (Analysis a) -> f (Analysis a)
analyseAllLhsVars1
analyseAllLhsVars1 :: (Annotated f, Data (f (Analysis a)), Data a) => f (Analysis a) -> f (Analysis a)
analyseAllLhsVars1 :: f (Analysis a) -> f (Analysis a)
analyseAllLhsVars1 f (Analysis a)
x = (Analysis a -> Analysis a) -> f (Analysis a) -> f (Analysis a)
forall (f :: * -> *) a. Annotated f => (a -> a) -> f a -> f a
modifyAnnotation (\ Analysis a
a -> Analysis a
a { allLhsVarsAnn :: [String]
allLhsVarsAnn = f (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
computeAllLhsVars f (Analysis a)
x }) f (Analysis a)
x
allLhsVars :: Data a => Block (Analysis a) -> [Name]
allLhsVars :: Block (Analysis a) -> [String]
allLhsVars = Analysis a -> [String]
forall a. Analysis a -> [String]
allLhsVarsAnn (Analysis a -> [String])
-> (Block (Analysis a) -> Analysis a)
-> Block (Analysis a)
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Block (Analysis a) -> Analysis a
forall (f :: * -> *) a. Annotated f => f a -> a
getAnnotation
allLhsVarsDoSpec :: Data a => DoSpecification (Analysis a) -> [Name]
allLhsVarsDoSpec :: DoSpecification (Analysis a) -> [String]
allLhsVarsDoSpec = DoSpecification (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
computeAllLhsVars
computeAllLhsVars :: forall a b . (Data a, Data (b (Analysis a))) => b (Analysis a) -> [Name]
computeAllLhsVars :: b (Analysis a) -> [String]
computeAllLhsVars = (Statement (Analysis a) -> [String])
-> [Statement (Analysis a)] -> [String]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Statement (Analysis a) -> [String]
lhsOfStmt ([Statement (Analysis a)] -> [String])
-> (b (Analysis a) -> [Statement (Analysis a)])
-> b (Analysis a)
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b (Analysis a) -> [Statement (Analysis a)]
forall from to. Biplate from to => from -> [to]
universeBi
where
lhsOfStmt :: Statement (Analysis a) -> [Name]
lhsOfStmt :: Statement (Analysis a) -> [String]
lhsOfStmt (StExpressionAssign Analysis a
_ SrcSpan
_ Expression (Analysis a)
e Expression (Analysis a)
e') = Expression (Analysis a) -> String
forall a. Expression (Analysis a) -> String
match' Expression (Analysis a)
e String -> [String] -> [String]
forall a. a -> [a] -> [a]
: Expression (Analysis a) -> [String]
forall (c :: * -> *).
Data (c (Analysis a)) =>
c (Analysis a) -> [String]
onExprs Expression (Analysis a)
e'
lhsOfStmt (StDeclaration Analysis a
_ SrcSpan
_ TypeSpec (Analysis a)
_ Maybe (AList Attribute (Analysis a))
_ AList Declarator (Analysis a)
decls) = [[String]] -> [String]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ Declarator (Analysis a) -> [String]
lhsOfDecls Declarator (Analysis a)
decl | Declarator (Analysis a)
decl <- AList Declarator (Analysis a) -> [Declarator (Analysis a)]
forall from to. Biplate from to => from -> [to]
universeBi AList Declarator (Analysis a)
decls ]
lhsOfStmt (StCall Analysis a
_ SrcSpan
_ f :: Expression (Analysis a)
f@(ExpValue Analysis a
_ SrcSpan
_ (ValIntrinsic String
_)) Maybe (AList Argument (Analysis a))
_)
| Just [String]
defs <- Expression (Analysis a) -> Maybe [String]
forall a. Expression (Analysis a) -> Maybe [String]
intrinsicDefs Expression (Analysis a)
f = [String]
defs
lhsOfStmt (StCall Analysis a
_ SrcSpan
_ Expression (Analysis a)
_ (Just AList Argument (Analysis a)
aexps)) = (Argument (Analysis a) -> [String])
-> [Argument (Analysis a)] -> [String]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Expression (Analysis a) -> [String]
match'' (Expression (Analysis a) -> [String])
-> (Argument (Analysis a) -> Expression (Analysis a))
-> Argument (Analysis a)
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Argument (Analysis a) -> Expression (Analysis a)
forall a. Argument a -> Expression a
extractExp) (AList Argument (Analysis a) -> [Argument (Analysis a)]
forall (t :: * -> *) a. AList t a -> [t a]
aStrip AList Argument (Analysis a)
aexps)
lhsOfStmt Statement (Analysis a)
s = Statement (Analysis a) -> [String]
forall (c :: * -> *).
Data (c (Analysis a)) =>
c (Analysis a) -> [String]
onExprs Statement (Analysis a)
s
lhsOfDecls :: Declarator (Analysis a) -> [String]
lhsOfDecls (DeclVariable Analysis a
_ SrcSpan
_ Expression (Analysis a)
e Maybe (Expression (Analysis a))
_ (Just Expression (Analysis a)
e')) = Expression (Analysis a) -> String
forall a. Expression (Analysis a) -> String
match' Expression (Analysis a)
e String -> [String] -> [String]
forall a. a -> [a] -> [a]
: Expression (Analysis a) -> [String]
forall (c :: * -> *).
Data (c (Analysis a)) =>
c (Analysis a) -> [String]
onExprs Expression (Analysis a)
e'
lhsOfDecls (DeclArray Analysis a
_ SrcSpan
_ Expression (Analysis a)
e AList DimensionDeclarator (Analysis a)
_ Maybe (Expression (Analysis a))
_ (Just Expression (Analysis a)
e')) = Expression (Analysis a) -> String
forall a. Expression (Analysis a) -> String
match' Expression (Analysis a)
e String -> [String] -> [String]
forall a. a -> [a] -> [a]
: Expression (Analysis a) -> [String]
forall (c :: * -> *).
Data (c (Analysis a)) =>
c (Analysis a) -> [String]
onExprs Expression (Analysis a)
e'
lhsOfDecls Declarator (Analysis a)
_ = []
onExprs :: (Data (c (Analysis a))) => c (Analysis a) -> [Name]
onExprs :: c (Analysis a) -> [String]
onExprs = (Expression (Analysis a) -> [String])
-> [Expression (Analysis a)] -> [String]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Expression (Analysis a) -> [String]
lhsOfExp ([Expression (Analysis a)] -> [String])
-> (c (Analysis a) -> [Expression (Analysis a)])
-> c (Analysis a)
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. c (Analysis a) -> [Expression (Analysis a)]
forall from to. Biplate from to => from -> [to]
universeBi
lhsOfExp :: Expression (Analysis a) -> [Name]
lhsOfExp :: Expression (Analysis a) -> [String]
lhsOfExp (ExpFunctionCall Analysis a
_ SrcSpan
_ Expression (Analysis a)
_ (Just AList Argument (Analysis a)
aexps)) = (Argument (Analysis a) -> [String])
-> [Argument (Analysis a)] -> [String]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Expression (Analysis a) -> [String]
match (Expression (Analysis a) -> [String])
-> (Argument (Analysis a) -> Expression (Analysis a))
-> Argument (Analysis a)
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Argument (Analysis a) -> Expression (Analysis a)
forall a. Argument a -> Expression a
extractExp) (AList Argument (Analysis a) -> [Argument (Analysis a)]
forall (t :: * -> *) a. AList t a -> [t a]
aStrip AList Argument (Analysis a)
aexps)
lhsOfExp Expression (Analysis a)
_ = []
extractExp :: Argument a -> Expression a
extractExp (Argument a
_ SrcSpan
_ Maybe String
_ Expression a
exp) = Expression a
exp
match' :: Expression (Analysis a) -> String
match' v :: Expression (Analysis a)
v@(ExpValue Analysis a
_ SrcSpan
_ ValVariable{}) = Expression (Analysis a) -> String
forall a. Expression (Analysis a) -> String
varName Expression (Analysis a)
v
match' (ExpSubscript Analysis a
_ SrcSpan
_ Expression (Analysis a)
e AList Index (Analysis a)
_) = Expression (Analysis a) -> String
match' Expression (Analysis a)
e
match' (ExpDataRef Analysis a
_ SrcSpan
_ Expression (Analysis a)
v Expression (Analysis a)
_) = Expression (Analysis a) -> String
match' Expression (Analysis a)
v
match' Expression (Analysis a)
e = ShowS
forall a. HasCallStack => String -> a
error ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ String
"An unexpected LHS to an expression assign: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Expression () -> String
forall a. Show a => a -> String
show ((Analysis a -> ()) -> Expression (Analysis a) -> Expression ()
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (() -> Analysis a -> ()
forall a b. a -> b -> a
const ()) Expression (Analysis a)
e)
match'' :: Expression (Analysis a) -> [String]
match'' v :: Expression (Analysis a)
v@(ExpValue Analysis a
_ SrcSpan
_ ValVariable{}) = [Expression (Analysis a) -> String
forall a. Expression (Analysis a) -> String
varName Expression (Analysis a)
v]
match'' (ExpSubscript Analysis a
_ SrcSpan
_ Expression (Analysis a)
e AList Index (Analysis a)
_) = Expression (Analysis a) -> [String]
match'' Expression (Analysis a)
e
match'' (ExpDataRef Analysis a
_ SrcSpan
_ Expression (Analysis a)
v Expression (Analysis a)
_) = Expression (Analysis a) -> [String]
match'' Expression (Analysis a)
v
match'' Expression (Analysis a)
e = Expression (Analysis a) -> [String]
forall (c :: * -> *).
Data (c (Analysis a)) =>
c (Analysis a) -> [String]
onExprs Expression (Analysis a)
e
match :: Expression (Analysis a) -> [String]
match v :: Expression (Analysis a)
v@(ExpValue Analysis a
_ SrcSpan
_ ValVariable{}) = [Expression (Analysis a) -> String
forall a. Expression (Analysis a) -> String
varName Expression (Analysis a)
v]
match (ExpSubscript Analysis a
_ SrcSpan
_ Expression (Analysis a)
e AList Index (Analysis a)
_) = Expression (Analysis a) -> [String]
match Expression (Analysis a)
e
match (ExpDataRef Analysis a
_ SrcSpan
_ Expression (Analysis a)
e Expression (Analysis a)
_) = Expression (Analysis a) -> [String]
match Expression (Analysis a)
e
match Expression (Analysis a)
e = Expression (Analysis a) -> [String]
forall (c :: * -> *).
Data (c (Analysis a)) =>
c (Analysis a) -> [String]
onExprs Expression (Analysis a)
e
blockRhsExprs :: Data a => Block a -> [Expression a]
blockRhsExprs :: Block a -> [Expression a]
blockRhsExprs (BlStatement a
_ SrcSpan
_ Maybe (Expression a)
_ Statement a
s) = Statement a -> [Expression a]
forall a. Data a => Statement a -> [Expression a]
statementRhsExprs Statement a
s
blockRhsExprs (BlDo a
_ SrcSpan
_ Maybe (Expression a)
_ Maybe String
_ Maybe (Expression a)
_ (Just (DoSpecification a
_ SrcSpan
_ (StExpressionAssign a
_ SrcSpan
_ Expression a
lhs Expression a
rhs) Expression a
e1 Maybe (Expression a)
e2)) [Block a]
_ Maybe (Expression a)
_)
| ExpSubscript a
_ SrcSpan
_ Expression a
_ AList Index a
subs <- Expression a
lhs = (Expression a, Expression a, Maybe (Expression a))
-> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi (Expression a
rhs, Expression a
e1, Maybe (Expression a)
e2) [Expression a] -> [Expression a] -> [Expression a]
forall a. [a] -> [a] -> [a]
++ AList Index a -> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi AList Index a
subs
| Bool
otherwise = (Expression a, Expression a, Maybe (Expression a))
-> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi (Expression a
rhs, Expression a
e1, Maybe (Expression a)
e2)
blockRhsExprs (BlDoWhile a
_ SrcSpan
_ Maybe (Expression a)
e1 Maybe String
_ Maybe (Expression a)
_ Expression a
e2 [Block a]
_ Maybe (Expression a)
_) = (Maybe (Expression a), Expression a) -> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi (Maybe (Expression a)
e1, Expression a
e2)
blockRhsExprs (BlIf a
_ SrcSpan
_ Maybe (Expression a)
e1 Maybe String
_ [Maybe (Expression a)]
e2 [[Block a]]
_ Maybe (Expression a)
_) = (Maybe (Expression a), [Maybe (Expression a)]) -> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi (Maybe (Expression a)
e1, [Maybe (Expression a)]
e2)
blockRhsExprs Block a
b = Block a -> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi Block a
b
statementRhsExprs :: Data a => Statement a -> [Expression a]
statementRhsExprs :: Statement a -> [Expression a]
statementRhsExprs (StExpressionAssign a
_ SrcSpan
_ Expression a
lhs Expression a
rhs)
| ExpSubscript a
_ SrcSpan
_ Expression a
_ AList Index a
subs <- Expression a
lhs = Expression a -> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi Expression a
rhs [Expression a] -> [Expression a] -> [Expression a]
forall a. [a] -> [a] -> [a]
++ AList Index a -> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi AList Index a
subs
| Bool
otherwise = Expression a -> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi Expression a
rhs
statementRhsExprs StDeclaration{} = []
statementRhsExprs (StIfLogical a
_ SrcSpan
_ Expression a
_ Statement a
s) = Statement a -> [Expression a]
forall a. Data a => Statement a -> [Expression a]
statementRhsExprs Statement a
s
statementRhsExprs (StDo a
_ SrcSpan
_ Maybe String
_ Maybe (Expression a)
l Maybe (DoSpecification a)
s') = Maybe (Expression a) -> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi Maybe (Expression a)
l [Expression a] -> [Expression a] -> [Expression a]
forall a. [a] -> [a] -> [a]
++ Maybe (DoSpecification a) -> [Expression a]
forall a. Data a => Maybe (DoSpecification a) -> [Expression a]
doSpecRhsExprs Maybe (DoSpecification a)
s'
where doSpecRhsExprs :: Maybe (DoSpecification a) -> [Expression a]
doSpecRhsExprs (Just (DoSpecification a
_ SrcSpan
_ Statement a
s Expression a
e1 Maybe (Expression a)
e2)) =
(Expression a
e1 Expression a -> [Expression a] -> [Expression a]
forall a. a -> [a] -> [a]
: Maybe (Expression a) -> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi Maybe (Expression a)
e2) [Expression a] -> [Expression a] -> [Expression a]
forall a. [a] -> [a] -> [a]
++ Statement a -> [Expression a]
forall a. Data a => Statement a -> [Expression a]
statementRhsExprs Statement a
s
doSpecRhsExprs Maybe (DoSpecification a)
Nothing = []
statementRhsExprs Statement a
s = Statement a -> [Expression a]
forall from to. Biplate from to => from -> [to]
universeBi Statement a
s
blockVarUses :: forall a. Data a => Block (Analysis a) -> [Name]
blockVarUses :: Block (Analysis a) -> [String]
blockVarUses (BlStatement Analysis a
_ SrcSpan
_ Maybe (Expression (Analysis a))
_ (StExpressionAssign Analysis a
_ SrcSpan
_ Expression (Analysis a)
lhs Expression (Analysis a)
rhs))
| ExpSubscript Analysis a
_ SrcSpan
_ Expression (Analysis a)
_ AList Index (Analysis a)
subs <- Expression (Analysis a)
lhs = Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Expression (Analysis a)
rhs [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ (Index (Analysis a) -> [String])
-> [Index (Analysis a)] -> [String]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Index (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars (AList Index (Analysis a) -> [Index (Analysis a)]
forall (t :: * -> *) a. AList t a -> [t a]
aStrip AList Index (Analysis a)
subs)
| Bool
otherwise = Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Expression (Analysis a)
rhs
blockVarUses (BlDo Analysis a
_ SrcSpan
_ Maybe (Expression (Analysis a))
_ Maybe String
_ Maybe (Expression (Analysis a))
_ (Just (DoSpecification Analysis a
_ SrcSpan
_ (StExpressionAssign Analysis a
_ SrcSpan
_ Expression (Analysis a)
lhs Expression (Analysis a)
rhs) Expression (Analysis a)
e1 Maybe (Expression (Analysis a))
e2)) [Block (Analysis a)]
_ Maybe (Expression (Analysis a))
_)
| ExpSubscript Analysis a
_ SrcSpan
_ Expression (Analysis a)
_ AList Index (Analysis a)
subs <- Expression (Analysis a)
lhs = Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Expression (Analysis a)
rhs [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Expression (Analysis a)
e1 [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
-> (Expression (Analysis a) -> [String])
-> Maybe (Expression (Analysis a))
-> [String]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Maybe (Expression (Analysis a))
e2 [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ (Index (Analysis a) -> [String])
-> [Index (Analysis a)] -> [String]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Index (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars (AList Index (Analysis a) -> [Index (Analysis a)]
forall (t :: * -> *) a. AList t a -> [t a]
aStrip AList Index (Analysis a)
subs)
| Bool
otherwise = Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Expression (Analysis a)
rhs [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Expression (Analysis a)
e1 [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [String]
-> (Expression (Analysis a) -> [String])
-> Maybe (Expression (Analysis a))
-> [String]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Maybe (Expression (Analysis a))
e2
blockVarUses (BlStatement Analysis a
_ SrcSpan
_ Maybe (Expression (Analysis a))
_ st :: Statement (Analysis a)
st@StDeclaration{}) = [[String]] -> [String]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ Data a => Declarator (Analysis a) -> [String]
Declarator (Analysis a) -> [String]
rhsOfDecls Declarator (Analysis a)
d | Declarator (Analysis a)
d <- Statement (Analysis a) -> [Declarator (Analysis a)]
forall from to. Biplate from to => from -> [to]
universeBi Statement (Analysis a)
st ]
where
rhsOfDecls :: Data a => Declarator (Analysis a) -> [Name]
rhsOfDecls :: Declarator (Analysis a) -> [String]
rhsOfDecls (DeclVariable Analysis a
_ SrcSpan
_ Expression (Analysis a)
_ Maybe (Expression (Analysis a))
_ (Just Expression (Analysis a)
e)) = Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Expression (Analysis a)
e
rhsOfDecls (DeclArray Analysis a
_ SrcSpan
_ Expression (Analysis a)
_ AList DimensionDeclarator (Analysis a)
_ Maybe (Expression (Analysis a))
_ (Just Expression (Analysis a)
e)) = Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Expression (Analysis a)
e
rhsOfDecls Declarator (Analysis a)
_ = []
blockVarUses (BlStatement Analysis a
_ SrcSpan
_ Maybe (Expression (Analysis a))
_ (StCall Analysis a
_ SrcSpan
_ f :: Expression (Analysis a)
f@(ExpValue Analysis a
_ SrcSpan
_ (ValIntrinsic String
_)) Maybe (AList Argument (Analysis a))
_))
| Just [String]
uses <- Expression (Analysis a) -> Maybe [String]
forall a. Expression (Analysis a) -> Maybe [String]
intrinsicUses Expression (Analysis a)
f = [String]
uses
blockVarUses (BlStatement Analysis a
_ SrcSpan
_ Maybe (Expression (Analysis a))
_ (StCall Analysis a
_ SrcSpan
_ Expression (Analysis a)
_ (Just AList Argument (Analysis a)
aexps))) = AList Argument (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars AList Argument (Analysis a)
aexps
blockVarUses (BlDoWhile Analysis a
_ SrcSpan
_ Maybe (Expression (Analysis a))
e1 Maybe String
_ Maybe (Expression (Analysis a))
_ Expression (Analysis a)
e2 [Block (Analysis a)]
_ Maybe (Expression (Analysis a))
_) = [String]
-> (Expression (Analysis a) -> [String])
-> Maybe (Expression (Analysis a))
-> [String]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Maybe (Expression (Analysis a))
e1 [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Expression (Analysis a)
e2
blockVarUses (BlIf Analysis a
_ SrcSpan
_ Maybe (Expression (Analysis a))
e1 Maybe String
_ [Maybe (Expression (Analysis a))]
e2 [[Block (Analysis a)]]
_ Maybe (Expression (Analysis a))
_) = [String]
-> (Expression (Analysis a) -> [String])
-> Maybe (Expression (Analysis a))
-> [String]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Maybe (Expression (Analysis a))
e1 [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ (Maybe (Expression (Analysis a)) -> [String])
-> [Maybe (Expression (Analysis a))] -> [String]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap ([String]
-> (Expression (Analysis a) -> [String])
-> Maybe (Expression (Analysis a))
-> [String]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] Expression (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars) [Maybe (Expression (Analysis a))]
e2
blockVarUses Block (Analysis a)
b = Block (Analysis a) -> [String]
forall a (b :: * -> *).
(Data a, Data (b (Analysis a))) =>
b (Analysis a) -> [String]
allVars Block (Analysis a)
b
blockVarDefs :: Data a => Block (Analysis a) -> [Name]
blockVarDefs :: Block (Analysis a) -> [String]
blockVarDefs b :: Block (Analysis a)
b@BlStatement{} = Block (Analysis a) -> [String]
forall a. Data a => Block (Analysis a) -> [String]
allLhsVars Block (Analysis a)
b
blockVarDefs (BlDo Analysis a
_ SrcSpan
_ Maybe (Expression (Analysis a))
_ Maybe String
_ Maybe (Expression (Analysis a))
_ (Just DoSpecification (Analysis a)
doSpec) [Block (Analysis a)]
_ Maybe (Expression (Analysis a))
_) = DoSpecification (Analysis a) -> [String]
forall a. Data a => DoSpecification (Analysis a) -> [String]
allLhsVarsDoSpec DoSpecification (Analysis a)
doSpec
blockVarDefs Block (Analysis a)
_ = []
dummyArg :: Name -> Int -> Name
dummyArg :: String -> Node -> String
dummyArg String
n Node
i = String
n String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"[" String -> ShowS
forall a. [a] -> [a] -> [a]
++ Node -> String
forall a. Show a => a -> String
show Node
i String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
"]"
intrinsicDefs :: Expression (Analysis a) -> Maybe [Name]
intrinsicDefs :: Expression (Analysis a) -> Maybe [String]
intrinsicDefs = (([String], [String]) -> [String])
-> Maybe ([String], [String]) -> Maybe [String]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ([String], [String]) -> [String]
forall a b. (a, b) -> a
fst (Maybe ([String], [String]) -> Maybe [String])
-> (Expression (Analysis a) -> Maybe ([String], [String]))
-> Expression (Analysis a)
-> Maybe [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Expression (Analysis a) -> Maybe ([String], [String])
forall a. Expression (Analysis a) -> Maybe ([String], [String])
intrinsicDefsUses
intrinsicUses :: Expression (Analysis a) -> Maybe [Name]
intrinsicUses :: Expression (Analysis a) -> Maybe [String]
intrinsicUses = (([String], [String]) -> [String])
-> Maybe ([String], [String]) -> Maybe [String]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ([String], [String]) -> [String]
forall a b. (a, b) -> b
snd (Maybe ([String], [String]) -> Maybe [String])
-> (Expression (Analysis a) -> Maybe ([String], [String]))
-> Expression (Analysis a)
-> Maybe [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Expression (Analysis a) -> Maybe ([String], [String])
forall a. Expression (Analysis a) -> Maybe ([String], [String])
intrinsicDefsUses
intrinsicDefsUses :: Expression (Analysis a) -> Maybe ([Name], [Name])
intrinsicDefsUses :: Expression (Analysis a) -> Maybe ([String], [String])
intrinsicDefsUses Expression (Analysis a)
f = ([Node] -> [String]) -> ([Node], [Node]) -> ([String], [String])
forall t b. (t -> b) -> (t, t) -> (b, b)
both ((Node -> String) -> [Node] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (String -> Node -> String
dummyArg (Expression (Analysis a) -> String
forall a. Expression (Analysis a) -> String
varName Expression (Analysis a)
f))) (([Node], [Node]) -> ([String], [String]))
-> Maybe ([Node], [Node]) -> Maybe ([String], [String])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> String -> IntrinsicsTable -> Maybe ([Node], [Node])
getIntrinsicDefsUses (Expression (Analysis a) -> String
forall a. Expression (Analysis a) -> String
srcName Expression (Analysis a)
f) IntrinsicsTable
allIntrinsics
where both :: (t -> b) -> (t, t) -> (b, b)
both t -> b
f' (t
x, t
y) = (t -> b
f' t
x, t -> b
f' t
y)