xref: /original-bsd/old/as.tahoe/instrs.h (revision e59fb703)
1 /*
2  *	Copyright (c) 1982 Regents of the University of California
3  *	@(#)instrs.h 4.5 6/9/83
4  */
5 /*
6  *	Argument data types
7  *
8  *	If you change these definitions, you must also change the tables
9  *	in assizetab.c
10  */
11 #define	TYPB		000	/* byte integer */
12 #define	TYPW		001	/* word integer */
13 #define	TYPL		002	/* long integer */
14 #define	TYPQ		003	/* quad integer */
15 #define	TYPF		004	/* F float */
16 #define	TYPD		005	/* D float */
17 #define	TYPNONE		006	/* when nothing */
18 #define	TYPLG		3	/* number of bits the above take up */
19 
20 #define	TYPMASK	((1<<TYPLG)-1)	/* the mask (assumes 2's comp arith) */
21 /*
22  *	Constructors and extractors for argument access kinds and types
23  */
24 #define A_CONS(access, type)	((access) | (type))
25 #define	A_ACCEXT(consed)	((consed) & (TYPMASK << TYPLG))
26 #define	A_TYPEXT(consed)	((consed) & TYPMASK)
27 
28 /*
29  * Argument access types used to test validity of operands to operators
30  */
31 #define	ACCR	(1<<TYPLG)			/* read */
32 #define	ACCW	(2<<TYPLG)			/* write */
33 #define	ACCB	(4<<TYPLG)			/* branch displacement */
34 #define	ACCA	(8<<TYPLG)			/* address only */
35 #define	ACCM	(ACCR | ACCW)			/* modify */
36 #define	ACCI	(ACCB | ACCR)			/* XFC code */
37 
38 #define ACCESSMASK	(ACCA | ACCR | ACCW | ACCB)	/* the mask */
39 
40 /*
41  *	Construction of TYPX and ACCX, to make the instrs table
42  *	easy to use and read.
43  */
44 /*
45  *	For real memory address
46  */
47 #define	A_AB	A_CONS(ACCA, TYPB)
48 #define	A_AW	A_CONS(ACCA, TYPW)
49 #define	A_AL	A_CONS(ACCA, TYPL)
50 #define	A_AQ	A_CONS(ACCA, TYPQ)
51 #define	A_AF	A_CONS(ACCA, TYPF)
52 #define	A_AD	A_CONS(ACCA, TYPD)
53 /*
54  *	For branch displacement
55  */
56 #define	A_BB	A_CONS(ACCB, TYPB)
57 #define	A_BW	A_CONS(ACCB, TYPW)
58 /*
59  *	For modification
60  */
61 #define	A_MB	A_CONS(ACCM, TYPB)
62 #define	A_MW	A_CONS(ACCM, TYPW)
63 #define	A_ML	A_CONS(ACCM, TYPL)
64 #define	A_MF	A_CONS(ACCM, TYPF)
65 #define	A_MD	A_CONS(ACCM, TYPD)
66 /*
67  *	For reading
68  */
69 #define	A_RB	A_CONS(ACCR, TYPB)
70 #define	A_RW	A_CONS(ACCR, TYPW)
71 #define	A_RL	A_CONS(ACCR, TYPL)
72 #define	A_RQ	A_CONS(ACCR, TYPQ)
73 #define	A_RF	A_CONS(ACCR, TYPF)
74 #define	A_RD	A_CONS(ACCR, TYPD)
75 /*
76  *	For writing
77  */
78 #define	A_WB	A_CONS(ACCW, TYPB)
79 #define	A_WW	A_CONS(ACCW, TYPW)
80 #define	A_WL	A_CONS(ACCW, TYPL)
81 #define	A_WQ	A_CONS(ACCW, TYPQ)
82 #define	A_WF	A_CONS(ACCW, TYPF)
83 #define	A_WD	A_CONS(ACCW, TYPD)
84 
85 #ifndef INSTTAB
86 /*
87  *	Define what the entries in the table look like.
88  *	This is only used for adb and sdb; not for as.
89  */
90 #define	INSTTAB
91 struct insttab{
92 	char	*iname;
93 	u_char	opcode;
94 	char	nargs;
95 	u_char	argtype[6];
96 } insttab[];
97 
98 #define OP(name,opcode,nargs,a1,a2,a3,a4,a5,a6) {name,opcode,nargs,a1,a2,a3,a4,a5,a6}
99 
100 #endif INSTTAB
101 
102