{-# 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 Int
n) = Char -> SDoc
forall doc. IsLine doc => Char -> doc
char Char
'!' SDoc -> SDoc -> SDoc
forall doc. IsLine doc => doc -> doc -> doc
<> Int -> SDoc
forall doc. IsLine doc => Int -> doc
int Int
n
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