Add support for .extInstruction pseudo-op.
[deliverable/binutils-gdb.git] / opcodes / arc-ext.h
CommitLineData
886a2506 1/* ARC target-dependent stuff. Extension data structures.
6f2750fe 2 Copyright (C) 1995-2016 Free Software Foundation, Inc.
0d2bcfaf 3
9b201bb5 4 This file is part of libopcodes.
0d2bcfaf 5
9b201bb5
NC
6 This library 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 3, or (at your option)
9 any later version.
0d2bcfaf 10
9b201bb5
NC
11 It is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 License for more details.
0d2bcfaf 15
9b201bb5
NC
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
0d2bcfaf 20
886a2506
NC
21/*This header file defines a table of extensions to the ARC processor
22 architecture. These extensions are read from the '.arcextmap' or
23 '.gnu.linkonce.arcextmap.<type>.<N>' sections in the ELF file which
24 is identified by the bfd parameter to the build_ARC_extmap function.
0d2bcfaf 25
886a2506
NC
26 These extensions may include:
27 core registers
28 auxiliary registers
29 instructions
30 condition codes
0d2bcfaf 31
886a2506
NC
32 Once the table has been constructed, accessor functions may be used
33 to retrieve information from it.
0d2bcfaf 34
886a2506
NC
35 The build_ARC_extmap constructor function build_ARC_extmap may be
36 called as many times as required; it will re-initialize the table
37 each time. */
38
39#ifndef ARC_EXTENSIONS_H
40#define ARC_EXTENSIONS_H
41
b99747ae
CZ
42#include "opcode/arc.h"
43
886a2506
NC
44#define IGNORE_FIRST_OPD 1
45
46/* Define this if we do not want to encode instructions based on the
47 ARCompact Programmer's Reference. */
48#define UNMANGLED
0d2bcfaf 49
886a2506
NC
50/* This defines the kinds of extensions which may be read from the
51 ections in the executable files. */
52enum ExtOperType
0d2bcfaf 53{
886a2506
NC
54 EXT_INSTRUCTION = 0,
55 EXT_CORE_REGISTER = 1,
56 EXT_AUX_REGISTER = 2,
57 EXT_COND_CODE = 3,
58 EXT_INSTRUCTION32 = 4,
59 EXT_AC_INSTRUCTION = 4,
60 EXT_REMOVE_CORE_REG = 5,
61 EXT_LONG_CORE_REGISTER = 6,
62 EXT_AUX_REGISTER_EXTENDED = 7,
63 EXT_INSTRUCTION32_EXTENDED = 8,
64 EXT_CORE_REGISTER_CLASS = 9
0d2bcfaf
NC
65};
66
886a2506 67enum ExtReadWrite
0d2bcfaf 68{
886a2506
NC
69 REG_INVALID,
70 REG_READ,
71 REG_WRITE,
72 REG_READWRITE
0d2bcfaf
NC
73};
74
b99747ae
CZ
75/* Macro used when generating the patterns for an extension
76 instruction. */
77#define INSERT_XOP(OP, NAME, CODE, MASK, CPU, ARG, FLG) \
78 do { \
79 (OP)->name = NAME; \
80 (OP)->opcode = CODE; \
81 (OP)->mask = MASK; \
82 (OP)->cpu = CPU; \
83 (OP)->class = ARITH; \
84 (OP)->subclass = NONE; \
85 memcpy ((OP)->operands, (ARG), MAX_INSN_ARGS); \
86 memcpy ((OP)->flags, (FLG), MAX_INSN_FLGS); \
87 (OP++); \
88 } while (0)
89
90/* Typedef to hold the extension instruction definition. */
91typedef struct ExtInstruction
92{
93 /* Name. */
94 char *name;
95
96 /* Major opcode. */
97 char major;
98
99 /* Minor(sub) opcode. */
100 char minor;
101
102 /* Flags, holds the syntax class and modifiers. */
103 char flags;
104
105 /* Syntax class. Use by assembler. */
106 unsigned char syntax;
107
108 /* Syntax class modifier. Used by assembler. */
109 unsigned char modsyn;
110
111 /* Suffix class. Used by assembler. */
112 unsigned char suffix;
113
114 /* Pointer to the next extension instruction. */
115 struct ExtInstruction* next;
116} extInstruction_t;
0d2bcfaf 117
886a2506
NC
118/* Constructor function. */
119extern void build_ARC_extmap (bfd *);
120
121/* Accessor functions. */
122extern enum ExtReadWrite arcExtMap_coreReadWrite (int);
123extern const char * arcExtMap_coreRegName (int);
124extern const char * arcExtMap_auxRegName (long);
125extern const char * arcExtMap_condCodeName (int);
b99747ae
CZ
126extern const extInstruction_t *arcExtMap_insn (int, int);
127extern struct arc_opcode *arcExtMap_genOpcode (const extInstruction_t *,
128 unsigned arc_target,
129 const char **errmsg);
886a2506
NC
130
131/* Dump function (for debugging). */
132extern void dump_ARC_extmap (void);
0d2bcfaf 133
886a2506 134#endif /* ARC_EXTENSIONS_H */
This page took 0.643169 seconds and 4 git commands to generate.