summaryrefslogtreecommitdiff
path: root/compiler/GHC/Builtin/PrimOps.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Builtin/PrimOps.hs')
-rw-r--r--compiler/GHC/Builtin/PrimOps.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/GHC/Builtin/PrimOps.hs b/compiler/GHC/Builtin/PrimOps.hs
index 8b4fc099cd..c9f0d56aaf 100644
--- a/compiler/GHC/Builtin/PrimOps.hs
+++ b/compiler/GHC/Builtin/PrimOps.hs
@@ -5,6 +5,7 @@
-}
{-# LANGUAGE CPP #-}
+{-# LANGUAGE LambdaCase #-}
module GHC.Builtin.PrimOps (
PrimOp(..), PrimOpVecCat(..), allThePrimOps,
@@ -18,7 +19,7 @@ module GHC.Builtin.PrimOps (
primOpOutOfLine, primOpCodeSize,
primOpOkForSpeculation, primOpOkForSideEffects,
primOpIsCheap, primOpFixity, primOpDocs,
- primOpIsDiv,
+ primOpIsDiv, primOpIsReallyInline,
getPrimOpResultInfo, isComparisonPrimOp, PrimOpResultInfo(..),
@@ -807,3 +808,12 @@ data PrimCall = PrimCall CLabelString Unit
instance Outputable PrimCall where
ppr (PrimCall lbl pkgId)
= text "__primcall" <+> ppr pkgId <+> ppr lbl
+
+-- | Indicate if a primop is really inline: that is, it isn't out-of-line and it
+-- isn't SeqOp/DataToTagOp which are two primops that evaluate their argument
+-- hence induce thread/stack/heap changes.
+primOpIsReallyInline :: PrimOp -> Bool
+primOpIsReallyInline = \case
+ SeqOp -> False
+ DataToTagOp -> False
+ p -> not (primOpOutOfLine p)