summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@mit.edu>2011-05-16 12:55:20 +0100
committerEdward Z. Yang <ezyang@mit.edu>2011-05-16 12:57:06 +0100
commit52cba3c47b25a78402e542ff63dc905fc5b26b62 (patch)
tree4fca8bac5edd14e3405ec330467bafc40d3df4ee
parent23e89f3d4dc66e4f92296ae390510f1bae1320a4 (diff)
downloadhaskell-52cba3c47b25a78402e542ff63dc905fc5b26b62.tar.gz
Amend comment per Marlow's comments.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
-rw-r--r--compiler/codeGen/StgCmmUtils.hs31
1 files changed, 16 insertions, 15 deletions
diff --git a/compiler/codeGen/StgCmmUtils.hs b/compiler/codeGen/StgCmmUtils.hs
index ad9ebf175c..d917811684 100644
--- a/compiler/codeGen/StgCmmUtils.hs
+++ b/compiler/codeGen/StgCmmUtils.hs
@@ -340,22 +340,23 @@ emitRtsCall' res pkg fun args _vols safe
-- * Regs.h claims that BaseReg should be saved last and loaded first
-- * This might not have been tickled before since BaseReg is callee save
-- * Regs.h saves SparkHd, ParkT1, SparkBase and SparkLim
--- EZY: This code is very dodgy, because callerSaves only ever
--- returns true in the current universe for registers NOT in
+--
+-- This code isn't actually used right now, because callerSaves
+-- only ever returns true in the current universe for registers NOT in
-- system_regs (just do a grep for CALLER_SAVES in
--- includes/stg/MachRegs.h). Thus, this is all one giant no-op. What we are
--- actually interested in is saving are the non-system registers, which
--- we is what the old code generator actually does at this point.
--- Unfortunately, we can't do that here either, because we don't
--- liveness information, and thus there's not an easy way to tell which
--- specific global registers need to be saved (the 'vols' argument in
--- the old code generator.) One possible hack is to save all of them
--- unconditionally, but unless we have very clever dead /memory/
--- elimination (unlikely), this will still leave a dead, unnecessary
--- memory assignment. And really, we shouldn't be doing the workaround
--- at this point in the pipeline, see Note [Register parameter passing].
--- Right now the workaround is to avoid inlining across unsafe foreign
--- calls in rewriteAssignments.
+-- includes/stg/MachRegs.h). It's all one giant no-op, and for
+-- good reason: having to save system registers on every foreign call
+-- would be very expensive, so we avoid assigning them to those
+-- registers when we add support for an architecture.
+--
+-- Note that the old code generator actually does more work here: it
+-- also saves other global registers. We can't (nor want) to do that
+-- here, as we don't have liveness information. And really, we
+-- shouldn't be doing the workaround at this point in the pipeline, see
+-- Note [Register parameter passing] and the ToDo on CmmCall in
+-- cmm/CmmNode.hs. Right now the workaround is to avoid inlining across
+-- unsafe foreign calls in rewriteAssignments, but this is strictly
+-- temporary.
callerSaveVolatileRegs :: (CmmAGraph, CmmAGraph)
callerSaveVolatileRegs = (caller_save, caller_load)
where