Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Macaw.CFG.App
Description
Synopsis
- data App (f :: Type -> Type) (tp :: Type) where
- Eq :: forall (f :: Type -> Type) (tp1 :: Type). !(f tp1) -> !(f tp1) -> App f 'BoolType
- Mux :: forall (tp :: Type) (f :: Type -> Type). !(TypeRepr tp) -> !(f BoolType) -> !(f tp) -> !(f tp) -> App f tp
- AndApp :: forall (f :: Type -> Type). !(f BoolType) -> !(f BoolType) -> App f 'BoolType
- OrApp :: forall (f :: Type -> Type). !(f BoolType) -> !(f BoolType) -> App f 'BoolType
- NotApp :: forall (f :: Type -> Type). !(f BoolType) -> App f 'BoolType
- XorApp :: forall (f :: Type -> Type). !(f BoolType) -> !(f BoolType) -> App f 'BoolType
- MkTuple :: forall (flds :: [Type]) (f :: Type -> Type). !(List TypeRepr flds) -> !(List f flds) -> App f ('TupleType flds)
- TupleField :: forall (l :: [Type]) (f :: Type -> Type) (tp :: Type). !(List TypeRepr l) -> !(f (TupleType l)) -> !(Index l tp) -> App f tp
- ExtractElement :: forall (tp :: Type) (f :: Type -> Type) (n :: Nat). !(TypeRepr tp) -> !(f (VecType n tp)) -> !Int -> App f tp
- InsertElement :: forall (n :: Nat) (tp1 :: Type) (f :: Type -> Type). !(TypeRepr (VecType n tp1)) -> !(f (VecType n tp1)) -> !Int -> !(f tp1) -> App f ('VecType n tp1)
- Trunc :: forall (n :: Natural) (m :: Natural) (f :: Type -> Type). (1 <= n, (n + 1) <= m) => !(f (BVType m)) -> !(NatRepr n) -> App f ('BVType n)
- SExt :: forall (m :: Natural) (n :: Natural) (f :: Type -> Type). (1 <= m, (m + 1) <= n, 1 <= n) => !(f (BVType m)) -> !(NatRepr n) -> App f ('BVType n)
- UExt :: forall (m :: Natural) (n :: Natural) (f :: Type -> Type). (1 <= m, (m + 1) <= n, 1 <= n) => !(f (BVType m)) -> !(NatRepr n) -> App f ('BVType n)
- Bitcast :: forall (f :: Type -> Type) (tp1 :: Type) (tp :: Type). !(f tp1) -> !(WidthEqProof tp1 tp) -> App f tp
- BVAdd :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n)
- BVAdc :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f ('BVType n)
- BVSub :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n)
- BVSbb :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f ('BVType n)
- BVMul :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n)
- BVUnsignedLe :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> App f 'BoolType
- BVUnsignedLt :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> App f 'BoolType
- BVSignedLe :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> App f 'BoolType
- BVSignedLt :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> App f 'BoolType
- BVTestBit :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> App f 'BoolType
- BVComplement :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> App f ('BVType n)
- BVAnd :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n)
- BVOr :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n)
- BVXor :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n)
- BVShl :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n)
- BVShr :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n)
- BVSar :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n)
- UadcOverflows :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f 'BoolType
- SadcOverflows :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f 'BoolType
- UsbbOverflows :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f 'BoolType
- SsbbOverflows :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f 'BoolType
- PopCount :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> App f ('BVType n)
- ReverseBytes :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType (8 * n))) -> App f ('BVType (8 * n))
- Bsf :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> App f ('BVType n)
- Bsr :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> App f ('BVType n)
- ppApp :: forall f ann (tp :: Type). (forall (u :: Type). f u -> Doc ann) -> App f tp -> Doc ann
- ppAppA :: forall m f (tp :: Type) ann. Applicative m => (forall (u :: Type). f u -> m (Doc ann)) -> App f tp -> m (Doc ann)
- data AppRender (f :: Type -> Type) = AppRender Text [AppRenderArg f]
- data AppRenderArg (f :: Type -> Type) where
- rendApp :: forall (f :: Type -> Type) (tp :: Type). App f tp -> AppRender f
- data WidthEqProof (in_tp :: Type) (out_tp :: Type) where
- PackBits :: forall (n :: Natural) (w :: Natural). (1 <= n, 2 <= n, 1 <= w) => !(NatRepr n) -> !(NatRepr w) -> WidthEqProof ('VecType n (BVType w)) ('BVType (n * w))
- UnpackBits :: forall (n :: Natural) (w :: Natural). (1 <= n, 2 <= n, 1 <= w) => !(NatRepr n) -> !(NatRepr w) -> WidthEqProof ('BVType (n * w)) ('VecType n (BVType w))
- FromFloat :: forall (ftp :: FloatInfo). !(FloatInfoRepr ftp) -> WidthEqProof ('FloatType ftp) ('BVType (FloatInfoBits ftp))
- ToFloat :: forall (ftp :: FloatInfo). !(FloatInfoRepr ftp) -> WidthEqProof ('BVType (FloatInfoBits ftp)) ('FloatType ftp)
- VecEqCongruence :: forall (n :: Nat) (i :: Type) (o :: Type). !(NatRepr n) -> !(WidthEqProof i o) -> WidthEqProof ('VecType n i) ('VecType n o)
- WidthEqRefl :: forall (in_tp :: Type). !(TypeRepr in_tp) -> WidthEqProof in_tp in_tp
- WidthEqTrans :: forall (in_tp :: Type) (y :: Type) (out_tp :: Type). !(WidthEqProof in_tp y) -> !(WidthEqProof y out_tp) -> WidthEqProof in_tp out_tp
- widthEqProofEq :: forall (xi :: Type) (xo :: Type) (yi :: Type) (yo :: Type). WidthEqProof xi xo -> WidthEqProof yi yo -> Maybe (WidthEqProof xi xo :~: WidthEqProof yi yo)
- widthEqProofCompare :: forall (xi :: Type) (xo :: Type) (yi :: Type) (yo :: Type). WidthEqProof xi xo -> WidthEqProof yi yo -> OrderingF (WidthEqProof xi xo) (WidthEqProof yi yo)
- widthEqSource :: forall (i :: Type) (o :: Type). WidthEqProof i o -> TypeRepr i
- widthEqTarget :: forall (i :: Type) (o :: Type). WidthEqProof i o -> TypeRepr o
- widthEqSym :: forall (x :: Type) (y :: Type). WidthEqProof x y -> WidthEqProof y x
App
data App (f :: Type -> Type) (tp :: Type) where Source #
This datatype defines operations used on multiple architectures.
These operations are all total functions. Different architecture tend to have different ways of raising signals or exceptions, and so partial functions are all architecture specific.
Constructors
Eq :: forall (f :: Type -> Type) (tp1 :: Type). !(f tp1) -> !(f tp1) -> App f 'BoolType | Compare for equality. |
Mux :: forall (tp :: Type) (f :: Type -> Type). !(TypeRepr tp) -> !(f BoolType) -> !(f tp) -> !(f tp) -> App f tp | |
AndApp :: forall (f :: Type -> Type). !(f BoolType) -> !(f BoolType) -> App f 'BoolType | |
OrApp :: forall (f :: Type -> Type). !(f BoolType) -> !(f BoolType) -> App f 'BoolType | |
NotApp :: forall (f :: Type -> Type). !(f BoolType) -> App f 'BoolType | |
XorApp :: forall (f :: Type -> Type). !(f BoolType) -> !(f BoolType) -> App f 'BoolType | |
MkTuple :: forall (flds :: [Type]) (f :: Type -> Type). !(List TypeRepr flds) -> !(List f flds) -> App f ('TupleType flds) | Create a tuple from a list of fields |
TupleField :: forall (l :: [Type]) (f :: Type -> Type) (tp :: Type). !(List TypeRepr l) -> !(f (TupleType l)) -> !(Index l tp) -> App f tp | Extract the value out of a tuple. |
ExtractElement :: forall (tp :: Type) (f :: Type -> Type) (n :: Nat). !(TypeRepr tp) -> !(f (VecType n tp)) -> !Int -> App f tp | Extracts an element at given constant index from vector |
InsertElement :: forall (n :: Nat) (tp1 :: Type) (f :: Type -> Type). !(TypeRepr (VecType n tp1)) -> !(f (VecType n tp1)) -> !Int -> !(f tp1) -> App f ('VecType n tp1) | Sets an element at given constant in vector. |
Trunc :: forall (n :: Natural) (m :: Natural) (f :: Type -> Type). (1 <= n, (n + 1) <= m) => !(f (BVType m)) -> !(NatRepr n) -> App f ('BVType n) | Given a |
SExt :: forall (m :: Natural) (n :: Natural) (f :: Type -> Type). (1 <= m, (m + 1) <= n, 1 <= n) => !(f (BVType m)) -> !(NatRepr n) -> App f ('BVType n) | Given a |
UExt :: forall (m :: Natural) (n :: Natural) (f :: Type -> Type). (1 <= m, (m + 1) <= n, 1 <= n) => !(f (BVType m)) -> !(NatRepr n) -> App f ('BVType n) | Given a |
Bitcast :: forall (f :: Type -> Type) (tp1 :: Type) (tp :: Type). !(f tp1) -> !(WidthEqProof tp1 tp) -> App f tp | This casts an expression from one type to another that should use the same number of bytes in memory. |
BVAdd :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n) |
|
BVAdc :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f ('BVType n) |
|
BVSub :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n) |
|
BVSbb :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f ('BVType n) |
|
BVMul :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n) | |
BVUnsignedLe :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> App f 'BoolType | |
BVUnsignedLt :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> App f 'BoolType | |
BVSignedLe :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> App f 'BoolType | |
BVSignedLt :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> App f 'BoolType | |
BVTestBit :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> App f 'BoolType | |
BVComplement :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> App f ('BVType n) | |
BVAnd :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n) | |
BVOr :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n) | |
BVXor :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n) | |
BVShl :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n) | Left shift (e.g. `BVShl x y` denotes `fromUnsigned (toUnsigned x * 2 ^ toUnsigned y)` |
BVShr :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n) | Unsigned right shift (e.g. `BVShr x y` denotes `fromUnsigned (toUnsigned x / 2 ^ toUnsigned y)` |
BVSar :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> !(f (BVType n)) -> App f ('BVType n) | Arithmetic right shift (e.g. `BVSar x y` denotes `fromUnsigned (toSigned x / 2 ^ toUnsigned y)` |
UadcOverflows :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f 'BoolType | Add two values and a carry bit to determine if they have an unsigned overflow. This is the sum of three three values cannot be represented as an unsigned number. |
SadcOverflows :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f 'BoolType | Add two values and a carry bit to determine if they have a signed overflow.
|
UsbbOverflows :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f 'BoolType | Unsigned subtract with borrow overflow
|
SsbbOverflows :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(f (BVType n)) -> !(f (BVType n)) -> !(f BoolType) -> App f 'BoolType | Signed subtract with borrow overflow.
|
PopCount :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> App f ('BVType n) | This returns the number of true bits in the input. |
ReverseBytes :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType (8 * n))) -> App f ('BVType (8 * n)) | Reverse the bytes in a bitvector expression. |
Bsf :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> App f ('BVType n) | bsf "bit scan forward" returns the index of the least-significant bit that is 1. An equivalent way of stating this is that it returns the number zero-bits starting from the least significant bit. This returns n if the value is zero. |
Bsr :: forall (n :: Natural) (f :: Type -> Type). 1 <= n => !(NatRepr n) -> !(f (BVType n)) -> App f ('BVType n) | bsr "bit scan reverse" returns the index of the most-significant bit that is 1. An equivalent way of stating this is that it returns the number zero-bits starting from the most-significant bit location. This returns n if the value is zero. |
Instances
FoldableFC App Source # | |
Defined in Data.Macaw.CFG.App Methods foldMapFC :: forall f m. Monoid m => (forall (x :: Type). f x -> m) -> forall (x :: Type). App f x -> m # foldrFC :: (forall (x :: Type). f x -> b -> b) -> forall (x :: Type). b -> App f x -> b # foldlFC :: forall f b. (forall (x :: Type). b -> f x -> b) -> forall (x :: Type). b -> App f x -> b # foldrFC' :: (forall (x :: Type). f x -> b -> b) -> forall (x :: Type). b -> App f x -> b # foldlFC' :: forall f b. (forall (x :: Type). b -> f x -> b) -> forall (x :: Type). b -> App f x -> b # toListFC :: (forall (x :: Type). f x -> a) -> forall (x :: Type). App f x -> [a] # | |
FunctorFC App Source # | |
TraversableFC App Source # | |
Defined in Data.Macaw.CFG.App Methods traverseFC :: forall f g m. Applicative m => (forall (x :: Type). f x -> m (g x)) -> forall (x :: Type). App f x -> m (App g x) | |
TestEquality f => TestEquality (App f :: Type -> Type) Source # | |
Defined in Data.Macaw.CFG.App | |
(HashableF f, TestEquality f) => HashableF (App f :: Type -> Type) Source # | |
Defined in Data.Macaw.CFG.App | |
OrdF f => OrdF (App f :: Type -> Type) Source # | |
Defined in Data.Macaw.CFG.App Methods compareF :: forall (x :: Type) (y :: Type). App f x -> App f y -> OrderingF x y leqF :: forall (x :: Type) (y :: Type). App f x -> App f y -> Bool ltF :: forall (x :: Type) (y :: Type). App f x -> App f y -> Bool geqF :: forall (x :: Type) (y :: Type). App f x -> App f y -> Bool gtF :: forall (x :: Type) (y :: Type). App f x -> App f y -> Bool | |
HasRepr (App f :: Type -> Type) TypeRepr Source # | |
TestEquality f => Eq (App f tp) Source # | |
OrdF f => Ord (App f tp) Source # | |
Defined in Data.Macaw.CFG.App | |
(HashableF f, TestEquality f) => Hashable (App f tp) Source # | |
Defined in Data.Macaw.CFG.App |
ppApp :: forall f ann (tp :: Type). (forall (u :: Type). f u -> Doc ann) -> App f tp -> Doc ann Source #
ppAppA :: forall m f (tp :: Type) ann. Applicative m => (forall (u :: Type). f u -> m (Doc ann)) -> App f tp -> m (Doc ann) Source #
Pretty print an App
as an expression using the given function
for printing arguments.
Rendering
data AppRenderArg (f :: Type -> Type) where Source #
rendApp :: forall (f :: Type -> Type) (tp :: Type). App f tp -> AppRender f Source #
Pretty print an App
as an expression using the given function
for printing arguments.
Casting proof objects.
data WidthEqProof (in_tp :: Type) (out_tp :: Type) where Source #
Data type to represent that two types use the same number of bits, and thus can be bitcast.
Note. This datatype needs to balance several competing requirements. It needs to support all bitcasts needed by architectures, represent bitcasts compactly, allow bitcasts to be removed during optimization, and allow bitcasts to be symbolically simulated.
Due to these requirements, we have a fairly limited set of proof rules. New rules can be added, but need to be balanced against the above set of goals. By design we do not have transitivity or equality, as those can be obtained by respectively chaining bitcasts or eliminating them.
Constructors
PackBits :: forall (n :: Natural) (w :: Natural). (1 <= n, 2 <= n, 1 <= w) => !(NatRepr n) -> !(NatRepr w) -> WidthEqProof ('VecType n (BVType w)) ('BVType (n * w)) | |
UnpackBits :: forall (n :: Natural) (w :: Natural). (1 <= n, 2 <= n, 1 <= w) => !(NatRepr n) -> !(NatRepr w) -> WidthEqProof ('BVType (n * w)) ('VecType n (BVType w)) | |
FromFloat :: forall (ftp :: FloatInfo). !(FloatInfoRepr ftp) -> WidthEqProof ('FloatType ftp) ('BVType (FloatInfoBits ftp)) | |
ToFloat :: forall (ftp :: FloatInfo). !(FloatInfoRepr ftp) -> WidthEqProof ('BVType (FloatInfoBits ftp)) ('FloatType ftp) | |
VecEqCongruence :: forall (n :: Nat) (i :: Type) (o :: Type). !(NatRepr n) -> !(WidthEqProof i o) -> WidthEqProof ('VecType n i) ('VecType n o) | Convert between vector types that are equivalent. |
WidthEqRefl :: forall (in_tp :: Type). !(TypeRepr in_tp) -> WidthEqProof in_tp in_tp | Type is equal to itself. |
WidthEqTrans :: forall (in_tp :: Type) (y :: Type) (out_tp :: Type). !(WidthEqProof in_tp y) -> !(WidthEqProof y out_tp) -> WidthEqProof in_tp out_tp | Allows transitivity composing proofs. |
widthEqProofEq :: forall (xi :: Type) (xo :: Type) (yi :: Type) (yo :: Type). WidthEqProof xi xo -> WidthEqProof yi yo -> Maybe (WidthEqProof xi xo :~: WidthEqProof yi yo) Source #
Compare two proofs, and return truei if the input/output types are the same.
widthEqProofCompare :: forall (xi :: Type) (xo :: Type) (yi :: Type) (yo :: Type). WidthEqProof xi xo -> WidthEqProof yi yo -> OrderingF (WidthEqProof xi xo) (WidthEqProof yi yo) Source #
Compare proofs based on ordering of source and target.
widthEqSource :: forall (i :: Type) (o :: Type). WidthEqProof i o -> TypeRepr i Source #
Return the input type of the width equality proof
widthEqTarget :: forall (i :: Type) (o :: Type). WidthEqProof i o -> TypeRepr o Source #
Return the result type of the width equality proof
widthEqSym :: forall (x :: Type) (y :: Type). WidthEqProof x y -> WidthEqProof y x Source #
Apply symmetry to a width equality proof.