Contents    Page-10    Prev    Next    Page+10    Index   

Code Generation

Code generation can be broken into several steps:

  1. Generate the prologue

  2. Generate the program code

  3. Generate the epilogue

Subroutines are provided to generate the prologue and epilogue.

The arguments to the code generator are:


/*       code tree     stack frame size  */
gencode(parseresult, blockoffs[blocknumber],
            labelnumber);

parseresult = pointer to code tree:
              (program foo (progn output)
                           (progn ...))
blockoffs[blocknumber]
            = size of local variables, bytes

labelnumber = max label number used so far