Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Defines the target language for first-order L1 language with C code generator for it.
Synopsis
- data Var
- type Tag = Word8
- data Tail
- data Triv
- data Ty
- data Prim
- = AddP
- | SubP
- | MulP
- | DivP
- | ModP
- | EqP
- | LtP
- | GtP
- | LtEqP
- | GtEqP
- | EqSymP
- | EqBenchProgP String
- | ExpP
- | RandP
- | FRandP
- | FSqrtP
- | FTanP
- | FloatToIntP
- | IntToFloatP
- | SizeParam
- | OrP
- | AndP
- | DictInsertP Ty
- | DictLookupP Ty
- | DictEmptyP Ty
- | DictHasKeyP Ty
- | SymSetEmpty
- | SymSetContains
- | SymSetInsert
- | SymHashEmpty
- | SymHashInsert
- | SymHashLookup
- | SymHashContains
- | IntHashEmpty
- | IntHashInsert
- | IntHashLookup
- | VAllocP Ty
- | VFreeP Ty
- | VFree2P Ty
- | VLengthP Ty
- | VNthP Ty
- | VSliceP Ty
- | InplaceVUpdateP Ty
- | VConcatP Ty
- | VSortP Ty
- | InplaceVSortP Ty
- | VMergeP Ty
- | PDictAllocP Ty Ty
- | PDictInsertP Ty Ty
- | PDictLookupP Ty Ty
- | PDictHasKeyP Ty Ty
- | PDictForkP Ty Ty
- | PDictJoinP Ty Ty
- | LLAllocP Ty
- | LLIsEmptyP Ty
- | LLConsP Ty
- | LLHeadP Ty
- | LLTailP Ty
- | LLFreeP Ty
- | LLFree2P Ty
- | LLCopyP Ty
- | GetNumProcessors
- | ReadPackedFile (Maybe FilePath) TyCon
- | WritePackedFile FilePath TyCon
- | ReadArrayFile (Maybe (FilePath, Int)) Ty
- | NewBuffer Multiplicity
- | NewParBuffer Multiplicity
- | ScopedBuffer Multiplicity
- | ScopedParBuffer Multiplicity
- | EndOfBuffer Multiplicity
- | MMapFileSize Var
- | ReadTag
- | WriteTag
- | TagCursor
- | ReadTaggedCursor
- | WriteTaggedCursor
- | ReadCursor
- | WriteCursor
- | ReadScalar Scalar
- | WriteScalar Scalar
- | ReadList
- | WriteList
- | ReadVector
- | WriteVector
- | BoundsCheck
- | IndirectionBarrier TyCon
- | BumpArenaRefCount
- | FreeBuffer
- | SizeOfPacked
- | SizeOfScalar
- | GetFirstWord
- | PrintInt
- | PrintChar
- | PrintFloat
- | PrintBool
- | PrintSym
- | PrintString String
- | PrintRegionCount
- | ReadInt
- | ParSync
- | GetCilkWorkerNum
- | IsBig
- | Gensym
- | FreeSymTable
- | SSPush SSModality TyCon
- | SSPop SSModality
- | Assert
- data FunDecl = FunDecl {}
- data Alts
- data Prog = Prog {}
- data MainExp = PrintExp Tail
- type Label = Var
- type SymTable = Map Word16 String
- type InfoTable = Map TyCon TyConInfo
- type TyConInfo = Map DataCon DataConInfo
- data DataConInfo = DataConInfo {
- dcon_tag :: Tag
- scalar_bytes :: Int
- num_shortcut :: Int
- num_scalars :: Int
- num_packed :: Int
- field_tys :: [Ty3]
- data Scalar
- mkScalar :: Ty -> Scalar
- scalarToTy :: Scalar -> Ty
- withTail :: MonadState Int m => (Tail, Ty) -> ([Triv] -> Tail) -> m Tail
- fromL3Ty :: Ty3 -> Ty
- voidTy :: Ty
- inlineTrivL4 :: Prog -> Prog
- typeOfTriv :: Map Var Ty -> Triv -> Ty
Documentation
Instances
Out Var Source # | |
IsString Var Source # | |
Defined in Gibbon.Common fromString :: String -> Var Source # | |
Read Var Source # | |
Show Var Source # | |
NFData Var Source # | |
Defined in Gibbon.Common | |
Eq Var Source # | |
Ord Var Source # | |
FreeVars LocExp Source # | |
FunctionTy Ty2 Source # | Function types know about locations and traversal effects. |
Renamable Var Source # | |
Pretty Var Source # | |
ToIdent Var Source # | |
Interp Store Exp2 Source # | |
InterpProg Store Exp2 Source # | |
InterpExt Store Exp2 (E2Ext LocVar Ty2) Source # | |
Out (ArrowTy2 Ty2) Source # | |
FreeVars a => FreeVars (TyEnv a) Source # | |
Pretty [Var] Source # | |
Typeable (PreExp E2Ext LocVar (UrTy LocVar)) Source # | The add1 :: Tree ... (add1 [loc1, loc2] tr1) .. in this case, we want the type of (add1 tr1) to be (Tree |
type ArrowTy Ty2 Source # | |
Defined in Gibbon.L2.Syntax |
RetValsT [Triv] | Only in tail position, for returning from a function. |
EndOfMain | A marker for an end of the main expression. |
AssnValsT | INTERNAL ONLY: used for assigning instead of returning. |
LetCallT | |
LetPrimCallT | |
LetTrivT | |
LetIfT | |
LetUnpackT | |
LetAllocT | |
LetAvailT | |
IfT | |
ErrT String | |
LetTimedT | |
Switch Label Triv Alts (Maybe Tail) | For casing on numeric tags or integers. |
TailCall Var [Triv] | |
Goto Label | |
LetArenaT | |
Instances
VarTriv Var | |
IntTriv Int64 | |
CharTriv Char | |
FloatTriv Double | |
BoolTriv Bool | |
TagTriv Tag | |
SymTriv Word16 | An index into the symbol table. |
ProdTriv [Triv] | Tuples |
ProjTriv Int Triv | Projections |
Instances
IntTy | 8 byte integers. |
CharTy | 4 byte characters. |
FloatTy | 8 byte floating point numbers |
BoolTy | 1 byte integers. |
TagTyPacked | A single byte / Word8. Used in PACKED mode. |
TagTyBoxed | A tag used in the UNPACKED, boxed, pointer-based, graph-of-structs representation. This can usually be the same as TagTy, but needn't necessarily be. |
SymTy | Symbols used in writing compiler passes. It's an alias for Int, an index into a symbol table. |
CursorTy | A byte-indexing pointer. This is always a pointer to a raw buffer of bytes that does not contain pointers. |
PtrTy | A machine word. Same width as IntTy. Untyped. This is a pointer to a struct value which may contain other pointers. |
RegionTy | Region start and a refcount |
ChunkTy | Start and end pointers |
ProdTy [Ty] | |
SymDictTy Var Ty | We allow built-in dictionaries from symbols to a value type. |
ArenaTy | |
PDictTy Ty Ty | |
VectorTy Ty | |
ListTy Ty | |
SymSetTy | |
SymHashTy | |
IntHashTy |
Instances
AddP | |
SubP | |
MulP | |
DivP | |
ModP | |
EqP | |
LtP | |
GtP | |
LtEqP | |
GtEqP | |
EqSymP | |
EqBenchProgP String | |
ExpP | |
RandP | |
FRandP | |
FSqrtP | |
FTanP | |
FloatToIntP | |
IntToFloatP | |
SizeParam | |
OrP | |
AndP | |
DictInsertP Ty | takes k,v,dict |
DictLookupP Ty | takes k,dict, errors if absent |
DictEmptyP Ty | |
DictHasKeyP Ty | |
SymSetEmpty | |
SymSetContains | |
SymSetInsert | |
SymHashEmpty | |
SymHashInsert | |
SymHashLookup | |
SymHashContains | |
IntHashEmpty | |
IntHashInsert | |
IntHashLookup | |
VAllocP Ty | |
VFreeP Ty | |
VFree2P Ty | |
VLengthP Ty | |
VNthP Ty | |
VSliceP Ty | |
InplaceVUpdateP Ty | |
VConcatP Ty | |
VSortP Ty | |
InplaceVSortP Ty | |
VMergeP Ty | |
PDictAllocP Ty Ty | |
PDictInsertP Ty Ty | |
PDictLookupP Ty Ty | |
PDictHasKeyP Ty Ty | |
PDictForkP Ty Ty | |
PDictJoinP Ty Ty | |
LLAllocP Ty | |
LLIsEmptyP Ty | |
LLConsP Ty | |
LLHeadP Ty | |
LLTailP Ty | |
LLFreeP Ty | |
LLFree2P Ty | |
LLCopyP Ty | |
GetNumProcessors | |
ReadPackedFile (Maybe FilePath) TyCon | |
WritePackedFile FilePath TyCon | |
ReadArrayFile (Maybe (FilePath, Int)) Ty | |
NewBuffer Multiplicity | Allocate a new buffer, return a cursor. |
NewParBuffer Multiplicity | Allocate a new buffer for parallel allocations, return a cursor. |
ScopedBuffer Multiplicity | Returns a pointer to a buffer, with the invariant that data written to this region is no longer used after the enclosing function returns. I.e. this can be stack allocated data. |
ScopedParBuffer Multiplicity | Like ScopedBuffer, but for parallel allocations. |
EndOfBuffer Multiplicity | |
MMapFileSize Var | |
ReadTag | Read one byte from the cursor and advance it. |
WriteTag | Write a static tag value, takes a cursor to target. |
TagCursor | Create a tagged a cursor |
ReadTaggedCursor | |
WriteTaggedCursor | |
ReadCursor | Read and return a cursor |
WriteCursor | |
ReadScalar Scalar | |
WriteScalar Scalar | |
ReadList | |
WriteList | |
ReadVector | |
WriteVector | |
BoundsCheck | |
IndirectionBarrier TyCon | |
BumpArenaRefCount | |
FreeBuffer | |
SizeOfPacked | Take start and end cursors and return size of data they represent This could be represented as (end - start) / (sizeof(Int)) |
SizeOfScalar | Takes in a variable, and returns an int, sizeof(var) |
GetFirstWord | takes a PtrTy, returns IntTy containing the (first) word pointed to. |
PrintInt | Print an integer to stdout. |
PrintChar | Print a character to stdout. |
PrintFloat | Print a floating point number to stdout. |
PrintBool | Print a boolean to stdout. |
PrintSym | Fetch a symbol from the symbol table, and print it. |
PrintString String | Print a constant string to stdout. TODO: add string values to the language. |
PrintRegionCount | Call print_global_region_count() defined in the RTS. |
ReadInt | |
ParSync | cilk_sync |
GetCilkWorkerNum | Runs __cilkrts_get_worker_number() |
IsBig | |
Gensym | |
FreeSymTable | |
SSPush SSModality TyCon | |
SSPop SSModality | |
Assert |
Instances
Instances
Out FunDecl Source # | |
Generic FunDecl Source # | |
Show FunDecl Source # | |
NFData FunDecl Source # | |
Defined in Gibbon.L4.Syntax | |
Eq FunDecl Source # | |
Ord FunDecl Source # | |
type Rep FunDecl Source # | |
Defined in Gibbon.L4.Syntax type Rep FunDecl = D1 ('MetaData "FunDecl" "Gibbon.L4.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "FunDecl" 'PrefixI 'True) ((S1 ('MetaSel ('Just "funName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var) :*: S1 ('MetaSel ('Just "funArgs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Var, Ty)])) :*: (S1 ('MetaSel ('Just "funRetTy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Ty) :*: (S1 ('MetaSel ('Just "funBody") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Tail) :*: S1 ('MetaSel ('Just "isPure") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))) |
Switch alternatives.
Instances
Out Alts Source # | |
Generic Alts Source # | |
Show Alts Source # | |
NFData Alts Source # | |
Defined in Gibbon.L4.Syntax | |
Eq Alts Source # | |
Ord Alts Source # | |
type Rep Alts Source # | |
Defined in Gibbon.L4.Syntax type Rep Alts = D1 ('MetaData "Alts" "Gibbon.L4.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "TagAlts" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Tag, Tail)])) :+: C1 ('MetaCons "IntAlts" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Int64, Tail)]))) |
Instances
Out Prog Source # | |
Generic Prog Source # | |
Show Prog Source # | |
NFData Prog Source # | |
Defined in Gibbon.L4.Syntax | |
Eq Prog Source # | |
Ord Prog Source # | |
Pretty Prog Source # | |
type Rep Prog Source # | |
Defined in Gibbon.L4.Syntax type Rep Prog = D1 ('MetaData "Prog" "Gibbon.L4.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "Prog" 'PrefixI 'True) ((S1 ('MetaSel ('Just "infoTable") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 InfoTable) :*: S1 ('MetaSel ('Just "symbolTable") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SymTable)) :*: (S1 ('MetaSel ('Just "fundefs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [FunDecl]) :*: S1 ('MetaSel ('Just "mainExp") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe MainExp))))) |
PrintExp Tail | Evaluate the expression and print the result. Type of the expression must will eventually be anything, but not all types support printing currently [2017.01.03]. |
Instances
Out MainExp Source # | |
Generic MainExp Source # | |
Show MainExp Source # | |
NFData MainExp Source # | |
Defined in Gibbon.L4.Syntax | |
Eq MainExp Source # | |
Ord MainExp Source # | |
type Rep MainExp Source # | |
Defined in Gibbon.L4.Syntax |
data DataConInfo Source #
DataConInfo | |
|
Instances
Instances
Out Scalar Source # | |
Generic Scalar Source # | |
Read Scalar Source # | |
Show Scalar Source # | |
NFData Scalar Source # | |
Defined in Gibbon.L3.Syntax | |
Eq Scalar Source # | |
Ord Scalar Source # | |
Defined in Gibbon.L3.Syntax | |
type Rep Scalar Source # | |
Defined in Gibbon.L3.Syntax type Rep Scalar = D1 ('MetaData "Scalar" "Gibbon.L3.Syntax" "gibbon-0.3-inplace" 'False) ((C1 ('MetaCons "IntS" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CharS" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FloatS" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SymS" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BoolS" 'PrefixI 'False) (U1 :: Type -> Type)))) |
scalarToTy :: Scalar -> Ty Source #
Utility functions
withTail :: MonadState Int m => (Tail, Ty) -> ([Triv] -> Tail) -> m Tail Source #
Extend the tail of a Tail. Take the return values from a Tail expression and do some more computation.
WARNING: presently this may invoke the given function more than once and duplicate code.
inlineTrivL4 :: Prog -> Prog Source #