binutils-gdb/opcodes/arc-ext.h
Claudiu Zissulescu b99747aeed Add support for .extInstruction pseudo-op.
gas/
2016-04-04  Claudiu Zissulescu  <claziss@synopsys.com>

	* testsuite/gas/arc/textinsn-errors.d: New File.
	* testsuite/gas/arc/textinsn-errors.err: Likewise.
	* testsuite/gas/arc/textinsn-errors.s: Likewise.
	* testsuite/gas/arc/textinsn2op.d: Likewise.
	* testsuite/gas/arc/textinsn2op.s: Likewise.
	* testsuite/gas/arc/textinsn2op01.d: Likewise.
	* testsuite/gas/arc/textinsn2op01.s: Likewise.
	* testsuite/gas/arc/textinsn3op.d: Likewise.
	* testsuite/gas/arc/textinsn3op.s: Likewise.
	* doc/c-arc.texi (ARC Directives): Add .extInstruction
	documentation.
	* config/tc-arc.c (arcext_section): New variable.
	(arc_extinsn): New function.
	(md_pseudo_table): Add .extInstruction pseudo op.
	(attributes_t): New type.
	(suffixclass, syntaxclass, syntaxclassmod): New constant
	structures.
	(find_opcode_match): Remove arc_num_opcodes.
	(md_begin): Likewise.
	(tokenize_extinsn): New function.
	(arc_set_ext_seg): Likewise.
	(create_extinst_section): Likewise.

include/
2016-04-04  Claudiu Zissulescu  <claziss@synopsys.com>

	* opcode/arc.h (arc_num_opcodes): Remove.
	(ARC_SYNTAX_3OP, ARC_SYNTAX_2OP, ARC_OP1_MUST_BE_IMM)
	(ARC_OP1_IMM_IMPLIED, ARC_SUFFIX_NONE, ARC_SUFFIX_COND)
	(ARC_SUFFIX_FLAG): Define.
	(flags_none, flags_f, flags_cc, flags_ccf): Declare.
	(arg_none, arg_32bit_rarbrc, arg_32bit_zarbrc, arg_32bit_rbrbrc)
	(arg_32bit_rarbu6, arg_32bit_zarbu6, arg_32bit_rbrbu6)
	(arg_32bit_rbrbs12, arg_32bit_ralimmrc, arg_32bit_rarblimm)
	(arg_32bit_zalimmrc, arg_32bit_zarblimm, arg_32bit_rbrblimm)
	(arg_32bit_ralimmu6, arg_32bit_zalimmu6, arg_32bit_zalimms12)
	(arg_32bit_ralimmlimm, arg_32bit_zalimmlimm, arg_32bit_rbrc)
	(arg_32bit_zarc, arg_32bit_rbu6, arg_32bit_zau6, arg_32bit_rblimm)
	(arg_32bit_zalimm, arg_32bit_limmrc, arg_32bit_limmu6)
	(arg_32bit_limms12, arg_32bit_limmlimm): Likewise.

opcodes/
2016-04-04  Claudiu Zissulescu  <claziss@synopsys.com>

	* arc-opc.c (flags_none, flags_f, flags_cc, flags_ccf):
	Initialize.
	(arg_none, arg_32bit_rarbrc, arg_32bit_zarbrc, arg_32bit_rbrbrc)
	(arg_32bit_rarbu6, arg_32bit_zarbu6, arg_32bit_rbrbu6)
	(arg_32bit_rbrbs12, arg_32bit_ralimmrc, arg_32bit_rarblimm)
	(arg_32bit_zalimmrc, arg_32bit_zarblimm, arg_32bit_rbrblimm)
	(arg_32bit_ralimmu6, arg_32bit_zalimmu6, arg_32bit_zalimms12)
	(arg_32bit_ralimmlimm, arg_32bit_zalimmlimm, arg_32bit_rbrc)
	(arg_32bit_zarc, arg_32bit_rbu6, arg_32bit_zau6, arg_32bit_rblimm)
	(arg_32bit_zalimm, arg_32bit_limmrc, arg_32bit_limmu6)
	(arg_32bit_limms12, arg_32bit_limmlimm): Likewise.
	(arc_opcode arc_opcodes): Null terminate the array.
	(arc_num_opcodes): Remove.
	* arc-ext.h (INSERT_XOP): Define.
	(extInstruction_t): Likewise.
	(arcExtMap_instName): Delete.
	(arcExtMap_insn): New function.
	(arcExtMap_genOpcode): Likewise.
	* arc-ext.c (ExtInstruction): Remove.
	(create_map): Zero initialize instruction fields.
	(arcExtMap_instName): Remove.
	(arcExtMap_insn): New function.
	(dump_ARC_extmap): More info while debuging.
	(arcExtMap_genOpcode): New function.
	* arc-dis.c (find_format): New function.
	(print_insn_arc): Use find_format.
	(arc_get_disassembler): Enable dump_ARC_extmap only when
	debugging.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2016-04-12 10:06:07 +02:00

