BSD 4 release
[unix-history] / usr / src / cmd / c2 / c2.h
CommitLineData
31cef89c 1/*static char sccsid[] = "@(#)c2.h 4.2 10/17/80";*/
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
87#define BYTE 1
88#define WORD 2
89#define LONG 3
90#define FLOAT 4
91#define DOUBLE 5
92#define QUAD 6
93#define OP2 7
94#define OP3 8
95#define OPB 9
96#define OPX 10
97
98#define T(a,b) (a|((b)<<8))
99#define U(a,b) (a|((b)<<4))
100
101struct optab {
102 char opstring[7];
103 short opcode;
104} optab[];
105
106struct node {
107 char op;
108 char subop;
109 short refc;
110 struct node *forw;
111 struct node *back;
112 struct node *ref;
113 char *code;
114 struct optab *pop;
46aa6964 115 long labno;
9de4af78
BJ
116 short seq;
117};
118
119struct {
120 short combop;
121};
122
123char line[512];
124struct node first;
125char *curlp;
126int nbrbr;
127int nsaddr;
128int redunm;
129int iaftbr;
130int njp1;
131int nrlab;
132int nxjump;
133int ncmot;
134int nrevbr;
135int loopiv;
136int nredunj;
137int nskip;
138int ncomj;
139int nsob;
140int nrtst;
141int nbj;
142int nfield;
143
144int nchange;
145int isn;
146int debug;
147char *lasta;
148char *lastr;
149char *firstr;
150char revbr[];
151#define NREG 12
152char *regs[NREG+5]; /* 0-11, 4 for operands, 1 for running off end */
153char conloc[20];
154char conval[20];
155char ccloc[20];
156
157#define RT1 12
158#define RT2 13
159#define RT3 14
160#define RT4 15
161#define LABHS 127
162
163struct { char lbyte; };
164
165char *copy();
166long getnum();
167struct node *codemove();
168struct node *insertl();
169struct node *nonlab();