In C--: should CmmCall and CmmProc agree on their live registers?

Moritz Angermann moritz.angermann at gmail.com
Fri Sep 22 06:32:53 UTC 2017


Hi,

apologies for writing so many emails recently. This is a minor
spinoff from the "The Curious Case of T6084" email.

While digging into it, I keep asking myself if CmmProc’s live
registers should match those of the CmmCall that is calling it?

Is there any invariant we try to enforce or would want to
enforce?

- Can the CmmProcs live registers be a strict superset of
  the corresponding CmmCalls?

  From the source comments in `compiler/cmm/Cmm.hs`:
  > Registers live on entry. Note that the set of live
  > registers will be correct in generated C-- code, but
  > not in hand-written C-- code. However,
  > splitAtProcPoints calculates correct liveness
  > information for CmmProcs.

  I would assume that this is an invalid case?

- Can the CmmProcs live registers be a strict subset of
  the corresponding CmmCalls?

  This case however seems to be valid case.  However, this
  makes me wonder if we can, and should(?) propagate the
  live register info from the CmmProc to the CmmCall so
  that they match up, and the registers are not kept live
  at the origin of the CmmCall if they aren’t needed?  And
  as such potentially compute anything to put into the
  registers the CmmCall considers live, but the CmmProc
  would ignore anyway?

Cheers,
 Moritz


More information about the ghc-devs mailing list