[Git][ghc/ghc][wip/nr/wasm-translation-prototypes] code cleanup
Norman Ramsey (@nrnrnr)
gitlab at gitlab.haskell.org
Thu Sep 29 16:40:16 UTC 2022
Norman Ramsey pushed to branch wip/nr/wasm-translation-prototypes at Glasgow Haskell Compiler / GHC
Commits:
4c9c1cc1 by Norman Ramsey at 2022-09-29T12:40:02-04:00
code cleanup
- - - - -
1 changed file:
- compiler/GHC/Wasm/Tx.hs
Changes:
=====================================
compiler/GHC/Wasm/Tx.hs
=====================================
@@ -71,12 +71,10 @@ wasmUnary :: CG bool codegen
-> codegen bool r
-
-
wasmBinary w es operator k =
- binaryCPS es $ \tag code1 code2 ->
- checkTagWidth tag w $ -- optional check
- k tag (code1 <> WasmLift tag code2 <> operator tag)
+ binaryCPS es $ \tag code1 code2 ->
+ checkTagWidth tag w $ -- optional check
+ k tag (code1 <> WasmLift tag code2 <> operator tag)
wasmCompare w es operator k =
@@ -93,6 +91,7 @@ binaryCPS
-> WasmIR bool '[] (t : '[])
-> codegen bool a)
-> codegen bool a
+
binaryCPS [e1, e2] k = -- would dearly love to use do notation here
tx e1 $ \tag1 code1 ->
tx e2 $ \tag2 code2 ->
@@ -105,14 +104,8 @@ wasmUnary w [e] operator k =
tx e $ \tag code -> checkTagWidth tag w $ k tag (code <> operator tag)
wasmUnary _ _ _ _ = panic "wrong number of operands to unary operator in Cmm"
+----------------------------------------------------------------
---whenEqual :: WasmTypeTag t -> WasmTypeTag t' -> (forall t . WasmTypeTag t -> a) -> a
--- -- trusted code
---whenEqual TagI32 TagI32 k = k TagI32
---whenEqual TagF32 TagF32 k = k TagF32
---whenEqual TagI64 TagI64 k = k TagI64
---whenEqual TagF64 TagF64 k = k TagF64
---whenEqual _ _ _ = panic "ill-typed Cmm in Wasm translation"
checkTagWidth :: WasmTypeTag t -> CT.Width -> a -> a
checkTagWidth TagI32 CT.W32 a = a
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4c9c1cc16512a29fd63333d75b6050d7a611fd4d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4c9c1cc16512a29fd63333d75b6050d7a611fd4d
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220929/a2f0e4a1/attachment-0001.html>
More information about the ghc-commits
mailing list