Commit | Line | Data |
---|---|---|
41feb04a | 1 | /* c2.h 4.9 85/03/19 */ |
b767c045 | 2 | |
9de4af78 BJ |
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 | |
46aa6964 BJ |
63 | #define LCOMM 59 |
64 | #define COMM 60 | |
9de4af78 BJ |
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 | ||
11850887 RC |
87 | #define JCC 20 |
88 | #define JCS 21 | |
89 | #define JVC 22 | |
90 | #define JVS 23 | |
91 | ||
0594fe30 BJ |
92 | /* |
93 | * When the new opcodes were added, the relative | |
94 | * ordering of the first 3 (those that are not float) | |
95 | * had to be retained, so that other parts of the program | |
96 | * were not broken. | |
97 | * | |
98 | * In addition, the distance between OP3 and OP2 must be preserved. | |
99 | * The order of definitions above OP2 must not be changed. | |
100 | * | |
101 | * Note that these definitions DO NOT correspond to | |
102 | * those definitions used in as, adb and sdb. | |
103 | */ | |
9de4af78 BJ |
104 | #define BYTE 1 |
105 | #define WORD 2 | |
106 | #define LONG 3 | |
0594fe30 BJ |
107 | #define FFLOAT 4 |
108 | #define DFLOAT 5 | |
f69a6536 RH |
109 | #define QUAD 6 |
110 | #define OP2 7 | |
111 | #define OP3 8 | |
112 | #define OPB 9 | |
113 | #define OPX 10 | |
114 | #define GFLOAT 11 | |
115 | #define HFLOAT 12 | |
116 | #define OCTA 13 | |
9de4af78 BJ |
117 | |
118 | #define T(a,b) (a|((b)<<8)) | |
119 | #define U(a,b) (a|((b)<<4)) | |
120 | ||
575b3828 | 121 | #define C2_ASIZE 128 |
033bb901 | 122 | |
9de4af78 BJ |
123 | struct optab { |
124 | char opstring[7]; | |
125 | short opcode; | |
126 | } optab[]; | |
127 | ||
128 | struct node { | |
41feb04a RC |
129 | union { |
130 | struct { | |
131 | char op_op; | |
132 | char op_subop; | |
133 | } un_op; | |
134 | short un_combop; | |
135 | } op_un; | |
9de4af78 BJ |
136 | short refc; |
137 | struct node *forw; | |
138 | struct node *back; | |
139 | struct node *ref; | |
140 | char *code; | |
141 | struct optab *pop; | |
46aa6964 | 142 | long labno; |
9de4af78 BJ |
143 | short seq; |
144 | }; | |
145 | ||
41feb04a RC |
146 | #define op op_un.un_op.op_op |
147 | #define subop op_un.un_op.op_subop | |
148 | #define combop op_un.un_combop | |
9de4af78 BJ |
149 | |
150 | char line[512]; | |
151 | struct node first; | |
152 | char *curlp; | |
153 | int nbrbr; | |
154 | int nsaddr; | |
155 | int redunm; | |
156 | int iaftbr; | |
157 | int njp1; | |
158 | int nrlab; | |
159 | int nxjump; | |
160 | int ncmot; | |
161 | int nrevbr; | |
162 | int loopiv; | |
163 | int nredunj; | |
164 | int nskip; | |
165 | int ncomj; | |
166 | int nsob; | |
167 | int nrtst; | |
168 | int nbj; | |
169 | int nfield; | |
170 | ||
171 | int nchange; | |
41feb04a | 172 | long isn; |
9de4af78 BJ |
173 | int debug; |
174 | char *lasta; | |
175 | char *lastr; | |
176 | char *firstr; | |
177 | char revbr[]; | |
178 | #define NREG 12 | |
179 | char *regs[NREG+5]; /* 0-11, 4 for operands, 1 for running off end */ | |
033bb901 MT |
180 | char conloc[C2_ASIZE]; |
181 | char conval[C2_ASIZE]; | |
182 | char ccloc[C2_ASIZE]; | |
9de4af78 BJ |
183 | |
184 | #define RT1 12 | |
185 | #define RT2 13 | |
186 | #define RT3 14 | |
187 | #define RT4 15 | |
188 | #define LABHS 127 | |
189 | ||
9de4af78 BJ |
190 | char *copy(); |
191 | long getnum(); | |
192 | struct node *codemove(); | |
193 | struct node *insertl(); | |
194 | struct node *nonlab(); | |
41feb04a RC |
195 | struct node *alloc(); |
196 | ||
197 | #ifdef notdef | |
198 | #define decref(p) \ | |
199 | ((p) && --(p)->refc <= 0 ? nrlab++, delnode(p) : 0) | |
200 | #define delnode(p) \ | |
201 | ((p)->back->forw = (p)->forw, (p)->forw->back = (p)->back) | |
202 | #endif notdef |