home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.bin / pascal / src / fend.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-16  |  32.2 KB  |  1,152 lines

  1. /*-
  2.  * Copyright (c) 1980 The Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  */
  33.  
  34. #ifndef lint
  35. static char sccsid[] = "@(#)fend.c    5.5 (Berkeley) 4/16/91";
  36. #endif /* not lint */
  37.  
  38. #include "whoami.h"
  39. #include "0.h"
  40. #include "tree.h"
  41. #include "opcode.h"
  42. #include "objfmt.h"
  43. #include "align.h"
  44. #include "tmps.h"
  45.  
  46. /*
  47.  * this array keeps the pxp counters associated with
  48.  * functions and procedures, so that they can be output
  49.  * when their bodies are encountered
  50.  */
  51. int    bodycnts[ DSPLYSZ ];
  52.  
  53. #ifdef PC
  54. #   include "pc.h"
  55. #   include <pcc.h>
  56. #endif PC
  57.  
  58. #ifdef OBJ
  59. int    cntpatch;
  60. int    nfppatch;
  61. #endif OBJ
  62.  
  63. #include "tree_ty.h"
  64.  
  65. struct    nl *Fp;
  66. int    pnumcnt;
  67. /*
  68.  * Funcend is called to
  69.  * finish a block by generating
  70.  * the code for the statements.
  71.  * It then looks for unresolved declarations
  72.  * of labels, procedures and functions,
  73.  * and cleans up the name list.
  74.  * For the program, it checks the
  75.  * semantics of the program
  76.  * statement (yuchh).
  77.  */
  78. funcend(fp, bundle, endline)
  79.     struct nl *fp;
  80.     struct tnode *bundle;
  81.     int endline;
  82. {
  83.     register struct nl *p;
  84.     register int i, b;
  85.     int inp, out;
  86.     struct tnode *blk;
  87.     bool chkref;
  88.     struct nl *iop;
  89.     char *cp;
  90.     extern int cntstat;
  91. #    ifdef PC
  92.         struct entry_exit_cookie    eecookie;
  93. #    endif PC
  94. #    ifndef PC
  95.     int var;
  96. #    endif PC
  97.  
  98.     cntstat = 0;
  99. /*
  100.  *    yyoutline();
  101.  */
  102.     if (program != NIL)
  103.         line = program->value[3];
  104.     blk = bundle->stmnt_blck.stmnt_list;
  105.     if (fp == NIL) {
  106.         cbn--;
  107. #        ifdef PTREE
  108.             nesting--;
  109. #        endif PTREE
  110.         return;
  111.     }
  112. #ifdef OBJ
  113.     /*
  114.      * Patch the branch to the entry point of the function.
  115.      * Assure alignment of O_BEG structure.
  116.      */
  117.     if (((int)lc & 02) == 0)
  118.         word(0);
  119.     patch4((PTR_DCL) fp->value[NL_ENTLOC]);
  120.     /*
  121.      * Put out the block entrance code and the block name.
  122.      * HDRSZE is the number of bytes of info in the static
  123.      * BEG data area exclusive of the proc name. It is
  124.      * currently defined as:
  125.     /*    struct hdr {
  126.     /*        long framesze;    /* number of bytes of local vars */
  127.     /*        long nargs;    /* number of bytes of arguments */
  128.     /*        bool tests;    /* TRUE => perform runtime tests */
  129.     /*        short offset;    /* offset of procedure in source file */
  130.     /*        char name[1];    /* name of active procedure */
  131.     /*    };
  132.      */
  133. #    define HDRSZE (2 * sizeof(long) + sizeof(short) + sizeof(bool))
  134.     var = put(2, ((lenstr(fp->symbol,0) + HDRSZE) << 8)
  135.         | (cbn == 1 && opt('p') == 0 ? O_NODUMP: O_BEG), (long)0);
  136.         /*
  137.          *  output the number of bytes of arguments
  138.          *  this is only checked on formal calls.
  139.          */
  140.     (void) put(2, O_CASE4, cbn == 1 ? (long)0 : (long)(fp->value[NL_OFFS]-DPOFF2));
  141.         /*
  142.          *    Output the runtime test mode for the routine
  143.          */
  144.     (void) put(2, sizeof(bool) == 2 ? O_CASE2 : O_CASE4, opt('t') ? TRUE : FALSE);
  145.         /*
  146.          *    Output line number and routine name
  147.          */
  148.     (void) put(2, O_CASE2, bundle->stmnt_blck.line_no);
  149.     putstr(fp->symbol, 0);
  150. #endif OBJ
  151. #ifdef PC
  152.     /*
  153.      * put out the procedure entry code
  154.      */
  155.     eecookie.nlp = fp;
  156.     if ( fp -> class == PROG ) {
  157.         /*
  158.          *    If there is a label declaration in the main routine
  159.          *    then there may be a non-local goto to it that does
  160.          *    not appear in this module. We have to assume that
  161.          *    such a reference may occur and generate code to
  162.          *    prepare for it.
  163.          */
  164.         if ( parts[ cbn ] & LPRT ) {
  165.         parts[ cbn ] |= ( NONLOCALVAR | NONLOCALGOTO );
  166.         }
  167.         codeformain();
  168.         ftnno = fp -> value[NL_ENTLOC];
  169.         prog_prologue(&eecookie);
  170.         stabline(bundle->stmnt_blck.line_no);
  171.         stabfunc(fp, "program", bundle->stmnt_blck.line_no , (long) 0 );
  172.     } else {
  173.         ftnno = fp -> value[NL_ENTLOC];
  174.         fp_prologue(&eecookie);
  175.         stabline(bundle->stmnt_blck.line_no);
  176.         stabfunc(fp, fp->symbol, bundle->stmnt_blck.line_no,
  177.         (long)(cbn - 1));
  178.         for ( p = fp -> chain ; p != NIL ; p = p -> chain ) {
  179.         stabparam( p , p -> value[ NL_OFFS ] , (int) lwidth(p->type));
  180.         }
  181.         if ( fp -> class == FUNC ) {
  182.             /*
  183.              *    stab the function variable
  184.              */
  185.         p = fp -> ptr[ NL_FVAR ];
  186.         stablvar( p , p -> value[ NL_OFFS ] , (int) lwidth( p -> type));
  187.         }
  188.         /*
  189.          *    stab local variables
  190.          *    rummage down hash chain links.
  191.          */
  192.         for ( i = 0 ; i <= 077 ; i++ ) {
  193.         for ( p = disptab[ i ] ; p != NIL ; p = p->nl_next) {
  194.             if ( ( p -> nl_block & 037 ) != cbn ) {
  195.             break;
  196.             }
  197.             /*
  198.              *    stab locals (not parameters)
  199.              */
  200.             if ( p -> symbol != NIL ) {
  201.             if ( p -> class == VAR && p -> value[ NL_OFFS ] < 0 ) {
  202.                 stablvar( p , p -> value[ NL_OFFS ] ,
  203.                 (int) lwidth( p -> type ) );
  204.             } else if ( p -> class == CONST ) {
  205.                 stabconst( p );
  206.             }
  207.             }
  208.         }
  209.         }
  210.     }
  211.     stablbrac( cbn );
  212.         /*
  213.          *    ask second pass to allocate known locals
  214.          */
  215.     putlbracket(ftnno, &sizes[cbn]);
  216.     fp_entrycode(&eecookie);
  217. #endif PC
  218.     if ( monflg ) {
  219.         if ( fp -> value[ NL_CNTR ] != 0 ) {
  220.             inccnt( fp -> value [ NL_CNTR ] );
  221.         }
  222.         inccnt( bodycnts[ fp -> nl_block & 037 ] );
  223.     }
  224.     if (fp->class == PROG) {
  225.         /*
  226.          * The glorious buffers option.
  227.          *          0 = don't buffer output
  228.          *          1 = line buffer output
  229.          *          2 = 512 byte buffer output
  230.          */
  231. #        ifdef OBJ
  232.             if (opt('b') != 1)
  233.                 (void) put(1, O_BUFF | opt('b') << 8);
  234. #        endif OBJ
  235. #        ifdef PC
  236.             if ( opt( 'b' ) != 1 ) {
  237.             putleaf( PCC_ICON , 0 , 0
  238.                 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR ) , "_BUFF" );
  239.             putleaf( PCC_ICON , opt( 'b' ) , 0 , PCCT_INT , (char *) 0 );
  240.             putop( PCC_CALL , PCCT_INT );
  241.             putdot( filename , line );
  242.             }
  243. #        endif PC
  244.         inp = 0;
  245.         out = 0;
  246.         for (p = fp->chain; p != NIL; p = p->chain) {
  247.             if (pstrcmp(p->symbol, input->symbol) == 0) {
  248.                 inp++;
  249.                 continue;
  250.             }
  251.             if (pstrcmp(p->symbol, output->symbol) == 0) {
  252.                 out++;
  253.                 continue;
  254.             }
  255.             iop = lookup1(p->symbol);
  256.             if (iop == NIL || bn != cbn) {
  257.                 error("File %s listed in program statement but not declared", p->symbol);
  258.                 continue;
  259.             }
  260.             if (iop->class != VAR) {
  261.                 error("File %s listed in program statement but declared as a %s", p->symbol, classes[iop->class]);
  262.                 continue;
  263.             }
  264.             if (iop->type == NIL)
  265.                 continue;
  266.             if (iop->type->class != FILET) {
  267.                 error("File %s listed in program statement but defined as %s",
  268.                     p->symbol, nameof(iop->type));
  269.                 continue;
  270.             }
  271. #            ifdef OBJ
  272.                 (void) put(2, O_CON24, text(iop->type) ? 0 : width(iop->type->type));
  273.                 i = lenstr(p->symbol,0);
  274.                 (void) put(2, O_CON24, i);
  275.                 (void) put(2, O_LVCON, i);
  276.                 putstr(p->symbol, 0);
  277.                 (void) put(2, O_LV | bn<<8+INDX, (int)iop->value[NL_OFFS]);
  278.                 (void) put(1, O_DEFNAME);
  279. #            endif OBJ
  280. #            ifdef PC
  281.                 putleaf( PCC_ICON , 0 , 0
  282.                     , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR )
  283.                     , "_DEFNAME" );
  284.                 putLV( p -> symbol , bn , iop -> value[NL_OFFS] ,
  285.                     iop -> extra_flags , p2type( iop ) );
  286.                 putCONG( p -> symbol , strlen( p -> symbol )
  287.                     , LREQ );
  288.                 putop( PCC_CM , PCCT_INT );
  289.                 putleaf( PCC_ICON , strlen( p -> symbol )
  290.                     , 0 , PCCT_INT , (char *) 0 );
  291.                 putop( PCC_CM , PCCT_INT );
  292.                 putleaf( PCC_ICON
  293.                 , text(iop->type) ? 0 : width(iop->type->type)
  294.                 , 0 , PCCT_INT , (char *) 0 );
  295.                 putop( PCC_CM , PCCT_INT );
  296.                 putop( PCC_CALL , PCCT_INT );
  297.                 putdot( filename , line );
  298. #            endif PC
  299.         }
  300.     }
  301.     /*
  302.      * Process the prog/proc/func body
  303.      */
  304.     noreach = FALSE;
  305.     line = bundle->stmnt_blck.line_no;
  306.     statlist(blk);
  307. #    ifdef PTREE
  308.         {
  309.         pPointer Body = tCopy( blk );
  310.  
  311.         pDEF( PorFHeader[ nesting -- ] ).PorFBody = Body;
  312.         }
  313. #    endif PTREE
  314. #    ifdef OBJ
  315.         if (cbn== 1 && monflg != FALSE) {
  316.             patchfil((PTR_DCL) (cntpatch - 2), (long)cnts, 2);
  317.             patchfil((PTR_DCL) (nfppatch - 2), (long)pfcnt, 2);
  318.         }
  319. #    endif OBJ
  320. #    ifdef PC
  321.         if ( fp -> class == PROG && monflg ) {
  322.         putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR )
  323.             , "_PMFLUSH" );
  324.         putleaf( PCC_ICON , cnts , 0 , PCCT_INT , (char *) 0 );
  325.         putleaf( PCC_ICON , pfcnt , 0 , PCCT_INT , (char *) 0 );
  326.         putop( PCC_CM , PCCT_INT );
  327.         putLV( PCPCOUNT , 0 , 0 , NGLOBAL , PCCT_INT );
  328.         putop( PCC_CM , PCCT_INT );
  329.         putop( PCC_CALL , PCCT_INT );
  330.         putdot( filename , line );
  331.         }
  332. #    endif PC
  333.     /*
  334.      * Clean up the symbol table displays and check for unresolves
  335.      */
  336.     line = endline;
  337.     if (fp->class == PROG && inp == 0 && (input->nl_flags & (NUSED|NMOD)) != 0) {
  338.         recovered();
  339.         error("Input is used but not defined in the program statement");
  340.     }
  341.     if (fp->class == PROG && out == 0 && (output->nl_flags & (NUSED|NMOD)) != 0) {
  342.         recovered();
  343.         error("Output is used but not defined in the program statement");
  344.     }
  345.     b = cbn;
  346.     Fp = fp;
  347.     chkref = (syneflg == errcnt[cbn] && opt('w') == 0)?TRUE:FALSE;
  348.     for (i = 0; i <= 077; i++) {
  349.         for (p = disptab[i]; p != NIL && (p->nl_block & 037) == b; p = p->nl_next) {
  350.             /*
  351.              * Check for variables defined
  352.              * but not referenced 
  353.              */
  354.             if (chkref && p->symbol != NIL)
  355.             switch (p->class) {
  356.                 case FIELD:
  357.                     /*
  358.                      * If the corresponding record is
  359.                      * unused, we shouldn't complain about
  360.                      * the fields.
  361.                      */
  362.                 default:
  363.                     if ((p->nl_flags & (NUSED|NMOD)) == 0) {
  364.                         warning();
  365.                         nerror("%s %s is neither used nor set", classes[p->class], p->symbol);
  366.                         break;
  367.                     }
  368.                     /*
  369.                      * If a var parameter is either
  370.                      * modified or used that is enough.
  371.                      */
  372.                     if (p->class == REF)
  373.                         continue;
  374. #                    ifdef OBJ
  375.                         if ((p->nl_flags & NUSED) == 0) {
  376.                         warning();
  377.                         nerror("%s %s is never used", classes[p->class], p->symbol);
  378.                         break;
  379.                         }
  380. #                    endif OBJ
  381. #                    ifdef PC
  382.                         if (((p->nl_flags & NUSED) == 0) && ((p->extra_flags & NEXTERN) == 0)) {
  383.                         warning();
  384.                         nerror("%s %s is never used", classes[p->class], p->symbol);
  385.                         break;
  386.                         }
  387. #                    endif PC
  388.                     if ((p->nl_flags & NMOD) == 0) {
  389.                         warning();
  390.                         nerror("%s %s is used but never set", classes[p->class], p->symbol);
  391.                         break;
  392.                     }
  393.                 case LABEL:
  394.                 case FVAR:
  395.                 case BADUSE:
  396.                     break;
  397.             }
  398.             switch (p->class) {
  399.                 case BADUSE:
  400.                     cp = "s";
  401.                     /* This used to say ud_next
  402.                        that is not a member of nl so
  403.                        i changed it to nl_next,
  404.                        which may be wrong */
  405.                     if (p->chain->nl_next == NIL)
  406.                         cp++;
  407.                     eholdnl();
  408.                     if (p->value[NL_KINDS] & ISUNDEF)
  409.                         nerror("%s undefined on line%s", p->symbol, cp);
  410.                     else
  411.                         nerror("%s improperly used on line%s", p->symbol, cp);
  412.                     pnumcnt = 10;
  413.                     pnums((struct udinfo *) p->chain);
  414.                     pchr('\n');
  415.                     break;
  416.  
  417.                 case FUNC:
  418.                 case PROC:
  419. #                    ifdef OBJ
  420.                         if ((p->nl_flags & NFORWD))
  421.                         nerror("Unresolved forward declaration of %s %s", classes[p->class], p->symbol);
  422. #                    endif OBJ
  423. #                    ifdef PC
  424.                         if ((p->nl_flags & NFORWD) && ((p->extra_flags & NEXTERN) == 0))
  425.                         nerror("Unresolved forward declaration of %s %s", classes[p->class], p->symbol);
  426. #                    endif PC
  427.                     break;
  428.  
  429.                 case LABEL:
  430.                     if (p->nl_flags & NFORWD)
  431.                         nerror("label %s was declared but not defined", p->symbol);
  432.                     break;
  433.                 case FVAR:
  434.                     if ((p->nl_flags & NMOD) == 0)
  435.                         nerror("No assignment to the function variable");
  436.                     break;
  437.             }
  438.         }
  439.         /*
  440.          * Pop this symbol
  441.          * table slot
  442.          */
  443.         disptab[i] = p;
  444.     }
  445.  
  446. #    ifdef OBJ
  447.         (void) put(1, O_END);
  448. #    endif OBJ
  449. #    ifdef PC
  450.         fp_exitcode(&eecookie);
  451.         stabrbrac(cbn);
  452.         putrbracket(ftnno);
  453.         fp_epilogue(&eecookie);
  454.         if (fp -> class != PROG) {
  455.         fp_formalentry(&eecookie);
  456.         }
  457.         /*
  458.          *    declare pcp counters, if any
  459.          */
  460.         if ( monflg && fp -> class == PROG ) {
  461.         putprintf( "    .data" , 0 );
  462.         aligndot(PCCT_INT);
  463.         putprintf( "    .comm    " , 1 );
  464.         putprintf( PCPCOUNT , 1 );
  465.         putprintf( ",%d" , 0 , ( cnts + 1 ) * sizeof (long) );
  466.         putprintf( "    .text" , 0 );
  467.         }
  468. #    endif PC
  469. #ifdef DEBUG
  470.     dumpnl(fp->ptr[2], (int) fp->symbol);
  471. #endif
  472.  
  473. #ifdef OBJ
  474.     /*
  475.      * save the namelist for the debugger pdx
  476.      */
  477.  
  478.     savenl(fp->ptr[2], (int) fp->symbol);
  479. #endif
  480.  
  481.     /*
  482.      * Restore the
  483.      * (virtual) name list
  484.      * position
  485.      */
  486.     nlfree(fp->ptr[2]);
  487.     /*
  488.      * Proc/func has been
  489.      * resolved
  490.      */
  491.     fp->nl_flags &= ~NFORWD;
  492.     /*
  493.      * Patch the beg
  494.      * of the proc/func to
  495.      * the proper variable size
  496.      */
  497.     if (Fp == NIL)
  498.         elineon();
  499. #    ifdef OBJ
  500.         patchfil((PTR_DCL) var,
  501.         roundup(-sizes[cbn].om_max, (long) A_STACK), 2);
  502. #    endif OBJ
  503.     cbn--;
  504.     if (inpflist(fp->symbol)) {
  505.         opop('l');
  506.     }
  507. }
  508.  
  509. #ifdef PC
  510.     /*
  511.      *    construct the long name of a function based on it's static nesting.
  512.      *    into a caller-supplied buffer (that should be about BUFSIZ big).
  513.      */
  514. sextname( buffer , name , level )
  515.     char    buffer[];
  516.     char    *name;
  517.     int        level;
  518. {
  519.     char    *starthere;
  520.     int    i;
  521.  
  522.     starthere = &buffer[0];
  523.     for ( i = 1 ; i < level ; i++ ) {
  524.     sprintf( starthere , EXTFORMAT , enclosing[ i ] );
  525.     starthere += strlen( enclosing[ i ] ) + 1;
  526.     }
  527.     sprintf( starthere , EXTFORMAT , name );
  528.     starthere += strlen( name ) + 1;
  529.     if ( starthere >= &buffer[ BUFSIZ ] ) {
  530.     panic( "sextname" );
  531.     }
  532. }
  533.  
  534.     /*
  535.      *    code for main()
  536.      */
  537. #ifdef vax
  538.  
  539. codeformain()
  540. {
  541.     putprintf("    .text" , 0 );
  542.     putprintf("    .align    1" , 0 );
  543.     putprintf("    .globl    _main" , 0 );
  544.     putprintf("_main:" , 0 );
  545.     putprintf("    .word    0" , 0 );
  546.     if ( opt ( 't' ) ) {
  547.     putprintf("    pushl    $1" , 0 );
  548.     } else {
  549.     putprintf("    pushl    $0" , 0 );
  550.     }
  551.     putprintf("    calls    $1,_PCSTART" , 0 );
  552.     putprintf("    movl    4(ap),__argc" , 0 );
  553.     putprintf("    movl    8(ap),__argv" , 0 );
  554.     putprintf("    calls    $0,_program" , 0 );
  555.     putprintf("    pushl    $0" , 0 );
  556.     putprintf("    calls    $1,_PCEXIT" , 0 );
  557. }
  558. #endif vax
  559.  
  560. #ifdef tahoe
  561. codeformain()
  562. {
  563.     putprintf("    .text" , 0 );
  564.     putprintf("    .align    1" , 0 );
  565.     putprintf("    .globl    _main" , 0 );
  566.     putprintf("_main:" , 0 );
  567.     putprintf("    .word    0" , 0 );
  568.     if ( opt ( 't' ) ) {
  569.     putprintf("    pushl    $1" , 0 );
  570.     } else {
  571.     putprintf("    pushl    $0" , 0 );
  572.     }
  573.     putprintf("    callf    $8,_PCSTART" , 0 );
  574.     putprintf("    movl    4(fp),__argc" , 0 );
  575.     putprintf("    movl    8(fp),__argv" , 0 );
  576.     putprintf("    callf    $4,_program" , 0 );
  577.     putprintf("    pushl    $0" , 0 );
  578.     putprintf("    callf    $8,_PCEXIT" , 0 );
  579. }
  580. #endif tahoe
  581.  
  582.     /*
  583.      *    prologue for the program.
  584.      *    different because it
  585.      *        doesn't have formal entry point
  586.      */
  587. #if defined(vax) || defined(tahoe) 
  588. prog_prologue(eecookiep)
  589.     struct entry_exit_cookie    *eecookiep;
  590. {
  591.     putprintf("    .text" , 0 );
  592.     putprintf("    .align    1" , 0 );
  593.     putprintf("    .globl    _program" , 0 );
  594.     putprintf("_program:" , 0 );
  595.     /*
  596.      *    register save mask
  597.      */
  598.     eecookiep -> savlabel = (int) getlab();
  599.     putprintf("    .word    %s%d", 0, (int) SAVE_MASK_LABEL , eecookiep -> savlabel );
  600. }
  601.  
  602. fp_prologue(eecookiep)
  603.     struct entry_exit_cookie    *eecookiep;
  604. {
  605.  
  606.     sextname( eecookiep -> extname, eecookiep -> nlp -> symbol , cbn - 1 );
  607.     putprintf( "    .text" , 0 );
  608.     putprintf( "    .align    1" , 0 );
  609.     putprintf( "    .globl    %s%s", 0, (int) FORMALPREFIX, (int) eecookiep -> extname );
  610.     putprintf( "    .globl    %s" , 0 , (int) eecookiep -> extname );
  611.     putprintf( "%s:" , 0 , (int) eecookiep -> extname );
  612.     /*
  613.      *    register save mask
  614.      */
  615.     eecookiep -> savlabel = (int) getlab();
  616.     putprintf("    .word    %s%d", 0, (int) SAVE_MASK_LABEL , eecookiep -> savlabel );
  617. }
  618. #endif vax || tahoe
  619.  
  620.     /*
  621.      *    code before any user code.
  622.      *    or code that is machine dependent.
  623.      */
  624. #ifdef vax
  625. fp_entrycode(eecookiep)
  626.     struct entry_exit_cookie    *eecookiep;
  627. {
  628.     int    ftnno = eecookiep -> nlp -> value[NL_ENTLOC];
  629.     int    proflabel = (int) getlab();
  630.     int    setjmp0 = (int) getlab();
  631.  
  632.     /*
  633.      *    top of code;  destination of jump from formal entry code.
  634.      */
  635.     eecookiep -> toplabel = (int) getlab();
  636.     (void) putlab( (char *) eecookiep -> toplabel );
  637.     putprintf("    subl2    $%s%d,sp" , 0 , (int) FRAME_SIZE_LABEL, ftnno );
  638.     if ( profflag ) {
  639.         /*
  640.          *    call mcount for profiling
  641.          */
  642.     putprintf( "    moval    " , 1 );
  643.     putprintf( PREFIXFORMAT , 1 , (int) LABELPREFIX , proflabel );
  644.     putprintf( ",r0" , 0 );
  645.     putprintf( "    jsb    mcount" , 0 );
  646.     putprintf( "    .data" , 0 );
  647.     putprintf( "    .align    2" , 0 );
  648.     (void) putlab( (char *) proflabel );
  649.     putprintf( "    .long    0" , 0 );
  650.     putprintf( "    .text" , 0 );
  651.     }
  652.     /*
  653.      *    if there are nested procedures that access our variables
  654.      *    we must save the display.
  655.      */
  656.     if ( parts[ cbn ] & NONLOCALVAR ) {
  657.         /*
  658.          *    save old display 
  659.          */
  660.     putprintf( "    movq    %s+%d,%d(%s)" , 0
  661.         , (int) DISPLAYNAME , cbn * sizeof(struct dispsave)
  662.         , DSAVEOFFSET , (int) P2FPNAME );
  663.         /*
  664.          *    set up new display by saving AP and FP in appropriate
  665.          *    slot in display structure.
  666.          */
  667.     putprintf( "    movq    %s,%s+%d" , 0
  668.         , (int) P2APNAME , (int) DISPLAYNAME , cbn * sizeof(struct dispsave) );
  669.     }
  670.     /*
  671.      *    set underflow checking if runtime tests
  672.      */
  673.     if ( opt( 't' ) ) {
  674.     putprintf( "    bispsw    $0xe0" , 0 );
  675.     }
  676.     /*
  677.      *    zero local variables if checking is on
  678.      *    by calling blkclr( bytes of locals , starting local address );
  679.      */
  680.     if ( opt( 't' ) && ( -sizes[ cbn ].om_max ) > DPOFF1 ) {
  681.     putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR )
  682.         , "_blkclr" );
  683.     putLV((char *) 0 , cbn , (int) sizes[ cbn ].om_max , NLOCAL , PCCT_CHAR );
  684.     putleaf( PCC_ICON ,  (int) (( -sizes[ cbn ].om_max ) - DPOFF1)
  685.         , 0 , PCCT_INT ,(char *) 0 );
  686.     putop( PCC_CM , PCCT_INT );
  687.     putop( PCC_CALL , PCCT_INT );
  688.     putdot( filename , line );
  689.     }
  690.     /*
  691.      *  set up goto vector if non-local goto to this frame
  692.      */
  693.     if ( parts[ cbn ] & NONLOCALGOTO ) {
  694.     putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR )
  695.         , "_setjmp" );
  696.     putLV( (char *) 0 , cbn , GOTOENVOFFSET , NLOCAL , PCCTM_PTR|PCCT_STRTY );
  697.     putop( PCC_CALL , PCCT_INT );
  698.     putleaf( PCC_ICON , 0 , 0 , PCCT_INT , (char *) 0 );
  699.     putop( PCC_NE , PCCT_INT );
  700.     putleaf( PCC_ICON , setjmp0 , 0 , PCCT_INT , (char *) 0 );
  701.     putop( PCC_CBRANCH , PCCT_INT );
  702.     putdot( filename , line );
  703.         /*
  704.          *    on non-local goto, setjmp returns with address to
  705.          *    be branched to.
  706.          */
  707.     putprintf( "    jmp    (r0)" , 0 );
  708.     (void) putlab((char *) setjmp0);
  709.     }
  710. }
  711. #endif vax
  712.  
  713. #ifdef tahoe
  714. fp_entrycode(eecookiep)
  715.     struct entry_exit_cookie    *eecookiep;
  716. {
  717.     int    ftnno = eecookiep -> nlp -> value[NL_ENTLOC];
  718.     int    proflabel = (int) getlab();
  719.     int    setjmp0 = (int) getlab();
  720.  
  721.     /*
  722.      *    top of code;  destination of jump from formal entry code.
  723.      */
  724.     eecookiep -> toplabel = (int) getlab();
  725.     (void) putlab( (char *) eecookiep -> toplabel );
  726.     putprintf("    subl3    $%s%d,fp,sp" , 0 , (int) FRAME_SIZE_LABEL, ftnno );
  727.     if ( profflag ) {
  728.         /*
  729.          *    call mcount for profiling
  730.          */
  731.     putprintf( "    pushal    " , 1 );
  732.     putprintf( PREFIXFORMAT , 0 , (int) LABELPREFIX , proflabel );
  733.     putprintf( "    callf    $8,mcount" , 0 );
  734.     putprintf( "    .data" , 0 );
  735.     putprintf( "    .align    2" , 0 );
  736.     (void) putlab( (char *) proflabel );
  737.     putprintf( "    .long    0" , 0 );
  738.     putprintf( "    .text" , 0 );
  739.     }
  740.     /*
  741.      *    if there are nested procedures that access our variables
  742.      *    we must save the display.
  743.      */
  744.     if ( parts[ cbn ] & NONLOCALVAR ) {
  745.         /*
  746.          *    save old display 
  747.          */
  748.     putprintf( "    movl    %s+%d,%d(%s)" , 0
  749.         , (int) DISPLAYNAME , cbn * sizeof(struct dispsave)
  750.         , DSAVEOFFSET , (int) P2FPNAME );
  751.         /*
  752.          *    set up new display by saving FP in appropriate
  753.          *    slot in display structure.
  754.          */
  755.     putprintf( "    movl    %s,%s+%d" , 0
  756.         , (int) P2FPNAME , (int) DISPLAYNAME , cbn * sizeof(struct dispsave) );
  757.     }
  758.     /*
  759.      *    set underflow checking if runtime tests
  760.      */
  761.     if ( opt( 't' ) ) {
  762.     putprintf( "    bicpsw    $0x20" , 0 );
  763.     }
  764.     /*
  765.      *    zero local variables if checking is on
  766.      *    by calling blkclr( bytes of locals , starting local address );
  767.      */
  768.     if ( opt( 't' ) && ( -sizes[ cbn ].om_max ) > DPOFF1 ) {
  769.     putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR )
  770.         , "_blkclr" );
  771.     putLV((char *) 0 , cbn , (int) sizes[ cbn ].om_max , NLOCAL , PCCT_CHAR );
  772.     putleaf( PCC_ICON ,  (int) (( -sizes[ cbn ].om_max ) - DPOFF1)
  773.         , 0 , PCCT_INT ,(char *) 0 );
  774.     putop( PCC_CM , PCCT_INT );
  775.     putop( PCC_CALL , PCCT_INT );
  776.     putdot( filename , line );
  777.     }
  778.     /*
  779.      *  set up goto vector if non-local goto to this frame
  780.      */
  781.     if ( parts[ cbn ] & NONLOCALGOTO ) {
  782.     putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR )
  783.         , "_setjmp" );
  784.     putLV( (char *) 0 , cbn , GOTOENVOFFSET , NLOCAL , PCCTM_PTR|PCCT_STRTY );
  785.     putop( PCC_CALL , PCCT_INT );
  786.     putleaf( PCC_ICON , 0 , 0 , PCCT_INT , (char *) 0 );
  787.     putop( PCC_NE , PCCT_INT );
  788.     putleaf( PCC_ICON , setjmp0 , 0 , PCCT_INT , (char *) 0 );
  789.     putop( PCC_CBRANCH , PCCT_INT );
  790.     putdot( filename , line );
  791.         /*
  792.          *    on non-local goto, setjmp returns with address to
  793.          *    be branched to.
  794.          */
  795.     putprintf( "    jmp    (r0)" , 0 );
  796.     (void) putlab((char *) setjmp0);
  797.     }
  798. }
  799. #endif tahoe
  800.  
  801. #if defined(vax) || defined(tahoe)
  802. fp_exitcode(eecookiep)
  803.     struct entry_exit_cookie    *eecookiep;
  804. {
  805.     /*
  806.      *    if there were file variables declared at this level
  807.      *    call PCLOSE( ap ) to clean them up.
  808.      */
  809.     if ( dfiles[ cbn ] ) {
  810.     putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR )
  811.         , "_PCLOSE" );
  812.     putleaf( PCC_REG , 0 , P2AP , PCCM_ADDTYPE( PCCT_CHAR , PCCTM_PTR ) , (char *) 0 );
  813.     putop( PCC_CALL , PCCT_INT );
  814.     putdot( filename , line );
  815.     }
  816.     /*
  817.      *    if this is a function,
  818.      *    the function variable is the return value.
  819.      *    if it's a scalar valued function, return scalar,
  820.      *    else, return a pointer to the structure value.
  821.      */
  822.     if ( eecookiep-> nlp -> class == FUNC ) {
  823.     struct nl    *fvar = eecookiep-> nlp -> ptr[ NL_FVAR ];
  824.     long        fvartype = p2type( fvar -> type );
  825.     long        label;
  826.     char        labelname[ BUFSIZ ];
  827.  
  828.     switch ( classify( fvar -> type ) ) {
  829.         case TBOOL:
  830.         case TCHAR:
  831.         case TINT:
  832.         case TSCAL:
  833.         case TDOUBLE:
  834.         case TPTR:
  835.         putRV( fvar -> symbol , ( fvar -> nl_block ) & 037 ,
  836.             fvar -> value[ NL_OFFS ] ,
  837.             fvar -> extra_flags ,
  838.             (int) fvartype );
  839.         putop( PCC_FORCE , (int) fvartype );
  840.         break;
  841.         default:
  842.         label = (int) getlab();
  843.         sprintf( labelname , PREFIXFORMAT , LABELPREFIX , label );
  844.         putprintf( "    .data" , 0 );
  845.         aligndot(A_STRUCT);
  846.         putprintf( "    .lcomm    %s,%d" , 0 ,
  847.                 (int) labelname , (int) lwidth( fvar -> type ) );
  848.         putprintf( "    .text" , 0 );
  849.         putleaf( PCC_NAME , 0 , 0 , (int) fvartype , labelname );
  850.         putLV( fvar -> symbol , ( fvar -> nl_block ) & 037 ,
  851.             fvar -> value[ NL_OFFS ] ,
  852.             fvar -> extra_flags ,
  853.             (int) fvartype );
  854.         putstrop( PCC_STASG , (int) PCCM_ADDTYPE(fvartype, PCCTM_PTR) ,
  855.             (int) lwidth( fvar -> type ) ,
  856.             align( fvar -> type ) );
  857.         putdot( filename , line );
  858.         putleaf( PCC_ICON , 0 , 0 , (int) PCCM_ADDTYPE(fvartype, PCCTM_PTR), labelname );
  859.         putop( PCC_FORCE , (int) PCCM_ADDTYPE(fvartype, PCCTM_PTR) );
  860.         break;
  861.     }
  862.     putdot( filename , line );
  863.     }
  864.     /*
  865.      *    if there are nested procedures we must save the display.
  866.      */
  867.     if ( parts[ cbn ] & NONLOCALVAR ) {
  868.         /*
  869.          *    restore old display entry from save area
  870.          */
  871. #ifdef vax
  872.     putprintf( "    movq    %d(%s),%s+%d" , 0
  873.         , DSAVEOFFSET , (int) P2FPNAME
  874.         , (int) DISPLAYNAME , cbn * sizeof(struct dispsave) );
  875. #endif
  876. #ifdef tahoe
  877.     putprintf( "    movl    %d(%s),%s+%d" , 0
  878.         , DSAVEOFFSET , (int) P2FPNAME
  879.         , (int) DISPLAYNAME , cbn * sizeof(struct dispsave) );
  880. #endif
  881.     }
  882. }
  883. #endif vax || tahoe
  884.  
  885. #if defined(vax) || defined(tahoe)
  886. fp_epilogue(eecookiep)
  887.     struct entry_exit_cookie    *eecookiep;
  888. {
  889.     stabline(line);
  890.     putprintf("    ret" , 0 );
  891.     /*
  892.      *    set the register save mask.
  893.      */
  894.     putprintf("    .set    %s%d,0x%x", 0,
  895.         (int) SAVE_MASK_LABEL, eecookiep -> savlabel, savmask());
  896. }
  897. #endif vax || tahoe
  898.  
  899. #if defined(vax) || defined(tahoe)
  900. fp_formalentry(eecookiep)
  901.     struct entry_exit_cookie    *eecookiep;
  902. {
  903.  
  904.     putprintf("    .align 1", 0);
  905.     putprintf("%s%s:" , 0 , (int) FORMALPREFIX , (int) eecookiep -> extname );
  906.     putprintf("    .word    %s%d", 0, (int) SAVE_MASK_LABEL, eecookiep -> savlabel );
  907.     putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR ) , "_FCALL" );
  908.     putRV((char *) 0 , cbn ,
  909.     eecookiep -> nlp -> value[ NL_OFFS ] + sizeof( struct formalrtn * ) ,
  910.     NPARAM , PCCTM_PTR | PCCT_STRTY );
  911.     putRV((char *) 0, cbn, eecookiep -> nlp -> value[NL_OFFS], NPARAM, PCCTM_PTR|PCCT_STRTY);
  912.     putop( PCC_CM , PCCT_INT );
  913.     putop( PCC_CALL , PCCT_INT );
  914.     putdot( filename , line );
  915.     putjbr( (long) eecookiep -> toplabel );
  916. }
  917. #endif vax || tahoe
  918.  
  919. #ifdef mc68000
  920.  
  921. codeformain()
  922. {
  923.     putprintf("    .text", 0);
  924.     putprintf("    .globl    _main", 0);
  925.     putprintf("_main:", 0);
  926.     putprintf("    link    %s,#0", 0, P2FPNAME);
  927.     if (opt('t')) {
  928.     putprintf("    pea    1", 0);
  929.     } else {
  930.     putprintf("    pea    0", 0);
  931.     }
  932.     putprintf("    jbsr    _PCSTART", 0);
  933.     putprintf("    addql    #4,sp", 0);
  934.     putprintf("    movl    %s@(8),__argc", 0, P2FPNAME);
  935.     putprintf("    movl    %s@(12),__argv", 0, P2FPNAME);
  936.     putprintf("    jbsr    _program", 0);
  937.     putprintf("    pea    0", 0);
  938.     putprintf("    jbsr    _PCEXIT", 0);
  939. }
  940.  
  941. prog_prologue(eecookiep)
  942.     struct entry_exit_cookie    *eecookiep;
  943. {
  944.     int    ftnno = eecookiep -> nlp -> value[NL_ENTLOC];
  945.  
  946.     putprintf("    .text", 0);
  947.     putprintf("    .globl    _program", 0);
  948.     putprintf("_program:", 0);
  949.     putprintf("    link    %s,#0", 0, P2FPNAME);
  950.     putprintf("    addl    #-%s%d,sp", 0, FRAME_SIZE_LABEL, ftnno);
  951.     /* touch new end of stack, to break more stack space */
  952.     putprintf("    tstb    sp@(-%s%d)", 0, PAGE_BREAK_LABEL, ftnno);
  953.     putprintf("    moveml    #%s%d,sp@", 0, SAVE_MASK_LABEL, ftnno);
  954. }
  955.  
  956. fp_prologue(eecookiep)
  957.     struct entry_exit_cookie    *eecookiep;
  958. {
  959.     int        ftnno = eecookiep -> nlp -> value[NL_ENTLOC];
  960.  
  961.     sextname(eecookiep -> extname, eecookiep -> nlp -> symbol, cbn - 1);
  962.     putprintf("    .text", 0);
  963.     putprintf("    .globl    %s%s", 0, FORMALPREFIX, eecookiep -> extname);
  964.     putprintf("    .globl    %s", 0, eecookiep -> extname);
  965.     putprintf("%s:", 0, eecookiep -> extname);
  966.     putprintf("    link    %s,#0", 0, P2FPNAME);
  967.     putprintf("    addl    #-%s%d,sp", 0, FRAME_SIZE_LABEL, ftnno);
  968.     /* touch new end of stack, to break more stack space */
  969.     putprintf("    tstb    sp@(-%s%d)", 0, PAGE_BREAK_LABEL, ftnno);
  970.     putprintf("    moveml    #%s%d,sp@", 0, SAVE_MASK_LABEL, ftnno);
  971. }
  972.  
  973. fp_entrycode(eecookiep)
  974.     struct entry_exit_cookie    *eecookiep;
  975. {
  976.     char *proflabel = getlab();
  977.     char *setjmp0 = getlab();
  978.  
  979.     /*
  980.      *    fill in the label cookie
  981.      */
  982.     eecookiep -> toplabel = getlab();
  983.     (void) putlab(eecookiep -> toplabel);
  984.     /*
  985.      *    call mcount if we are profiling.
  986.      */
  987.     if ( profflag ) {
  988.     putprintf("    movl    #%s%d,a0", 0, LABELPREFIX,  proflabel);
  989.     putprintf("    jsr    mcount", 0);
  990.     putprintf("    .data", 0);
  991.     putprintf("    .even", 0);
  992.     (void) putlab(proflabel);
  993.     putprintf("    .long    0", 0);
  994.     putprintf("    .text", 0);
  995.     }
  996.     /*
  997.      *    if there are nested procedures that access our variables
  998.      *    we must save the display
  999.      */
  1000.     if (parts[cbn] & NONLOCALVAR) {
  1001.         /*
  1002.          *    save the old display
  1003.          */
  1004.     putprintf("    movl    %s+%d,%s@(%d)", 0,
  1005.             DISPLAYNAME, cbn * sizeof(struct dispsave),
  1006.             P2FPNAME, DSAVEOFFSET);
  1007.         /*
  1008.          *    set up the new display by saving the framepointer
  1009.          *    in the display structure.
  1010.          */
  1011.     putprintf("    movl    %s,%s+%d", 0,
  1012.             P2FPNAME, DISPLAYNAME, cbn * sizeof(struct dispsave));
  1013.     }
  1014.     /*
  1015.      *    zero local variables if checking is on
  1016.      *    by calling blkclr( bytes of locals , starting local address );
  1017.      */
  1018.     if ( opt( 't' ) && ( -sizes[ cbn ].om_max ) > DPOFF1 ) {
  1019.     putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR )
  1020.         , "_blkclr" );
  1021.     putLV( 0 , cbn , sizes[ cbn ].om_max , NLOCAL , PCCT_CHAR );
  1022.     putleaf( PCC_ICON ,  ( -sizes[ cbn ].om_max ) - DPOFF1
  1023.         , 0 , PCCT_INT , 0 );
  1024.     putop( PCC_CM , PCCT_INT );
  1025.     putop( PCC_CALL , PCCT_INT );
  1026.     putdot( filename , line );
  1027.     }
  1028.     /*
  1029.      *  set up goto vector if non-local goto to this frame
  1030.      */
  1031.     if ( parts[ cbn ] & NONLOCALGOTO ) {
  1032.     putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR )
  1033.         , "_setjmp" );
  1034.     putLV( 0 , cbn , GOTOENVOFFSET , NLOCAL , PCCTM_PTR|PCCT_STRTY );
  1035.     putop( PCC_CALL , PCCT_INT );
  1036.     putleaf( PCC_ICON , 0 , 0 , PCCT_INT , 0 );
  1037.     putop( PCC_NE , PCCT_INT );
  1038.     putleaf( PCC_ICON , setjmp0 , 0 , PCCT_INT , 0 );
  1039.     putop( PCC_CBRANCH , PCCT_INT );
  1040.     putdot( filename , line );
  1041.         /*
  1042.          *    on non-local goto, setjmp returns with address to
  1043.          *    be branched to.
  1044.          */
  1045.     putprintf("    movl    d0,a0", 0);
  1046.     putprintf("    jmp    a0@", 0);
  1047.     (void) putlab(setjmp0);
  1048.     }
  1049. }
  1050.  
  1051. fp_exitcode(eecookiep)
  1052.     struct entry_exit_cookie    *eecookiep;
  1053. {
  1054.     /*
  1055.      *    if there were file variables declared at this level
  1056.      *    call PCLOSE( ap ) to clean them up.
  1057.      */
  1058.     if ( dfiles[ cbn ] ) {
  1059.     putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR )
  1060.         , "_PCLOSE" );
  1061.     putleaf( PCC_REG , 0 , P2AP , PCCM_ADDTYPE( PCCT_CHAR , PCCTM_PTR ) , 0 );
  1062.     putop( PCC_CALL , PCCT_INT );
  1063.     putdot( filename , line );
  1064.     }
  1065.     /*
  1066.      *    if this is a function,
  1067.      *    the function variable is the return value.
  1068.      *    if it's a scalar valued function, return scalar,
  1069.      *    else, return a pointer to the structure value.
  1070.      */
  1071.     if ( eecookiep -> nlp -> class == FUNC ) {
  1072.     struct nl    *fvar = eecookiep -> nlp -> ptr[ NL_FVAR ];
  1073.     long        fvartype = p2type( fvar -> type );
  1074.     char        *label;
  1075.     char        labelname[ BUFSIZ ];
  1076.  
  1077.     switch ( classify( fvar -> type ) ) {
  1078.         case TBOOL:
  1079.         case TCHAR:
  1080.         case TINT:
  1081.         case TSCAL:
  1082.         case TDOUBLE:
  1083.         case TPTR:
  1084.         putRV( fvar -> symbol , ( fvar -> nl_block ) & 037 ,
  1085.             fvar -> value[ NL_OFFS ] ,
  1086.             fvar -> extra_flags ,
  1087.             fvartype );
  1088.         putop( PCC_FORCE , fvartype );
  1089.         break;
  1090.         default:
  1091.         label = getlab();
  1092.         sprintf( labelname , PREFIXFORMAT , LABELPREFIX , label );
  1093.         putprintf("    .lcomm    %s,%d", 0,
  1094.             labelname, lwidth(fvar -> type));
  1095.         putleaf( PCC_NAME , 0 , 0 , fvartype , labelname );
  1096.         putLV( fvar -> symbol , ( fvar -> nl_block ) & 037 ,
  1097.             fvar -> value[ NL_OFFS ] ,
  1098.             fvar -> extra_flags ,
  1099.             fvartype );
  1100.         putstrop( PCC_STASG , PCCM_ADDTYPE(fvartype, PCCTM_PTR) ,
  1101.             lwidth( fvar -> type ) ,
  1102.             align( fvar -> type ) );
  1103.         putdot( filename , line );
  1104.         putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE(fvartype, PCCTM_PTR), labelname );
  1105.         putop( PCC_FORCE , PCCM_ADDTYPE(fvartype, PCCTM_PTR) );
  1106.         break;
  1107.     }
  1108.     putdot( filename , line );
  1109.     }
  1110.     /*
  1111.      *    if we saved a display, we must restore it.
  1112.      */
  1113.     if ( parts[ cbn ] & NONLOCALVAR ) {
  1114.         /*
  1115.          *    restore old display entry from save area
  1116.          */
  1117.     putprintf("    movl    %s@(%d),%s+%d", 0,
  1118.             P2FPNAME, DSAVEOFFSET,
  1119.             DISPLAYNAME, cbn * sizeof(struct dispsave));
  1120.     }
  1121. }
  1122.  
  1123. fp_epilogue(eecookiep)
  1124.     struct entry_exit_cookie    *eecookiep;
  1125. {
  1126.     /*
  1127.      *    all done by the second pass.
  1128.      */
  1129. }
  1130.  
  1131. fp_formalentry(eecookiep)
  1132.     struct entry_exit_cookie    *eecookiep;
  1133. {
  1134.     putprintf( "%s%s:" , 0 , FORMALPREFIX , eecookiep -> extname );
  1135.     putprintf("    link    %s,#0", 0, P2FPNAME);
  1136.     putprintf("    addl    #-%s%d,sp", 0, FRAME_SIZE_LABEL, ftnno);
  1137.     /* touch new end of stack, to break more stack space */
  1138.     putprintf("    tstb    sp@(-%s%d)", 0, PAGE_BREAK_LABEL, ftnno);
  1139.     putprintf("    moveml    #%s%d,sp@", 0, SAVE_MASK_LABEL, ftnno);
  1140.     putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR ) , "_FCALL" );
  1141.     putRV( 0 , cbn ,
  1142.     eecookiep -> nlp -> value[ NL_OFFS ] + sizeof( struct formalrtn * ) ,
  1143.     NPARAM , PCCTM_PTR | PCCT_STRTY );
  1144.     putRV(0, cbn, eecookiep -> nlp -> value[NL_OFFS], NPARAM, PCCTM_PTR|PCCT_STRTY);
  1145.     putop( PCC_CM , PCCT_INT );
  1146.     putop( PCC_CALL , PCCT_INT );
  1147.     putdot( filename , line );
  1148.     putjbr( eecookiep -> toplabel );
  1149. }
  1150. #endif mc68000
  1151. #endif PC
  1152.