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