summaryrefslogtreecommitdiff
path: root/compiler/GHC/StgToCmm
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-01-27 13:15:49 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-02-04 16:14:47 -0500
commit58d7faacafc975d522cbc9f56a7db1e46b37d4a1 (patch)
tree2ed5935efe8bc01decb21b848447cdcfb13652a9 /compiler/GHC/StgToCmm
parentb79206f1add1c9e9a88f1cc9e2d2c47be9bfea3e (diff)
downloadhaskell-58d7faacafc975d522cbc9f56a7db1e46b37d4a1.tar.gz
cmm: Introduce cmmLoadBWord and cmmLoadGCWord
Diffstat (limited to 'compiler/GHC/StgToCmm')
-rw-r--r--compiler/GHC/StgToCmm/Foreign.hs15
-rw-r--r--compiler/GHC/StgToCmm/Layout.hs2
-rw-r--r--compiler/GHC/StgToCmm/Prim.hs8
-rw-r--r--compiler/GHC/StgToCmm/Prof.hs2
-rw-r--r--compiler/GHC/StgToCmm/Ticky.hs2
-rw-r--r--compiler/GHC/StgToCmm/Utils.hs4
6 files changed, 16 insertions, 17 deletions
diff --git a/compiler/GHC/StgToCmm/Foreign.hs b/compiler/GHC/StgToCmm/Foreign.hs
index a1ee175bad..e3cd4d8db1 100644
--- a/compiler/GHC/StgToCmm/Foreign.hs
+++ b/compiler/GHC/StgToCmm/Foreign.hs
@@ -303,10 +303,9 @@ saveThreadState profile = do
, -- tso->stackobj->sp = Sp;
mkStore (cmmOffset platform
- (CmmLoad (cmmOffset platform
+ (cmmLoadBWord platform (cmmOffset platform
(CmmReg (CmmLocal tso))
- (tso_stackobj profile))
- (bWord platform))
+ (tso_stackobj profile)))
(stack_SP profile))
spExpr
@@ -444,7 +443,7 @@ closeNursery profile tso = do
let alloc =
CmmMachOp (mo_wordSub platform)
[ cmmOffsetW platform hpExpr 1
- , CmmLoad (nursery_bdescr_start platform cnreg) (bWord platform)
+ , cmmLoadBWord platform (nursery_bdescr_start platform cnreg)
]
alloc_limit = cmmOffset platform (CmmReg tsoreg) (tso_alloc_limit profile)
@@ -473,9 +472,9 @@ loadThreadState profile = do
-- tso = CurrentTSO;
mkAssign (CmmLocal tso) currentTSOExpr,
-- stack = tso->stackobj;
- mkAssign (CmmLocal stack) (CmmLoad (cmmOffset platform (CmmReg (CmmLocal tso)) (tso_stackobj profile)) (bWord platform)),
+ mkAssign (CmmLocal stack) (cmmLoadBWord platform (cmmOffset platform (CmmReg (CmmLocal tso)) (tso_stackobj profile))),
-- Sp = stack->sp;
- mkAssign spReg (CmmLoad (cmmOffset platform (CmmReg (CmmLocal stack)) (stack_SP profile)) (bWord platform)),
+ mkAssign spReg (cmmLoadBWord platform (cmmOffset platform (CmmReg (CmmLocal stack)) (stack_SP profile))),
-- SpLim = stack->stack + RESERVED_STACK_WORDS;
mkAssign spLimReg (cmmOffsetW platform (cmmOffset platform (CmmReg (CmmLocal stack)) (stack_STACK profile))
(pc_RESERVED_STACK_WORDS (platformConstants platform))),
@@ -543,12 +542,12 @@ openNursery profile tso = do
-- stg_returnToStackTop in rts/StgStartup.cmm.
pure $ catAGraphs [
mkAssign cnreg currentNurseryExpr,
- mkAssign bdfreereg (CmmLoad (nursery_bdescr_free platform cnreg) (bWord platform)),
+ mkAssign bdfreereg (cmmLoadBWord platform (nursery_bdescr_free platform cnreg)),
-- Hp = CurrentNursery->free - 1;
mkAssign hpReg (cmmOffsetW platform (CmmReg bdfreereg) (-1)),
- mkAssign bdstartreg (CmmLoad (nursery_bdescr_start platform cnreg) (bWord platform)),
+ mkAssign bdstartreg (cmmLoadBWord platform (nursery_bdescr_start platform cnreg)),
-- HpLim = CurrentNursery->start +
-- CurrentNursery->blocks*BLOCK_SIZE_W - 1;
diff --git a/compiler/GHC/StgToCmm/Layout.hs b/compiler/GHC/StgToCmm/Layout.hs
index 5664be908e..0857cf5db2 100644
--- a/compiler/GHC/StgToCmm/Layout.hs
+++ b/compiler/GHC/StgToCmm/Layout.hs
@@ -90,7 +90,7 @@ emitReturn results
; case sequel of
Return ->
do { adjustHpBackwards
- ; let e = CmmLoad (CmmStackSlot Old updfr_off) (gcWord platform)
+ ; let e = cmmLoadGCWord platform (CmmStackSlot Old updfr_off)
; emit (mkReturn profile (entryCode platform e) results updfr_off)
}
AssignTo regs adjust ->
diff --git a/compiler/GHC/StgToCmm/Prim.hs b/compiler/GHC/StgToCmm/Prim.hs
index b980c0aacd..72f42ba831 100644
--- a/compiler/GHC/StgToCmm/Prim.hs
+++ b/compiler/GHC/StgToCmm/Prim.hs
@@ -2169,7 +2169,7 @@ doWritePtrArrayOp addr idx val
) (CmmLit (CmmInt 1 W8))
loadArrPtrsSize :: Profile -> CmmExpr -> CmmExpr
-loadArrPtrsSize profile addr = CmmLoad (cmmOffsetB platform addr off) (bWord platform)
+loadArrPtrsSize profile addr = cmmLoadBWord platform (cmmOffsetB platform addr off)
where off = fixedHdrSize profile + pc_OFFSET_StgMutArrPtrs_ptrs (profileConstants profile)
platform = profilePlatform profile
@@ -3258,7 +3258,7 @@ doPtrArrayBoundsCheck
doPtrArrayBoundsCheck idx arr = do
profile <- getProfile
platform <- getPlatform
- let sz = CmmLoad (cmmOffsetB platform arr sz_off) (bWord platform)
+ let sz = cmmLoadBWord platform (cmmOffset platform arr sz_off)
sz_off = fixedHdrSize profile + pc_OFFSET_StgMutArrPtrs_ptrs (platformConstants platform)
doBoundsCheck idx sz
@@ -3269,7 +3269,7 @@ doSmallPtrArrayBoundsCheck
doSmallPtrArrayBoundsCheck idx arr = do
profile <- getProfile
platform <- getPlatform
- let sz = CmmLoad (cmmOffsetB platform arr sz_off) (bWord platform)
+ let sz = cmmLoadBWord platform (cmmOffset platform arr sz_off)
sz_off = fixedHdrSize profile + pc_OFFSET_StgSmallMutArrPtrs_ptrs (platformConstants platform)
doBoundsCheck idx sz
@@ -3282,7 +3282,7 @@ doByteArrayBoundsCheck
doByteArrayBoundsCheck idx arr idx_ty elem_ty = do
profile <- getProfile
platform <- getPlatform
- let sz = CmmLoad (cmmOffsetB platform arr sz_off) (bWord platform)
+ let sz = cmmLoadBWord platform (cmmOffset platform arr sz_off)
sz_off = fixedHdrSize profile + pc_OFFSET_StgArrBytes_bytes (platformConstants platform)
elem_sz = widthInBytes $ typeWidth elem_ty
idx_sz = widthInBytes $ typeWidth idx_ty
diff --git a/compiler/GHC/StgToCmm/Prof.hs b/compiler/GHC/StgToCmm/Prof.hs
index 8af9189e9a..bb3d4a8696 100644
--- a/compiler/GHC/StgToCmm/Prof.hs
+++ b/compiler/GHC/StgToCmm/Prof.hs
@@ -396,7 +396,7 @@ ldvEnter cl_ptr = do
-- don't forget to subtract node's tag
ldv_wd = ldvWord platform cl_ptr
new_ldv_wd = cmmOrWord platform
- (cmmAndWord platform (CmmLoad ldv_wd (bWord platform))
+ (cmmAndWord platform (cmmLoadBWord platform ldv_wd)
(CmmLit (mkWordCLit platform (pc_ILDV_CREATE_MASK constants))))
(cmmOrWord platform (loadEra platform) (CmmLit (mkWordCLit platform (pc_ILDV_STATE_USE constants))))
ifProfiling $
diff --git a/compiler/GHC/StgToCmm/Ticky.hs b/compiler/GHC/StgToCmm/Ticky.hs
index 2a543b6553..118c05d920 100644
--- a/compiler/GHC/StgToCmm/Ticky.hs
+++ b/compiler/GHC/StgToCmm/Ticky.hs
@@ -374,7 +374,7 @@ registerTickyCtr ctr_lbl = do
let locked = cmmEqWord platform (CmmReg $ CmmLocal old) (zeroExpr platform)
emit =<< mkCmmIfThen locked register_stmts
- let test = cmmEqWord platform (CmmLoad registeredp (bWord platform)) (zeroExpr platform)
+ let test = cmmEqWord platform (cmmLoadBWord platform registeredp) (zeroExpr platform)
emit =<< mkCmmIfThen test cas_test
tickyReturnOldCon, tickyReturnNewCon :: RepArity -> FCode ()
diff --git a/compiler/GHC/StgToCmm/Utils.hs b/compiler/GHC/StgToCmm/Utils.hs
index 67fb8c621e..22e34dddae 100644
--- a/compiler/GHC/StgToCmm/Utils.hs
+++ b/compiler/GHC/StgToCmm/Utils.hs
@@ -146,7 +146,7 @@ mkTaggedObjectLoad platform reg base offset tag
tagToClosure :: Platform -> TyCon -> CmmExpr -> CmmExpr
tagToClosure platform tycon tag
- = CmmLoad (cmmOffsetExprW platform closure_tbl tag) (bWord platform)
+ = cmmLoadBWord platform (cmmOffsetExprW platform closure_tbl tag)
where closure_tbl = CmmLit (CmmLabel lbl)
lbl = mkClosureTableLabel (tyConName tycon) NoCafRefs
@@ -561,7 +561,7 @@ whenUpdRemSetEnabled code = do
platform <- getPlatform
do_it <- getCode code
let
- enabled = CmmLoad (CmmLit $ CmmLabel mkNonmovingWriteBarrierEnabledLabel) (bWord platform)
+ enabled = cmmLoadBWord platform (CmmLit $ CmmLabel mkNonmovingWriteBarrierEnabledLabel)
zero = zeroExpr platform
is_enabled = cmmNeWord platform enabled zero
the_if <- mkCmmIfThenElse' is_enabled do_it mkNop (Just False)