Changes between Version 15 and Version 16 of Commentary/Compiler/CPS


Ignore:
Timestamp:
Jun 26, 2007 1:55:12 PM (8 years ago)
Author:
Michael D. Adams
Comment:

Added info about Cmm syntax changes

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/CPS

    v15 v16  
    9898   * Have {{{codeGen}}} emit C-- with functions. 
    9999 
     100== Current Pipeline == 
     101 
     102=== {{{cmmToRawCmm}}} === 
     103The {{{Cmm}}}/{{{parseCmmFile}}} pipeline and the {{{Stg}}}/{{{codeGen}}} pipeline 
     104can each independantly use the CPS pass. 
     105However, they currently bypass it untill the CPS code becomes stablized, 
     106but they must both use the {{{cmmToRawCmm}}} pass. 
     107This pass converts the header on each function from a {{{CmmInfo}}} 
     108to a {{{[CmmStatic]}}}. 
     109 
     110== Non-CPS Changes == 
     111 * Cmm Syntax Changes 
     112   * The returns parameters of a function call must be surrounded by parenthesis. 
     113     For example 
     114{{{ 
     115foreign "C" fee (); 
     116(x) = foreign "C" foo (); 
     117(x, y) = foreign "C--" bar (); 
     118}}} 
     119     This is simply to avoid shift-reduce conflicts with assignment. 
     120     Future revisions to the parser may eliminate the need for this. 
     121 
     122   * Variable declarations may are annotated to indicate 
     123     whether they are GC followable pointers. 
     124{{{ 
     125W_ x; // Not GC followable 
     126"ptr" W_ y, z; // Both GC followable 
     127}}} 
     128   * The bitmap of a {{{INFO_TABLE_RET}}} is now specified using 
     129     a parameter like syntax. 
     130{{{ 
     131INFO_TABLE_RET(stg_ap_v, RET_SMALL) { ... } // No args 
     132INFO_TABLE_RET(stg_ap_d, RET_SMALL, D_ unused1) { ... } // Single double arg 
     133INFO_TABLE_RET(stg_ap_np, RET_SMALL, W_ non_ptr, "ptr" W_ pointer) { ... } 
     134  // Pointerhood indicated by "ptr" annotation 
     135}}} 
     136     Note that these are not real parameters, they are the stack layout 
     137     of the continuation.  Also, until the CPS algorithm 
     138     gets properly hooked into the {{{Cmm}}} path the parameter names are not used. 
     139   * The return values of a function call may only be {{{LocalReg}}}. 
     140     This is due to changes in the {{{Cmm}}} data type. 
     141 
     142 * Cmm Data Type Changes 
     143   * The return parameters of a {{{CmmCall}}} are {{{LocalReg}}} instead of {{{CmmReg}}}. 
     144     This is because a {{{GlobalReg}}} doesn't have a well defined pointerhood, 
     145     and the return values will become parameters to continuations where 
     146     their pointerhood will be needed. 
     147   * The type of info tables is now a separate parameter to {{{GenCmmTop}}} 
     148     * Before 
     149{{{ 
     150data GenCmmTop d i 
     151  = CmmProc [d] ... 
     152  | CmmData Section [d] 
     153}}} 
     154     * After 
     155{{{ 
     156data GenCmmTop d h i 
     157  = CmmProc h ... 
     158  | CmmData Section [d] 
     159}}} 
     160     This is to support using either {{{CmmInfo}}} or {{{[CmmStatic]}}} 
     161     as the header of a {{{CmmProc}}}. 
     162     * Before info table conversion use {{{Cmm}}} 
     163{{{ 
     164type Cmm = GenCmmTop CmmStatic CmmInfo CmmStmt 
     165}}} 
     166     * After info table conversion use {{{RawCmm}}} 
     167{{{ 
     168type RawCmm = GenCmmTop CmmStatic [CmmStatic] CmmStmt 
     169}}} 
     170     Same for {{{CmmTop}} and {{{RawCmmTop}}}. 
     171   * New type aliases {{{CmmActuals}}}, {{{CmmFormals}}} and {{{CmmHintFormals}}}. 
     172     Respectively these are the actual parameters of a function call, 
     173     the formal parameters of a function, and the 
     174     return results of a function call with pointerhood annotation 
     175     (CPS may convert these to formal parameter of the call's continuation). 
     176 
    100177== Notes == 
    101178 * Changed the parameter to a {{{CmmTop}}} to be {{{CmmFormals}}} instead of {{{[LocalReg]}}}