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