{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module GHC.Llvm.MetaData where
import GHC.Prelude
import GHC.Llvm.Types
import GHC.Utils.Outputable
newtype MetaId = MetaId Int
deriving (MetaId -> MetaId -> Bool
(MetaId -> MetaId -> Bool)
-> (MetaId -> MetaId -> Bool) -> Eq MetaId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MetaId -> MetaId -> Bool
== :: MetaId -> MetaId -> Bool
$c/= :: MetaId -> MetaId -> Bool
/= :: MetaId -> MetaId -> Bool
Eq, Eq MetaId
Eq MetaId =>
(MetaId -> MetaId -> Ordering)
-> (MetaId -> MetaId -> Bool)
-> (MetaId -> MetaId -> Bool)
-> (MetaId -> MetaId -> Bool)
-> (MetaId -> MetaId -> Bool)
-> (MetaId -> MetaId -> MetaId)
-> (MetaId -> MetaId -> MetaId)
-> Ord MetaId
MetaId -> MetaId -> Bool
MetaId -> MetaId -> Ordering
MetaId -> MetaId -> MetaId
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
$ccompare :: MetaId -> MetaId -> Ordering
compare :: MetaId -> MetaId -> Ordering
$c< :: MetaId -> MetaId -> Bool
< :: MetaId -> MetaId -> Bool
$c<= :: MetaId -> MetaId -> Bool
<= :: MetaId -> MetaId -> Bool
$c> :: MetaId -> MetaId -> Bool
> :: MetaId -> MetaId -> Bool
$c>= :: MetaId -> MetaId -> Bool
>= :: MetaId -> MetaId -> Bool
$cmax :: MetaId -> MetaId -> MetaId
max :: MetaId -> MetaId -> MetaId
$cmin :: MetaId -> MetaId -> MetaId
min :: MetaId -> MetaId -> MetaId
Ord, Int -> MetaId
MetaId -> Int
MetaId -> [MetaId]
MetaId -> MetaId
MetaId -> MetaId -> [MetaId]
MetaId -> MetaId -> MetaId -> [MetaId]
(MetaId -> MetaId)
-> (MetaId -> MetaId)
-> (Int -> MetaId)
-> (MetaId -> Int)
-> (MetaId -> [MetaId])
-> (MetaId -> MetaId -> [MetaId])
-> (MetaId -> MetaId -> [MetaId])
-> (MetaId -> MetaId -> MetaId -> [MetaId])
-> Enum MetaId
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: MetaId -> MetaId
succ :: MetaId -> MetaId
$cpred :: MetaId -> MetaId
pred :: MetaId -> MetaId
$ctoEnum :: Int -> MetaId
toEnum :: Int -> MetaId
$cfromEnum :: MetaId -> Int
fromEnum :: MetaId -> Int
$cenumFrom :: MetaId -> [MetaId]
enumFrom :: MetaId -> [MetaId]
$cenumFromThen :: MetaId -> MetaId -> [MetaId]
enumFromThen :: MetaId -> MetaId -> [MetaId]
$cenumFromTo :: MetaId -> MetaId -> [MetaId]
enumFromTo :: MetaId -> MetaId -> [MetaId]
$cenumFromThenTo :: MetaId -> MetaId -> MetaId -> [MetaId]
enumFromThenTo :: MetaId -> MetaId -> MetaId -> [MetaId]
Enum)
instance Outputable MetaId where
ppr :: MetaId -> SDoc
ppr = MetaId -> SDoc
forall doc. IsLine doc => MetaId -> doc
ppMetaId
ppMetaId :: IsLine doc => MetaId -> doc
ppMetaId :: forall doc. IsLine doc => MetaId -> doc
ppMetaId (MetaId Int
n) = Char -> doc
forall doc. IsLine doc => Char -> doc
char Char
'!' doc -> doc -> doc
forall doc. IsLine doc => doc -> doc -> doc
<> Int -> doc
forall doc. IsLine doc => Int -> doc
int Int
n
{-# SPECIALIZE ppMetaId :: MetaId -> SDoc #-}
{-# SPECIALIZE ppMetaId :: MetaId -> HLine #-}
data MetaExpr = MetaStr !LMString
| MetaNode !MetaId
| MetaVar !LlvmVar
| MetaStruct [MetaExpr]
deriving (MetaExpr -> MetaExpr -> Bool
(MetaExpr -> MetaExpr -> Bool)
-> (MetaExpr -> MetaExpr -> Bool) -> Eq MetaExpr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MetaExpr -> MetaExpr -> Bool
== :: MetaExpr -> MetaExpr -> Bool
$c/= :: MetaExpr -> MetaExpr -> Bool
/= :: MetaExpr -> MetaExpr -> Bool
Eq)
data MetaAnnot = MetaAnnot LMString MetaExpr
deriving (MetaAnnot -> MetaAnnot -> Bool
(MetaAnnot -> MetaAnnot -> Bool)
-> (MetaAnnot -> MetaAnnot -> Bool) -> Eq MetaAnnot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MetaAnnot -> MetaAnnot -> Bool
== :: MetaAnnot -> MetaAnnot -> Bool
$c/= :: MetaAnnot -> MetaAnnot -> Bool
/= :: MetaAnnot -> MetaAnnot -> Bool
Eq)
data MetaDecl
= MetaNamed !LMString [MetaId]
| MetaUnnamed !MetaId !MetaExpr