[Git][ghc/ghc][master] 2 commits: compiler: refactor lower_CmmExpr_Ptr
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Fri Jun 14 04:28:48 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
fb629e24 by amesgen at 2024-06-14T00:28:20-04:00
compiler: refactor lower_CmmExpr_Ptr
- - - - -
def46c8c by amesgen at 2024-06-14T00:28:20-04:00
compiler: handle CmmRegOff in lower_CmmExpr_Ptr
- - - - -
1 changed file:
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
Changes:
=====================================
compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
=====================================
@@ -1045,22 +1045,16 @@ lower_CmmExpr_Typed lbl ty expr = do
lower_CmmExpr_Ptr :: CLabel -> CmmExpr -> WasmCodeGenM w (WasmExpr w w, Int)
lower_CmmExpr_Ptr lbl ptr = do
ty_word <- wasmWordTypeM
- case ptr of
- CmmLit (CmmLabelOff lbl o)
- | o >= 0 -> do
- instrs <-
- lower_CmmExpr_Typed
- lbl
- ty_word
- (CmmLit $ CmmLabel lbl)
- pure (instrs, o)
- CmmMachOp (MO_Add _) [base, CmmLit (CmmInt o _)]
- | o >= 0 -> do
- instrs <- lower_CmmExpr_Typed lbl ty_word base
- pure (instrs, fromInteger o)
- _ -> do
- instrs <- lower_CmmExpr_Typed lbl ty_word ptr
- pure (instrs, 0)
+ let (ptr', o) = case ptr of
+ CmmLit (CmmLabelOff lbl o)
+ | o >= 0 -> (CmmLit $ CmmLabel lbl, o)
+ CmmRegOff reg o
+ | o >= 0 -> (CmmReg reg, o)
+ CmmMachOp (MO_Add _) [base, CmmLit (CmmInt o _)]
+ | o >= 0 -> (base, fromInteger o)
+ _ -> (ptr, 0)
+ instrs <- lower_CmmExpr_Typed lbl ty_word ptr'
+ pure (instrs, o)
-- | Push a series of values onto the wasm value stack, returning the
-- result stack type.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4570319fc2631c97490a337242a3b6c50f3072e4...def46c8ccddf036851482172919ec392c05f6cc5
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4570319fc2631c97490a337242a3b6c50f3072e4...def46c8ccddf036851482172919ec392c05f6cc5
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/20240614/e7a60651/attachment-0001.html>
More information about the ghc-commits
mailing list