1: /* c2.h 4.10 85/08/22 */
2:
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 JCC 20
88: #define JCS 21
89: #define JVC 22
90: #define JVS 23
91:
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: */
104: #define BYTE 1
105: #define WORD 2
106: #define LONG 3
107: #define FFLOAT 4
108: #define DFLOAT 5
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
117:
118: #define T(a,b) (a|((b)<<8))
119: #define U(a,b) (a|((b)<<4))
120:
121: #define C2_ASIZE 128
122:
123: struct optab {
124: char opstring[7];
125: short opcode;
126: } optab[];
127:
128: struct node {
129: union {
130: struct {
131: char op_op;
132: char op_subop;
133: } un_op;
134: short un_combop;
135: } op_un;
136: short refc;
137: struct node *forw;
138: struct node *back;
139: struct node *ref;
140: char *code;
141: struct optab *pop;
142: long labno;
143: short seq;
144: };
145:
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
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;
172: long isn;
173: int debug;
174: char revbr[];
175: #define NREG 12
176: char *regs[NREG+5]; /* 0-11, 4 for operands, 1 for running off end */
177: char conloc[C2_ASIZE];
178: char conval[C2_ASIZE];
179: char ccloc[C2_ASIZE];
180:
181: #define RT1 12
182: #define RT2 13
183: #define RT3 14
184: #define RT4 15
185: #define LABHS 127
186:
187: char *copy();
188: long getnum();
189: struct node *codemove();
190: struct node *insertl();
191: struct node *nonlab();
192:
193: #ifdef notdef
194: #define decref(p) \
195: ((p) && --(p)->refc <= 0 ? nrlab++, delnode(p) : 0)
196: #define delnode(p) \
197: ((p)->back->forw = (p)->forw, (p)->forw->back = (p)->back)
198: #endif notdef
199:
200: char *xalloc();
201: extern char *newa;
202: extern char *lasta;
203: extern char *lastr;
204: #define XALIGN(n) \
205: (((n)+(sizeof (char *) - 1)) & ~(sizeof (char *) - 1))
206: #define alloc(n) \
207: ((struct node *) \
208: ((newa = lasta) + (n) > lastr ? \
209: xalloc(n) : \
210: (lasta += XALIGN(n), newa)))
Defined variables
ccloc
defined in line
179; used 12 times
curlp
defined in line
152; used 16 times
first
defined in line
151; used 24 times
- in /usr/src/lib/c2/c20.c line
145,
153,
175,
191,
219,
244,
319,
471-476(2),
483,
498,
509,
616,
720
- in /usr/src/lib/c2/c21.c line
59-61(2),
411,
422,
900-902(2),
934,
953,
1180-1181(2)
isn
defined in line
172; used 8 times
line
defined in line
150; used 17 times
nbj
defined in line
168; used 4 times
nchange
defined in line
171; used 22 times
- in /usr/src/lib/c2/c20.c line
105-108(2),
508,
518,
543,
552,
566,
597,
660,
712,
751
- in /usr/src/lib/c2/c21.c line
167,
181,
191,
261,
274,
344,
392,
506,
762,
1312,
1326
njp1
defined in line
157; used 2 times
nsob
defined in line
166; used 4 times
regs
defined in line
176; used 215 times
- in /usr/src/lib/c2/c20.c line
428
- in /usr/src/lib/c2/c21.c line
45-51(10),
94-98(4),
106,
117-128(4),
135-136(3),
153-154(3),
160(2),
178-189(7),
210-214(5),
222-223(2),
240,
250-252(5),
266(2),
273(3),
298-309(4),
326-341(12),
364-365(2),
377-381(3),
387-389(5),
397-406(3),
430-432(3),
443-444(2),
450-457(8),
491-494(2),
501-503(2),
523-526(3),
535-536(2),
557-566(4),
580-601(9),
614-626(4),
639,
646,
656,
669(2),
679-688(4),
704,
710-713(4),
720-728(3),
748(2),
757,
765-774(9),
795(2),
821-830(7),
843(2),
860,
960-972(8),
1049(2),
1062,
1081-1082(3),
1088-1098(10),
1105-1118(14),
1129,
1140,
1160-1162(3),
1206-1209(4),
1218,
1231,
1323,
1336-1340(3)
Defined struct's
node
defined in line
128; used 126 times
- in line 137-139(6),
151(2),
189-191(6)
- in /usr/src/lib/c2/c20.c line
141(2),
316(2),
465-467(6),
506(2),
579-581(4),
601-605(6),
629-634(8),
718(2),
729-731(4)
- in /usr/src/lib/c2/c21.c line
34-41(8),
57(2),
79(2),
112(2),
204(2),
293-294(4),
359(2),
417(2),
555(2),
571-577(6),
653(2),
742(2),
790(2),
811-812(4),
891-892(4),
932(2),
982-983(4),
1013(2),
1021(2),
1030-1034(6),
1043(2),
1125(2),
1178(2),
1216(2),
1225(2),
1290-1292(4)
optab
defined in line
123; used 30 times
Defined macros
ACB
defined in line
51; used 2 times
ADD
defined in line
22; used 7 times
ALIGN
defined in line
43; used 1 times
ASH
defined in line
32; used 3 times
BIC
defined in line
25; used 1 times
BIS
defined in line
26; used 2 times
BIT
defined in line
24; used 1 times
BSS
defined in line
42;
never used
BYTE
defined in line
104; used 11 times
CALLS
defined in line
36; used 1 times
CASE
defined in line
38; used 2 times
CBR
defined in line
8; used 17 times
- in /usr/src/lib/c2/c20.c line
365,
477,
510,
522-524(2),
681
- in /usr/src/lib/c2/c21.c line
310,
361,
444,
655,
749,
801,
904,
935,
944,
958,
1306
CLR
defined in line
15; used 1 times
CMP
defined in line
21; used 3 times
COM
defined in line
28; used 1 times
COMM
defined in line
64;
never used
CVT
defined in line
20; used 7 times
DATA
defined in line
41; used 1 times
DEC
defined in line
17; used 5 times
DIV
defined in line
31; used 1 times
END
defined in line
44; used 4 times
EROU
defined in line
12; used 2 times
EXTV
defined in line
33; used 2 times
EXTZV
defined in line
34; used 2 times
INC
defined in line
16; used 4 times
INSV
defined in line
35; used 1 times
JBC
defined in line
78; used 5 times
JBCC
defined in line
82; used 3 times
JBCS
defined in line
84; used 1 times
JBR
defined in line
7; used 19 times
- in /usr/src/lib/c2/c20.c line
170(2),
477,
510-512(2),
522-524(2),
547,
591,
646-656(3),
721-724(2),
744
- in /usr/src/lib/c2/c21.c line
654,
760,
904,
945
JBS
defined in line
79; used 2 times
JBSC
defined in line
83; used 1 times
JBSS
defined in line
85; used 2 times
JCC
defined in line
87;
never used
JCS
defined in line
88;
never used
JEQ
defined in line
66; used 7 times
JGE
defined in line
69; used 3 times
JGT
defined in line
71; used 2 times
JHI
defined in line
76; used 1 times
JHIS
defined in line
74; used 1 times
JLBC
defined in line
80; used 2 times
JLBS
defined in line
81; used 1 times
JLE
defined in line
68; used 5 times
JLO
defined in line
75; used 1 times
JLOS
defined in line
73; used 1 times
JLT
defined in line
70; used 2 times
JMP
defined in line
9; used 4 times
JNE
defined in line
67; used 4 times
JSB
defined in line
58;
never used
JSW
defined in line
13; used 5 times
JVC
defined in line
89;
never used
JVS
defined in line
90;
never used
LABEL
defined in line
10; used 22 times
- in /usr/src/lib/c2/c20.c line
156,
209,
235,
263,
472,
484,
499,
530,
548,
560,
586-587(2),
607-611(2),
617,
648,
674,
736
- in /usr/src/lib/c2/c21.c line
412,
943-946(2),
1037
LCOMM
defined in line
63;
never used
LGEN
defined in line
54;
never used
LONG
defined in line
106; used 33 times
- in /usr/src/lib/c2/c21.c line
92,
99-104(2),
115,
138,
158,
166-171(2),
178,
185-190(4),
258,
272,
332,
712-719(5),
751,
767,
821,
867-870(2),
935,
942-943(2),
953-963(3)
- in /usr/src/lib/c2/c22.c line
15
MFPR
defined in line
59;
never used
MOV
defined in line
14; used 12 times
- in /usr/src/lib/c2/c21.c line
71,
115,
166,
249,
368,
600,
609,
637,
685,
692,
712,
989
MOVA
defined in line
52; used 9 times
MOVC3
defined in line
56; used 2 times
MOVZ
defined in line
45; used 6 times
MTPR
defined in line
60;
never used
MUL
defined in line
30; used 2 times
NEG
defined in line
29; used 1 times
NREG
defined in line
175; used 7 times
OCTA
defined in line
116; used 1 times
OP2
defined in line
110; used 17 times
- in /usr/src/lib/c2/c21.c line
50,
69,
171,
178,
185-187(2),
272,
388,
557,
587,
593-595(2),
624-626(2),
646,
799,
1148
OP3
defined in line
111; used 7 times
OPB
defined in line
112; used 1 times
OPX
defined in line
113; used 3 times
PUSH
defined in line
19; used 7 times
PUSHA
defined in line
53; used 4 times
QUAD
defined in line
109; used 2 times
RET
defined in line
37; used 3 times
RSB
defined in line
57; used 3 times
RT1
defined in line
181; used 67 times
- in /usr/src/lib/c2/c21.c line
45-47(3),
94-96(2),
117-125(3),
135-136(2),
153-154(3),
180,
189,
210-211(2),
222-223(2),
240,
250,
273,
309,
326-327(2),
334-336(2),
365,
377,
387-389(3),
443,
450,
456-457(2),
491-494(2),
501-503(2),
525,
614-619(2),
639,
656,
679-684(2),
710-713(4),
748,
769-774(2),
795,
825,
843,
860,
960-964(2),
971,
1129,
1140,
1218,
1231,
1307,
1323
RT2
defined in line
182; used 60 times
- in /usr/src/lib/c2/c21.c line
47-51(4),
94,
106,
128,
135,
160,
178-188(4),
212-213(2),
250-251(2),
266,
273,
298-299(2),
340,
364,
378-381(2),
387(2),
444,
451-457(4),
536,
562,
589,
599-601(2),
624,
646,
688,
720,
748,
757,
767-770(4),
795,
821-830(5),
843,
964-965(2),
971-972(2),
1301,
1308
RT3
defined in line
183; used 28 times
- in /usr/src/lib/c2/c21.c line
45-51(3),
98,
160,
188,
214,
251-252(2),
266,
273,
329-341(5),
526,
535,
557,
564,
595,
626,
724,
765-771(3),
825,
966
RT4
defined in line
184; used 5 times
SET
defined in line
55;
never used
SOB
defined in line
39;
never used
SUB
defined in line
23; used 2 times
T
defined in line
118; used 21 times
TEXT
defined in line
40; used 1 times
TST
defined in line
18; used 5 times
U
defined in line
119; used 11 times
WGEN
defined in line
46; used 1 times
WORD
defined in line
105; used 4 times
XOR
defined in line
27; used 1 times
combop
defined in line
148; used 44 times
- in /usr/src/lib/c2/c20.c line
156-160(2),
176,
192,
220,
244,
341,
477,
522-524(2),
591,
617,
744
- in /usr/src/lib/c2/c21.c line
99,
138,
654,
712-725(7),
760,
777(2),
801,
867-870(2),
935-945(7),
953-963(3),
970(2),
987-991(3)
decref
defined in line
194; used 12 times
- in /usr/src/lib/c2/c20.c line
501,
515,
532,
555,
565,
667,
690,
708,
743
- in /usr/src/lib/c2/c21.c line
1019,
1313,
1325
delnode
defined in line
196; used 25 times
- in line 195
- in /usr/src/lib/c2/c21.c line
73,
122,
162,
173,
236,
312(2),
445,
506,
603,
629,
658,
758-761(2),
778,
831,
861,
940,
968(2),
974(2),
1012,
1025
op
defined in line
146; used 147 times
- in /usr/src/lib/c2/c20.c line
232,
320,
365,
472-484(11),
499-500(3),
510-512(4),
522-524(2),
530,
547-551(9),
560,
586-587(2),
607-611(2),
646-656(6),
674,
681,
721-724(2),
736
- in /usr/src/lib/c2/c21.c line
46(4),
71-76(4),
101,
115,
123,
140,
166,
181,
190,
219(2),
249,
272,
306-310(2),
331(2),
361,
368,
381,
388,
412(2),
436,
444,
455-457(2),
481,
490,
503,
523-529(7),
558,
579-586(8),
598-601(6),
609(3),
616(2),
637(3),
648,
655,
676-677(2),
684-686(8),
692,
749,
756,
824,
842(2),
904(2),
935,
943-946(2),
958,
989(2),
999,
1037,
1299-1306(3),
1323
subop
defined in line
147; used 105 times
- in /usr/src/lib/c2/c20.c line
353-357(2),
367-377(4),
541(2),
688(2),
722(2)
- in /usr/src/lib/c2/c21.c line
43,
50(2),
68-71(2),
92,
104,
115,
123,
158,
166-171(2),
178,
185-190(4),
220,
257-259(3),
272,
311-313(4),
332,
362(2),
368(2),
388(2),
401(2),
443,
452-457(5),
480,
489-494(3),
504-508(3),
533-535(2),
557,
579-587(5),
593-595(2),
624-626(2),
638-639(3),
646,
683,
749-753(4),
760,
767-771(2),
799-800(3),
821,
852,
859,
908(2),
937-938(3),
962,
969-970(3),
1233,
1301,
1307-1310(3),
1324
Usage of this include