📄 fend.c
字号:
putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR ) , "_blkclr" ); putLV((char *) 0 , cbn , (int) sizes[ cbn ].om_max , NLOCAL , PCCT_CHAR ); putleaf( PCC_ICON , (int) (( -sizes[ cbn ].om_max ) - DPOFF1) , 0 , PCCT_INT ,(char *) 0 ); putop( PCC_CM , PCCT_INT ); putop( PCC_CALL , PCCT_INT ); putdot( filename , line ); } /* * set up goto vector if non-local goto to this frame */ if ( parts[ cbn ] & NONLOCALGOTO ) { putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR ) , "_setjmp" ); putLV( (char *) 0 , cbn , GOTOENVOFFSET , NLOCAL , PCCTM_PTR|PCCT_STRTY ); putop( PCC_CALL , PCCT_INT ); putleaf( PCC_ICON , 0 , 0 , PCCT_INT , (char *) 0 ); putop( PCC_NE , PCCT_INT ); putleaf( PCC_ICON , setjmp0 , 0 , PCCT_INT , (char *) 0 ); putop( PCC_CBRANCH , PCCT_INT ); putdot( filename , line ); /* * on non-local goto, setjmp returns with address to * be branched to. */ putprintf( " jmp (r0)" , 0 ); (void) putlab((char *) setjmp0); }}#endif tahoe#if defined(vax) || defined(tahoe)fp_exitcode(eecookiep) struct entry_exit_cookie *eecookiep;{ /* * if there were file variables declared at this level * call PCLOSE( ap ) to clean them up. */ if ( dfiles[ cbn ] ) { putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR ) , "_PCLOSE" ); putleaf( PCC_REG , 0 , P2AP , PCCM_ADDTYPE( PCCT_CHAR , PCCTM_PTR ) , (char *) 0 ); putop( PCC_CALL , PCCT_INT ); putdot( filename , line ); } /* * if this is a function, * the function variable is the return value. * if it's a scalar valued function, return scalar, * else, return a pointer to the structure value. */ if ( eecookiep-> nlp -> class == FUNC ) { struct nl *fvar = eecookiep-> nlp -> ptr[ NL_FVAR ]; long fvartype = p2type( fvar -> type ); long label; char labelname[ BUFSIZ ]; switch ( classify( fvar -> type ) ) { case TBOOL: case TCHAR: case TINT: case TSCAL: case TDOUBLE: case TPTR: putRV( fvar -> symbol , ( fvar -> nl_block ) & 037 , fvar -> value[ NL_OFFS ] , fvar -> extra_flags , (int) fvartype ); putop( PCC_FORCE , (int) fvartype ); break; default: label = (int) getlab(); sprintf( labelname , PREFIXFORMAT , LABELPREFIX , label ); putprintf( " .data" , 0 ); aligndot(A_STRUCT); putprintf( " .lcomm %s,%d" , 0 , (int) labelname , (int) lwidth( fvar -> type ) ); putprintf( " .text" , 0 ); putleaf( PCC_NAME , 0 , 0 , (int) fvartype , labelname ); putLV( fvar -> symbol , ( fvar -> nl_block ) & 037 , fvar -> value[ NL_OFFS ] , fvar -> extra_flags , (int) fvartype ); putstrop( PCC_STASG , (int) PCCM_ADDTYPE(fvartype, PCCTM_PTR) , (int) lwidth( fvar -> type ) , align( fvar -> type ) ); putdot( filename , line ); putleaf( PCC_ICON , 0 , 0 , (int) PCCM_ADDTYPE(fvartype, PCCTM_PTR), labelname ); putop( PCC_FORCE , (int) PCCM_ADDTYPE(fvartype, PCCTM_PTR) ); break; } putdot( filename , line ); } /* * if there are nested procedures we must save the display. */ if ( parts[ cbn ] & NONLOCALVAR ) { /* * restore old display entry from save area */#ifdef vax putprintf( " movq %d(%s),%s+%d" , 0 , DSAVEOFFSET , (int) P2FPNAME , (int) DISPLAYNAME , cbn * sizeof(struct dispsave) );#endif#ifdef tahoe putprintf( " movl %d(%s),%s+%d" , 0 , DSAVEOFFSET , (int) P2FPNAME , (int) DISPLAYNAME , cbn * sizeof(struct dispsave) );#endif }}#endif vax || tahoe#if defined(vax) || defined(tahoe)fp_epilogue(eecookiep) struct entry_exit_cookie *eecookiep;{ stabline(line); putprintf(" ret" , 0 ); /* * set the register save mask. */ putprintf(" .set %s%d,0x%x", 0, (int) SAVE_MASK_LABEL, eecookiep -> savlabel, savmask());}#endif vax || tahoe#if defined(vax) || defined(tahoe)fp_formalentry(eecookiep) struct entry_exit_cookie *eecookiep;{ putprintf(" .align 1", 0); putprintf("%s%s:" , 0 , (int) FORMALPREFIX , (int) eecookiep -> extname ); putprintf(" .word %s%d", 0, (int) SAVE_MASK_LABEL, eecookiep -> savlabel ); putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR ) , "_FCALL" ); putRV((char *) 0 , cbn , eecookiep -> nlp -> value[ NL_OFFS ] + sizeof( struct formalrtn * ) , NPARAM , PCCTM_PTR | PCCT_STRTY ); putRV((char *) 0, cbn, eecookiep -> nlp -> value[NL_OFFS], NPARAM, PCCTM_PTR|PCCT_STRTY); putop( PCC_CM , PCCT_INT ); putop( PCC_CALL , PCCT_INT ); putdot( filename , line ); putjbr( (long) eecookiep -> toplabel );}#endif vax || tahoe#ifdef mc68000codeformain(){ putprintf(" .text", 0); putprintf(" .globl _main", 0); putprintf("_main:", 0); putprintf(" link %s,#0", 0, P2FPNAME); if (opt('t')) { putprintf(" pea 1", 0); } else { putprintf(" pea 0", 0); } putprintf(" jbsr _PCSTART", 0); putprintf(" addql #4,sp", 0); putprintf(" movl %s@(8),__argc", 0, P2FPNAME); putprintf(" movl %s@(12),__argv", 0, P2FPNAME); putprintf(" jbsr _program", 0); putprintf(" pea 0", 0); putprintf(" jbsr _PCEXIT", 0);}prog_prologue(eecookiep) struct entry_exit_cookie *eecookiep;{ int ftnno = eecookiep -> nlp -> value[NL_ENTLOC]; putprintf(" .text", 0); putprintf(" .globl _program", 0); putprintf("_program:", 0); putprintf(" link %s,#0", 0, P2FPNAME); putprintf(" addl #-%s%d,sp", 0, FRAME_SIZE_LABEL, ftnno); /* touch new end of stack, to break more stack space */ putprintf(" tstb sp@(-%s%d)", 0, PAGE_BREAK_LABEL, ftnno); putprintf(" moveml #%s%d,sp@", 0, SAVE_MASK_LABEL, ftnno);}fp_prologue(eecookiep) struct entry_exit_cookie *eecookiep;{ int ftnno = eecookiep -> nlp -> value[NL_ENTLOC]; sextname(eecookiep -> extname, eecookiep -> nlp -> symbol, cbn - 1); putprintf(" .text", 0); putprintf(" .globl %s%s", 0, FORMALPREFIX, eecookiep -> extname); putprintf(" .globl %s", 0, eecookiep -> extname); putprintf("%s:", 0, eecookiep -> extname); putprintf(" link %s,#0", 0, P2FPNAME); putprintf(" addl #-%s%d,sp", 0, FRAME_SIZE_LABEL, ftnno); /* touch new end of stack, to break more stack space */ putprintf(" tstb sp@(-%s%d)", 0, PAGE_BREAK_LABEL, ftnno); putprintf(" moveml #%s%d,sp@", 0, SAVE_MASK_LABEL, ftnno);}fp_entrycode(eecookiep) struct entry_exit_cookie *eecookiep;{ char *proflabel = getlab(); char *setjmp0 = getlab(); /* * fill in the label cookie */ eecookiep -> toplabel = getlab(); (void) putlab(eecookiep -> toplabel); /* * call mcount if we are profiling. */ if ( profflag ) { putprintf(" movl #%s%d,a0", 0, LABELPREFIX, proflabel); putprintf(" jsr mcount", 0); putprintf(" .data", 0); putprintf(" .even", 0); (void) putlab(proflabel); putprintf(" .long 0", 0); putprintf(" .text", 0); } /* * if there are nested procedures that access our variables * we must save the display */ if (parts[cbn] & NONLOCALVAR) { /* * save the old display */ putprintf(" movl %s+%d,%s@(%d)", 0, DISPLAYNAME, cbn * sizeof(struct dispsave), P2FPNAME, DSAVEOFFSET); /* * set up the new display by saving the framepointer * in the display structure. */ putprintf(" movl %s,%s+%d", 0, P2FPNAME, DISPLAYNAME, cbn * sizeof(struct dispsave)); } /* * zero local variables if checking is on * by calling blkclr( bytes of locals , starting local address ); */ if ( opt( 't' ) && ( -sizes[ cbn ].om_max ) > DPOFF1 ) { putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR ) , "_blkclr" ); putLV( 0 , cbn , sizes[ cbn ].om_max , NLOCAL , PCCT_CHAR ); putleaf( PCC_ICON , ( -sizes[ cbn ].om_max ) - DPOFF1 , 0 , PCCT_INT , 0 ); putop( PCC_CM , PCCT_INT ); putop( PCC_CALL , PCCT_INT ); putdot( filename , line ); } /* * set up goto vector if non-local goto to this frame */ if ( parts[ cbn ] & NONLOCALGOTO ) { putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR ) , "_setjmp" ); putLV( 0 , cbn , GOTOENVOFFSET , NLOCAL , PCCTM_PTR|PCCT_STRTY ); putop( PCC_CALL , PCCT_INT ); putleaf( PCC_ICON , 0 , 0 , PCCT_INT , 0 ); putop( PCC_NE , PCCT_INT ); putleaf( PCC_ICON , setjmp0 , 0 , PCCT_INT , 0 ); putop( PCC_CBRANCH , PCCT_INT ); putdot( filename , line ); /* * on non-local goto, setjmp returns with address to * be branched to. */ putprintf(" movl d0,a0", 0); putprintf(" jmp a0@", 0); (void) putlab(setjmp0); }}fp_exitcode(eecookiep) struct entry_exit_cookie *eecookiep;{ /* * if there were file variables declared at this level * call PCLOSE( ap ) to clean them up. */ if ( dfiles[ cbn ] ) { putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR ) , "_PCLOSE" ); putleaf( PCC_REG , 0 , P2AP , PCCM_ADDTYPE( PCCT_CHAR , PCCTM_PTR ) , 0 ); putop( PCC_CALL , PCCT_INT ); putdot( filename , line ); } /* * if this is a function, * the function variable is the return value. * if it's a scalar valued function, return scalar, * else, return a pointer to the structure value. */ if ( eecookiep -> nlp -> class == FUNC ) { struct nl *fvar = eecookiep -> nlp -> ptr[ NL_FVAR ]; long fvartype = p2type( fvar -> type ); char *label; char labelname[ BUFSIZ ]; switch ( classify( fvar -> type ) ) { case TBOOL: case TCHAR: case TINT: case TSCAL: case TDOUBLE: case TPTR: putRV( fvar -> symbol , ( fvar -> nl_block ) & 037 , fvar -> value[ NL_OFFS ] , fvar -> extra_flags , fvartype ); putop( PCC_FORCE , fvartype ); break; default: label = getlab(); sprintf( labelname , PREFIXFORMAT , LABELPREFIX , label ); putprintf(" .lcomm %s,%d", 0, labelname, lwidth(fvar -> type)); putleaf( PCC_NAME , 0 , 0 , fvartype , labelname ); putLV( fvar -> symbol , ( fvar -> nl_block ) & 037 , fvar -> value[ NL_OFFS ] , fvar -> extra_flags , fvartype ); putstrop( PCC_STASG , PCCM_ADDTYPE(fvartype, PCCTM_PTR) , lwidth( fvar -> type ) , align( fvar -> type ) ); putdot( filename , line ); putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE(fvartype, PCCTM_PTR), labelname ); putop( PCC_FORCE , PCCM_ADDTYPE(fvartype, PCCTM_PTR) ); break; } putdot( filename , line ); } /* * if we saved a display, we must restore it. */ if ( parts[ cbn ] & NONLOCALVAR ) { /* * restore old display entry from save area */ putprintf(" movl %s@(%d),%s+%d", 0, P2FPNAME, DSAVEOFFSET, DISPLAYNAME, cbn * sizeof(struct dispsave)); }}fp_epilogue(eecookiep) struct entry_exit_cookie *eecookiep;{ /* * all done by the second pass. */}fp_formalentry(eecookiep) struct entry_exit_cookie *eecookiep;{ putprintf( "%s%s:" , 0 , FORMALPREFIX , eecookiep -> extname ); putprintf(" link %s,#0", 0, P2FPNAME); putprintf(" addl #-%s%d,sp", 0, FRAME_SIZE_LABEL, ftnno); /* touch new end of stack, to break more stack space */ putprintf(" tstb sp@(-%s%d)", 0, PAGE_BREAK_LABEL, ftnno); putprintf(" moveml #%s%d,sp@", 0, SAVE_MASK_LABEL, ftnno); putleaf( PCC_ICON , 0 , 0 , PCCM_ADDTYPE( PCCTM_FTN | PCCT_INT , PCCTM_PTR ) , "_FCALL" ); putRV( 0 , cbn , eecookiep -> nlp -> value[ NL_OFFS ] + sizeof( struct formalrtn * ) , NPARAM , PCCTM_PTR | PCCT_STRTY ); putRV(0, cbn, eecookiep -> nlp -> value[NL_OFFS], NPARAM, PCCTM_PTR|PCCT_STRTY); putop( PCC_CM , PCCT_INT ); putop( PCC_CALL , PCCT_INT ); putdot( filename , line ); putjbr( eecookiep -> toplabel );}#endif mc68000#endif PC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -