xref: /original-bsd/old/as.vax/assizetab.c (revision fbed46ce)
1 /*
2  *	Copyright (c) 1982 Regents of the University of California
3  */
4 #ifndef lint
5 static char sccsid[] = "@(#)assizetab.c 4.3 02/14/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 /*
96  *	Convert TYP[BWLQOFDGH] into {1 if a floating point number}
97  */
98 int	ty_float[] = {
99 	0,	/* TYPB */
100 	0,	/* TYPW */
101 	0,	/* TYPL */
102 	0,	/* TYPQ */
103 	0,	/* TYPO */
104 	1,	/* TYPF */
105 	1,	/* TYPD */
106 	1,	/* TYPG */
107 	1,	/* TYPH */
108 	0	/* TYPNONE */
109 };
110 #ifdef AS
111 /*
112  *	Convert TYP[BWLQOFDGH] into {LEN1 ... LEN16}
113  */
114 int	ty_LEN[] = {
115 	LEN1,	/* TYPB */
116 	LEN2,	/* TYPW */
117 	LEN4,	/* TYPL */
118 	LEN8,	/* TYPQ */
119 	LEN16,	/* TYPO */
120 	LEN4,	/* TYPF */
121 	LEN8,	/* TYPD */
122 	LEN8,	/* TYPG */
123 	LEN16,	/* TYPH */
124 	0	/* TYPNONE */
125 };
126 #endif AS
127 /*
128  *	Convert TYP[BWLQOFDGH] into {1 ... 16}
129  */
130 int	ty_nbyte[] = {
131 	1,	/* TYPB */
132 	2,	/* TYPW */
133 	4,	/* TYPL */
134 	8,	/* TYPQ */
135 	16,	/* TYPO */
136 	4,	/* TYPF */
137 	8,	/* TYPD */
138 	8,	/* TYPG */
139 	16,	/* TYPH */
140 	0	/* TYPNONE */
141 };
142 /*
143  *	Convert TYP[BWLQOFDGH] into lg{1 ... 16}
144  */
145 int	ty_nlg[] = {
146 	0,	/* TYPB */
147 	1,	/* TYPW */
148 	2,	/* TYPL */
149 	3,	/* TYPQ */
150 	4,	/* TYPO */
151 	2,	/* TYPF */
152 	3,	/* TYPD */
153 	3,	/* TYPG */
154 	4,	/* TYPH */
155 	-1	/* TYPNONE */
156 };
157 /*
158  *	Convert TYP[BWLQOFDGH] into strings
159  */
160 char	*ty_string[] = {
161 	"byte",		/* TYPB */
162 	"word",		/* TYPW */
163 	"long",		/* TYPL */
164 	"quad",		/* TYPQ */
165 	"octa",		/* TYPO */
166 	"f_float",	/* TYPF */
167 	"d_float",	/* TYPD */
168 	"g_float",	/* TYPG */
169 	"h_float",	/* TYPH */
170 	"unpackd",	/* TYPUNPACKED */
171 	"??snark??"	/* TYPNONE */
172 };
173