1/* vax-inst.h - GNU - Part of vax.c
2   Copyright 1987, 1992, 1995, 2000, 2002 Free Software Foundation, Inc.
3
4   This file is part of GAS, the GNU Assembler.
5
6   GAS is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   GAS is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with GAS; see the file COPYING.  If not, write to
18   the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
19
20/*
21 * This is part of vax-ins-parse.c & friends.
22 * We want to parse a vax instruction text into a tree defined here.
23 */
24
25#define VIT_MAX_OPERANDS (6)	/* maximum number of operands in one       */
26/* single vax instruction */
27
28struct vop			/* vax instruction operand                 */
29{
30  short int vop_ndx;		/* -1, or index register. eg 7=[R7]	   */
31  short int vop_reg;		/* -1, or register number. eg @I^#=0xF     */
32  /* Helps distinguish "abs" from "abs(PC)".  */
33  short int vop_mode;		/* addressing mode 4 bits. eg I^#=0x9	   */
34  char vop_short;		/* operand displacement length as written  */
35  /* ' '=none, "bilsw"=B^I^L^S^W^.           */
36  char vop_access;		/* 'b'branch ' 'no-instruction 'amrvw'norm */
37  char vop_width;		/* Operand width, one of "bdfghloqw"	   */
38  const char *vop_warn;		/* warning message of this operand, if any */
39  const char *vop_error;	/* say if operand is inappropriate         */
40  char *vop_expr_begin;		/* Unparsed expression, 1st char ...	   */
41  char *vop_expr_end;		/* ... last char.			   */
42  unsigned char vop_nbytes;	/* number of bytes in datum		   */
43};
44
45typedef long vax_opcodeT;	/* For initialising array of opcodes	   */
46/* Some synthetic opcodes > 16 bits!       */
47
48#define VIT_OPCODE_SYNTHETIC 0x80000000	/* Not real hardware instruction.  */
49#define VIT_OPCODE_SPECIAL   0x40000000	/* Not normal branch optimising.   */
50/* Never set without ..._SYNTHETIC */
51
52#define VAX_WIDTH_UNCONDITIONAL_JUMP '-'	/* These are encoded into         */
53#define VAX_WIDTH_CONDITIONAL_JUMP   '?'	/* vop_width when vop_access=='b' */
54#define VAX_WIDTH_WORD_JUMP          '!'	/* and VIT_OPCODE_SYNTHETIC set.  */
55#define VAX_WIDTH_BYTE_JUMP	     ':'	/*                                */
56
57#define VAX_JSB (0x16)		/* Jump to subroutine			   */
58#define VAX_JMP (0x17)		/* Useful for branch optimising. Jump instr*/
59#define VAX_PC_RELATIVE_MODE (0xef)	/* Use it after VAX_JMP		   */
60#define VAX_ABSOLUTE_MODE (0x9F)/* Use as @#...			   */
61#define VAX_BRB (0x11)		/* Canonical branch.			   */
62#define VAX_BRW (0x31)		/* Another canonical branch		   */
63#define VAX_CALLS (0xFB)	/* Call with arg list on stack	           */
64#define VAX_CALLG (0xFA)	/* Call with arg list in memory		   */
65#define VAX_WIDEN_WORD (0x20)	/* Add this to byte branch to get word br.  */
66#define VAX_WIDEN_LONG (0x6)	/* Add this to byte branch to get long jmp.*/
67/* Needs VAX_PC_RELATIVE_MODE byte after it*/
68
69struct vit			/* vax instruction tree                    */
70{
71  /* vit_opcode is char[] for portability.   */
72  char vit_opcode[sizeof (vax_opcodeT)];
73  unsigned char vit_opcode_nbytes;	/* How long is _opcode? (chars)	   */
74  unsigned char vit_operands;	/*					   */
75  struct vop vit_operand[VIT_MAX_OPERANDS];	/* operands             */
76  const char *vit_error;	/* "" or error text */
77};
78
79/* end of vax-inst.h */
80