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

Simon Peyton Jones simonpj at microsoft.com
Fri Oct 6 14:44:47 UTC 2017


Moritz

I have this stuff all paged out.  Would you like to give a couple of concrete examples of what you have in mind, with any design alternatives?  And illustrate your suggestion about propagation, which I don't yet grok.

Thanks

Simon

|  -----Original Message-----
|  From: Moritz Angermann [mailto:moritz.angermann at gmail.com]
|  Sent: 06 October 2017 04:37
|  To: Simon Peyton Jones <simonpj at microsoft.com>
|  Cc: GHC developers <ghc-devs at haskell.org>
|  Subject: Re: In C--: should CmmCall and CmmProc agree on their live
|  registers?
|  
|  Hi Simon,
|  
|  no, I did not until now. Thank you! As such it is acceptable that the
|  CmmCalls set of live registers is a superset of the CmmProcs live registers
|  that is called.
|  
|  Say we shrink the set of live registers of the CmmProc, as we determine that
|  some of the arguments passed in registers are not used in the graph at all.
|  Would we want to propagate this information to the CmmCall if possible?
|  
|  Cheers,
|   Moritz
|  
|  
|  > On Oct 5, 2017, at 5:59 PM, Simon Peyton Jones <simonpj at microsoft.com>
|  wrote:
|  >
|  > 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.
|  >
|  > Simon
|  >
|  > |  -----Original Message-----
|  > |  From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of
|  > | Moritz  Angermann
|  > |  Sent: 22 September 2017 07:33
|  > |  To: GHC developers <ghc-devs at haskell.org>
|  > |  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 haskell.org
|  > |
|  > | https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail
|  > | .haskell
|  > |  .org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
|  > |
|  > | devs&data=02%7C01%7Csimonpj%40microsoft.com%7C6009bb0f47a447a4217708
|  > | d50183ce
|  > | fa%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636416587981602708&s
|  > | data=vII
|  > |  rlKVJa6E%2FBvVz5Sod1c544nw6gsGp54Mlhr7bQ8g%3D&reserved=0



More information about the ghc-devs mailing list