135 lines
3.9 KiB
C

/* ARC target-dependent stuff. Extension data structures.
Copyright (C) 1995-2016 Free Software Foundation, Inc.
This file is part of libopcodes.
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
It is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
/*This header file defines a table of extensions to the ARC processor
architecture. These extensions are read from the '.arcextmap' or
'.gnu.linkonce.arcextmap.<type>.<N>' sections in the ELF file which
is identified by the bfd parameter to the build_ARC_extmap function.
These extensions may include:
core registers
auxiliary registers
instructions
condition codes
Once the table has been constructed, accessor functions may be used
to retrieve information from it.
The build_ARC_extmap constructor function build_ARC_extmap may be
called as many times as required; it will re-initialize the table
each time. */
#ifndef ARC_EXTENSIONS_H
#define ARC_EXTENSIONS_H
#include "opcode/arc.h"
#define IGNORE_FIRST_OPD 1
/* Define this if we do not want to encode instructions based on the
ARCompact Programmer's Reference. */
#define UNMANGLED
/* This defines the kinds of extensions which may be read from the
ections in the executable files. */
enum ExtOperType
{
EXT_INSTRUCTION = 0,
EXT_CORE_REGISTER = 1,
EXT_AUX_REGISTER = 2,
EXT_COND_CODE = 3,
EXT_INSTRUCTION32 = 4,
EXT_AC_INSTRUCTION = 4,
EXT_REMOVE_CORE_REG = 5,
EXT_LONG_CORE_REGISTER = 6,
EXT_AUX_REGISTER_EXTENDED = 7,
EXT_INSTRUCTION32_EXTENDED = 8,
EXT_CORE_REGISTER_CLASS = 9
};
enum ExtReadWrite
{
REG_INVALID,
REG_READ,
REG_WRITE,
REG_READWRITE
};
/* Macro used when generating the patterns for an extension
instruction. */
#define INSERT_XOP(OP, NAME, CODE, MASK, CPU, ARG, FLG) \
do { \
(OP)->name = NAME; \
(OP)->opcode = CODE; \
(OP)->mask = MASK; \
(OP)->cpu = CPU; \
(OP)->class = ARITH; \
(OP)->subclass = NONE; \
memcpy ((OP)->operands, (ARG), MAX_INSN_ARGS); \
memcpy ((OP)->flags, (FLG), MAX_INSN_FLGS); \
(OP++); \
} while (0)
/* Typedef to hold the extension instruction definition. */
typedef struct ExtInstruction
{
/* Name. */
char *name;
/* Major opcode. */
char major;
/* Minor(sub) opcode. */
char minor;
/* Flags, holds the syntax class and modifiers. */
char flags;
/* Syntax class. Use by assembler. */
unsigned char syntax;
/* Syntax class modifier. Used by assembler. */
unsigned char modsyn;
/* Suffix class. Used by assembler. */
unsigned char suffix;
/* Pointer to the next extension instruction. */
struct ExtInstruction* next;
} extInstruction_t;
/* Constructor function. */
extern void build_ARC_extmap (bfd *);
/* Accessor functions. */
extern enum ExtReadWrite arcExtMap_coreReadWrite (int);
extern const char * arcExtMap_coreRegName (int);
extern const char * arcExtMap_auxRegName (long);
extern const char * arcExtMap_condCodeName (int);
extern const extInstruction_t *arcExtMap_insn (int, int);
extern struct arc_opcode *arcExtMap_genOpcode (const extInstruction_t *,
unsigned arc_target,
const char **errmsg);
/* Dump function (for debugging). */
extern void dump_ARC_extmap (void);
#endif /* ARC_EXTENSIONS_H */