gibbon-0.3: A compiler for operating on serialized data
Safe HaskellSafe-Inferred
LanguageHaskell2010

Gibbon.NewL2.Syntax

Description

An intermediate language with an effect system that captures traversals.

Synopsis

Extended language L2 with location types.

data E2Ext loc dec Source #

The extension that turns L1 into L2.

Constructors

LetRegionE Region RegionSize (Maybe RegionType) (E2 loc dec)

Allocate a new region.

LetParRegionE Region RegionSize (Maybe RegionType) (E2 loc dec)

Allocate a new region for parallel allocations.

LetLocE LocVar (PreLocExp loc) (E2 loc dec)

Bind a new location.

RetE [loc] Var

Return a value together with extra loc values.

FromEndE loc

Bind a location from an EndOf location (for RouteEnds and after).

BoundsCheck Int loc loc 
AddFixed Var Int 
IndirectionE TyCon DataCon (loc, loc) (loc, loc) (E2 loc dec)

A indirection node.

StartOfPkdCursor Var 
TagCursor Var Var 
GetCilkWorkerNum

Translates to __cilkrts_get_worker_number().

LetAvail [Var] (E2 loc dec)

These variables are available to use before the join point.

AllocateTagHere LocVar TyCon 
AllocateScalarsHere LocVar

A marker which tells subsequent a compiler pass where to move the tag and scalar field allocations so that they happen before any of the subsequent packed fields.

SSPush SSModality LocVar LocVar TyCon 
SSPop SSModality LocVar LocVar

Spill and restore from the shadow-stack.

Instances

Instances details
Interp Store Exp2 Source # 
Instance details

Defined in Gibbon.L2.Interp

InterpProg Store Exp2 Source # 
Instance details

Defined in Gibbon.L2.Interp

InterpExt Store Exp2 (E2Ext LocVar Ty2) Source # 
Instance details

Defined in Gibbon.L2.Interp

