Commentary Cmm page (Observations and Areas for Improvement)

Peter Tanski p.tanski at gmail.com
Tue Nov 28 09:37:13 EST 2006


On Nov 24, 2006, at 2:50 AM, Simon Peyton-Jones wrote:
> Peter Tanski wrote:
>> I was trying to determine the grounds for when a side-effecting  
>> primop would be inlined and when it would be coded as a separate  
>> procedure.
>
> That's a matter for the implementation, not the C--, or Cmm,  
> specification.  The user should not care.  The implementer makes  
> the usual cost/performance/complexity trade-off, and decides.  I  
> think there is no more to it than that.

Quite so.  The wiki is intended for implementers, in this case those  
who would be interested in implementing new Cmm primitive operators.

> If you are asking what GHC's current code-generator's decisions  
> are, concerning this choice, I couldn't tell you without looking at  
> the code!

According to nativeGen/MachCodeGen.hs, out-of-line primitive  
operators (usually floating point operations) seem to be foreign  
calls.  I suppose a possible addition to Cmm, such as primitive  
operators with exceptions, might be inlined but I haven't looked  
carefully at the trade-offs.

On a somewhat related note, it has been a long holiday weekend (lots  
of company, no spare time) so I got a slow start redoing the Cmm  
language wiki page.  It should be done fairly soon.

Cheers,
Pete



More information about the Cvs-ghc mailing list