1 /*static char sccsid[] = "@(#)c2.h 4.2 10/18/80";*/ 2 /* @(#)c2.h 1.19 80/08/26 13:39:07 */ 3 /* 4 * Header for object code improver 5 */ 6 7 #define JBR 1 8 #define CBR 2 9 #define JMP 3 10 #define LABEL 4 11 #define DLABEL 5 12 #define EROU 7 13 #define JSW 9 14 #define MOV 10 15 #define CLR 11 16 #define INC 12 17 #define DEC 13 18 #define TST 14 19 #define PUSH 15 20 #define CVT 16 21 #define CMP 17 22 #define ADD 18 23 #define SUB 19 24 #define BIT 20 25 #define BIC 21 26 #define BIS 22 27 #define XOR 23 28 #define COM 24 29 #define NEG 25 30 #define MUL 26 31 #define DIV 27 32 #define ASH 28 33 #define EXTV 29 34 #define EXTZV 30 35 #define INSV 31 36 #define CALLS 32 37 #define RET 33 38 #define CASE 34 39 #define SOB 35 40 #define TEXT 36 41 #define DATA 37 42 #define BSS 38 43 #define ALIGN 39 44 #define END 40 45 #define MOVZ 41 46 #define WGEN 42 47 #define SOBGEQ 43 48 #define SOBGTR 44 49 #define AOBLEQ 45 50 #define AOBLSS 46 51 #define ACB 47 52 #define MOVA 48 53 #define PUSHA 49 54 #define LGEN 50 55 #define SET 51 56 #define MOVC3 52 57 #define RSB 53 58 #define JSB 54 59 #define MFPR 55 60 #define MTPR 56 61 #define PROBER 57 62 #define PROBEW 58 63 #define LCOMM 59 64 #define COMM 60 65 66 #define JEQ 0 67 #define JNE 1 68 #define JLE 2 69 #define JGE 3 70 #define JLT 4 71 #define JGT 5 72 /* rearranged for unsigned branches so that jxxu = jxx + 6 */ 73 #define JLOS 8 74 #define JHIS 9 75 #define JLO 10 76 #define JHI 11 77 78 #define JBC 12 79 #define JBS 13 80 #define JLBC 14 81 #define JLBS 15 82 #define JBCC 16 83 #define JBSC 17 84 #define JBCS 18 85 #define JBSS 19 86 87 #define BYTE 1 88 #define WORD 2 89 #define LONG 3 90 #define FLOAT 4 91 #define DOUBLE 5 92 #define QUAD 6 93 #define OP2 7 94 #define OP3 8 95 #define OPB 9 96 #define OPX 10 97 98 #define T(a,b) (a|((b)<<8)) 99 #define U(a,b) (a|((b)<<4)) 100 101 struct optab { 102 char opstring[7]; 103 short opcode; 104 } optab[]; 105 106 struct node { 107 char op; 108 char subop; 109 short refc; 110 struct node *forw; 111 struct node *back; 112 struct node *ref; 113 char *code; 114 struct optab *pop; 115 long labno; 116 short seq; 117 }; 118 119 struct { 120 short combop; 121 }; 122 123 char line[512]; 124 struct node first; 125 char *curlp; 126 int nbrbr; 127 int nsaddr; 128 int redunm; 129 int iaftbr; 130 int njp1; 131 int nrlab; 132 int nxjump; 133 int ncmot; 134 int nrevbr; 135 int loopiv; 136 int nredunj; 137 int nskip; 138 int ncomj; 139 int nsob; 140 int nrtst; 141 int nbj; 142 int nfield; 143 144 int nchange; 145 int isn; 146 int debug; 147 char *lasta; 148 char *lastr; 149 char *firstr; 150 char revbr[]; 151 #define NREG 12 152 char *regs[NREG+5]; /* 0-11, 4 for operands, 1 for running off end */ 153 char conloc[20]; 154 char conval[20]; 155 char ccloc[20]; 156 157 #define RT1 12 158 #define RT2 13 159 #define RT3 14 160 #define RT4 15 161 #define LABHS 127 162 163 struct { char lbyte; }; 164 165 char *copy(); 166 long getnum(); 167 struct node *codemove(); 168 struct node *insertl(); 169 struct node *nonlab(); 170