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