import Data.Maybe
import Prelude hiding (zip)
--- The point of this module is to insert spills and reloads to
--- establish the invariant that at a call (or at any proc point with
--- an established protocol) all live variables not expected in
--- registers are sitting on the stack. We use a backward analysis to
--- insert spills and reloads. It should be followed by a
--- forward transformation to sink reloads as deeply as possible, so as
--- to reduce register pressure.
-
--- A variable can be expected to be live in a register, live on the
--- stack, or both. This analysis ensures that spills and reloads are
--- inserted as needed to make sure that every live variable needed
--- after a call is available on the stack. Spills are pushed back to
--- their reaching definitions, but reloads are dropped wherever needed
--- and will have to be sunk by a later forward transformation.
+{- Note [Overview of spill/reload]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The point of this module is to insert spills and reloads to
+establish the invariant that at a call (or at any proc point with
+an established protocol) all live variables not expected in
+registers are sitting on the stack. We use a backward analysis to
+insert spills and reloads. It should be followed by a
+forward transformation to sink reloads as deeply as possible, so as
+to reduce register pressure.
+
+A variable can be expected to be live in a register, live on the
+stack, or both. This analysis ensures that spills and reloads are
+inserted as needed to make sure that every live variable needed
+after a call is available on the stack. Spills are pushed back to
+their reaching definitions, but reloads are dropped wherever needed
+and will have to be sunk by a later forward transformation.
+-}
data DualLive = DualLive { on_stack :: RegSet, in_regs :: RegSet }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
\r
Things to do:\r
+\r
+ - CmmContFlowOpt.runCmmContFlowOptZs is not called!\r
+ - Why is runCmmOpts called from HscMain? Seems too "high up".\r
+ In fact HscMain calls (runCmmOpts cmmCfgOptsZ) which is what\r
+ runCmmContFlowOptZs does. Tidy up!\r
+\r
+\r
+ - AsmCodeGen has a generic Cmm optimiser; move this into new pipeline\r
+\r
+ - AsmCodeGen has post-native-cg branch elimiator (shortCutBranches);\r
+ we ultimately want to share this with the Cmm branch eliminator.\r
+\r
+ - At the moment, references to global registers like Hp are "lowered" \r
+ late (in AsmCodeGen.fixAssignTop and cmmToCmm). We should do this\r
+ early, in the new native codegen, much in the way that we lower \r
+ calling conventions. Might need to be a bit sophisticated about\r
+ aliasing.\r
+\r
- Refactor Cmm so that it contains only shared stuff\r
Add a module MoribundCmm which contains stuff from\r
Cmm for old code gen path\r