Annotation of researchv8dc/cmd/ccom/vax/lcatch2.c, revision 1.1.1.1

1.1       root        1: # include "mfile2.h"
                      2: extern int Pflag, bbcnt;
                      3: /* a lot of the machine dependent parts of the second pass */
                      4: 
                      5: char *
                      6: rnames[]= {  /* keyed to register number tokens */
                      7: 
                      8:        "r0", "r1",
                      9:        "r2", "r3", "r4",
                     10:        "r5", "r6", "r7", "r8", "r9", "r10", "r11",
                     11:        "ap", "fp", "sp", "pc" 
                     12:        };
                     13: 
                     14: eobl2()                        /* end of function stuff */
                     15: {
                     16: }
                     17: 
                     18: char *
                     19: exname( ix )
                     20: char *ix;
                     21: {
                     22:        /* make a name look like an external name in the local machine */
                     23: 
                     24:        static char text[100] = "_";
                     25: 
                     26:        if( ix == NULL ) cerror("no name in exname");
                     27:        strcpy(text+1, ix);
                     28:        return( text );
                     29: }
                     30: 
                     31: lineid( l, fn )
                     32: int l;
                     33: char *fn;
                     34: {
                     35:        /* identify line l and file fn */
                     36:        printx( "#      line %d, file %s\n", l, fn );
                     37: }
                     38: 
                     39: deflab( n )
                     40: int n;
                     41: {
                     42:        printx( "L%d:\n", n );
                     43: }
                     44: 
                     45: 
                     46: genubr( n )
                     47: int n;
                     48: {
                     49:        /* output a branch to label n */
                     50:        printx( "\tjbr\tL%d\n", n );
                     51:        if(Pflag)
                     52:                printx("#jmp L%d\n", n);
                     53: }
                     54: genret( s, l, n )
                     55: int s, l, n;
                     56: {
                     57:        /* a return: s nonzero means a structure returned */
                     58:        /* n has the value of "retlab", a common spot for returns */
                     59:        deflab(n);
                     60:        if( s ) printx( "\tmovab\tL%d,r0\n", l );
                     61:        if(Pflag) {
                     62:                printx("#ret %d\n", ++bbcnt);
                     63:                printx("\tincl\tlocprof+%d\n", 4*(bbcnt+3));
                     64:        }
                     65:        dbfunret();
                     66:        printx( "\tret\n" );
                     67: }
                     68: 
                     69: defalign(n)
                     70: int n;
                     71: {
                     72:        /* cause the alignment to become a multiple of n bits */
                     73:        if( n % SZCHAR ) cerror( "funny alignment: %d", n );
                     74:        else n /= SZCHAR;
                     75:        if( n == 1 ) return;
                     76:        else if( n==2 ) n=1;
                     77:        else if( n==4 ) n=2;
                     78:        else cerror( "funny alignment: %d", n );
                     79:        printx( "\t.align\t%d\n", n );
                     80: }
                     81: 
                     82: char *locnames[] = {
                     83:        /* location counter names for PROG, DATA, ADATA, ISTRNG, STRNG */
                     84:        "       .text\n",
                     85:        "       .data\n",
                     86:        "       .data\n",
                     87:        "       .data   2\n",
                     88:        "       .data   1\n",
                     89:        };
                     90: 
                     91: bycode( t, i )
                     92: int t, i;
                     93: {
                     94:        /* put byte i+1 in a string */
                     95: 
                     96:        if ( t < 0 ) { /* end of the string */
                     97:                printx("\n");
                     98:        } else { /* stash byte t into string */
                     99:                if( (i&7) == 0 ) printx( "\n    .byte   " );
                    100:                else printx(",");
                    101:                printx("0x%x", t);
                    102:        }
                    103: }
                    104: 
                    105: genshort( s )
                    106: short s;
                    107: {
                    108:        /* write out a short value */
                    109:        printx( "       .short  %d\n", (short) s );
                    110: }
                    111: 
                    112: genlong( l )
                    113: long l;
                    114: {
                    115:        /* write out a long initializer */
                    116:        printx( "       .long   0x%lx\n", l );
                    117: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.