(Out l, Out d) => Out (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

docPrec :: Int -> E2Ext l d -> Doc Source #

doc :: E2Ext l d -> Doc Source #

docList :: [E2Ext l d] -> Doc Source #

Generic (E2Ext loc dec) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type Rep (E2Ext loc dec) :: Type -> Type Source #

Methods

from :: E2Ext loc dec -> Rep (E2Ext loc dec) x Source #

to :: Rep (E2Ext loc dec) x -> E2Ext loc dec Source #

(Read dec, Read loc) => Read (E2Ext loc dec) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

readsPrec :: Int -> ReadS (E2Ext loc dec) Source #

readList :: ReadS [E2Ext loc dec] Source #

readPrec :: ReadPrec (E2Ext loc dec) Source #

readListPrec :: ReadPrec [E2Ext loc dec] Source #

(Show dec, Show loc) => Show (E2Ext loc dec) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

showsPrec :: Int -> E2Ext loc dec -> ShowS Source #

show :: E2Ext loc dec -> String Source #

showList :: [E2Ext loc dec] -> ShowS Source #

(NFData loc, NFData dec) => NFData (E2Ext loc dec) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

rnf :: E2Ext loc dec -> () Source #

(Eq dec, Eq loc) => Eq (E2Ext loc dec) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

(==) :: E2Ext loc dec -> E2Ext loc dec -> Bool Source #

(/=) :: E2Ext loc dec -> E2Ext loc dec -> Bool Source #

(Ord dec, Ord loc) => Ord (E2Ext loc dec) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

compare :: E2Ext loc dec -> E2Ext loc dec -> Ordering Source #

(<) :: E2Ext loc dec -> E2Ext loc dec -> Bool Source #

(<=) :: E2Ext loc dec -> E2Ext loc dec -> Bool Source #

(>) :: E2Ext loc dec -> E2Ext loc dec -> Bool Source #

(>=) :: E2Ext loc dec -> E2Ext loc dec -> Bool Source #

max :: E2Ext loc dec -> E2Ext loc dec -> E2Ext loc dec Source #

min :: E2Ext loc dec -> E2Ext loc dec -> E2Ext loc dec Source #

(Out l, Out d, Show l, Show d) => Expression (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type TyOf (E2Ext l d) Source #

type LocOf (E2Ext l d) Source #

Methods

isTrivial :: E2Ext l d -> Bool Source #

(Typeable (E2Ext l d), Expression (E2Ext l d), Flattenable (E2 l d)) => Flattenable (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gFlattenExp :: DDefs (TyOf (E2Ext l d)) -> Env2 (TyOf (E2Ext l d)) -> E2Ext l d -> PassM (E2Ext l d) Source #

gFlattenGatherBinds :: DDefs (TyOf (E2Ext l d)) -> Env2 (TyOf (E2Ext l d)) -> E2Ext l d -> PassM ([Binds (E2Ext l d)], E2Ext l d) Source #

FreeVars (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gFreeVars :: E2Ext l d -> Set Var Source #

HasRenamable E2Ext l d => Renamable (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gRename :: Map Var Var -> E2Ext l d -> E2Ext l d Source #

Typeable (E2Ext LocArg Ty2) Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

(Out l, Show l, Typeable (E2 l (UrTy l))) => Typeable (E2Ext l (UrTy l)) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gRecoverType :: DDefs (TyOf (E2Ext l (UrTy l))) -> Env2 (TyOf (E2Ext l (UrTy l))) -> E2Ext l (UrTy l) -> TyOf (E2Ext l (UrTy l)) Source #

HasPrettyToo E2Ext l d => Pretty (E2Ext l d) Source # 
Instance details

Defined in Gibbon.Pretty

Methods

pprintWithStyle :: PPStyle -> E2Ext l d -> Doc Source #

pprint :: E2Ext l d -> Doc Source #

Typeable (PreExp E2Ext LocVar (UrTy LocVar)) Source #

The gRecoverType instance defined in Language.Syntax is incorrect for L2. For the AppE case, it'll just return the type with with the function was defined. However, we want the recovered type to have the locations actually used at the callsites! For example,

add1 :: Tree a -> Tree b add1 = _

... (add1 [loc1, loc2] tr1) ..

in this case, we want the type of (add1 tr1) to be (Tree loc2) and NOT (Tree b). We have to do something similar for variables bound by a pattern match.

Instance details

Defined in Gibbon.L2.Syntax

Out (E2Ext LocArg Ty2) => Typeable (PreExp E2Ext LocArg Ty2) Source #

The gRecoverType instance defined in Language.Syntax is incorrect for L2. For the AppE case, it'll just return the type with with the function was defined. However, we want the recovered type to have the locations actually used at the callsites! For example,

add1 :: Tree a -> Tree b add1 = _

... (add1 [loc1, loc2] tr1) ..

in this case, we want the type of (add1 tr1) to be (Tree loc2) and NOT (Tree b). We have to do something similar for variables bound by a pattern match.

Instance details

Defined in Gibbon.NewL2.Syntax

HasSimplifiableExt E2Ext l d => SimplifiableExt (PreExp E2Ext l d) (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gInlineTrivExt :: Map Var (PreExp E2Ext l d) -> E2Ext l d -> E2Ext l d Source #

HasSubstitutableExt E2Ext l d => SubstitutableExt (PreExp E2Ext l d) (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

gSubstExt :: Var -> PreExp E2Ext l d -> E2Ext l d -> E2Ext l d Source #

gSubstEExt :: PreExp E2Ext l d -> PreExp E2Ext l d -> E2Ext l d -> E2Ext l d Source #

type Rep (E2Ext loc dec) Source # 
Instance details

Defined in Gibbon.L2.Syntax

type Rep (E2Ext loc dec) = D1 ('MetaData "E2Ext" "Gibbon.L2.Syntax" "gibbon-0.3-inplace" 'False) ((((C1 ('MetaCons "LetRegionE" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Region) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RegionSize)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe RegionType)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (E2 loc dec)))) :+: C1 ('MetaCons "LetParRegionE" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Region) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RegionSize)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe RegionType)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (E2 loc dec))))) :+: (C1 ('MetaCons "LetLocE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocVar) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PreLocExp loc)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (E2 loc dec)))) :+: C1 ('MetaCons "RetE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [loc]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var)))) :+: ((C1 ('MetaCons "FromEndE" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc)) :+: C1 ('MetaCons "BoundsCheck" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 loc)))) :+: (C1 ('MetaCons "AddFixed" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "IndirectionE" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TyCon) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 DataCon)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (loc, loc)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (loc, loc)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (E2 loc dec)))))))) :+: (((C1 ('MetaCons "StartOfPkdCursor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var)) :+: C1 ('MetaCons "TagCursor" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Var))) :+: (C1 ('MetaCons "GetCilkWorkerNum" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "LetAvail" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Var]) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (E2 loc dec))))) :+: ((C1 ('MetaCons "AllocateTagHere" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocVar) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TyCon)) :+: C1 ('MetaCons "AllocateScalarsHere" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocVar))) :+: (C1 ('MetaCons "SSPush" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SSModality) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocVar)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocVar) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TyCon))) :+: C1 ('MetaCons "SSPop" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SSModality) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocVar) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocVar)))))))
type LocOf (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

type LocOf (E2Ext l d) = l
type TyOf (E2Ext l d) Source # 
Instance details

Defined in Gibbon.L2.Syntax

type TyOf (E2Ext l d) = d

type Exp2 = PreExp E2Ext LocArg Ty2 Source #

Extended expressions, L2.

By adding a LocVar decoration, all data constructors, applications, and bindings gain a location annotation.

newtype Ty2 Source #

L1 Types extended with abstract Locations.

Constructors

MkTy2 

Fields

Instances

Instances details
Out Ty2 Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Methods

docPrec :: Int -> Ty2 -> Doc Source #

doc :: Ty2 -> Doc Source #

docList :: [Ty2] -> Doc Source #

Generic Ty2 Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Associated Types

type Rep Ty2 :: Type -> Type Source #

Methods

from :: Ty2 -> Rep Ty2 x Source #

to :: Rep Ty2 x -> Ty2 Source #

Read Ty2 Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Show Ty2 Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

NFData Ty2 Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Methods

rnf :: Ty2 -> () Source #

Eq Ty2 Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Methods

(==) :: Ty2 -> Ty2 -> Bool Source #

(/=) :: Ty2 -> Ty2 -> Bool Source #

Ord Ty2 Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Methods

compare :: Ty2 -> Ty2 -> Ordering Source #

(<) :: Ty2 -> Ty2 -> Bool Source #

(<=) :: Ty2 -> Ty2 -> Bool Source #

(>) :: Ty2 -> Ty2 -> Bool Source #

(>=) :: Ty2 -> Ty2 -> Bool Source #

max :: Ty2 -> Ty2 -> Ty2 Source #

min :: Ty2 -> Ty2 -> Ty2 Source #

FunctionTy Ty2 Source #

Function types know about locations and traversal effects.

Instance details

Defined in Gibbon.NewL2.Syntax

Associated Types

type ArrowTy Ty2 Source #

Pretty Ty2 Source # 
Instance details

Defined in Gibbon.Pretty

Out (ArrowTy2 Ty2) Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Typeable (E2Ext LocArg Ty2) Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Out (E2Ext LocArg Ty2) => Typeable (PreExp E2Ext LocArg Ty2) Source #

The gRecoverType instance defined in Language.Syntax is incorrect for L2. For the AppE case, it'll just return the type with with the function was defined. However, we want the recovered type to have the locations actually used at the callsites! For example,

add1 :: Tree a -> Tree b add1 = _

... (add1 [loc1, loc2] tr1) ..

in this case, we want the type of (add1 tr1) to be (Tree loc2) and NOT (Tree b). We have to do something similar for variables bound by a pattern match.

Instance details

Defined in Gibbon.NewL2.Syntax

type Rep Ty2 Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

type Rep Ty2 = D1 ('MetaData "Ty2" "Gibbon.NewL2.Syntax" "gibbon-0.3-inplace" 'True) (C1 ('MetaCons "MkTy2" 'PrefixI 'True) (S1 ('MetaSel ('Just "unTy2") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (UrTy LocVar))))
type ArrowTy Ty2 Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

data Effect Source #

The side-effect of evaluating a function.

Constructors

Traverse LocVar

The function, during its execution, traverses all of the value living at this location.

Instances

Instances details
Out Effect Source # 
Instance details

Defined in Gibbon.L2.Syntax

Generic Effect Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type Rep Effect :: Type -> Type Source #

Read Effect Source # 
Instance details

Defined in Gibbon.L2.Syntax

Show Effect Source # 
Instance details

Defined in Gibbon.L2.Syntax

NFData Effect Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

rnf :: Effect -> () Source #

Eq Effect Source # 
Instance details

Defined in Gibbon.L2.Syntax

Ord Effect Source # 
Instance details

Defined in Gibbon.L2.Syntax

type Rep Effect Source # 
Instance details

Defined in Gibbon.L2.Syntax

type Rep Effect = D1 ('MetaData "Effect" "Gibbon.L2.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "Traverse" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LocVar)))

data ArrowTy2 ty2 Source #

Our type for functions grows to include effects, and explicit universal quantification over location/region variables.

Constructors

ArrowTy2 

Fields

  • locVars :: [LRM]

    Universally-quantified location params. Only these should be referenced in arrIn/arrOut.

  • arrIns :: [ty2]

    Input type for the function.

  • arrEffs :: Set Effect

    These are present-but-empty initially, and the populated by InferEffects.

  • arrOut :: ty2

    Output type for the function.

  • locRets :: [LocRet]

    L2B feature: multi-valued returns.

  • hasParallelism :: Bool

    Does this function have parallelism

Instances

Instances details
Functor ArrowTy2 Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

fmap :: (a -> b) -> ArrowTy2 a -> ArrowTy2 b Source #

(<$) :: a -> ArrowTy2 b -> ArrowTy2 a Source #

Out (ArrowTy2 Ty2) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Out (ArrowTy2 Ty2) Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Generic (ArrowTy2 ty2) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type Rep (ArrowTy2 ty2) :: Type -> Type Source #

Methods

from :: ArrowTy2 ty2 -> Rep (ArrowTy2 ty2) x Source #

to :: Rep (ArrowTy2 ty2) x -> ArrowTy2 ty2 Source #

Read ty2 => Read (ArrowTy2 ty2) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Show ty2 => Show (ArrowTy2 ty2) Source # 
Instance details

Defined in Gibbon.L2.Syntax

NFData ty2 => NFData (ArrowTy2 ty2) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

rnf :: ArrowTy2 ty2 -> () Source #

Eq ty2 => Eq (ArrowTy2 ty2) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

(==) :: ArrowTy2 ty2 -> ArrowTy2 ty2 -> Bool Source #

(/=) :: ArrowTy2 ty2 -> ArrowTy2 ty2 -> Bool Source #

Ord ty2 => Ord (ArrowTy2 ty2) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

compare :: ArrowTy2 ty2 -> ArrowTy2 ty2 -> Ordering Source #

(<) :: ArrowTy2 ty2 -> ArrowTy2 ty2 -> Bool Source #

(<=) :: ArrowTy2 ty2 -> ArrowTy2 ty2 -> Bool Source #

(>) :: ArrowTy2 ty2 -> ArrowTy2 ty2 -> Bool Source #

(>=) :: ArrowTy2 ty2 -> ArrowTy2 ty2 -> Bool Source #

max :: ArrowTy2 ty2 -> ArrowTy2 ty2 -> ArrowTy2 ty2 Source #

min :: ArrowTy2 ty2 -> ArrowTy2 ty2 -> ArrowTy2 ty2 Source #

Pretty ty2 => Pretty (ArrowTy2 ty2) Source # 
Instance details

Defined in Gibbon.Pretty

type Rep (ArrowTy2 ty2) Source # 
Instance details

Defined in Gibbon.L2.Syntax

data LocRet Source #

Locations (end-witnesses) returned from functions after RouteEnds.

Constructors

EndOf LRM 

Instances

Instances details
Out LocRet Source # 
Instance details

Defined in Gibbon.L2.Syntax

Generic LocRet Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type Rep LocRet :: Type -> Type Source #

Read LocRet Source # 
Instance details

Defined in Gibbon.L2.Syntax

Show LocRet Source # 
Instance details

Defined in Gibbon.L2.Syntax

NFData LocRet Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

rnf :: LocRet -> () Source #

Eq LocRet Source # 
Instance details

Defined in Gibbon.L2.Syntax

Ord LocRet Source # 
Instance details

Defined in Gibbon.L2.Syntax

type Rep LocRet Source # 
Instance details

Defined in Gibbon.L2.Syntax

type Rep LocRet = D1 ('MetaData "LocRet" "Gibbon.L2.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "EndOf" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LRM)))

data LocArg Source #

Instances

Instances details
Out LocArg Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Generic LocArg Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Associated Types

type Rep LocArg :: Type -> Type Source #

Read LocArg Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Show LocArg Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

NFData LocArg Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Methods

rnf :: LocArg -> () Source #

Eq LocArg Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Ord LocArg Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

FreeVars LocExp Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Pretty LocArg Source # 
Instance details

Defined in Gibbon.Pretty

Typeable (E2Ext LocArg Ty2) Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Out (E2Ext LocArg Ty2) => Typeable (PreExp E2Ext LocArg Ty2) Source #

The gRecoverType instance defined in Language.Syntax is incorrect for L2. For the AppE case, it'll just return the type with with the function was defined. However, we want the recovered type to have the locations actually used at the callsites! For example,

add1 :: Tree a -> Tree b add1 = _

... (add1 [loc1, loc2] tr1) ..

in this case, we want the type of (add1 tr1) to be (Tree loc2) and NOT (Tree b). We have to do something similar for variables bound by a pattern match.

Instance details

Defined in Gibbon.NewL2.Syntax

type Rep LocArg Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

data PreLocExp loc Source #

Define a location in terms of a different location.

Instances

Instances details
Functor PreLocExp Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

fmap :: (a -> b) -> PreLocExp a -> PreLocExp b Source #

(<$) :: a -> PreLocExp b -> PreLocExp a Source #

FreeVars LocExp Source # 
Instance details

Defined in Gibbon.L2.Syntax

FreeVars LocExp Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Out l => Out (PreLocExp l) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Generic (PreLocExp loc) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type Rep (PreLocExp loc) :: Type -> Type Source #

Methods

from :: PreLocExp loc -> Rep (PreLocExp loc) x Source #

to :: Rep (PreLocExp loc) x -> PreLocExp loc Source #

Read loc => Read (PreLocExp loc) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Show loc => Show (PreLocExp loc) Source # 
Instance details

Defined in Gibbon.L2.Syntax

NFData loc => NFData (PreLocExp loc) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

rnf :: PreLocExp loc -> () Source #

Eq loc => Eq (PreLocExp loc) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

(==) :: PreLocExp loc -> PreLocExp loc -> Bool Source #

(/=) :: PreLocExp loc -> PreLocExp loc -> Bool Source #

Ord loc => Ord (PreLocExp loc) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

compare :: PreLocExp loc -> PreLocExp loc -> Ordering Source #

(<) :: PreLocExp loc -> PreLocExp loc -> Bool Source #

(<=) :: PreLocExp loc -> PreLocExp loc -> Bool Source #

(>) :: PreLocExp loc -> PreLocExp loc -> Bool Source #

(>=) :: PreLocExp loc -> PreLocExp loc -> Bool Source #

max :: PreLocExp loc -> PreLocExp loc -> PreLocExp loc Source #

min :: PreLocExp loc -> PreLocExp loc -> PreLocExp loc Source #

Pretty l => Pretty (PreLocExp l) Source # 
Instance details

Defined in Gibbon.Pretty

type Rep (PreLocExp loc) Source # 
Instance details

Defined in Gibbon.L2.Syntax

Regions and locations

type LocVar = Var Source #

Abstract location variables.

data Region Source #

An abstract region identifier. This is used inside type signatures and elsewhere.

Constructors

GlobR Var Multiplicity

A global region with lifetime equal to the whole program.

DynR Var Multiplicity

A dynamic region that may be created or destroyed, tagged by an identifier.

VarR Var

A region metavariable that can range over either global or dynamic regions.

MMapR Var

A region that doesn't result in an (explicit) memory allocation. It merely ensures that there are no free locations in the program.

Instances

Instances details
Out Region Source # 
Instance details

Defined in Gibbon.L2.Syntax

Generic Region Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type Rep Region :: Type -> Type Source #

Read Region Source # 
Instance details

Defined in Gibbon.L2.Syntax

Show Region Source # 
Instance details

Defined in Gibbon.L2.Syntax

NFData Region Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

rnf :: Region -> () Source #

Eq Region Source # 
Instance details

Defined in Gibbon.L2.Syntax

Ord Region Source # 
Instance details

Defined in Gibbon.L2.Syntax

Pretty Region Source # 
Instance details

Defined in Gibbon.Pretty

type Rep Region Source # 
Instance details

Defined in Gibbon.L2.Syntax

data Modality Source #

The modality of locations and cursors: input/output, for reading and writing, respectively.

Constructors

Input 
Output 

Instances

Instances details
Out Modality Source # 
Instance details

Defined in Gibbon.L2.Syntax

Generic Modality Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type Rep Modality :: Type -> Type Source #

Read Modality Source # 
Instance details

Defined in Gibbon.L2.Syntax

Show Modality Source # 
Instance details

Defined in Gibbon.L2.Syntax

NFData Modality Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

rnf :: Modality -> () Source #

Eq Modality Source # 
Instance details

Defined in Gibbon.L2.Syntax

Ord Modality Source # 
Instance details

Defined in Gibbon.L2.Syntax

Pretty Modality Source # 
Instance details

Defined in Gibbon.Pretty

type Rep Modality Source # 
Instance details

Defined in Gibbon.L2.Syntax

type Rep Modality = D1 ('MetaData "Modality" "Gibbon.L2.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "Input" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "Output" 'PrefixI 'False) (U1 :: Type -> Type))

data LRM Source #

A location and region, together with modality.

Constructors

LRM 

Instances

Instances details
Out LRM Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

docPrec :: Int -> LRM -> Doc Source #

doc :: LRM -> Doc Source #

docList :: [LRM] -> Doc Source #

Generic LRM Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type Rep LRM :: Type -> Type Source #

Methods

from :: LRM -> Rep LRM x Source #

to :: Rep LRM x -> LRM Source #

Read LRM Source # 
Instance details

Defined in Gibbon.L2.Syntax

Show LRM Source # 
Instance details

Defined in Gibbon.L2.Syntax

NFData LRM Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

rnf :: LRM -> () Source #

Eq LRM Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

(==) :: LRM -> LRM -> Bool Source #

(/=) :: LRM -> LRM -> Bool Source #

Ord LRM Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

compare :: LRM -> LRM -> Ordering Source #

(<) :: LRM -> LRM -> Bool Source #

(<=) :: LRM -> LRM -> Bool Source #

(>) :: LRM -> LRM -> Bool Source #

(>=) :: LRM -> LRM -> Bool Source #

max :: LRM -> LRM -> LRM Source #

min :: LRM -> LRM -> LRM Source #

Pretty LRM Source # 
Instance details

Defined in Gibbon.Pretty

type Rep LRM Source # 
Instance details

Defined in Gibbon.L2.Syntax

data LREM Source #

Constructors

LREM 

Instances

Instances details
Out LREM Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Methods

docPrec :: Int -> LREM -> Doc Source #

doc :: LREM -> Doc Source #

docList :: [LREM] -> Doc Source #

Generic LREM Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Associated Types

type Rep LREM :: Type -> Type Source #

Methods

from :: LREM -> Rep LREM x Source #

to :: Rep LREM x -> LREM Source #

Read LREM Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Show LREM Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

NFData LREM Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Methods

rnf :: LREM -> () Source #

Eq LREM Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Methods

(==) :: LREM -> LREM -> Bool Source #

(/=) :: LREM -> LREM -> Bool Source #

Ord LREM Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

Pretty LREM Source # 
Instance details

Defined in Gibbon.Pretty

type Rep LREM Source # 
Instance details

Defined in Gibbon.NewL2.Syntax

data Multiplicity Source #

Region variants (multiplicities)

Constructors

Bounded Int

Contain a finite number of values and can be stack-allocated.

Infinite

Consist of a linked list of buffers, spread throughout memory (though possible constrained to 4GB regions). Writing into these regions requires bounds-checking. The buffers can start very small at the head of the list, but probably grow geometrically in size, making the cost of traversing all of them logarithmic.

BigInfinite

These regions are infinite, but also have the expectation of containing many values. Thus we give them large initial page sizes. This is also could be the appropriate place to use mmap to grow the region and to establish guard places.

Instances

Instances details
Out Multiplicity Source # 
Instance details

Defined in Gibbon.L2.Syntax

Generic Multiplicity Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type Rep Multiplicity :: Type -> Type Source #

Read Multiplicity Source # 
Instance details

Defined in Gibbon.L2.Syntax

Show Multiplicity Source # 
Instance details

Defined in Gibbon.L2.Syntax

NFData Multiplicity Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

rnf :: Multiplicity -> () Source #

Eq Multiplicity Source # 
Instance details

Defined in Gibbon.L2.Syntax

Ord Multiplicity Source # 
Instance details

Defined in Gibbon.L2.Syntax

type Rep Multiplicity Source # 
Instance details

Defined in Gibbon.L2.Syntax

type Rep Multiplicity = D1 ('MetaData "Multiplicity" "Gibbon.L2.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "Bounded" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: (C1 ('MetaCons "Infinite" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BigInfinite" 'PrefixI 'False) (U1 :: Type -> Type)))

data RegionSize Source #

Constructors

BoundedSize Int 
Undefined 

Instances

Instances details
Out RegionSize Source # 
Instance details

Defined in Gibbon.L2.Syntax

Monoid RegionSize Source # 
Instance details

Defined in Gibbon.L2.Syntax

Semigroup RegionSize Source # 
Instance details

Defined in Gibbon.L2.Syntax

Generic RegionSize Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type Rep RegionSize :: Type -> Type Source #

Read RegionSize Source # 
Instance details

Defined in Gibbon.L2.Syntax

Show RegionSize Source # 
Instance details

Defined in Gibbon.L2.Syntax

NFData RegionSize Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

rnf :: RegionSize -> () Source #

Eq RegionSize Source # 
Instance details

Defined in Gibbon.L2.Syntax

Ord RegionSize Source #

Undefined is at the top of this lattice.

Instance details

Defined in Gibbon.L2.Syntax

Pretty RegionSize Source # 
Instance details

Defined in Gibbon.Pretty

type Rep RegionSize Source # 
Instance details

Defined in Gibbon.L2.Syntax

type Rep RegionSize = D1 ('MetaData "RegionSize" "Gibbon.L2.Syntax" "gibbon-0.3-inplace" 'False) (C1 ('MetaCons "BoundedSize" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)) :+: C1 ('MetaCons "Undefined" 'PrefixI 'False) (U1 :: Type -> Type))

data RegionType Source #

Instances

Instances details
Out RegionType Source # 
Instance details

Defined in Gibbon.L2.Syntax

Semigroup RegionType Source # 
Instance details

Defined in Gibbon.L2.Syntax

Generic RegionType Source # 
Instance details

Defined in Gibbon.L2.Syntax

Associated Types

type Rep RegionType :: Type -> Type Source #

Read RegionType Source # 
Instance details

Defined in Gibbon.L2.Syntax

Show RegionType Source # 
Instance details

Defined in Gibbon.L2.Syntax

NFData RegionType Source # 
Instance details

Defined in Gibbon.L2.Syntax

Methods

rnf :: RegionType -> () Source #

Eq RegionType Source # 
Instance details

Defined in Gibbon.L2.Syntax

Ord RegionType Source # 
Instance details

Defined in Gibbon.L2.Syntax

type Rep RegionType Source # 
Instance details

Defined in Gibbon.L2.Syntax

type Rep RegionType = D1 ('MetaData "RegionType" "Gibbon.L2.Syntax" "gibbon-0.3-inplace" 'False) ((C1 ('MetaCons "IndirectionFree" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "RightwardLocalIndirections" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "LocalIndirections" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NoSharing" 'PrefixI 'False) (U1 :: Type -> Type)))

Operations on types

allLocVars :: ArrowTy2 ty2 -> [LocVar] Source #

Retrieve all LocVars from a fn type (Arrow)

substLoc :: Map LocVar LocVar -> Ty2 -> Ty2 Source #

Apply a location substitution to a type.

substLocs :: Map LocVar LocVar -> [Ty2] -> [Ty2] Source #

List version of substLoc.

substEff :: Map LocVar LocVar -> Effect -> Effect Source #

Apply a substitution to an effect.

substEffs :: Map LocVar LocVar -> Set Effect -> Set Effect Source #

Apply a substitution to an effect set.

extendPatternMatchEnv :: HasCallStack => DataCon -> DDefs Ty2 -> [Var] -> [LocVar] -> Env2 Ty2 -> Env2 Ty2 Source #

Extend an environment for a pattern match. E.g.

data Foo = MkFoo Int Foo | ...

case foo1 of MkFoo (i:loc1) (f:loc2) -> new_env2 = extendPatternMatchEnv [loc1,loc2] old_env2

locsInTy :: Ty2 -> [LocVar] Source #

Collect all the locations mentioned in a type.

Other helpers

occurs :: Set Var -> Exp2 -> Bool Source #

Does a variable occur in an expression ?

N.B. it only looks for actual variables, not LocVar's or RegionVar's.

mapPacked :: (Var -> l -> UrTy l) -> UrTy l -> UrTy l Source #

constPacked :: UrTy a1 -> UrTy a2 -> UrTy a1 Source #

depList :: Exp2 -> [(Var, Var, [Var])] Source #

Build a dependency list which can be later converted to a graph

changeAppToSpawn :: (Eq loc, Eq dec) => Var -> [PreExp E2Ext loc dec] -> PreExp E2Ext loc dec -> PreExp E2Ext loc dec Source #