xref: /original-bsd/old/as.tahoe/assizetab.c (revision 3839ed90)
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 };
23 int	lgreflen[] = { 	/* {LEN*+PCREL} ==> number of bytes */
24 	-1,	-1,
25 	0,	0,	/* LEN1,	LEN1 + PCREL */
26 	1,	1,	/* LEN2,	LEN2 + PCREL */
27 	2,	2,	/* LEN4,	LEN2 + PCREL */
28 	3,	3	/* LEN8,	LEN2 + PCREL */
29 };
30 
31 /*
32  *	Convert sizes to loader reference types and type flags
33  */
34 /*0	1	2	3	4	5	6	7	8*/
35 /*
36  *	Convert {1,2,4,8} into {LEN1, LEN2, LEN4, LEN8}
37  */
38 int	len124[] = {
39 	0,	LEN1,	/* 0 */
40 	LEN2,	0,	/* 2 */
41 	LEN4,	0,	/* 4 */
42 	0,	0,	/* 6 */
43 	LEN8,	0	/* 8 */
44 };
45 /*
46  *	Convert {1,2,4,8} into {bits to construct operands}
47  */
48 char	mod124[] = {
49 	0,	0x00,	/* 0 */
50 	0x20,	0,	/* 2 */
51 	0x40,	0,	/* 4 */
52 	0,	0,	/* 6 */
53 	0,	0	/* 8 */
54 };
55 /*
56  *	{1,2,4,8} into {TYPB, TYPW, TYPL, TYPQ}
57  */
58 int	type_124[] = {
59 	0,	TYPB,	/* 0 */
60 	TYPW,	0,	/* 2 */
61 	TYPL,	0,	/* 4 */
62 	0,	0,	/* 6 */
63 	TYPQ,   0	/* 8 */
64 };
65 #endif AS
66 /*
67  *	Convert TYP[BWLQOFDGH] into {1 if relocation not OK}
68  */
69 int	ty_NORELOC[] = {
70 	0,	/* TYPB */
71 	0,	/* TYPW */
72 	0,	/* TYPL */
73 	1,	/* TYPQ */
74 	1,	/* TYPF */
75 	1,	/* TYPD */
76 	1	/* TYPNONE */
77 };
78 #ifndef ADB
79 /*
80  *	Convert TYP[BWLQOFDGH] into {1 if a floating point number}
81  */
82 int	ty_float[] = {
83 	0,	/* TYPB */
84 	0,	/* TYPW */
85 	0,	/* TYPL */
86 	0,	/* TYPQ */
87 	1,	/* TYPF */
88 	1,	/* TYPD */
89 	0	/* TYPNONE */
90 };
91 #endif
92 #ifdef AS
93 /*
94  *	Convert TYP[BWLQOFDGH] into {LEN1 ... LEN16}
95  */
96 int	ty_LEN[] = {
97 	LEN1,	/* TYPB */
98 	LEN2,	/* TYPW */
99 	LEN4,	/* TYPL */
100 	LEN8,	/* TYPQ */
101 	LEN4,	/* TYPF */
102 	LEN8,	/* TYPD */
103 	0	/* TYPNONE */
104 };
105 #endif AS
106 /*
107  *	Convert TYP[BWLQFD] into {1 ... 8}
108  */
109 int	ty_nbyte[] = {
110 	1,	/* TYPB */
111 	2,	/* TYPW */
112 	4,	/* TYPL */
113 	8,	/* TYPQ */
114 	4,	/* TYPF */
115 	8,	/* TYPD */
116 	0	/* TYPNONE */
117 };
118 #ifndef ADB
119 /*
120  *	Convert TYP[BWLQFD] into lg{1 ... 8}
121  */
122 int	ty_nlg[] = {
123 	0,	/* TYPB */
124 	1,	/* TYPW */
125 	2,	/* TYPL */
126 	3,	/* TYPQ */
127 	2,	/* TYPF */
128 	3,	/* TYPD */
129 	-1	/* TYPNONE */
130 };
131 /*
132  *	Convert TYP[BWLQFD] into strings
133  */
134 char	*ty_string[] = {
135 	"byte",		/* TYPB */
136 	"word",		/* TYPW */
137 	"long",		/* TYPL */
138 	"quad",		/* TYPQ */
139 	"f_float",	/* TYPF */
140 	"d_float",	/* TYPD */
141 	"??snark??"	/* TYPNONE */
142 };
143 #endif
144