source: trunk/src/binutils/include/opcode/sparc.h@ 1790

Last change on this file since 1790 was 610, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r609,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 8.4 KB
Line 
1/* Definitions for opcode table for the sparc.
2 Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2002
3 Free Software Foundation, Inc.
4
5This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and
6the GNU Binutils.
7
8GAS/GDB is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation; either version 2, or (at your option)
11any later version.
12
13GAS/GDB is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with GAS or GDB; see the file COPYING. If not, write to
20the Free Software Foundation, 59 Temple Place - Suite 330,
21Boston, MA 02111-1307, USA. */
22
23#include "ansidecl.h"
24
25/* The SPARC opcode table (and other related data) is defined in
26 the opcodes library in sparc-opc.c. If you change anything here, make
27 sure you fix up that file, and vice versa. */
28
29 /* FIXME-someday: perhaps the ,a's and such should be embedded in the
30 instruction's name rather than the args. This would make gas faster, pinsn
31 slower, but would mess up some macros a bit. xoxorich. */
32
33/* List of instruction sets variations.
34 These values are such that each element is either a superset of a
35 preceding each one or they conflict in which case SPARC_OPCODE_CONFLICT_P
36 returns non-zero.
37 The values are indices into `sparc_opcode_archs' defined in sparc-opc.c.
38 Don't change this without updating sparc-opc.c. */
39
40enum sparc_opcode_arch_val {
41 SPARC_OPCODE_ARCH_V6 = 0,
42 SPARC_OPCODE_ARCH_V7,
43 SPARC_OPCODE_ARCH_V8,
44 SPARC_OPCODE_ARCH_SPARCLET,
45 SPARC_OPCODE_ARCH_SPARCLITE,
46 /* v9 variants must appear last */
47 SPARC_OPCODE_ARCH_V9,
48 SPARC_OPCODE_ARCH_V9A, /* v9 with ultrasparc additions */
49 SPARC_OPCODE_ARCH_V9B, /* v9 with ultrasparc and cheetah additions */
50 SPARC_OPCODE_ARCH_BAD /* error return from sparc_opcode_lookup_arch */
51};
52
53/* The highest architecture in the table. */
54#define SPARC_OPCODE_ARCH_MAX (SPARC_OPCODE_ARCH_BAD - 1)
55
56/* Given an enum sparc_opcode_arch_val, return the bitmask to use in
57 insn encoding/decoding. */
58#define SPARC_OPCODE_ARCH_MASK(arch) (1 << (arch))
59
60/* Given a valid sparc_opcode_arch_val, return non-zero if it's v9. */
61#define SPARC_OPCODE_ARCH_V9_P(arch) ((arch) >= SPARC_OPCODE_ARCH_V9)
62
63/* Table of cpu variants. */
64
65struct sparc_opcode_arch {
66 const char *name;
67 /* Mask of sparc_opcode_arch_val's supported.
68 EG: For v7 this would be
69 (SPARC_OPCODE_ARCH_MASK (..._V6) | SPARC_OPCODE_ARCH_MASK (..._V7)).
70 These are short's because sparc_opcode.architecture is. */
71 short supported;
72};
73
74extern const struct sparc_opcode_arch sparc_opcode_archs[];
75
76/* Given architecture name, look up it's sparc_opcode_arch_val value. */
77extern enum sparc_opcode_arch_val sparc_opcode_lookup_arch
78 PARAMS ((const char *));
79
80/* Return the bitmask of supported architectures for ARCH. */
81#define SPARC_OPCODE_SUPPORTED(ARCH) (sparc_opcode_archs[ARCH].supported)
82
83/* Non-zero if ARCH1 conflicts with ARCH2.
84 IE: ARCH1 as a supported bit set that ARCH2 doesn't, and vice versa. */
85#define SPARC_OPCODE_CONFLICT_P(ARCH1, ARCH2) \
86(((SPARC_OPCODE_SUPPORTED (ARCH1) & SPARC_OPCODE_SUPPORTED (ARCH2)) \
87 != SPARC_OPCODE_SUPPORTED (ARCH1)) \
88 && ((SPARC_OPCODE_SUPPORTED (ARCH1) & SPARC_OPCODE_SUPPORTED (ARCH2)) \
89 != SPARC_OPCODE_SUPPORTED (ARCH2)))
90
91/* Structure of an opcode table entry. */
92
93struct sparc_opcode {
94 const char *name;
95 unsigned long match; /* Bits that must be set. */
96 unsigned long lose; /* Bits that must not be set. */
97 const char *args;
98 /* This was called "delayed" in versions before the flags. */
99 char flags;
100 short architecture; /* Bitmask of sparc_opcode_arch_val's. */
101};
102
103#define F_DELAYED 1 /* Delayed branch */
104#define F_ALIAS 2 /* Alias for a "real" instruction */
105#define F_UNBR 4 /* Unconditional branch */
106#define F_CONDBR 8 /* Conditional branch */