Fix libctf ChangeLog date in most recent entry.
[binutils-gdb.git] / opcodes / arc-ext.h
blob52fe0c2e2aa8030b8421f759709c06ba8ccd7371
1 /* ARC target-dependent stuff. Extension data structures.
2 Copyright (C) 1995-2020 Free Software Foundation, Inc.
4 This file is part of libopcodes.
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.
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.
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. */
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.
26 These extensions may include:
27 core registers
28 auxiliary registers
29 instructions
30 condition codes
32 Once the table has been constructed, accessor functions may be used
33 to retrieve information from it.
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. */
39 #ifndef ARC_EXTENSIONS_H
40 #define ARC_EXTENSIONS_H
42 #include "opcode/arc.h"
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
48 #define IGNORE_FIRST_OPD 1
50 /* Define this if we do not want to encode instructions based on the
51 ARCompact Programmer's Reference. */
52 #define UNMANGLED
54 /* This defines the kinds of extensions which may be read from the
55 ections in the executable files. */
56 enum ExtOperType
58 EXT_INSTRUCTION = 0,
59 EXT_CORE_REGISTER = 1,
60 EXT_AUX_REGISTER = 2,
61 EXT_COND_CODE = 3,
62 EXT_INSTRUCTION32 = 4,
63 EXT_AC_INSTRUCTION = 4,
64 EXT_REMOVE_CORE_REG = 5,
65 EXT_LONG_CORE_REGISTER = 6,
66 EXT_AUX_REGISTER_EXTENDED = 7,
67 EXT_INSTRUCTION32_EXTENDED = 8,
68 EXT_CORE_REGISTER_CLASS = 9
71 enum ExtReadWrite
73 REG_INVALID,
74 REG_READ,
75 REG_WRITE,
76 REG_READWRITE
79 /* Macro used when generating the patterns for an extension
80 instruction. */
81 #define INSERT_XOP(OP, NAME, CODE, MASK, CPU, ARG, FLG) \
82 do { \
83 (OP)->name = NAME; \
84 (OP)->opcode = CODE; \
85 (OP)->mask = MASK; \
86 (OP)->cpu = CPU; \
87 (OP)->insn_class = ARITH; \
88 (OP)->subclass = NONE; \
89 memcpy ((OP)->operands, (ARG), MAX_INSN_ARGS); \
90 memcpy ((OP)->flags, (FLG), MAX_INSN_FLGS); \
91 (OP++); \
92 } while (0)
94 /* Typedef to hold the extension instruction definition. */
95 typedef struct ExtInstruction
97 /* Name. */
98 char *name;
100 /* Major opcode. */
101 char major;
103 /* Minor(sub) opcode. */
104 char minor;
106 /* Flags, holds the syntax class and modifiers. */
107 char flags;
109 /* Syntax class. Use by assembler. */
110 unsigned char syntax;
112 /* Syntax class modifier. Used by assembler. */
113 unsigned char modsyn;
115 /* Suffix class. Used by assembler. */
116 unsigned char suffix;
118 /* Pointer to the next extension instruction. */
119 struct ExtInstruction* next;
120 } extInstruction_t;
122 /* Constructor function. */
123 extern void build_ARC_extmap (bfd *);
125 /* Accessor functions. */
126 extern enum ExtReadWrite arcExtMap_coreReadWrite (int);
127 extern const char * arcExtMap_coreRegName (int);
128 extern const char * arcExtMap_auxRegName (unsigned);
129 extern const char * arcExtMap_condCodeName (int);
130 extern const extInstruction_t *arcExtMap_insn (int, unsigned long long);
131 extern struct arc_opcode *arcExtMap_genOpcode (const extInstruction_t *,
132 unsigned arc_target,
133 const char **errmsg);
135 /* Dump function (for debugging). */
136 extern void dump_ARC_extmap (void);
138 #ifdef __cplusplus
140 #endif
142 #endif /* ARC_EXTENSIONS_H */