summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-08-04 14:41:19 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-08-07 08:35:21 -0400
commit5f03606319f745b10e9918c76a47426b293f0bf9 (patch)
tree11636b2285c29ad34a6393faebe61c4148cebda9
parentfa9bb70a3fefef681cb0e80cc78977386c1dcf0a (diff)
downloadhaskell-5f03606319f745b10e9918c76a47426b293f0bf9.tar.gz
cmm: Clean up Notes a bit
-rw-r--r--compiler/GHC/Cmm/Node.hs13
-rw-r--r--compiler/GHC/Cmm/Sink.hs1
-rw-r--r--compiler/GHC/StgToCmm/Foreign.hs2
-rw-r--r--compiler/GHC/StgToCmm/Utils.hs2
-rw-r--r--includes/stg/MachRegs.h2
5 files changed, 12 insertions, 8 deletions
diff --git a/compiler/GHC/Cmm/Node.hs b/compiler/GHC/Cmm/Node.hs
index 31a3d14a86..01db60b116 100644
--- a/compiler/GHC/Cmm/Node.hs
+++ b/compiler/GHC/Cmm/Node.hs
@@ -93,7 +93,7 @@ data CmmNode e x where
--
-- Invariant: the arguments and the ForeignTarget must not
-- mention any registers for which GHC.Platform.callerSaves
- -- is True. See Note [Register Parameter Passing].
+ -- is True. See Note [Register parameter passing].
CmmBranch :: ULabel -> CmmNode O C
-- Goto another block in the same procedure
@@ -223,11 +223,12 @@ convention, rdi, rsi, rdx and rcx (as well as r8 and r9) may be used for
argument passing. These are registers R3-R6, which our generated
code may also be using; as a result, it's necessary to save these
values before doing a foreign call. This is done during initial
-code generation in callerSaveVolatileRegs in GHC.StgToCmm.Utils. However,
-one result of doing this is that the contents of these registers
-may mysteriously change if referenced inside the arguments. This
-is dangerous, so you'll need to disable inlining much in the same
-way is done in GHC.Cmm.Opt currently. We should fix this!
+code generation in callerSaveVolatileRegs in GHC.StgToCmm.Utils.
+
+However, one result of doing this is that the contents of these registers may
+mysteriously change if referenced inside the arguments. This is dangerous, so
+you'll need to disable inlining much in the same way is done in GHC.Cmm.Sink
+currently. We should fix this!
-}
---------------------------------------------
diff --git a/compiler/GHC/Cmm/Sink.hs b/compiler/GHC/Cmm/Sink.hs
index bd8c19d2d3..0d16411de3 100644
--- a/compiler/GHC/Cmm/Sink.hs
+++ b/compiler/GHC/Cmm/Sink.hs
@@ -772,6 +772,7 @@ regAddr _ _ _ _ = AnyMem
{-
Note [Inline GlobalRegs?]
+~~~~~~~~~~~~~~~~~~~~~~~~~
Should we freely inline GlobalRegs?
diff --git a/compiler/GHC/StgToCmm/Foreign.hs b/compiler/GHC/StgToCmm/Foreign.hs
index 1f0939d344..ecab35714f 100644
--- a/compiler/GHC/StgToCmm/Foreign.hs
+++ b/compiler/GHC/StgToCmm/Foreign.hs
@@ -261,7 +261,7 @@ load_target_into_temp other_target@(PrimTarget _) =
-- What we want to do here is create a new temporary for the foreign
-- call argument if it is not safe to use the expression directly,
-- because the expression mentions caller-saves GlobalRegs (see
--- Note [Register Parameter Passing]).
+-- Note [Register parameter passing]).
--
-- However, we can't pattern-match on the expression here, because
-- this is used in a loop by GHC.Cmm.Parser, and testing the expression
diff --git a/compiler/GHC/StgToCmm/Utils.hs b/compiler/GHC/StgToCmm/Utils.hs
index 8531ca2283..f1a68eeb28 100644
--- a/compiler/GHC/StgToCmm/Utils.hs
+++ b/compiler/GHC/StgToCmm/Utils.hs
@@ -243,7 +243,7 @@ emitRtsCallGen res lbl args safe
-- shouldn't be doing the workaround at this point in the pipeline, see
-- Note [Register parameter passing] and the ToDo on CmmCall in
-- "GHC.Cmm.Node". Right now the workaround is to avoid inlining across
--- unsafe foreign calls in rewriteAssignments, but this is strictly
+-- unsafe foreign calls in GHC.Cmm.Sink, but this is strictly
-- temporary.
callerSaveVolatileRegs :: Platform -> (CmmAGraph, CmmAGraph)
callerSaveVolatileRegs platform = (caller_save, caller_load)
diff --git a/includes/stg/MachRegs.h b/includes/stg/MachRegs.h
index 82cce6e66a..be7b7d60b4 100644
--- a/includes/stg/MachRegs.h
+++ b/includes/stg/MachRegs.h
@@ -61,6 +61,8 @@
are the RX, FX, DX and USER registers; as a result, if you
decide to caller save a system register (e.g. SP, HP, etc), note that
this code path is completely untested! -- EZY
+
+ See Note [Register parameter passing] for details.
-------------------------------------------------------------------------- */
/* -----------------------------------------------------------------------------