Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- data WasmType
- data WasmTypeTag (a :: WasmType) where
- TagI32 :: WasmTypeTag 'I32
- TagI64 :: WasmTypeTag 'I64
- TagF32 :: WasmTypeTag 'F32
- TagF64 :: WasmTypeTag 'F64
- data SomeWasmType where
- SomeWasmType :: forall (t :: WasmType). WasmTypeTag t -> SomeWasmType
- data TypeList (a :: [WasmType]) where
- TypeListNil :: TypeList ('[] :: [WasmType])
- TypeListCons :: forall (t :: WasmType) (ts :: [WasmType]). WasmTypeTag t -> TypeList ts -> TypeList (t ': ts)
- someWasmTypesFromTypeList :: forall (ts :: [WasmType]). TypeList ts -> [SomeWasmType]
- data WasmFunctionType (pre :: [WasmType]) (post :: [WasmType]) = WasmFunctionType {}
- newtype SymName = SymName FastString
- data SymVisibility
- data SymKind
- data DataSectionKind
- data DataSectionContent
- data DataSection = DataSection {}
- type GlobalInfo = (SymName, SomeWasmType)
- type LocalInfo = (Int, SomeWasmType)
- data FuncBody (w :: WasmType) = FuncBody {
- funcLocals :: [SomeWasmType]
- funcBody :: WasmControl (WasmStatements w) (WasmExpr w w) ('[] :: [WasmType]) '[w]
- data Signage
- data WasmInstr (a :: WasmType) (b :: [WasmType]) (c :: [WasmType]) where
- WasmComment :: forall (a :: WasmType) (b :: [WasmType]). String -> WasmInstr a b b
- WasmNop :: forall (a :: WasmType) (b :: [WasmType]). WasmInstr a b b
- WasmDrop :: forall (a :: WasmType) (t :: WasmType) (c :: [WasmType]). WasmInstr a (t ': c) c
- WasmUnreachable :: forall (a :: WasmType) (b :: [WasmType]) (c :: [WasmType]). WasmInstr a b c
- WasmConst :: forall (t :: WasmType) (a :: WasmType) (b :: [WasmType]). WasmTypeTag t -> Integer -> WasmInstr a b (t ': b)
- WasmSymConst :: forall (a :: WasmType) (b :: [WasmType]). SymName -> WasmInstr a b (a ': b)
- WasmLoad :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> Maybe Int -> Signage -> Int -> AlignmentSpec -> WasmInstr a (a ': pre) (t ': pre)
- WasmStore :: forall (t :: WasmType) (a :: WasmType) (c :: [WasmType]). WasmTypeTag t -> Maybe Int -> Int -> AlignmentSpec -> WasmInstr a (t ': (a ': c)) c
- WasmGlobalGet :: forall (t :: WasmType) (a :: WasmType) (b :: [WasmType]). WasmTypeTag t -> SymName -> WasmInstr a b (t ': b)
- WasmGlobalSet :: forall (t :: WasmType) (a :: WasmType) (c :: [WasmType]). WasmTypeTag t -> SymName -> WasmInstr a (t ': c) c
- WasmLocalGet :: forall (t :: WasmType) (a :: WasmType) (b :: [WasmType]). WasmTypeTag t -> Int -> WasmInstr a b (t ': b)
- WasmLocalSet :: forall (t :: WasmType) (a :: WasmType) (c :: [WasmType]). WasmTypeTag t -> Int -> WasmInstr a (t ': c) c
- WasmLocalTee :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> Int -> WasmInstr a (t ': pre) (t ': pre)
- WasmCCall :: forall (a :: WasmType) (b :: [WasmType]) (c :: [WasmType]). SymName -> WasmInstr a b c
- WasmCCallIndirect :: forall (arg_tys :: [WasmType]) (ret_tys :: [WasmType]) (a :: WasmType) (pre :: [WasmType]) (c :: [WasmType]). TypeList arg_tys -> TypeList ret_tys -> WasmInstr a (a ': pre) c
- WasmConcat :: forall (a :: WasmType) (b :: [WasmType]) (mid :: [WasmType]) (c :: [WasmType]). WasmInstr a b mid -> WasmInstr a mid c -> WasmInstr a b c
- WasmReinterpret :: forall (t0 :: WasmType) (t1 :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t0 -> WasmTypeTag t1 -> WasmInstr a (t0 ': pre) (t1 ': pre)
- WasmTruncSat :: forall (t0 :: WasmType) (t1 :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t0 -> WasmTypeTag t1 -> WasmInstr a (t0 ': pre) (t1 ': pre)
- WasmConvert :: forall (t0 :: WasmType) (t1 :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t0 -> WasmTypeTag t1 -> WasmInstr a (t0 ': pre) (t1 ': pre)
- WasmAdd :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmSub :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmMul :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmDiv :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmRem :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmAnd :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmOr :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmXor :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmEq :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre)
- WasmNe :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre)
- WasmLt :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre)
- WasmGt :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre)
- WasmLe :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre)
- WasmGe :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre)
- WasmShl :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmShr :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmI32Extend8S :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I32 ': pre) ('I32 ': pre)
- WasmI32Extend16S :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I32 ': pre) ('I32 ': pre)
- WasmI64Extend8S :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I64 ': pre) ('I64 ': pre)
- WasmI64Extend16S :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I64 ': pre) ('I64 ': pre)
- WasmI64Extend32S :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I64 ': pre) ('I64 ': pre)
- WasmI64ExtendI32 :: forall (a :: WasmType) (pre :: [WasmType]). Signage -> WasmInstr a ('I32 ': pre) ('I64 ': pre)
- WasmI32WrapI64 :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I64 ': pre) ('I32 ': pre)
- WasmF32DemoteF64 :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('F64 ': pre) ('F32 ': pre)
- WasmF64PromoteF32 :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('F32 ': pre) ('F64 ': pre)
- WasmAbs :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': pre) (t ': pre)
- WasmNeg :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': pre) (t ': pre)
- WasmMin :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmMax :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre)
- WasmCond :: forall (a :: WasmType) (c :: [WasmType]). WasmInstr a c c -> WasmInstr a (a ': c) c
- newtype WasmExpr (w :: WasmType) (t :: WasmType) = WasmExpr (forall (pre :: [WasmType]). WasmInstr w pre (t ': pre))
- data SomeWasmExpr (w :: WasmType) where
- SomeWasmExpr :: forall (t :: WasmType) (w :: WasmType). WasmTypeTag t -> WasmExpr w t -> SomeWasmExpr w
- newtype WasmStatements (w :: WasmType) = WasmStatements (forall (pre :: [WasmType]). WasmInstr w pre pre)
- data WasmControl a b (c :: [WasmType]) (d :: [WasmType]) where
- WasmPush :: forall (t :: WasmType) b a (c :: [WasmType]). WasmTypeTag t -> b -> WasmControl a b c (t ': c)
- WasmBlock :: forall (c :: [WasmType]) (d :: [WasmType]) a b. WasmFunctionType c d -> WasmControl a b c d -> WasmControl a b c d
- WasmLoop :: forall (c :: [WasmType]) (d :: [WasmType]) a b. WasmFunctionType c d -> WasmControl a b c d -> WasmControl a b c d
- WasmIfTop :: forall (pre :: [WasmType]) (d :: [WasmType]) a b. WasmFunctionType pre d -> WasmControl a b pre d -> WasmControl a b pre d -> WasmControl a b ('I32 ': pre) d
- WasmBr :: forall a b (c :: [WasmType]) (d :: [WasmType]). Int -> WasmControl a b c d
- WasmFallthrough :: forall a b (c :: [WasmType]) (d :: [WasmType]). WasmControl a b c d
- WasmBrTable :: forall b a (c :: [WasmType]) (d :: [WasmType]). b -> BrTableInterval -> [Int] -> Int -> WasmControl a b c d
- WasmTailCall :: forall b a (c :: [WasmType]) (d :: [WasmType]). b -> WasmControl a b c d
- WasmActions :: forall a b (c :: [WasmType]). a -> WasmControl a b c c
- WasmSeq :: forall a b (c :: [WasmType]) (mid :: [WasmType]) (d :: [WasmType]). WasmControl a b c mid -> WasmControl a b mid d -> WasmControl a b c d
- data BrTableInterval = BrTableInterval {}
- wasmControlCast :: forall s e (pre :: [WasmType]) (post :: [WasmType]) (pre' :: [WasmType]) (post' :: [WasmType]). WasmControl s e pre post -> WasmControl s e pre' post'
- data WasmCodeGenState (w :: WasmType) = WasmCodeGenState {
- wasmPlatform :: Platform
- defaultSyms :: SymSet
- funcTypes :: SymMap ([SomeWasmType], [SomeWasmType])
- funcBodies :: SymMap (FuncBody w)
- dataSections :: SymMap DataSection
- ctors :: [SymName]
- localRegs :: UniqFM LocalReg LocalInfo
- localRegsCount :: Int
- wasmDUniqSupply :: DUniqSupply
- initialWasmCodeGenState :: forall (w :: WasmType). Platform -> DUniqSupply -> WasmCodeGenState w
- newtype WasmCodeGenM (w :: WasmType) a = WasmCodeGenM (State (WasmCodeGenState w) a)
- wasmGetsM :: forall (w :: WasmType) a. (WasmCodeGenState w -> a) -> WasmCodeGenM w a
- wasmPlatformM :: forall (w :: WasmType). WasmCodeGenM w Platform
- wasmWordTypeM :: forall (w :: WasmType). WasmCodeGenM w (WasmTypeTag w)
- wasmWordCmmTypeM :: forall (w :: WasmType). WasmCodeGenM w CmmType
- wasmStateM :: forall (w :: WasmType) a. (WasmCodeGenState w -> (# a, WasmCodeGenState w #)) -> WasmCodeGenM w a
- wasmModifyM :: forall (w :: WasmType). (WasmCodeGenState w -> WasmCodeGenState w) -> WasmCodeGenM w ()
- wasmExecM :: forall (w :: WasmType) a. WasmCodeGenM w a -> WasmCodeGenState w -> WasmCodeGenState w
- wasmRunM :: forall (w :: WasmType) a. WasmCodeGenM w a -> WasmCodeGenState w -> (a, WasmCodeGenState w)
- data WasmAsmConfig = WasmAsmConfig {}
- defaultWasmAsmConfig :: forall (w :: WasmType). WasmCodeGenState w -> WasmAsmConfig
Documentation
WebAssembly type of a WebAssembly value that WebAssembly code could either expect on the evaluation stack or leave on the evaluation stack.
Instances
TestEquality WasmTypeTag Source # | |
Defined in GHC.CmmToAsm.Wasm.Types testEquality :: forall (a :: WasmType) (b :: WasmType). WasmTypeTag a -> WasmTypeTag b -> Maybe (a :~: b) # |
data WasmTypeTag (a :: WasmType) where Source #
Singleton type useful for programming with WasmType
at the type
level.
TagI32 :: WasmTypeTag 'I32 | |
TagI64 :: WasmTypeTag 'I64 | |
TagF32 :: WasmTypeTag 'F32 | |
TagF64 :: WasmTypeTag 'F64 |
Instances
TestEquality WasmTypeTag Source # | |
Defined in GHC.CmmToAsm.Wasm.Types testEquality :: forall (a :: WasmType) (b :: WasmType). WasmTypeTag a -> WasmTypeTag b -> Maybe (a :~: b) # | |
Show (WasmTypeTag t) Source # | |
Defined in GHC.CmmToAsm.Wasm.Types showsPrec :: Int -> WasmTypeTag t -> ShowS # show :: WasmTypeTag t -> String # showList :: [WasmTypeTag t] -> ShowS # |
data SomeWasmType where Source #
SomeWasmType :: forall (t :: WasmType). WasmTypeTag t -> SomeWasmType |
Instances
Eq SomeWasmType Source # | |
Defined in GHC.CmmToAsm.Wasm.Types (==) :: SomeWasmType -> SomeWasmType -> Bool # (/=) :: SomeWasmType -> SomeWasmType -> Bool # |
data TypeList (a :: [WasmType]) where Source #
List of WebAssembly types used to describe the sequence of WebAssembly values that a block of code may expect on the stack or leave on the stack.
TypeListNil :: TypeList ('[] :: [WasmType]) | |
TypeListCons :: forall (t :: WasmType) (ts :: [WasmType]). WasmTypeTag t -> TypeList ts -> TypeList (t ': ts) |
someWasmTypesFromTypeList :: forall (ts :: [WasmType]). TypeList ts -> [SomeWasmType] Source #
data WasmFunctionType (pre :: [WasmType]) (post :: [WasmType]) Source #
The type of a WebAssembly function, loop, block, or conditional. This type says what values the code expects to pop off the stack and what values it promises to push. The WebAssembly standard requires that this type appear explicitly in the code.
For simplicity, we record other metadata in WasmCodeGenState
by
need, instead of carrying them along with SymName
.
data SymVisibility Source #
SymUndefined | Not defined in the current compilation unit. [ undefined binding=global vis=default ] |
SymStatic | Defined, not visible to other compilation units. [ binding=local vis=default ] |
SymDefault | Defined, visible to other compilation units. Adds [ binding=global vis=hidden ] |
Represents whether a symbol is a data symbol or a function
symbol. Unlike linkers for other targets, wasm-ld
does panic at
link-time if it finds symbol kind inconsistency between the
definition site and other use sites.
Currently we solely rely on isCFunctionLabel
to determine a
symbol's kind, but it does take extra effort to make it work. The
main source of inconsistency arises from hand-written Cmm sources,
where it's possible to refer to external entities like xxx_info
and xxx_closure
without explicit import CLOSURE
declarations.
The Cmm parser will implicitly assume those are foreign function
labels, and then this will break the WebAssembly backend. #22368
provides more context on this issue.
tl;dr for any GHC contributor that accidentally triggers wasm-ld
errors when hacking Cmm: whatever data symbols are used in new
code, just add the corresponding import CLOSURE
declarations at
the top of that Cmm file.
data DataSectionKind Source #
WebAssembly doesn't really have proper read-only memory regions yet. Neverthless we add the .rodata logic here, wasm-ld will aggregate all .rodata sections into a single one, which adds possibility for runtime checks later, either via a customized runtime, or via code instrumentation. See https://github.com/llvm/llvm-project/blob/b296aed8ae239c20ebdd7969e978f8d2a3b9c178/lld/wasm/Writer.cpp#L856
data DataSectionContent Source #
Neither Cmm or Wasm type system takes integer signedness into
account, therefore we always round up a CmmLit
to the right width
and handle it as an untyped integer.
data DataSection Source #
type GlobalInfo = (SymName, SomeWasmType) Source #
type LocalInfo = (Int, SomeWasmType) Source #
data FuncBody (w :: WasmType) Source #
FuncBody | |
|
data WasmInstr (a :: WasmType) (b :: [WasmType]) (c :: [WasmType]) where Source #
The w
type variable in the Wasm IR stands for "platform word
type", so TagI32
on wasm32, and TagI64
on wasm64. This way, we
can make the codegen logic work on both wasm32/wasm64 in a
type-safe manner.
WasmComment :: forall (a :: WasmType) (b :: [WasmType]). String -> WasmInstr a b b | |
WasmNop :: forall (a :: WasmType) (b :: [WasmType]). WasmInstr a b b | |
WasmDrop :: forall (a :: WasmType) (t :: WasmType) (c :: [WasmType]). WasmInstr a (t ': c) c | |
WasmUnreachable :: forall (a :: WasmType) (b :: [WasmType]) (c :: [WasmType]). WasmInstr a b c | |
WasmConst :: forall (t :: WasmType) (a :: WasmType) (b :: [WasmType]). WasmTypeTag t -> Integer -> WasmInstr a b (t ': b) | |
WasmSymConst :: forall (a :: WasmType) (b :: [WasmType]). SymName -> WasmInstr a b (a ': b) | |
WasmLoad :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> Maybe Int -> Signage -> Int -> AlignmentSpec -> WasmInstr a (a ': pre) (t ': pre) | |
WasmStore :: forall (t :: WasmType) (a :: WasmType) (c :: [WasmType]). WasmTypeTag t -> Maybe Int -> Int -> AlignmentSpec -> WasmInstr a (t ': (a ': c)) c | |
WasmGlobalGet :: forall (t :: WasmType) (a :: WasmType) (b :: [WasmType]). WasmTypeTag t -> SymName -> WasmInstr a b (t ': b) | |
WasmGlobalSet :: forall (t :: WasmType) (a :: WasmType) (c :: [WasmType]). WasmTypeTag t -> SymName -> WasmInstr a (t ': c) c | |
WasmLocalGet :: forall (t :: WasmType) (a :: WasmType) (b :: [WasmType]). WasmTypeTag t -> Int -> WasmInstr a b (t ': b) | |
WasmLocalSet :: forall (t :: WasmType) (a :: WasmType) (c :: [WasmType]). WasmTypeTag t -> Int -> WasmInstr a (t ': c) c | |
WasmLocalTee :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> Int -> WasmInstr a (t ': pre) (t ': pre) | |
WasmCCall :: forall (a :: WasmType) (b :: [WasmType]) (c :: [WasmType]). SymName -> WasmInstr a b c | |
WasmCCallIndirect :: forall (arg_tys :: [WasmType]) (ret_tys :: [WasmType]) (a :: WasmType) (pre :: [WasmType]) (c :: [WasmType]). TypeList arg_tys -> TypeList ret_tys -> WasmInstr a (a ': pre) c | |
WasmConcat :: forall (a :: WasmType) (b :: [WasmType]) (mid :: [WasmType]) (c :: [WasmType]). WasmInstr a b mid -> WasmInstr a mid c -> WasmInstr a b c | |
WasmReinterpret :: forall (t0 :: WasmType) (t1 :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t0 -> WasmTypeTag t1 -> WasmInstr a (t0 ': pre) (t1 ': pre) | |
WasmTruncSat :: forall (t0 :: WasmType) (t1 :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t0 -> WasmTypeTag t1 -> WasmInstr a (t0 ': pre) (t1 ': pre) | |
WasmConvert :: forall (t0 :: WasmType) (t1 :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t0 -> WasmTypeTag t1 -> WasmInstr a (t0 ': pre) (t1 ': pre) | |
WasmAdd :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmSub :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmMul :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmDiv :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmRem :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmAnd :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmOr :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmXor :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmEq :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre) | |
WasmNe :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre) | |
WasmLt :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre) | |
WasmGt :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre) | |
WasmLe :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre) | |
WasmGe :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (a ': pre) | |
WasmShl :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmShr :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). Signage -> WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmI32Extend8S :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I32 ': pre) ('I32 ': pre) | |
WasmI32Extend16S :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I32 ': pre) ('I32 ': pre) | |
WasmI64Extend8S :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I64 ': pre) ('I64 ': pre) | |
WasmI64Extend16S :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I64 ': pre) ('I64 ': pre) | |
WasmI64Extend32S :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I64 ': pre) ('I64 ': pre) | |
WasmI64ExtendI32 :: forall (a :: WasmType) (pre :: [WasmType]). Signage -> WasmInstr a ('I32 ': pre) ('I64 ': pre) | |
WasmI32WrapI64 :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('I64 ': pre) ('I32 ': pre) | |
WasmF32DemoteF64 :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('F64 ': pre) ('F32 ': pre) | |
WasmF64PromoteF32 :: forall (a :: WasmType) (pre :: [WasmType]). WasmInstr a ('F32 ': pre) ('F64 ': pre) | |
WasmAbs :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': pre) (t ': pre) | |
WasmNeg :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': pre) (t ': pre) | |
WasmMin :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmMax :: forall (t :: WasmType) (a :: WasmType) (pre :: [WasmType]). WasmTypeTag t -> WasmInstr a (t ': (t ': pre)) (t ': pre) | |
WasmCond :: forall (a :: WasmType) (c :: [WasmType]). WasmInstr a c c -> WasmInstr a (a ': c) c |
data SomeWasmExpr (w :: WasmType) where Source #
SomeWasmExpr :: forall (t :: WasmType) (w :: WasmType). WasmTypeTag t -> WasmExpr w t -> SomeWasmExpr w |
newtype WasmStatements (w :: WasmType) Source #
WasmStatements (forall (pre :: [WasmType]). WasmInstr w pre pre) |
data WasmControl a b (c :: [WasmType]) (d :: [WasmType]) where Source #
Representation of WebAssembly control flow.
Normally written as
WasmControl s e pre post
Type parameter s
is the type of (unspecified) statements.
It might be instantiated with an open Cmm block or with a sequence
of Wasm instructions.
Parameter e
is the type of expressions.
Parameter pre
represents the values that are expected on the
WebAssembly stack when the code runs, and post
represents
the state of the stack on completion.
WasmPush :: forall (t :: WasmType) b a (c :: [WasmType]). WasmTypeTag t -> b -> WasmControl a b c (t ': c) | |
WasmBlock :: forall (c :: [WasmType]) (d :: [WasmType]) a b. WasmFunctionType c d -> WasmControl a b c d -> WasmControl a b c d | |
WasmLoop :: forall (c :: [WasmType]) (d :: [WasmType]) a b. WasmFunctionType c d -> WasmControl a b c d -> WasmControl a b c d | |
WasmIfTop :: forall (pre :: [WasmType]) (d :: [WasmType]) a b. WasmFunctionType pre d -> WasmControl a b pre d -> WasmControl a b pre d -> WasmControl a b ('I32 ': pre) d | |
WasmBr :: forall a b (c :: [WasmType]) (d :: [WasmType]). Int -> WasmControl a b c d | |
WasmFallthrough :: forall a b (c :: [WasmType]) (d :: [WasmType]). WasmControl a b c d | |
WasmBrTable :: forall b a (c :: [WasmType]) (d :: [WasmType]). b -> BrTableInterval -> [Int] -> Int -> WasmControl a b c d | |
WasmTailCall :: forall b a (c :: [WasmType]) (d :: [WasmType]). b -> WasmControl a b c d | |
WasmActions :: forall a b (c :: [WasmType]). a -> WasmControl a b c c | |
WasmSeq :: forall a b (c :: [WasmType]) (mid :: [WasmType]) (d :: [WasmType]). WasmControl a b c mid -> WasmControl a b mid d -> WasmControl a b c d |
data BrTableInterval Source #
Instances
Outputable BrTableInterval Source # | |
Defined in GHC.CmmToAsm.Wasm.Types ppr :: BrTableInterval -> SDoc Source # | |
Show BrTableInterval Source # | |
Defined in GHC.CmmToAsm.Wasm.Types showsPrec :: Int -> BrTableInterval -> ShowS # show :: BrTableInterval -> String # showList :: [BrTableInterval] -> ShowS # |
wasmControlCast :: forall s e (pre :: [WasmType]) (post :: [WasmType]) (pre' :: [WasmType]) (post' :: [WasmType]). WasmControl s e pre post -> WasmControl s e pre' post' Source #
data WasmCodeGenState (w :: WasmType) Source #
WasmCodeGenState | |
|
initialWasmCodeGenState :: forall (w :: WasmType). Platform -> DUniqSupply -> WasmCodeGenState w Source #
newtype WasmCodeGenM (w :: WasmType) a Source #
WasmCodeGenM (State (WasmCodeGenState w) a) |
Instances
wasmGetsM :: forall (w :: WasmType) a. (WasmCodeGenState w -> a) -> WasmCodeGenM w a Source #
wasmPlatformM :: forall (w :: WasmType). WasmCodeGenM w Platform Source #
wasmWordTypeM :: forall (w :: WasmType). WasmCodeGenM w (WasmTypeTag w) Source #
wasmWordCmmTypeM :: forall (w :: WasmType). WasmCodeGenM w CmmType Source #
wasmStateM :: forall (w :: WasmType) a. (WasmCodeGenState w -> (# a, WasmCodeGenState w #)) -> WasmCodeGenM w a Source #
wasmModifyM :: forall (w :: WasmType). (WasmCodeGenState w -> WasmCodeGenState w) -> WasmCodeGenM w () Source #
wasmExecM :: forall (w :: WasmType) a. WasmCodeGenM w a -> WasmCodeGenState w -> WasmCodeGenState w Source #
wasmRunM :: forall (w :: WasmType) a. WasmCodeGenM w a -> WasmCodeGenState w -> (a, WasmCodeGenState w) Source #
data WasmAsmConfig Source #
WasmAsmConfig | |
|
defaultWasmAsmConfig :: forall (w :: WasmType). WasmCodeGenState w -> WasmAsmConfig Source #
The default WasmAsmConfig
must be extracted from the final
WasmCodeGenState
.