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