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