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

Simon Peyton Jones simonpj at
Thu Oct 5 09:59:34 UTC 2017

Did you ever get a reply to this?

In the output of the codegen, CmmProcs should have no live registers apart from those used to pass args, and the standard ones.


|  -----Original Message-----
|  From: ghc-devs [mailto:ghc-devs-bounces at] On Behalf Of Moritz
|  Angermann
|  Sent: 22 September 2017 07:33
|  To: GHC developers <ghc-devs at>
|  Subject: In C--: should CmmCall and CmmProc agree on their live registers?
|  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
|  _______________________________________________
|  ghc-devs mailing list
|  ghc-devs at
|  .org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
|  devs&
|  fa%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636416587981602708&sdata=vII
|  rlKVJa6E%2FBvVz5Sod1c544nw6gsGp54Mlhr7bQ8g%3D&reserved=0

More information about the ghc-devs mailing list