summaryrefslogtreecommitdiff
path: root/compiler/GHC/StgToCmm
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-11-05 00:35:54 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-15 03:54:02 -0500
commit6c9862c4fee395345dbbcd8ad58ae3f08753219e (patch)
tree5e6c97bc7e98703b8903c478d3c32631e22977bb /compiler/GHC/StgToCmm
parent6cc3944a06cc5be302bb023a43c0537838b50861 (diff)
downloadhaskell-6c9862c4fee395345dbbcd8ad58ae3f08753219e.tar.gz
cmm/Parser: Add syntax for ordered loads and stores
Diffstat (limited to 'compiler/GHC/StgToCmm')
-rw-r--r--compiler/GHC/StgToCmm/ExtCode.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/GHC/StgToCmm/ExtCode.hs b/compiler/GHC/StgToCmm/ExtCode.hs
index e80cf8b8b9..d41b872722 100644
--- a/compiler/GHC/StgToCmm/ExtCode.hs
+++ b/compiler/GHC/StgToCmm/ExtCode.hs
@@ -231,8 +231,12 @@ emitLabel = code . F.emitLabel
emitAssign :: CmmReg -> CmmExpr -> CmmParse ()
emitAssign l r = code (F.emitAssign l r)
-emitStore :: CmmExpr -> CmmExpr -> CmmParse ()
-emitStore l r = code (F.emitStore l r)
+emitStore :: Maybe MemoryOrdering -> CmmExpr -> CmmExpr -> CmmParse ()
+emitStore (Just mem_ord) l r = do
+ platform <- getPlatform
+ let w = typeWidth $ cmmExprType platform r
+ emit $ mkUnsafeCall (PrimTarget $ MO_AtomicWrite w mem_ord) [] [l,r]
+emitStore Nothing l r = code (F.emitStore l r)
getCode :: CmmParse a -> CmmParse CmmAGraph
getCode (EC ec) = EC $ \c e s -> do