module GHC.Llvm.Syntax where
import GHC.Prelude
import GHC.Llvm.MetaData
import GHC.Llvm.Types
import GHC.Types.Unique
type LlvmBlockId = Unique
data LlvmBlock = LlvmBlock {
LlvmBlock -> LlvmBlockId
blockLabel :: LlvmBlockId,
LlvmBlock -> [LlvmStatement]
blockStmts :: [LlvmStatement]
}
type LlvmBlocks = [LlvmBlock]
data LlvmModule = LlvmModule {
:: [LMString],
LlvmModule -> [LlvmAlias]
modAliases :: [LlvmAlias],
LlvmModule -> [MetaDecl]
modMeta :: [MetaDecl],
LlvmModule -> [LMGlobal]
modGlobals :: [LMGlobal],
LlvmModule -> LlvmFunctionDecls
modFwdDecls :: LlvmFunctionDecls,
LlvmModule -> LlvmFunctions
modFuncs :: LlvmFunctions
}
data LlvmFunction = LlvmFunction {
LlvmFunction -> LlvmFunctionDecl
funcDecl :: LlvmFunctionDecl,
LlvmFunction -> [LMString]
funcArgs :: [LMString],
LlvmFunction -> [LlvmFuncAttr]
funcAttrs :: [LlvmFuncAttr],
LlvmFunction -> LMSection
funcSect :: LMSection,
LlvmFunction -> Maybe LlvmStatic
funcPrefix :: Maybe LlvmStatic,
LlvmFunction -> LlvmBlocks
funcBody :: LlvmBlocks
}
type LlvmFunctions = [LlvmFunction]
type SingleThreaded = Bool
data LlvmSyncOrdering
= SyncUnord
| SyncMonotonic
| SyncAcquire
| SyncRelease
| SyncAcqRel
| SyncSeqCst
deriving (Int -> LlvmSyncOrdering -> ShowS
[LlvmSyncOrdering] -> ShowS
LlvmSyncOrdering -> String
(Int -> LlvmSyncOrdering -> ShowS)
-> (LlvmSyncOrdering -> String)
-> ([LlvmSyncOrdering] -> ShowS)
-> Show LlvmSyncOrdering
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LlvmSyncOrdering] -> ShowS
$cshowList :: [LlvmSyncOrdering] -> ShowS
show :: LlvmSyncOrdering -> String
$cshow :: LlvmSyncOrdering -> String
showsPrec :: Int -> LlvmSyncOrdering -> ShowS
$cshowsPrec :: Int -> LlvmSyncOrdering -> ShowS
Show, LlvmSyncOrdering -> LlvmSyncOrdering -> Bool
(LlvmSyncOrdering -> LlvmSyncOrdering -> Bool)
-> (LlvmSyncOrdering -> LlvmSyncOrdering -> Bool)
-> Eq LlvmSyncOrdering
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LlvmSyncOrdering -> LlvmSyncOrdering -> Bool
$c/= :: LlvmSyncOrdering -> LlvmSyncOrdering -> Bool
== :: LlvmSyncOrdering -> LlvmSyncOrdering -> Bool
$c== :: LlvmSyncOrdering -> LlvmSyncOrdering -> Bool
Eq)
data LlvmAtomicOp
= LAO_Xchg
| LAO_Add
| LAO_Sub
| LAO_And
| LAO_Nand
| LAO_Or
| LAO_Xor
| LAO_Max
| LAO_Min
| LAO_Umax
| LAO_Umin
deriving (Int -> LlvmAtomicOp -> ShowS
[LlvmAtomicOp] -> ShowS
LlvmAtomicOp -> String
(Int -> LlvmAtomicOp -> ShowS)
-> (LlvmAtomicOp -> String)
-> ([LlvmAtomicOp] -> ShowS)
-> Show LlvmAtomicOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LlvmAtomicOp] -> ShowS
$cshowList :: [LlvmAtomicOp] -> ShowS
show :: LlvmAtomicOp -> String
$cshow :: LlvmAtomicOp -> String
showsPrec :: Int -> LlvmAtomicOp -> ShowS
$cshowsPrec :: Int -> LlvmAtomicOp -> ShowS
Show, LlvmAtomicOp -> LlvmAtomicOp -> Bool
(LlvmAtomicOp -> LlvmAtomicOp -> Bool)
-> (LlvmAtomicOp -> LlvmAtomicOp -> Bool) -> Eq LlvmAtomicOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LlvmAtomicOp -> LlvmAtomicOp -> Bool
$c/= :: LlvmAtomicOp -> LlvmAtomicOp -> Bool
== :: LlvmAtomicOp -> LlvmAtomicOp -> Bool
$c== :: LlvmAtomicOp -> LlvmAtomicOp -> Bool
Eq)
data LlvmStatement
= Assignment LlvmVar LlvmExpression
| Fence Bool LlvmSyncOrdering
| Branch LlvmVar
| BranchIf LlvmVar LlvmVar LlvmVar
| [LMString]
| MkLabel LlvmBlockId
| Store LlvmVar LlvmVar
| Switch LlvmVar LlvmVar [(LlvmVar, LlvmVar)]
| Return (Maybe LlvmVar)
| Unreachable
| Expr LlvmExpression
| Nop
| MetaStmt [MetaAnnot] LlvmStatement
deriving (LlvmStatement -> LlvmStatement -> Bool
(LlvmStatement -> LlvmStatement -> Bool)
-> (LlvmStatement -> LlvmStatement -> Bool) -> Eq LlvmStatement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LlvmStatement -> LlvmStatement -> Bool
$c/= :: LlvmStatement -> LlvmStatement -> Bool
== :: LlvmStatement -> LlvmStatement -> Bool
$c== :: LlvmStatement -> LlvmStatement -> Bool
External instance of the constraint type Eq MetaAnnot
External instance of the constraint type forall a b. (Eq a, Eq b) => Eq (a, b)
External instance of the constraint type Eq LMString
External instance of the constraint type Eq MetaAnnot
External instance of the constraint type forall a. Eq a => Eq (Maybe a)
External instance of the constraint type forall a b. (Eq a, Eq b) => Eq (a, b)
External instance of the constraint type Eq LlvmVar
External instance of the constraint type Eq LlvmBlockId
External instance of the constraint type Eq LMString
External instance of the constraint type forall a. Eq a => Eq [a]
External instance of the constraint type Eq Bool
Instance of class: Eq of the constraint type Eq LlvmExpression
External instance of the constraint type Eq LlvmVar
External instance of the constraint type Eq LlvmVar
Instance of class: Eq of the constraint type Eq LlvmSyncOrdering
Instance of class: Eq of the constraint type Eq LlvmExpression
Instance of class: Eq of the constraint type Eq LlvmStatement
Eq)
data LlvmExpression
= Alloca LlvmType Int
| LlvmOp LlvmMachOp LlvmVar LlvmVar
| Compare LlvmCmpOp LlvmVar LlvmVar
| LlvmVar LlvmVar
| LlvmVar Int
| Insert LlvmVar LlvmVar LlvmVar
| Malloc LlvmType Int
| Load LlvmVar
| ALoad LlvmSyncOrdering SingleThreaded LlvmVar
| GetElemPtr Bool LlvmVar [LlvmVar]
| Cast LlvmCastOp LlvmVar LlvmType
| AtomicRMW LlvmAtomicOp LlvmVar LlvmVar LlvmSyncOrdering
| CmpXChg LlvmVar LlvmVar LlvmVar LlvmSyncOrdering LlvmSyncOrdering
| Call LlvmCallType LlvmVar [LlvmVar] [LlvmFuncAttr]
| CallM LlvmCallType LlvmVar [MetaExpr] [LlvmFuncAttr]
| Phi LlvmType [(LlvmVar,LlvmVar)]
| Asm LMString LMString LlvmType [LlvmVar] Bool Bool
| MExpr [MetaAnnot] LlvmExpression
deriving (LlvmExpression -> LlvmExpression -> Bool
(LlvmExpression -> LlvmExpression -> Bool)
-> (LlvmExpression -> LlvmExpression -> Bool) -> Eq LlvmExpression
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LlvmExpression -> LlvmExpression -> Bool
$c/= :: LlvmExpression -> LlvmExpression -> Bool
== :: LlvmExpression -> LlvmExpression -> Bool
$c== :: LlvmExpression -> LlvmExpression -> Bool
External instance of the constraint type Eq MetaExpr
External instance of the constraint type Eq LlvmFuncAttr
External instance of the constraint type Eq MetaAnnot
External instance of the constraint type Eq LMString
External instance of the constraint type forall a b. (Eq a, Eq b) => Eq (a, b)
External instance of the constraint type Eq LlvmVar
External instance of the constraint type Eq MetaExpr
External instance of the constraint type Eq LlvmFuncAttr
External instance of the constraint type forall a. Eq a => Eq [a]
External instance of the constraint type Eq LlvmFuncAttr
External instance of the constraint type Eq LlvmCallType
External instance of the constraint type Eq LlvmCallType
External instance of the constraint type Eq LlvmCastOp
External instance of the constraint type forall a. Eq a => Eq [a]
External instance of the constraint type Eq LlvmVar
External instance of the constraint type Eq Bool
Instance of class: Eq of the constraint type Eq LlvmSyncOrdering
External instance of the constraint type Eq LlvmCmpOp
External instance of the constraint type Eq LlvmVar
External instance of the constraint type Eq LlvmMachOp
External instance of the constraint type Eq Int
External instance of the constraint type Eq Int
External instance of the constraint type Eq LlvmType
External instance of the constraint type Eq LlvmType
External instance of the constraint type Eq MetaAnnot
External instance of the constraint type forall a b. (Eq a, Eq b) => Eq (a, b)
External instance of the constraint type Eq LMString
External instance of the constraint type forall a. Eq a => Eq [a]
External instance of the constraint type Eq Bool
External instance of the constraint type Eq LlvmVar
Instance of class: Eq of the constraint type Eq LlvmSyncOrdering
Instance of class: Eq of the constraint type Eq LlvmAtomicOp
Instance of class: Eq of the constraint type Eq LlvmExpression
Eq)