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