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