Bell 32V development
[unix-history] / usr / src / cmd / c2 / c2.h
CommitLineData
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
91struct optab {
92 char opstring[7];
93 short opcode;
94} optab[];
95
96struct 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
109struct {
110 short combop;
111};
112
113char line[512];
114struct node first;
115char *curlp;
116int nbrbr;
117int nsaddr;
118int redunm;
119int iaftbr;
120int njp1;
121int nrlab;
122int nxjump;
123int ncmot;
124int nrevbr;
125int loopiv;
126int nredunj;
127int nskip;
128int ncomj;
129int nsob;
130int nrtst;
131int nbj;
132int nfield;
133
134int nchange;
135int isn;
136int debug;
137char *lasta;
138char *lastr;
139char *firstr;
140char revbr[];
141#define NREG 12
142char *regs[NREG+5]; /* 0-11, 4 for operands, 1 for running off end */
143char conloc[20];
144char conval[20];
145char ccloc[20];
146
147#define RT1 12
148#define RT2 13
149#define RT3 14
150#define RT4 15
151#define LABHS 127
152
153struct { char lbyte; };
154
155char *copy();
156long getnum();
157struct node *codemove();
158struct node *insertl();
159struct node *nonlab();