|
|
1.1 ! root 1: /* %M% %I% %E% */ ! 2: ! 3: /* ! 4: * Header for object code improver ! 5: */ ! 6: ! 7: /* tokens */ ! 8: typedef enum { ! 9: NIL, ! 10: JBR, CBR, JMP, LABEL, DLABEL, EROU, JSW, ! 11: MOV, CLR, INC, DEC, TST, PUSH, CVT, MOVZ, ! 12: CMP, ADD, SUB, BIT, AND, OR, XOR, COM, ! 13: NEG, EMUL, MUL, DIV, EDIV, SHAL, SHAR, ! 14: SHL, SHR, CALLF, CALLS, CASE, ADDA, SUBA, ! 15: AOBLEQ, AOBLSS, MOVA, PUSHA, LDF, LNF, STF, ! 16: CMPF, CMPF2, TSTF, PUSHD, CVLF, CVFL, LDFD, ! 17: CVDF, NEGF, ADDF, SUBF, MULF, DIVF, SINF, ! 18: COSF, ATANF, LOGF, SQRTF, EXPF, MOVBLK, ! 19: MFPR, MTPR, PROBE, MOVO, TEXT, DATA, BSS, ! 20: ALIGN, END, LGEN, WGEN, SET, LCOMM, COMM ! 21: } OpCode; ! 22: ! 23: #define ord(e) ((int)(e)) ! 24: ! 25: #define JEQ 0 ! 26: #define JNE 1 ! 27: #define JLE 2 ! 28: #define JGE 3 ! 29: #define JLT 4 ! 30: #define JGT 5 ! 31: /* rearranged for unsigned branches so that jxxu = jxx + 6 */ ! 32: #define JLOS 8 ! 33: #define JHIS 9 ! 34: #define JLO 10 ! 35: #define JHI 11 ! 36: ! 37: #define JBC 12 ! 38: #define JBS 13 ! 39: #define RET 14 ! 40: ! 41: #define BYTE 1 ! 42: #define WORD 2 ! 43: #define LONG 3 ! 44: #define QUAD 4 ! 45: #define FLOAT 5 ! 46: #define DOUBLE 6 ! 47: #define OP2 7 ! 48: #define OP3 8 ! 49: #define OPB 9 ! 50: #define OPX 10 ! 51: ! 52: #define has2ops(p) (((p)->subop>>4) == OP2) ! 53: #define has3ops(p) (((p)->subop>>4) == OP3) ! 54: ! 55: /* #define T(a,b) (a|((b)<<8)) NUXI problems */ ! 56: #define U(a,b) (a|((b)<<4)) ! 57: ! 58: #define C2_ASIZE 128 ! 59: ! 60: struct optab { ! 61: char opstring[7]; ! 62: OpCode opcod; ! 63: unsigned char subopcod; ! 64: } optab[]; ! 65: ! 66: struct node { ! 67: OpCode op; ! 68: unsigned char subop; ! 69: short refc; ! 70: struct node *forw; ! 71: struct node *back; ! 72: struct node *ref; ! 73: char *code; ! 74: struct optab *pop; ! 75: long labno; ! 76: short seq; ! 77: }; ! 78: ! 79: struct intleavetab { ! 80: OpCode op; ! 81: unsigned char subop; ! 82: int intleavect; ! 83: } intltab[]; ! 84: ! 85: /* struct { NUXI problems ! 86: short combop; ! 87: }; */ ! 88: ! 89: char line[512]; ! 90: struct node first; ! 91: char *curlp; ! 92: int nbrbr; ! 93: int nsaddr; ! 94: int redunm; ! 95: int iaftbr; ! 96: int njp1; ! 97: int nrlab; ! 98: int nxjump; ! 99: int ncmot; ! 100: int nrevbr; ! 101: int loopiv; ! 102: int nredunj; ! 103: int nskip; ! 104: int ncomj; ! 105: int naob; ! 106: int nrtst; ! 107: int nbj; ! 108: int nst; ! 109: int nld; ! 110: ! 111: int nchange; ! 112: int isn; ! 113: int debug; ! 114: int fortflg; ! 115: int aobflag; ! 116: char *lasta; ! 117: char *lastr; ! 118: char *firstr; ! 119: char revbr[]; ! 120: #define NREG 13 ! 121: /* 0-12, f.p. accumulator, 4 for operands, 1 for running off end */ ! 122: char *regs[NREG+6]; ! 123: char conloc[C2_ASIZE]; ! 124: char conval[C2_ASIZE]; ! 125: char ccloc[C2_ASIZE]; ! 126: ! 127: #define ACC NREG ! 128: #define RT1 NREG+1 ! 129: #define RT2 NREG+2 ! 130: #define RT3 NREG+3 ! 131: #define RT4 NREG+4 ! 132: #define LABHS 127 ! 133: ! 134: #define MAXAOBDISP 5000 ! 135: ! 136: #define NUSE 6 ! 137: #define tempreg(s,r) ((unsigned)((r)=isreg(s)) < NUSE) ! 138: ! 139: struct node *uses[NUSE + 7]; /* for backwards flow analysis */ ! 140: struct node *useacc; /* same for acc */ ! 141: ! 142: short usecnt[NUSE]; /* count of register uses within a block */ ! 143: #define isused(r) (usecnt[(r)]) ! 144: #define adduse(r,p) (uses[(r)] = (p), usecnt[(r)]++) ! 145: #define deluse(r) (uses[(r)] = NULL, usecnt[(r)]--) ! 146: ! 147: char *lastrand; /* last operand of instruction */ ! 148: struct node *bflow(); ! 149: char *copy(); ! 150: long getnum(); ! 151: struct node *codemove(); ! 152: struct node *insertl(); ! 153: struct node *nonlab(); ! 154: struct node *alloc(); ! 155: char *findcon(); ! 156: char *byondrd(); ! 157: #define equstr !strcmp ! 158: #define COPYCODE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.