CmmStackInfo.updfr_space is a mystery
GHC.Cmm.CmmStackInfo
has a field, updfr_space
, which carries quite an air of mystery about it. In particular, its definition is:
data CmmStackInfo
= StackInfo {
...
updfr_space :: Maybe ByteOff,
-- XXX: this never contains anything useful, but it should.
-- See comment in GHC.Cmm.LayoutStack.
Furthermore, it has exactly zero "read" uses other than the Outputable
instance.
I believe the comment in GHC.Cmm.LayoutStack
is the following:
-- This doesn't seem right somehow. We need to find out whether this
-- proc will push some update frame material at some point, so that we
-- can avoid using that area of the stack for spilling. The
-- updfr_space field of the CmmProc *should* tell us, but it doesn't
-- (I think maybe it gets filled in later when we do proc-point
-- splitting).
--
-- So we'll just take the max of all the cml_ret_offs. This could be
-- unnecessarily pessimistic, but probably not in the code we
-- generate.
collectContInfo :: [CmmBlock] -> (ByteOff, LabelMap ByteOff)
Unfortunately this still doesn't say what meaning updfr_space
was intended to have.
Frankly I think we should rip out updfr_space
, figure out what optimisation it was supposed to be used for, and reintroduce it if we deed it worthwhile.