xref: /original-bsd/old/as.vax/assizetab.c (revision f0fd5f8a)
1 /*
2  *	Copyright (c) 1982 Regents of the University of California
3  */
4 #ifndef lint
5 static char sccsid[] = "@(#)assizetab.c 4.4 11/11/82";
6 #endif not lint
7 
8 #ifdef AS
9 #include <stdio.h>
10 #include "as.h"
11 #include "assyms.h"
12 
13 /*
14  *	Convert loader reference types (plus PCREL) to bytes and lg bytes
15  */
16 int	reflen[] = { 	/* {LEN*+PCREL} ==> number of bytes */
17 	0,	0,
18 	1,	1,	/* LEN1,	LEN1 + PCREL */
19 	2,	2,	/* LEN2,	LEN2 + PCREL */
20 	4,	4,	/* LEN4,	LEN2 + PCREL */
21 	8,	8,	/* LEN8,	LEN2 + PCREL */
22 	16,	16	/* LEN16,	LEN16 + PCREL */
23 };
24 int	lgreflen[] = { 	/* {LEN*+PCREL} ==> number of bytes */
25 	-1,	-1,
26 	0,	0,	/* LEN1,	LEN1 + PCREL */
27 	1,	1,	/* LEN2,	LEN2 + PCREL */
28 	2,	2,	/* LEN4,	LEN2 + PCREL */
29 	3,	3,	/* LEN8,	LEN2 + PCREL */
30 	4,	4	/* LEN16,	LEN16 + PCREL */
31 };
32 
33 /*
34  *	Convert sizes to loader reference types and type flags
35  */
36 /*0	1	2	3	4	5	6	7	8*/
37 /*
38  *	Convert {1,2,4,8} into {LEN1, LEN2, LEN4, LEN8}
39  */
40 int	len124[] = {
41 	0,	LEN1,	/* 0 */
42 	LEN2,	0,	/* 2 */
43 	LEN4,	0,	/* 4 */
44 	0,	0,	/* 6 */
45 	LEN8,	0,	/* 8 */
46 	0,	0,	/* 10 */
47 	0,	0,	/* 12 */
48 	0,	0,	/* 14 */
49 	LEN16,	0	/* 16 */
50 };
51 /*
52  *	Convert {1,2,4,8} into {bits to construct operands}
53  */
54 char	mod124[] = {
55 	0,	0x00,	/* 0 */
56 	0x20,	0,	/* 2 */
57 	0x40,	0,	/* 4 */
58 	0,	0,	/* 6 */
59 	0,	0,	/* 8 */
60 	0,	0,	/* 10 */
61 	0,	0,	/* 12 */
62 	0,	0,	/* 14 */
63 	0,	0	/* 16 */
64 };
65 /*
66  *	{1,2,4,8} into {TYPB, TYPW, TYPL, TYPQ}
67  */
68 int	type_124[] = {
69 	0,	TYPB,	/* 0 */
70 	TYPW,	0,	/* 2 */
71 	TYPL,	0,	/* 4 */
72 	0,	0,	/* 6 */
73 	TYPQ,	0,	/* 8 */
74 	0,	0,	/* 10 */
75 	0,	0,	/* 12 */
76 	0,	0,	/* 14 */
77 	TYPO,	0	/* 16 */
78 };
79 #endif AS
80 /*
81  *	Convert TYP[BWLQOFDGH] into {1 if relocation not OK}
82  */
83 int	ty_NORELOC[] = {
84 	0,	/* TYPB */
85 	0,	/* TYPW */
86 	0,	/* TYPL */
87 	1,	/* TYPQ */
88 	1,	/* TYPO */
89 	1,	/* TYPF */
90 	1,	/* TYPD */
91 	1,	/* TYPG */
92 	1,	/* TYPH */
93 	1	/* TYPNONE */
94 };
95 #ifndef ADB
96 /*
97  *	Convert TYP[BWLQOFDGH] into {1 if a floating point number}
98  */
99 int	ty_float[] = {
100 	0,	/* TYPB */
101 	0,	/* TYPW */
102 	0,	/* TYPL */
103 	0,	/* TYPQ */
104 	0,	/* TYPO */
105 	1,	/* TYPF */
106 	1,	/* TYPD */
107 	1,	/* TYPG */
108 	1,	/* TYPH */
109 	0	/* TYPNONE */
110 };
111 #endif
112 #ifdef AS
113 /*
114  *	Convert TYP[BWLQOFDGH] into {LEN1 ... LEN16}
115  */
116 int	ty_LEN[] = {
117 	LEN1,	/* TYPB */
118 	LEN2,	/* TYPW */
119 	LEN4,	/* TYPL */
120 	LEN8,	/* TYPQ */
121 	LEN16,	/* TYPO */
122 	LEN4,	/* TYPF */
123 	LEN8,	/* TYPD */
124 	LEN8,	/* TYPG */
125 	LEN16,	/* TYPH */
126 	0	/* TYPNONE */
127 };
128 #endif AS
129 /*
130  *	Convert TYP[BWLQOFDGH] into {1 ... 16}
131  */
132 int	ty_nbyte[] = {
133 	1,	/* TYPB */
134 	2,	/* TYPW */
135 	4,	/* TYPL */
136 	8,	/* TYPQ */
137 	16,	/* TYPO */
138 	4,	/* TYPF */
139 	8,	/* TYPD */
140 	8,	/* TYPG */
141 	16,	/* TYPH */
142 	0	/* TYPNONE */
143 };
144 #ifndef ADB
145 /*
146  *	Convert TYP[BWLQOFDGH] into lg{1 ... 16}
147  */
148 int	ty_nlg[] = {
149 	0,	/* TYPB */
150 	1,	/* TYPW */
151 	2,	/* TYPL */
152 	3,	/* TYPQ */
153 	4,	/* TYPO */
154 	2,	/* TYPF */
155 	3,	/* TYPD */
156 	3,	/* TYPG */
157 	4,	/* TYPH */
158 	-1	/* TYPNONE */
159 };
160 /*
161  *	Convert TYP[BWLQOFDGH] into strings
162  */
163 char	*ty_string[] = {
164 	"byte",		/* TYPB */
165 	"word",		/* TYPW */
166 	"long",		/* TYPL */
167 	"quad",		/* TYPQ */
168 	"octa",		/* TYPO */
169 	"f_float",	/* TYPF */
170 	"d_float",	/* TYPD */
171 	"g_float",	/* TYPG */
172 	"h_float",	/* TYPH */
173 	"unpackd",	/* TYPUNPACKED */
174 	"??snark??"	/* TYPNONE */
175 };
176 #endif
177