1129202Scognet/* vax-inst.h - GNU - Part of vax.c
2129202Scognet   Copyright 1987, 1992, 1995, 2000, 2002, 2005, 2007
3129202Scognet   Free Software Foundation, Inc.
4129202Scognet
5129202Scognet   This file is part of GAS, the GNU Assembler.
6129202Scognet
7129202Scognet   GAS is free software; you can redistribute it and/or modify
8129202Scognet   it under the terms of the GNU General Public License as published by
9129202Scognet   the Free Software Foundation; either version 3, or (at your option)
10129202Scognet   any later version.
11129202Scognet
12129202Scognet   GAS is distributed in the hope that it will be useful,
13129202Scognet   but WITHOUT ANY WARRANTY; without even the implied warranty of
14129202Scognet   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15129202Scognet   GNU General Public License for more details.
16129202Scognet
17129202Scognet   You should have received a copy of the GNU General Public License
18129202Scognet   along with GAS; see the file COPYING.  If not, write to
19129202Scognet   the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
20129202Scognet
21129202Scognet/*
22129202Scognet * This is part of vax-ins-parse.c & friends.
23129202Scognet * We want to parse a vax instruction text into a tree defined here.
24129202Scognet */
25129202Scognet
26129202Scognet#define VIT_MAX_OPERANDS (6)	/* maximum number of operands in one       */
27129202Scognet/* single vax instruction */
28129202Scognet
29129202Scognetstruct vop			/* vax instruction operand                 */
30129202Scognet{
31129202Scognet  short int vop_ndx;		/* -1, or index register. eg 7=[R7]	   */
32129202Scognet  short int vop_reg;		/* -1, or register number. eg @I^#=0xF     */
33129202Scognet  /* Helps distinguish "abs" from "abs(PC)".  */
34129202Scognet  short int vop_mode;		/* addressing mode 4 bits. eg I^#=0x9	   */
35129202Scognet  char vop_short;		/* operand displacement length as written  */
36129202Scognet  /* ' '=none, "bilsw"=B^I^L^S^W^.           */
37137287Scognet  char vop_access;		/* 'b'branch ' 'no-instruction 'amrvw'norm */
38129202Scognet  char vop_width;		/* Operand width, one of "bdfghloqw"	   */
39129202Scognet  const char *vop_warn;		/* warning message of this operand, if any */
40129202Scognet  const char *vop_error;	/* say if operand is inappropriate         */
41129202Scognet  char *vop_expr_begin;		/* Unparsed expression, 1st char ...	   */
42129202Scognet  char *vop_expr_end;		/* ... last char.			   */
43129202Scognet  unsigned char vop_nbytes;	/* number of bytes in datum		   */
44129202Scognet};
45129202Scognet
46129202Scognettypedef long vax_opcodeT;	/* For initialising array of opcodes	   */
47129202Scognet/* Some synthetic opcodes > 16 bits!       */
48129202Scognet
49129202Scognet#define VIT_OPCODE_SYNTHETIC 0x80000000	/* Not real hardware instruction.  */
50129202Scognet#define VIT_OPCODE_SPECIAL   0x40000000	/* Not normal branch optimising.   */
51129202Scognet/* Never set without ..._SYNTHETIC */
52129202Scognet
53129202Scognet#define VAX_WIDTH_UNCONDITIONAL_JUMP '-'	/* These are encoded into         */
54129202Scognet#define VAX_WIDTH_CONDITIONAL_JUMP   '?'	/* vop_width when vop_access=='b' */
55129202Scognet#define VAX_WIDTH_WORD_JUMP          '!'	/* and VIT_OPCODE_SYNTHETIC set.  */
56129202Scognet#define VAX_WIDTH_BYTE_JUMP	     ':'	/*                                */
57129202Scognet
58129202Scognet#define VAX_JSB (0x16)		/* Jump to subroutine			   */
59129202Scognet#define VAX_JMP (0x17)		/* Useful for branch optimising. Jump instr*/
60129202Scognet#define VAX_PC_RELATIVE_MODE (0xef)	/* Use it after VAX_JMP		   */
61129202Scognet#define VAX_ABSOLUTE_MODE (0x9F)/* Use as @#...			   */
62129202Scognet#define VAX_BRB (0x11)		/* Canonical branch.			   */
63129202Scognet#define VAX_BRW (0x31)		/* Another canonical branch		   */
64129202Scognet#define VAX_CALLS (0xFB)	/* Call with arg list on stack	           */
65129202Scognet#define VAX_CALLG (0xFA)	/* Call with arg list in memory		   */
66129202Scognet#define VAX_WIDEN_WORD (0x20)	/* Add this to byte branch to get word br.  */
67129202Scognet#define VAX_WIDEN_LONG (0x6)	/* Add this to byte branch to get long jmp.*/
68129202Scognet/* Needs VAX_PC_RELATIVE_MODE byte after it*/
69129202Scognet#define	VAX_CALLS (0xFB)	/* Call with arg list on stack	           */
70129202Scognet#define	VAX_CALLG (0xFA)	/* Call with arg list in memory		   */
71129202Scognet
72129202Scognetstruct vit			/* vax instruction tree                    */
73129202Scognet{
74129202Scognet  /* vit_opcode is char[] for portability.   */
75129202Scognet  char vit_opcode[sizeof (vax_opcodeT)];
76129202Scognet  unsigned char vit_opcode_nbytes;	/* How long is _opcode? (chars)	   */
77129202Scognet  unsigned char vit_operands;	/*					   */
78129202Scognet  struct vop vit_operand[VIT_MAX_OPERANDS];	/* operands             */
79129202Scognet  const char *vit_error;	/* "" or error text */
80129202Scognet};
81129202Scognet
82129202Scognet/* end of vax-inst.h */
83129202Scognet