BSD 4_3_Reno release
[unix-history] / usr / src / pgrm / as.tahoe / instrs.h
/*
* Copyright (c) 1982 Regents of the University of California
* @(#)instrs.h 4.5 6/9/83
*/
/*
* Argument data types
*
* If you change these definitions, you must also change the tables
* in assizetab.c
*/
#define TYPB 000 /* byte integer */
#define TYPW 001 /* word integer */
#define TYPL 002 /* long integer */
#define TYPQ 003 /* quad integer */
#define TYPF 004 /* F float */
#define TYPD 005 /* D float */
#define TYPNONE 006 /* when nothing */
#define TYPLG 3 /* number of bits the above take up */
#define TYPMASK ((1<<TYPLG)-1) /* the mask (assumes 2's comp arith) */
/*
* Constructors and extractors for argument access kinds and types
*/
#define A_CONS(access, type) ((access) | (type))
#define A_ACCEXT(consed) ((consed) & (TYPMASK << TYPLG))
#define A_TYPEXT(consed) ((consed) & TYPMASK)
/*
* Argument access types used to test validity of operands to operators
*/
#define ACCR (1<<TYPLG) /* read */
#define ACCW (2<<TYPLG) /* write */
#define ACCB (4<<TYPLG) /* branch displacement */
#define ACCA (8<<TYPLG) /* address only */
#define ACCM (ACCR | ACCW) /* modify */
#define ACCI (ACCB | ACCR) /* XFC code */
#define ACCESSMASK (ACCA | ACCR | ACCW | ACCB) /* the mask */
/*
* Construction of TYPX and ACCX, to make the instrs table
* easy to use and read.
*/
/*
* For real memory address
*/
#define A_AB A_CONS(ACCA, TYPB)
#define A_AW A_CONS(ACCA, TYPW)
#define A_AL A_CONS(ACCA, TYPL)
#define A_AQ A_CONS(ACCA, TYPQ)
#define A_AF A_CONS(ACCA, TYPF)
#define A_AD A_CONS(ACCA, TYPD)
/*
* For branch displacement
*/
#define A_BB A_CONS(ACCB, TYPB)
#define A_BW A_CONS(ACCB, TYPW)
/*
* For modification
*/
#define A_MB A_CONS(ACCM, TYPB)
#define A_MW A_CONS(ACCM, TYPW)
#define A_ML A_CONS(ACCM, TYPL)
#define A_MF A_CONS(ACCM, TYPF)
#define A_MD A_CONS(ACCM, TYPD)
/*
* For reading
*/
#define A_RB A_CONS(ACCR, TYPB)
#define A_RW A_CONS(ACCR, TYPW)
#define A_RL A_CONS(ACCR, TYPL)
#define A_RQ A_CONS(ACCR, TYPQ)
#define A_RF A_CONS(ACCR, TYPF)
#define A_RD A_CONS(ACCR, TYPD)
/*
* For writing
*/
#define A_WB A_CONS(ACCW, TYPB)
#define A_WW A_CONS(ACCW, TYPW)
#define A_WL A_CONS(ACCW, TYPL)
#define A_WQ A_CONS(ACCW, TYPQ)
#define A_WF A_CONS(ACCW, TYPF)
#define A_WD A_CONS(ACCW, TYPD)
#ifndef INSTTAB
/*
* Define what the entries in the table look like.
* This is only used for adb and sdb; not for as.
*/
#define INSTTAB
struct insttab{
char *iname;
u_char opcode;
char nargs;
u_char argtype[6];
} insttab[];
#define OP(name,opcode,nargs,a1,a2,a3,a4,a5,a6) {name,opcode,nargs,a1,a2,a3,a4,a5,a6}
#endif INSTTAB