Open doyougnu opened 6 months ago
The Wikipedia page is surprisingly informative with a bunch of further references:
Thank you for the reference! But I believe that the Cmm generated by GHC has diverged from the standard. Although I'll have to verify that claim to be sure.
I believe that the Cmm generated by GHC has diverged from the standard
The Wikipedia article does acknowledge this:
There are two main branches:
- C--, the original branch, with the final version 2.0 released in May 2005[3]
- Cmm, the fork actively used as the intermediate representation (IR) in the Glasgow Haskell Compiler (GHC)[4][5]
Some References:
This note in the Cmm.Info.Build
for cafAnal and the constructing SRTs:
-- |
-- The label of a CAFfy thing.
--
-- Labels that come from 'cafAnal' can be:
-- - @_closure@ labels for static functions, static data constructor
-- applications, or static thunks
-- - @_info@ labels for dynamic functions, thunks, or continuations
-- - @_entry@ labels for functions or thunks
--
and this data type:
-- | What type of Cmm label we're dealing with.
-- Determines the suffix appended to the name when a CLabel.CmmLabel
-- is pretty printed.
data CmmLabelInfo
= CmmInfo -- ^ misc rts info tables, suffix _info
| CmmEntry -- ^ misc rts entry points, suffix _entry
| CmmRetInfo -- ^ misc rts ret info tables, suffix _info
| CmmRet -- ^ misc rts return points, suffix _ret
| CmmData -- ^ misc rts data bits, eg CHARLIKE_closure
| CmmCode -- ^ misc rts code
| CmmClosure -- ^ closures eg CHARLIKE_closure
| CmmPrimCall -- ^ a prim call to some hand written Cmm code
deriving (Eq, Ord)
and this note:
-----------------------------------------------------------------------------
-- Printing out CLabels.
{-
Convention:
<name>_<type>
where <name> is <Module>_<name> for external names and <unique> for
internal names. <type> is one of the following:
info Info table
srt Static reference table
entry Entry code (function, closure)
slow Slow entry code (if any)
ret Direct return address
vtbl Vector table
<n>_alt Case alternative (tag n)
dflt Default case alternative
btm Large bitmap vector
closure Static closure
con_entry Dynamic Constructor entry code
con_info Dynamic Constructor info table
static_entry Static Constructor entry code
static_info Static Constructor info table
sel_info Selector info table
sel_entry Selector entry code
cc Cost centre
ccs Cost centre stack
We shall document the language once and for all!