LLVM M.D.Source codeContentsIndex
MD.Syntax.LLVM
MaintainerPaul Govereau <govereau@cs.harvard.edu>
Description
Abstract syntax for LLVM source programs.
Synopsis
module MD.Syntax.Enum
data Ident
= Ident String
| Z Ident
| N Ident
| P Ident
data Atom
= Null
| Undef
| Int Integer
| Float Float
| Var Ident
data Module = Module [Decl]
data Decl
= Target
| Global
| Declare
| TypeDef Ident Type
| Function {
fLinkage :: Maybe Linkage
fVisibility :: Maybe Visibility
fCCoonc :: Maybe CConv
fAttr :: [Attr]
fRetType :: Type
fName :: String
fArgs :: [Argument]
fBlocks :: [Block]
}
isFunction :: Decl -> Bool
data Argument
= Arg Type [Attr] Ident
| Dots
data Type
= I Integer
| F32
| F64
| F128
| F80
| F128_PPC
| Void
| Label
| MetaData
| Opaque
| TypeName Ident
| Array {
num_elements :: Integer
base_type :: Type
}
| Vector {
num_elements :: Integer
base_type :: Type
}
| Struct {
element_types :: [Type]
}
| PStruct {
element_types :: [Type]
}
| Pointer {
base_type :: Type
}
| FunTy {
return_type :: Type
var_args :: Bool
argments :: [(Type, [Attr])]
}
| ST
data Value
= Atom Atom
| ConstExpr Expr
data Expr
= GetElemPtr TV [TV]
| BinOp Opr String Type Value Value
| Conv ConvOp TV Type
| Select TV TV TV
data TV = TV Type Value
data Block = Block {
blockName :: String
blockIndex :: Int
blockMiddle :: Instructions
blockEnd :: ControlInst
blockMin :: String
blockMout :: String
}
data Label
= LI Int
| LS String
type Instructions = [Instruction]
data Instruction = Instruction {
boundId :: Maybe Ident
rhsExpr :: RHS
}
data RHS
= MemOp MemoryInst
| Expr Expr
| Phi Type [(Value, Label)]
| Call Value [TV]
data MemoryInst
= Alloca Type Integer Integer
| Malloc Type TV
| Free TV
| Load Bool TV
| Store Bool TV Value
data ControlInst
= Return (Maybe TV)
| Br Label
| CBr Value Label Label
| Switch TV Label [(TV, Label)]
blockTargets :: Block -> [Label]
targets :: ControlInst -> [Label]
Documentation
module MD.Syntax.Enum
data Ident Source
Constructors
Ident String
Z Ident
N Ident
P Ident
show/hide Instances
Eq Ident
Ord Ident
Show Ident
data Atom Source
Constructors
Null
Undef
Int Integer
Float Float
Var Ident
show/hide Instances
Eq Atom
Ord Atom
Show Atom
data Module Source
Constructors
Module [Decl]
show/hide Instances
Eq Module
Show Module
data Decl Source
Constructors
Target
Global
Declare
TypeDef Ident Type
Function
fLinkage :: Maybe Linkage
fVisibility :: Maybe Visibility
fCCoonc :: Maybe CConv
fAttr :: [Attr]
fRetType :: Type
fName :: String
fArgs :: [Argument]
fBlocks :: [Block]
show/hide Instances
Eq Decl
Show Decl
isFunction :: Decl -> BoolSource
data Argument Source
Constructors
Arg Type [Attr] Ident
Dots
show/hide Instances
data Type Source
LLVM Types These types are also used in the symbolc form, and for that we add a state variable type ST.
Constructors
I Integer
F32
F64
F128
F80
F128_PPC
Void
Label
MetaData
Opaque
TypeName Ident
Array
num_elements :: Integer
base_type :: Type
Vector
num_elements :: Integer
base_type :: Type
Struct
element_types :: [Type]
PStruct
element_types :: [Type]
Pointer
base_type :: Type
FunTy
return_type :: Type
var_args :: Bool
argments :: [(Type, [Attr])]
STGDSA state variable type
show/hide Instances
Eq Type
Ord Type
Show Type
data Value Source
Constructors
Atom Atom
ConstExpr Expr
show/hide Instances
Eq Value
Ord Value
Show Value
data Expr Source
Constructors
GetElemPtr TV [TV]
BinOp Opr String Type Value Value
Conv ConvOp TV Type
Select TV TV TV
show/hide Instances
Eq Expr
Ord Expr
Show Expr
data TV Source
Constructors
TV Type Value
show/hide Instances
Eq TV
Ord TV
Show TV
data Block Source
LLVM basic blocks
Constructors
Block
blockName :: String
blockIndex :: Int
blockMiddle :: Instructions
blockEnd :: ControlInst
blockMin :: String
blockMout :: String
show/hide Instances
Eq Block
Show Block
data Label Source
Block labels
Constructors
LI Int
LS String
show/hide Instances
Eq Label
Show Label
type Instructions = [Instruction]Source
data Instruction Source
Constructors
Instruction
boundId :: Maybe Ident
rhsExpr :: RHS
show/hide Instances
data RHS Source
Constructors
MemOp MemoryInst
Expr Expr
Phi Type [(Value, Label)]
Call Value [TV]
show/hide Instances
Eq RHS
Show RHS
data MemoryInst Source
Constructors
Alloca Type Integer Integer
Malloc Type TV
Free TV
Load Bool TV
Store Bool TV Value
show/hide Instances
data ControlInst Source
Constructors
Return (Maybe TV)
Br Label
CBr Value Label Label
Switch TV Label [(TV, Label)]
show/hide Instances
blockTargets :: Block -> [Label]Source
targets :: ControlInst -> [Label]Source
Produced by Haddock version 2.6.0