Begin implementing ARC NPS-400 Accelerator instructions

opcodes * arc-nps400-tbl.h: Change block comments to GNU format.
        * arc-dis.c: Add new globals addrtypenames,
        addrtypenames_max, and addtypeunknown.
        (get_addrtype): New function.
        (print_insn_arc): Print colons and address types when
        required.
        * arc-opc.c: Add MAKE_INSERT_NPS_ADDRTYPE macro and use to
        define insert and extract functions for all address types.
        (arc_operands): Add operands for colon and all address
        types.
        * arc-nps-400-tbl.h: Add NPS-400 BMU instructions to opcode table.
        * arc-opc.c: Add NPS_BD_TYPE and NPS_BMU_NUM operands,
        insert_nps_bd_num_buff and extract_nps_bd_num_buff functions.
        * arc-nps-400-tbl.h: Add NPS-400 PMU instructions to opcode table.
        * arc-opc.c: Add NPS_PMU_NXT_DST and NPS_PMU_NUM_JOB operands,
        insert_nps_pmu_num_job and extract_nps_pmu_num_job functions.

include * opcode/arc.h: Add ARC_OPERAND_ADDRTYPE,
        ARC_OPERAND_COLON. Add the arc_nps_address_type enum and
        ARC_NUM_ADDRTYPES.
        * opcode/arc.h: Add BMU to insn_class_t enum.
        * opcode/arc.h: Add PMU to insn_class_t enum.

gas     * config/tc-arc.c: Add new global arc_addrtype_hash.
        Define O_colon and O_addrtype.
        (debug_exp): Add O_colon and O_addrtype.
        (tokenize_arguments): Handle colon and address type
        tokens.
        (declare_addrtype): New function.
        (md_begin): Initialise arc_addrtype_hash.
        (arc_parse_name): Add lookup of address types.
	(assemble_insn): Handle colons and address types by
        ignoring them.
        * testsuite/gas/arc/nps400-8.s: New file.
        * testsuite/gas/arc/nps400-8.d: New file.
        * testsuite/gas/arc/nps400-8.s: Add PMU instruction tests.
        * testsuite/gas/arc/nps400-8.d: Add expected PMU
        instruction output.
This commit is contained in:
Graham Markall
2016-07-27 15:57:18 +01:00
committed by Nick Clifton
parent 61d2d2b549
commit db18dbabad
11 changed files with 724 additions and 126 deletions

View File

@@ -85,6 +85,16 @@ static const char * const regnames[64] =
"r56", "r57", "ACCL", "ACCH", "lp_count", "rezerved", "LIMM", "pcl"
};
static const char * const addrtypenames[ARC_NUM_ADDRTYPES] =
{
"bd", "jid", "lbd", "mbd", "sd", "sm", "xa", "xd",
"cd", "cbd", "cjid", "clbd", "cm", "csd", "cxa", "cxd"
};
static int addrtypenames_max = ARC_NUM_ADDRTYPES - 1;
static const char * const addrtypeunknown = "unknown";
/* This structure keeps track which instruction class(es)
should be ignored durring disassembling. */
@@ -175,7 +185,7 @@ skip_this_opcode (const struct arc_opcode * opcode,
/* If we found an incompatibility then we must skip. */
if (t != NULL)
return TRUE;
/* Even if we do not precisely know the if the right mnemonics
is correctly displayed, keep the disassmbled code class
consistent. */
@@ -653,6 +663,18 @@ get_auxreg (const struct arc_opcode *opcode,
return NULL;
}
/* Convert a value representing an address type to a string used to refer to
the address type in assembly code. */
static const char *
get_addrtype (int value)
{
if (value < 0 || value > addrtypenames_max)
return addrtypeunknown;
return addrtypenames[value];
}
/* Calculate the instruction length for an instruction starting with MSB
and LSB, the most and least significant byte. The ISA_MASK is used to
filter the instructions considered to only those that are part of the
@@ -1104,8 +1126,7 @@ print_insn_arc (bfd_vma memaddr,
}
/* Only take input from real operands. */
if ((operand->flags & ARC_OPERAND_FAKE)
&& !(operand->flags & ARC_OPERAND_BRAKET))
if (ARC_OPERAND_IS_FAKE (operand))
continue;
if ((operand->flags & ARC_OPERAND_IGNORE)
@@ -1113,6 +1134,12 @@ print_insn_arc (bfd_vma memaddr,
&& value == -1)
continue;
if (operand->flags & ARC_OPERAND_COLON)
{
(*info->fprintf_func) (info->stream, ":");
continue;
}
if (need_comma)
(*info->fprintf_func) (info->stream, ",");
@@ -1124,6 +1151,8 @@ print_insn_arc (bfd_vma memaddr,
continue;
}
need_comma = TRUE;
/* Print the operand as directed by the flags. */
if (operand->flags & ARC_OPERAND_IR)
{
@@ -1145,6 +1174,7 @@ print_insn_arc (bfd_vma memaddr,
else if (operand->flags & ARC_OPERAND_LIMM)
{
const char *rname = get_auxreg (opcode, value, isa_mask);
if (rname && open_braket)
(*info->fprintf_func) (info->stream, "%s", rname);
else
@@ -1172,6 +1202,13 @@ print_insn_arc (bfd_vma memaddr,
else
(*info->fprintf_func) (info->stream, "%d", value);
}
else if (operand->flags & ARC_OPERAND_ADDRTYPE)
{
const char *addrtype = get_addrtype (value);
(*info->fprintf_func) (info->stream, "%s", addrtype);
/* A colon follow an address type. */
need_comma = FALSE;
}
else
{
if (operand->flags & ARC_OPERAND_TRUNCATE
@@ -1189,8 +1226,6 @@ print_insn_arc (bfd_vma memaddr,
(*info->fprintf_func) (info->stream, "%#x", value);
}
}
need_comma = TRUE;
}
return insn_len;