|
|
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: /* only used in catch2.c */ ! 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[256] = "_"; /* shit for style */ ! 25: ! 26: if( ix == NULL ) cerror("no name in exname"); ! 27: strncpy(text+1, ix, sizeof(text)-2); ! 28: if(strlen(ix) > sizeof(text)-2) ! 29: cerror("buffer too short in exname"); ! 30: return( text ); ! 31: } ! 32: ! 33: lineid( l, fn ) ! 34: int l; ! 35: char *fn; ! 36: { ! 37: /* identify line l and file fn */ ! 38: printx( "# line %d, file %s\n", l, fn ); ! 39: } ! 40: ! 41: deflab( n ) /* cgram.y, local.c, trees.c */ ! 42: int n; ! 43: { ! 44: printx( "L%d:\n", n ); ! 45: } ! 46: ! 47: ! 48: genubr( n ) /* only used in local.c */ ! 49: int n; ! 50: { ! 51: /* output a branch to label n */ ! 52: printx( "\tjbr\tL%d\n", n ); ! 53: if(Pflag) ! 54: printx("#jmp L%d\n", n); ! 55: } ! 56: genret( s, l, n ) /* only used in local.c! */ ! 57: int s, l, n; ! 58: { ! 59: /* a return: s nonzero means a structure returned */ ! 60: /* n has the value of "retlab", a common spot for returns */ ! 61: deflab(n); ! 62: if( s ) printx( "\tmovab\tL%d,r0\n", l ); ! 63: if(Pflag) { ! 64: printx("#ret %d\n", ++bbcnt); ! 65: printx("\tincl\tlocprof+%d\n", 4*(bbcnt+3)); ! 66: } ! 67: dbfunret(); ! 68: printx( "\tret\n" ); ! 69: } ! 70: ! 71: defalign(n) /* used only in pftn.c */ ! 72: int n; ! 73: { ! 74: /* cause the alignment to become a multiple of n bits */ ! 75: if( n % SZCHAR ) cerror( "funny alignment: %d", n ); ! 76: else n /= SZCHAR; ! 77: if( n == 1 ) return; ! 78: else if( n==2 ) n=1; ! 79: else if( n==4 ) n=2; ! 80: else cerror( "funny alignment: %d", n ); ! 81: printx( "\t.align\t%d\n", n ); ! 82: } ! 83: ! 84: char *locnames[] = { /* only used in trees.c */ ! 85: /* location counter names for PROG, DATA, ADATA, ISTRNG, STRNG */ ! 86: " .text\n", ! 87: " .data\n", ! 88: " .data\n", ! 89: " .data 2\n", ! 90: " .data 1\n", ! 91: }; ! 92: ! 93: bycode( t, i ) /* this is used only in scan.c!! (second pass stuff?) */ ! 94: int t, i; ! 95: { ! 96: /* put byte i+1 in a string */ ! 97: ! 98: if ( t < 0 ) { /* end of the string */ ! 99: printx("\n"); ! 100: } else { /* stash byte t into string */ ! 101: if( (i&7) == 0 ) printx( "\n .byte " ); ! 102: else printx(","); ! 103: printx("0x%x", t); ! 104: } ! 105: } ! 106: ! 107: genlong(l) /* only in local.c */ ! 108: long l; ! 109: { ! 110: /* write out a long initializer */ ! 111: printx("\t.long\t0x%lx\n", l); ! 112: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.