summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToLlvm
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-05-06 14:52:53 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-12 21:41:43 -0400
commitbfabf94f63b6644bd32982fd13ea0c8bca9aeae4 (patch)
treeb185749a9676a57c226dab9681fa3c4ba0415dd3 /compiler/GHC/CmmToLlvm
parentda56ed41b62ab132db6d62637c11076985410b24 (diff)
downloadhaskell-bfabf94f63b6644bd32982fd13ea0c8bca9aeae4.tar.gz
Replace CPP assertions with Haskell functions
There is no reason to use CPP. __LINE__ and __FILE__ macros are now better replaced with GHC's CallStack. As a bonus, assert error messages now contain more information (function name, column). Here is the mapping table (HasCallStack omitted): * ASSERT: assert :: Bool -> a -> a * MASSERT: massert :: Bool -> m () * ASSERTM: assertM :: m Bool -> m () * ASSERT2: assertPpr :: Bool -> SDoc -> a -> a * MASSERT2: massertPpr :: Bool -> SDoc -> m () * ASSERTM2: assertPprM :: m Bool -> SDoc -> m ()
Diffstat (limited to 'compiler/GHC/CmmToLlvm')
-rw-r--r--compiler/GHC/CmmToLlvm/CodeGen.hs17
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/GHC/CmmToLlvm/CodeGen.hs b/compiler/GHC/CmmToLlvm/CodeGen.hs
index 3ad52b6f79..3f81c79e3f 100644
--- a/compiler/GHC/CmmToLlvm/CodeGen.hs
+++ b/compiler/GHC/CmmToLlvm/CodeGen.hs
@@ -13,12 +13,14 @@ import GHC.Prelude
import GHC.Driver.Session
import GHC.Driver.Ppr
+import GHC.Platform
+import GHC.Platform.Regs ( activeStgRegs )
+
import GHC.Llvm
import GHC.CmmToLlvm.Base
import GHC.CmmToLlvm.Regs
import GHC.Cmm.BlockId
-import GHC.Platform.Regs ( activeStgRegs )
import GHC.Cmm.CLabel
import GHC.Cmm
import GHC.Cmm.Ppr as PprCmm
@@ -29,14 +31,15 @@ import GHC.Cmm.Dataflow.Graph
import GHC.Cmm.Dataflow.Collections
import GHC.Data.FastString
-import GHC.Types.ForeignCall
-import GHC.Utils.Outputable
-import GHC.Utils.Panic (assertPanic)
-import qualified GHC.Utils.Panic as Panic
-import GHC.Platform
import GHC.Data.OrdList
+
+import GHC.Types.ForeignCall
import GHC.Types.Unique.Supply
import GHC.Types.Unique
+
+import GHC.Utils.Outputable
+import GHC.Utils.Panic.Plain (massert)
+import qualified GHC.Utils.Panic as Panic
import GHC.Utils.Misc
import Control.Monad.Trans.Class
@@ -559,7 +562,7 @@ genCallWithOverflow t@(PrimTarget op) w [dstV, dstO] [lhs, rhs] = do
, MO_AddWordC w
, MO_SubWordC w
]
- MASSERT(valid)
+ massert valid
let width = widthToLlvmInt w
-- This will do most of the work of generating the call to the intrinsic and
-- extracting the values from the struct.