kempe-0.1.1.0: Kempe compiler
Safe HaskellNone
LanguageHaskell2010

Kempe.IR

Description

IR loosely based on Appel book.

Synopsis

Documentation

data Stmt Source #

Instances

Instances details
Generic Stmt Source # 
Instance details

Defined in Kempe.IR

Associated Types

type Rep Stmt :: Type -> Type #

Methods

from :: Stmt -> Rep Stmt x #

to :: Rep Stmt x -> Stmt #

NFData Stmt Source # 
Instance details

Defined in Kempe.IR

Methods

rnf :: Stmt -> () #

Pretty Stmt Source # 
Instance details

Defined in Kempe.IR

Methods

pretty :: Stmt -> Doc ann

prettyList :: [Stmt] -> Doc ann

type Rep Stmt Source # 
Instance details

Defined in Kempe.IR

type Rep Stmt = D1 ('MetaData "Stmt" "Kempe.IR" "kempe-0.1.1.0-inplace-kempe-modules" 'False) (((C1 ('MetaCons "Labeled" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Label)) :+: C1 ('MetaCons "Jump" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Label))) :+: (C1 ('MetaCons "CJump" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Label) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Label))) :+: (C1 ('MetaCons "MJump" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Label)) :+: C1 ('MetaCons "CCall" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MonoStackType) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))))) :+: ((C1 ('MetaCons "KCall" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Label)) :+: C1 ('MetaCons "WrapKCall" 'PrefixI 'False) ((S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ABI) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MonoStackType)) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Label)))) :+: (C1 ('MetaCons "MovTemp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Temp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp)) :+: (C1 ('MetaCons "MovMem" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp))) :+: C1 ('MetaCons "Ret" 'PrefixI 'False) (U1 :: Type -> Type)))))

data Exp Source #

Instances

Instances details
Eq Exp Source # 
Instance details

Defined in Kempe.IR

Methods

(==) :: Exp -> Exp -> Bool #

(/=) :: Exp -> Exp -> Bool #

Generic Exp Source # 
Instance details

Defined in Kempe.IR

Associated Types

type Rep Exp :: Type -> Type #

Methods

from :: Exp -> Rep Exp x #

to :: Rep Exp x -> Exp #

NFData Exp Source # 
Instance details

Defined in Kempe.IR

Methods

rnf :: Exp -> () #

Pretty Exp Source # 
Instance details

Defined in Kempe.IR

Methods

pretty :: Exp -> Doc ann

prettyList :: [Exp] -> Doc ann

type Rep Exp Source # 
Instance details

Defined in Kempe.IR

type Rep Exp = D1 ('MetaData "Exp" "Kempe.IR" "kempe-0.1.1.0-inplace-kempe-modules" 'False) (((C1 ('MetaCons "ConstInt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64)) :+: (C1 ('MetaCons "ConstInt8" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int8)) :+: C1 ('MetaCons "ConstTag" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word8)))) :+: (C1 ('MetaCons "ConstWord" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :+: (C1 ('MetaCons "ConstBool" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)) :+: C1 ('MetaCons "Reg" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Temp))))) :+: ((C1 ('MetaCons "Mem" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int64) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp)) :+: (C1 ('MetaCons "ExprIntBinOp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 IntBinOp) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp))) :+: C1 ('MetaCons "ExprIntRel" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RelBinOp) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp))))) :+: ((C1 ('MetaCons "BoolBinOp" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BoolBinOp) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp))) :+: C1 ('MetaCons "IntNegIR" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp))) :+: (C1 ('MetaCons "PopcountIR" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp)) :+: C1 ('MetaCons "EqByte" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Exp))))))

data RelBinOp Source #

Instances

Instances details
Eq RelBinOp Source # 
Instance details

Defined in Kempe.IR

Generic RelBinOp Source # 
Instance details

Defined in Kempe.IR

Associated Types

type Rep RelBinOp :: Type -> Type #

Methods

from :: RelBinOp -> Rep RelBinOp x #

to :: Rep RelBinOp x -> RelBinOp #

NFData RelBinOp Source # 
Instance details

Defined in Kempe.IR

Methods

rnf :: RelBinOp -> () #

Pretty RelBinOp Source # 
Instance details

Defined in Kempe.IR

Methods

pretty :: RelBinOp -> Doc ann

prettyList :: [RelBinOp] -> Doc ann

type Rep RelBinOp Source # 
Instance details

Defined in Kempe.IR

type Rep RelBinOp = D1 ('MetaData "RelBinOp" "Kempe.IR" "kempe-0.1.1.0-inplace-kempe-modules" 'False) ((C1 ('MetaCons "IntEqIR" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "IntNeqIR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IntLtIR" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "IntGtIR" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "IntLeqIR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IntGeqIR" 'PrefixI 'False) (U1 :: Type -> Type))))

data IntBinOp Source #

Instances

Instances details
Eq IntBinOp Source # 
Instance details

Defined in Kempe.IR

Generic IntBinOp Source # 
Instance details

Defined in Kempe.IR

Associated Types

type Rep IntBinOp :: Type -> Type #

Methods

from :: IntBinOp -> Rep IntBinOp x #

to :: Rep IntBinOp x -> IntBinOp #

NFData IntBinOp Source # 
Instance details

Defined in Kempe.IR

Methods

rnf :: IntBinOp -> () #

Pretty IntBinOp Source # 
Instance details

Defined in Kempe.IR

Methods

pretty :: IntBinOp -> Doc ann

prettyList :: [IntBinOp] -> Doc ann

type Rep IntBinOp Source # 
Instance details

Defined in Kempe.IR

type Rep IntBinOp = D1 ('MetaData "IntBinOp" "Kempe.IR" "kempe-0.1.1.0-inplace-kempe-modules" 'False) (((C1 ('MetaCons "IntPlusIR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IntTimesIR" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "IntDivIR" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "IntMinusIR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "IntModIR" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "IntXorIR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WordShiftRIR" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "WordShiftLIR" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "WordModIR" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "WordDivIR" 'PrefixI 'False) (U1 :: Type -> Type)))))

data BoolBinOp Source #

Constructors

BoolAnd 
BoolOr 
BoolXor 

Instances

Instances details
Eq BoolBinOp Source # 
Instance details

Defined in Kempe.IR

Generic BoolBinOp Source # 
Instance details

Defined in Kempe.IR

Associated Types

type Rep BoolBinOp :: Type -> Type #

NFData BoolBinOp Source # 
Instance details

Defined in Kempe.IR

Methods

rnf :: BoolBinOp -> () #

Pretty BoolBinOp Source # 
Instance details

Defined in Kempe.IR

Methods

pretty :: BoolBinOp -> Doc ann

prettyList :: [BoolBinOp] -> Doc ann

type Rep BoolBinOp Source # 
Instance details

Defined in Kempe.IR

type Rep BoolBinOp = D1 ('MetaData "BoolBinOp" "Kempe.IR" "kempe-0.1.1.0-inplace-kempe-modules" 'False) (C1 ('MetaCons "BoolAnd" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "BoolOr" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BoolXor" 'PrefixI 'False) (U1 :: Type -> Type)))

data Temp Source #

Constructors

Temp64 !Int 
Temp8 !Int 
DataPointer 

Instances

Instances details
Eq Temp Source # 
Instance details

Defined in Kempe.IR

Methods

(==) :: Temp -> Temp -> Bool #

(/=) :: Temp -> Temp -> Bool #

Generic Temp Source # 
Instance details

Defined in Kempe.IR

Associated Types

type Rep Temp :: Type -> Type #

Methods

from :: Temp -> Rep Temp x #

to :: Rep Temp x -> Temp #

NFData Temp Source # 
Instance details

Defined in Kempe.IR

Methods

rnf :: Temp -> () #

Pretty Temp Source # 
Instance details

Defined in Kempe.IR

Methods

pretty :: Temp -> Doc ann

prettyList :: [Temp] -> Doc ann

type Rep Temp Source # 
Instance details

Defined in Kempe.IR

type Rep Temp = D1 ('MetaData "Temp" "Kempe.IR" "kempe-0.1.1.0-inplace-kempe-modules" 'False) (C1 ('MetaCons "Temp64" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)) :+: (C1 ('MetaCons "Temp8" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int)) :+: C1 ('MetaCons "DataPointer" 'PrefixI 'False) (U1 :: Type -> Type)))

type TempM = State TempSt Source #

prettyIR :: [Stmt] -> Doc ann Source #

data WriteSt Source #

Constructors

WriteSt 

Fields

size :: SizeEnv -> KempeTy a -> Size Source #

Don't call this on ill-kinded types; it won't throw any error.