Rizin
unix-like reverse engineering framework and cli tools
arc-opc.c File Reference
#include "sysdep.h"
#include <stdio.h>
#include <string.h>
#include "ansidecl.h"
#include "arc.h"
#include "opintl.h"

Go to the source code of this file.

Macros

#define ELEMENTS_IN(arr)   (sizeof (arr) / sizeof ((arr)[0]))
 
#define INSERT_FN(fn)
 
#define EXTRACT_FN(fn)
 
#define OPERANDS   3
 
#define UNUSED   0
 
#define REGA   (UNUSED + 1)
 
#define REGB   (REGA + 1)
 
#define REGC   (REGB + 1)
 
#define SHIMMFINISH   (REGC + 1)
 
#define LIMMFINISH   (SHIMMFINISH + 1)
 
#define ST_OFFSET   (LIMMFINISH + 1)
 
#define LD_OFFSET   (ST_OFFSET + 1)
 
#define BASE   (LD_OFFSET + 1)
 
#define SYNTAX_ST_NE   (BASE + 1)
 
#define SYNTAX_LD_NE   (SYNTAX_ST_NE + 1)
 
#define SYNTAX_ST   (SYNTAX_LD_NE + 1)
 
#define SYNTAX_LD   (SYNTAX_ST + 1)
 
#define FLAG   (SYNTAX_LD + 1)
 
#define FLAGFINISH   (FLAG + 1)
 
#define FLAGINSN   (FLAGFINISH + 1)
 
#define DELAY   (FLAGINSN + 1)
 
#define COND   (DELAY + 1)
 
#define FORCELIMM   (COND + 1)
 
#define BRANCH   (FORCELIMM + 1)
 
#define JUMP   (BRANCH + 1)
 
#define JUMPFLAGS   (JUMP + 1)
 
#define SIZE1   (JUMPFLAGS + 1)
 
#define SIZE10   (SIZE1 + 1)
 
#define SIZE22   (SIZE10 + 1)
 
#define SIGN0   (SIZE22 + 1)
 
#define SIGN9   (SIGN0 + 1)
 
#define ADDRESS3   (SIGN9 + 1)
 
#define ADDRESS12   (ADDRESS3 + 1)
 
#define ADDRESS24   (ADDRESS12 + 1)
 
#define CACHEBYPASS5   (ADDRESS24 + 1)
 
#define CACHEBYPASS14   (CACHEBYPASS5 + 1)
 
#define CACHEBYPASS26   (CACHEBYPASS14 + 1)
 
#define UNOPMACRO   (CACHEBYPASS26 + 1)
 
#define MODDOT   (UNOPMACRO + 1)
 
#define REG   (MODDOT + 1)
 
#define AUXREG   (REG + 1)
 
#define UNUSED_AC   0
 
#define REGA_AC   (UNUSED_AC + 1)
 
#define REGB_SOURCE_AC   (REGA_AC + 1)
 
#define REGB_DEST_AC   (REGB_SOURCE_AC + 1)
 
#define REGC_AC   (REGB_DEST_AC + 1)
 
#define UIMM6_AC   (REGC_AC + 1)
 
#define SIMM12_AC   (UIMM6_AC + 1)
 
#define LIMM_AC   (SIMM12_AC + 1)
 
#define FORCELIMM_AC   (LIMM_AC + 1)
 
#define COND_AC   (FORCELIMM_AC + 1)
 
#define FLAG_AC   (COND_AC + 1)
 
#define FLAGFINISH_AC   (FLAG_AC + 1)
 
#define DELAY_AC   (FLAGFINISH_AC + 1)
 
#define JUMP_DELAY_AC   (DELAY_AC + 1)
 
#define SIZE1_AC   (JUMP_DELAY_AC + 1)
 
#define SIZE7_AC   (SIZE1_AC + 1)
 
#define SIZE17_AC   (SIZE7_AC + 1)
 
#define SIGN6_AC   (SIZE17_AC + 1)
 
#define SIGN16_AC   (SIGN6_AC + 1)
 
#define ADDRESS3_AC   (SIGN16_AC + 1)
 
#define ADDRESS9_AC   (ADDRESS3_AC + 1)
 
#define ADDRESS22_AC   (ADDRESS9_AC + 1)
 
#define ADDRESS22S_AC   (ADDRESS22_AC + 1)
 
#define CACHEBYPASS5_AC   (ADDRESS22S_AC + 1)
 
#define CACHEBYPASS11_AC   (CACHEBYPASS5_AC + 1)
 
#define CACHEBYPASS15_AC   (CACHEBYPASS11_AC + 1)
 
#define BASE_AC   (CACHEBYPASS15_AC + 1)
 
#define OFFSET_AC   (BASE_AC + 1)
 
#define SIMM9_AC   (OFFSET_AC + 1)
 
#define BLINK_AC   (SIMM9_AC + 1)
 
#define UNCOND_BLINK_AC   (BLINK_AC + 1)
 
#define BRANCH_AC   (UNCOND_BLINK_AC + 1)
 
#define UNCOND_BRANCH_AC   (BRANCH_AC + 1)
 
#define UIMM7BY2_AC   (UNCOND_BRANCH_AC + 1)
 
#define SIMM13BY2_AC   (UIMM7BY2_AC + 1)
 
#define SYNTAX_ST_NE_AC   (SIMM13BY2_AC + 1)
 
#define SYNTAX_LD_NE_AC   (SYNTAX_ST_NE_AC + 1)
 
#define SYNTAX_ST_AC   (SYNTAX_LD_NE_AC + 1)
 
#define SYNTAX_LD_AC   (SYNTAX_ST_AC + 1)
 
#define SYNTAX_EX_AT   (SYNTAX_LD_AC + 1)
 
#define ILINK1   (SYNTAX_EX_AT + 1)
 
#define ILINK2   (ILINK1 + 1)
 
#define MODDOT_AC   (ILINK2 + 1)
 
#define REG_AC   (MODDOT_AC + 1)
 
#define AUXREG_AC   (REG_AC + 1)
 
#define REGA_AC16   (AUXREG_AC + 1)
 
#define REGB_AC16   (REGA_AC16 + 1)
 
#define REGC_AC16   (REGB_AC16 + 1)
 
#define REGH_AC16   (REGC_AC16 + 1)
 
#define UIMM3_AC16   (REGH_AC16 + 1)
 
#define UIMM5_AC16   (UIMM3_AC16 + 1)
 
#define UIMM7_AC16   (UIMM5_AC16 + 1)
 
#define UIMM8_AC16   (UIMM7_AC16 + 1)
 
#define UIMM6BY2_AC16   (UIMM8_AC16 + 1)
 
#define UIMM7BY4_AC16   (UIMM6BY2_AC16 + 1)
 
#define UIMM10BY4_AC16   (UIMM7BY4_AC16 + 1)
 
#define COND_BRANCH_AC16   (UIMM10BY4_AC16 + 1)
 
#define CMP_BRANCH_AC16   (COND_BRANCH_AC16 + 1)
 
#define UNCOND_BRANCH_AC16   (CMP_BRANCH_AC16 + 1)
 
#define BLINK_AC16   (UNCOND_BRANCH_AC16 + 1)
 
#define SIMM9_AC16   (BLINK_AC16 + 1)
 
#define SIMM10BY2_AC16   (SIMM9_AC16 + 1)
 
#define SIMM11BY4_AC16   (SIMM10BY2_AC16 + 1)
 
#define REG_R0   (SIMM11BY4_AC16 + 1)
 
#define REG_GP   (REG_R0 + 1)
 
#define REG_SP   (REG_GP + 1)
 
#define REG_BLINK   (REG_SP + 1)
 
#define REG_PCL   (REG_BLINK + 1)
 
#define UIMM6_A700_16   (REG_PCL + 1)
 
#define SIMD_VR_DEST   (UIMM6_A700_16 + 1)
 
#define SIMD_VR_REGB   (SIMD_VR_DEST + 1)
 
#define SIMD_VR_REGC   (SIMD_VR_REGB + 1)
 
#define SIMD_U8_CONSTANT   (SIMD_VR_REGC + 1)
 
#define SIMD_I_REGB   (SIMD_U8_CONSTANT + 1)
 
#define SIMD_I_REGC   (SIMD_I_REGB + 1)
 
#define SIMD_DR_REGB   (SIMD_I_REGC + 1)
 
#define SIMD_DR_REGC   (SIMD_DR_REGB + 1)
 
#define SDASYM   (SIMD_DR_REGC + 1)
 
#define SIMD_LANEMASK   (SDASYM+1)
 
#define THROW_AC   (SIMD_LANEMASK + 1)
 
#define SIMD_I_REGA   (THROW_AC + 1)
 
#define SIMD_I_S12   (SIMD_I_REGA+1)
 
#define SIMD_K_A   (SIMD_I_S12+1)
 
#define SIMD_K_B   (SIMD_K_A+1)
 
#define SIMD_K_C   (SIMD_K_B+1)
 
#define SIMD_I_U16   (SIMD_K_C+1)
 
#define SIMD_I_UU16   (SIMD_I_U16+1)
 
#define SIMD_I_UL16   (SIMD_I_UU16+1)
 
#define SIMD_DISCARDED   (SIMD_I_UL16+1)
 
#define SIMD_I_S15   (SIMD_DISCARDED+1)
 
#define SIMD_I_ZERO   (SIMD_SIMD_I_S15+1)
 
#define LS_VALUE   0
 
#define LS_DEST   0
 
#define LS_BASE   1
 
#define LS_OFFSET   2
 
#define ST_SYNTAX(V, B, O)
 
#define LD_SYNTAX(D, B, O)
 
#define X(x, b, m)   ((unsigned)((x)&(((1<<(m))-1)<<(b)))>>(b))
 

Enumerations

enum  operand { OP_NONE , OP_REG , OP_SHIMM , OP_LIMM }
 

Functions

int arc_get_noshortcut_flag (void)
 
 INSERT_FN (insert_u8)
 
 INSERT_FN (insert_u16)
 
 INSERT_FN (insert_uu16)
 
 INSERT_FN (insert_ul16)
 
 INSERT_FN (insert_null)
 
 INSERT_FN (insert_s12)
 
 INSERT_FN (insert_s15)
 
 INSERT_FN (insert_reg)
 
 INSERT_FN (insert_shimmfinish)
 
 INSERT_FN (insert_limmfinish)
 
 INSERT_FN (insert_offset)
 
 INSERT_FN (insert_base)
 
 INSERT_FN (insert_st_syntax)
 
 INSERT_FN (insert_ld_syntax)
 
 INSERT_FN (insert_ex_syntax)
 
 INSERT_FN (insert_addr_wb)
 
 INSERT_FN (insert_flag)
 
 INSERT_FN (insert_nullify)
 
 INSERT_FN (insert_flagfinish)
 
 INSERT_FN (insert_cond)
 
 INSERT_FN (insert_forcelimm)
 
 INSERT_FN (insert_reladdr)
 
 INSERT_FN (insert_absaddr)
 
 INSERT_FN (insert_jumpflags)
 
 INSERT_FN (insert_unopmacro)
 
 EXTRACT_FN (extract_reg)
 
 EXTRACT_FN (extract_ld_offset)
 
 EXTRACT_FN (extract_ld_syntax)
 
 EXTRACT_FN (extract_st_offset)
 
 EXTRACT_FN (extract_st_syntax)
 
 EXTRACT_FN (extract_flag)
 
 EXTRACT_FN (extract_cond)
 
 EXTRACT_FN (extract_reladdr)
 
 EXTRACT_FN (extract_jumpflags)
 
 EXTRACT_FN (extract_unopmacro)
 
static arc_insn insert_u8 (arc_insn insn, long *insn2 ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_s12 (arc_insn insn, long *ex, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_u16 (arc_insn insn, long *ex, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_uu16 (arc_insn insn, long *ex, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_ul16 (arc_insn insn, long *ex, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_s15 (arc_insn insn, long *ex, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_null (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_reg (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods, const struct arc_operand_value *reg, long value, const char **errmsg)
 
static arc_insn insert_flag (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_nullify (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_flagfinish (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_cond (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_forcelimm (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_addr_wb (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_base (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods, const struct arc_operand_value *reg, long value, const char **errmsg)
 
static arc_insn insert_offset (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods, const struct arc_operand_value *reg, long value, const char **errmsg)
 
static long extract_st_syntax (arc_insn *insn, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value **opval ATTRIBUTE_UNUSED, int *invalid)
 
int arc_limm_fixup_adjust (arc_insn insn)
 
static arc_insn insert_st_syntax (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg)
 
static arc_insn insert_ld_syntax (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg)
 
static long extract_ld_syntax (arc_insn *insn, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value **opval ATTRIBUTE_UNUSED, int *invalid)
 
static arc_insn insert_ex_syntax (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg)
 
static arc_insn insert_shimmfinish (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_limmfinish (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_jumpflags (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value, const char **errmsg)
 
static arc_insn insert_unopmacro (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg ATTRIBUTE_UNUSED)
 
static arc_insn insert_reladdr (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value, const char **errmsg)
 
static arc_insn insert_absaddr (arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value *reg ATTRIBUTE_UNUSED, long value ATTRIBUTE_UNUSED, const char **errmsg)
 
void arc_opcode_init_extract (void)
 
static const struct arc_operand_valuelookup_register (int type, long regno)
 
static long extract_reg (arc_insn *insn, const struct arc_operand *operand, int mods, const struct arc_operand_value **opval, int *invalid ATTRIBUTE_UNUSED)
 
static long extract_flag (arc_insn *insn, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value **opval, int *invalid ATTRIBUTE_UNUSED)
 
static long extract_cond (arc_insn *insn, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value **opval, int *invalid ATTRIBUTE_UNUSED)
 
static long extract_reladdr (arc_insn *insn, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value **opval ATTRIBUTE_UNUSED, int *invalid ATTRIBUTE_UNUSED)
 
static long extract_jumpflags (arc_insn *insn, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value **opval ATTRIBUTE_UNUSED, int *invalid)
 
static long extract_st_offset (arc_insn *insn, const struct arc_operand *operand, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value **opval ATTRIBUTE_UNUSED, int *invalid)
 
static long extract_ld_offset (arc_insn *insn, const struct arc_operand *operand, int mods, const struct arc_operand_value **opval, int *invalid)
 
static long extract_unopmacro (arc_insn *insn, const struct arc_operand *operand ATTRIBUTE_UNUSED, int mods ATTRIBUTE_UNUSED, const struct arc_operand_value **opval ATTRIBUTE_UNUSED, int *invalid)
 
int arc_get_opcode_mach (int bfd_mach, int big_p)
 
void arc_opcode_init_tables (int flags)
 
int arc_opcode_supported (const struct arc_opcode *opcode)
 
int arc_opval_supported (const struct arc_operand_value *opval ATTRIBUTE_UNUSED)
 
const struct arc_opcodearc_opcode_lookup_asm (const char *insn)
 
const struct arc_opcodearc_opcode_lookup_dis (unsigned int insn)
 
int arc_test_wb (void)
 
void arc_opcode_init_insert (void)
 
int arc_opcode_limm_p (long *limmp)
 
const struct arc_operand_valuearc_opcode_lookup_suffix (const struct arc_operand *type, int value)
 
int arc_insn_is_j (arc_insn)
 
int ac_lpcc_insn (arc_insn insn)
 
int ac_add_reg_sdasym_insn (arc_insn)
 
int ac_get_load_sdasym_insn_type (arc_insn, int)
 
int ac_get_store_sdasym_insn_type (arc_insn, int)
 
int arc_insn_not_jl (arc_insn insn)
 
int a4_brk_insn (arc_insn insn)
 
int ac_brk_s_insn (arc_insn insn)
 
int ac_branch_or_jump_insn (arc_insn insn, int compact_insn_16)
 
int ARC700_rtie_insn (arc_insn insn)
 
int ac_get_store_sdasym_insn_type (arc_insn insn, int compact_insn_16 ATTRIBUTE_UNUSED)
 
int ac_constant_operand (const struct arc_operand *op)
 
int ARC700_register_simd_operand (char fmt)
 
int ac_register_operand (const struct arc_operand *op)
 
int ac_symbol_operand (const struct arc_operand *op)
 
int arc_operand_type (int opertype)
 
struct arc_operand_valueget_ext_suffix (char *s, char field)
 
char * arc_aux_reg_name (int regVal)
 

Variables

static int flag_p
 
static int flagshimm_handled_p
 
static int addrwb_p
 
static int nullify_p
 
static int nullify
 
static int jumpflags_p
 
static int shimm_p
 
static int shimm
 
static int limm_p
 
static long limm
 
static int cpu_type
 
static unsigned char arc_operand_map_a4 [256]
 
static unsigned char arc_operand_map_ac [256]
 
static enum operand ls_operand [OPERANDS]
 
static const struct arc_operand arc_operands_a4 []
 
static const struct arc_operand arc_operands_ac []
 
int arc_cond_p
 
int arc_mach_a4 = 1
 
unsigned long arc_ld_ext_mask = 1 << (62 - 32)
 
int arc_user_mode_only = 0
 
struct arc_ext_operand_valuearc_ext_operands
 
unsigned char * arc_operand_map = arc_operand_map_a4
 
const struct arc_operandarc_operands = arc_operands_a4
 
static struct arc_opcode arc_opcodes []
 
static const struct arc_operand_value arc_reg_names_a4 []
 
static const struct arc_operand_value arc_reg_names_a500600 []
 
static const struct arc_operand_value arc_reg_names_a700 []
 
const struct arc_operand_valuearc_reg_names = arc_reg_names_a4
 
int arc_reg_names_count
 
static const struct arc_operand_value arc_suffixes_a4 []
 
static const struct arc_operand_value arc_suffixes_ac []
 
const struct arc_operand_valuearc_suffixes = arc_suffixes_a4
 
int arc_suffixes_count
 
static struct arc_opcodeopcode_map [26+1]
 
static struct arc_opcodeicode_map [32]
 

Macro Definition Documentation

◆ ADDRESS12

#define ADDRESS12   (ADDRESS3 + 1)

◆ ADDRESS22_AC

#define ADDRESS22_AC   (ADDRESS9_AC + 1)

◆ ADDRESS22S_AC

#define ADDRESS22S_AC   (ADDRESS22_AC + 1)

◆ ADDRESS24

#define ADDRESS24   (ADDRESS12 + 1)

◆ ADDRESS3

#define ADDRESS3   (SIGN9 + 1)

◆ ADDRESS3_AC

#define ADDRESS3_AC   (SIGN16_AC + 1)

◆ ADDRESS9_AC

#define ADDRESS9_AC   (ADDRESS3_AC + 1)

◆ AUXREG

#define AUXREG   (REG + 1)

◆ AUXREG_AC

#define AUXREG_AC   (REG_AC + 1)

◆ BASE

#define BASE   (LD_OFFSET + 1)

◆ BASE_AC

#define BASE_AC   (CACHEBYPASS15_AC + 1)

◆ BLINK_AC

#define BLINK_AC   (SIMM9_AC + 1)

◆ BLINK_AC16

#define BLINK_AC16   (UNCOND_BRANCH_AC16 + 1)

◆ BRANCH

#define BRANCH   (FORCELIMM + 1)

◆ BRANCH_AC

#define BRANCH_AC   (UNCOND_BLINK_AC + 1)

◆ CACHEBYPASS11_AC

#define CACHEBYPASS11_AC   (CACHEBYPASS5_AC + 1)

◆ CACHEBYPASS14

#define CACHEBYPASS14   (CACHEBYPASS5 + 1)

◆ CACHEBYPASS15_AC

#define CACHEBYPASS15_AC   (CACHEBYPASS11_AC + 1)

◆ CACHEBYPASS26

#define CACHEBYPASS26   (CACHEBYPASS14 + 1)

◆ CACHEBYPASS5

#define CACHEBYPASS5   (ADDRESS24 + 1)

◆ CACHEBYPASS5_AC

#define CACHEBYPASS5_AC   (ADDRESS22S_AC + 1)

◆ CMP_BRANCH_AC16

#define CMP_BRANCH_AC16   (COND_BRANCH_AC16 + 1)

◆ COND

#define COND   (DELAY + 1)

◆ COND_AC

#define COND_AC   (FORCELIMM_AC + 1)

◆ COND_BRANCH_AC16

#define COND_BRANCH_AC16   (UIMM10BY4_AC16 + 1)

◆ DELAY

#define DELAY   (FLAGINSN + 1)

◆ DELAY_AC

#define DELAY_AC   (FLAGFINISH_AC + 1)

◆ ELEMENTS_IN

#define ELEMENTS_IN (   arr)    (sizeof (arr) / sizeof ((arr)[0]))

Definition at line 46 of file arc-opc.c.

◆ EXTRACT_FN

#define EXTRACT_FN (   fn)
Value:
static long fn (arc_insn *, const struct arc_operand *, \
int, const struct arc_operand_value **, int *)
unsigned int arc_insn
Definition: arc.h:62
static const char struct stat static buf struct stat static buf static idle const char static path static fd const char static len const void static prot const char struct module static image struct kernel_sym static table unsigned char static buf static fsuid unsigned struct dirent unsigned static count const struct iovec static count static pid const void static len static flags const struct sched_param static p static pid static policy struct timespec static tp static suid unsigned fn
Definition: sflib.h:186

Definition at line 60 of file arc-opc.c.

◆ FLAG

#define FLAG   (SYNTAX_LD + 1)

◆ FLAG_AC

#define FLAG_AC   (COND_AC + 1)

◆ FLAGFINISH

#define FLAGFINISH   (FLAG + 1)

◆ FLAGFINISH_AC

#define FLAGFINISH_AC   (FLAG_AC + 1)

◆ FLAGINSN

#define FLAGINSN   (FLAGFINISH + 1)

◆ FORCELIMM

#define FORCELIMM   (COND + 1)

◆ FORCELIMM_AC

#define FORCELIMM_AC   (LIMM_AC + 1)

◆ ILINK1

#define ILINK1   (SYNTAX_EX_AT + 1)

◆ ILINK2

#define ILINK2   (ILINK1 + 1)

◆ INSERT_FN

#define INSERT_FN (   fn)
Value:
static arc_insn fn (arc_insn, long *, const struct arc_operand *, \
int, const struct arc_operand_value *, long, \
const char **)

Definition at line 55 of file arc-opc.c.

◆ JUMP

#define JUMP   (BRANCH + 1)

◆ JUMP_DELAY_AC

#define JUMP_DELAY_AC   (DELAY_AC + 1)

◆ JUMPFLAGS

#define JUMPFLAGS   (JUMP + 1)

◆ LD_OFFSET

#define LD_OFFSET   (ST_OFFSET + 1)

◆ LD_SYNTAX

#define LD_SYNTAX (   D,
  B,
  O 
)
Value:
( (ls_operand[LS_DEST] == (D) \
&& ls_operand[LS_BASE] == (B) \
&& ls_operand[LS_OFFSET] == (O)))
#define LS_OFFSET
Definition: arc-opc.c:885
#define LS_BASE
Definition: arc-opc.c:884
static enum operand ls_operand[OPERANDS]
Definition: arc-opc.c:154
#define LS_DEST
Definition: arc-opc.c:883
#define B(x)
Definition: arc.h:166
#define D
Definition: block.c:38
#define O
Definition: rcond.c:14

◆ LIMM_AC

#define LIMM_AC   (SIMM12_AC + 1)

◆ LIMMFINISH

#define LIMMFINISH   (SHIMMFINISH + 1)

◆ LS_BASE

#define LS_BASE   1

Definition at line 884 of file arc-opc.c.

◆ LS_DEST

#define LS_DEST   0

Definition at line 883 of file arc-opc.c.

◆ LS_OFFSET

#define LS_OFFSET   2

Definition at line 885 of file arc-opc.c.

◆ LS_VALUE

#define LS_VALUE   0

Definition at line 882 of file arc-opc.c.

◆ MODDOT

#define MODDOT   (UNOPMACRO + 1)

◆ MODDOT_AC

#define MODDOT_AC   (ILINK2 + 1)

◆ OFFSET_AC

#define OFFSET_AC   (BASE_AC + 1)

◆ OPERANDS

#define OPERANDS   3

Definition at line 152 of file arc-opc.c.

◆ REG

#define REG   (MODDOT + 1)

◆ REG_AC

#define REG_AC   (MODDOT_AC + 1)

◆ REG_BLINK

#define REG_BLINK   (REG_SP + 1)

◆ REG_GP

#define REG_GP   (REG_R0 + 1)

◆ REG_PCL

#define REG_PCL   (REG_BLINK + 1)

◆ REG_R0

#define REG_R0   (SIMM11BY4_AC16 + 1)

◆ REG_SP

#define REG_SP   (REG_GP + 1)

◆ REGA

#define REGA   (UNUSED + 1)

◆ REGA_AC

#define REGA_AC   (UNUSED_AC + 1)

◆ REGA_AC16

#define REGA_AC16   (AUXREG_AC + 1)

◆ REGB

#define REGB   (REGA + 1)

◆ REGB_AC16

#define REGB_AC16   (REGA_AC16 + 1)

◆ REGB_DEST_AC

#define REGB_DEST_AC   (REGB_SOURCE_AC + 1)

◆ REGB_SOURCE_AC

#define REGB_SOURCE_AC   (REGA_AC + 1)

◆ REGC

#define REGC   (REGB + 1)

◆ REGC_AC

#define REGC_AC   (REGB_DEST_AC + 1)

◆ REGC_AC16

#define REGC_AC16   (REGB_AC16 + 1)

◆ REGH_AC16

#define REGH_AC16   (REGC_AC16 + 1)

◆ SDASYM

#define SDASYM   (SIMD_DR_REGC + 1)

◆ SHIMMFINISH

#define SHIMMFINISH   (REGC + 1)

◆ SIGN0

#define SIGN0   (SIZE22 + 1)

◆ SIGN16_AC

#define SIGN16_AC   (SIGN6_AC + 1)

◆ SIGN6_AC

#define SIGN6_AC   (SIZE17_AC + 1)

◆ SIGN9

#define SIGN9   (SIGN0 + 1)

◆ SIMD_DISCARDED

#define SIMD_DISCARDED   (SIMD_I_UL16+1)

◆ SIMD_DR_REGB

#define SIMD_DR_REGB   (SIMD_I_REGC + 1)

◆ SIMD_DR_REGC

#define SIMD_DR_REGC   (SIMD_DR_REGB + 1)

◆ SIMD_I_REGA

#define SIMD_I_REGA   (THROW_AC + 1)

◆ SIMD_I_REGB

#define SIMD_I_REGB   (SIMD_U8_CONSTANT + 1)

◆ SIMD_I_REGC

#define SIMD_I_REGC   (SIMD_I_REGB + 1)

◆ SIMD_I_S12

#define SIMD_I_S12   (SIMD_I_REGA+1)

◆ SIMD_I_S15

#define SIMD_I_S15   (SIMD_DISCARDED+1)

◆ SIMD_I_U16

#define SIMD_I_U16   (SIMD_K_C+1)

◆ SIMD_I_UL16

#define SIMD_I_UL16   (SIMD_I_UU16+1)

◆ SIMD_I_UU16

#define SIMD_I_UU16   (SIMD_I_U16+1)

◆ SIMD_I_ZERO

#define SIMD_I_ZERO   (SIMD_SIMD_I_S15+1)

◆ SIMD_K_A

#define SIMD_K_A   (SIMD_I_S12+1)

◆ SIMD_K_B

#define SIMD_K_B   (SIMD_K_A+1)

◆ SIMD_K_C

#define SIMD_K_C   (SIMD_K_B+1)

◆ SIMD_LANEMASK

#define SIMD_LANEMASK   (SDASYM+1)

◆ SIMD_U8_CONSTANT

#define SIMD_U8_CONSTANT   (SIMD_VR_REGC + 1)

◆ SIMD_VR_DEST

#define SIMD_VR_DEST   (UIMM6_A700_16 + 1)

◆ SIMD_VR_REGB

#define SIMD_VR_REGB   (SIMD_VR_DEST + 1)

◆ SIMD_VR_REGC

#define SIMD_VR_REGC   (SIMD_VR_REGB + 1)

◆ SIMM10BY2_AC16

#define SIMM10BY2_AC16   (SIMM9_AC16 + 1)

◆ SIMM11BY4_AC16

#define SIMM11BY4_AC16   (SIMM10BY2_AC16 + 1)

◆ SIMM12_AC

#define SIMM12_AC   (UIMM6_AC + 1)

◆ SIMM13BY2_AC

#define SIMM13BY2_AC   (UIMM7BY2_AC + 1)

◆ SIMM9_AC

#define SIMM9_AC   (OFFSET_AC + 1)

◆ SIMM9_AC16

#define SIMM9_AC16   (BLINK_AC16 + 1)

◆ SIZE1

#define SIZE1   (JUMPFLAGS + 1)

◆ SIZE10

#define SIZE10   (SIZE1 + 1)

◆ SIZE17_AC

#define SIZE17_AC   (SIZE7_AC + 1)

◆ SIZE1_AC

#define SIZE1_AC   (JUMP_DELAY_AC + 1)

◆ SIZE22

#define SIZE22   (SIZE10 + 1)

◆ SIZE7_AC

#define SIZE7_AC   (SIZE1_AC + 1)

◆ ST_OFFSET

#define ST_OFFSET   (LIMMFINISH + 1)

◆ ST_SYNTAX

#define ST_SYNTAX (   V,
  B,
  O 
)
Value:
((ls_operand[LS_VALUE] == (V) && \
ls_operand[LS_BASE] == (B) && \
ls_operand[LS_OFFSET] == (O)))
#define LS_VALUE
Definition: arc-opc.c:882
#define V(handle, symbol)

◆ SYNTAX_EX_AT

#define SYNTAX_EX_AT   (SYNTAX_LD_AC + 1)

◆ SYNTAX_LD

#define SYNTAX_LD   (SYNTAX_ST + 1)

◆ SYNTAX_LD_AC

#define SYNTAX_LD_AC   (SYNTAX_ST_AC + 1)

◆ SYNTAX_LD_NE

#define SYNTAX_LD_NE   (SYNTAX_ST_NE + 1)

◆ SYNTAX_LD_NE_AC

#define SYNTAX_LD_NE_AC   (SYNTAX_ST_NE_AC + 1)

◆ SYNTAX_ST

#define SYNTAX_ST   (SYNTAX_LD_NE + 1)

◆ SYNTAX_ST_AC

#define SYNTAX_ST_AC   (SYNTAX_LD_NE_AC + 1)

◆ SYNTAX_ST_NE

#define SYNTAX_ST_NE   (BASE + 1)

◆ SYNTAX_ST_NE_AC

#define SYNTAX_ST_NE_AC   (SIMM13BY2_AC + 1)

◆ THROW_AC

#define THROW_AC   (SIMD_LANEMASK + 1)

◆ UIMM10BY4_AC16

#define UIMM10BY4_AC16   (UIMM7BY4_AC16 + 1)

◆ UIMM3_AC16

#define UIMM3_AC16   (REGH_AC16 + 1)

◆ UIMM5_AC16

#define UIMM5_AC16   (UIMM3_AC16 + 1)

◆ UIMM6_A700_16

#define UIMM6_A700_16   (REG_PCL + 1)

◆ UIMM6_AC

#define UIMM6_AC   (REGC_AC + 1)

◆ UIMM6BY2_AC16

#define UIMM6BY2_AC16   (UIMM8_AC16 + 1)

◆ UIMM7_AC16

#define UIMM7_AC16   (UIMM5_AC16 + 1)

◆ UIMM7BY2_AC

#define UIMM7BY2_AC   (UNCOND_BRANCH_AC + 1)

◆ UIMM7BY4_AC16

#define UIMM7BY4_AC16   (UIMM6BY2_AC16 + 1)

◆ UIMM8_AC16

#define UIMM8_AC16   (UIMM7_AC16 + 1)

◆ UNCOND_BLINK_AC

#define UNCOND_BLINK_AC   (BLINK_AC + 1)

◆ UNCOND_BRANCH_AC

#define UNCOND_BRANCH_AC   (BRANCH_AC + 1)

◆ UNCOND_BRANCH_AC16

#define UNCOND_BRANCH_AC16   (CMP_BRANCH_AC16 + 1)

◆ UNOPMACRO

#define UNOPMACRO   (CACHEBYPASS26 + 1)

◆ UNUSED

#define UNUSED   0

◆ UNUSED_AC

#define UNUSED_AC   0

◆ X

#define X (   x,
  b,
 
)    ((unsigned)((x)&(((1<<(m))-1)<<(b)))>>(b))

Enumeration Type Documentation

◆ operand

enum operand
Enumerator
OP_NONE 
OP_REG 
OP_SHIMM 
OP_LIMM 

Definition at line 39 of file arc-opc.c.

@ OP_LIMM
Definition: arc-opc.c:39
@ OP_NONE
Definition: arc-opc.c:39
@ OP_REG
Definition: arc-opc.c:39
@ OP_SHIMM
Definition: arc-opc.c:39

Function Documentation

◆ a4_brk_insn()

int a4_brk_insn ( arc_insn  insn)

Definition at line 4549 of file arc-opc.c.

4551 {
4552  return insn == 0x1ffffe00;
4553 }

◆ ac_add_reg_sdasym_insn()

int ac_add_reg_sdasym_insn ( arc_insn  insn)

Definition at line 4595 of file arc-opc.c.

4596 {
4597  return ((insn & 0xf8ff0fc0) == 0x20000f80);
4598 }

Referenced by insert_reg().

◆ ac_branch_or_jump_insn()

int ac_branch_or_jump_insn ( arc_insn  insn,
int  compact_insn_16 
)

Definition at line 4569 of file arc-opc.c.

4570 {
4571 
4572  return ((!compact_insn_16 && ((insn & I(-1)) == I(0x4)) &&
4573  (((insn >> 18) & 0xf) == 0x8)) ||
4574  (compact_insn_16 && ((insn & I(-1)) == I(0xf))) ||
4575  (!compact_insn_16 && ((insn & I(-1)) == I(0x1))) ||
4576  (compact_insn_16 && ((insn & I(-1)) == I(0x1f))) ||
4577  (!compact_insn_16 && ((insn & I(-1)) == I(0x0))) ||
4578  (compact_insn_16 && ((insn & I(-1)) == I(0x1e))));
4579 }
#define I(x)
Definition: arc.h:164

References I.

◆ ac_brk_s_insn()

int ac_brk_s_insn ( arc_insn  insn)

Definition at line 4559 of file arc-opc.c.

4560 {
4561  return insn == 0x7fff;
4562 }

◆ ac_constant_operand()

int ac_constant_operand ( const struct arc_operand op)

Definition at line 4737 of file arc-opc.c.

4738 {
4739  switch (op->fmt)
4740  {
4741  case '@': /* This is valid only for A700 . The checks in the instruction patterns would take care of other checks.*/
4742 
4743  case 'u':
4744  case 'K':
4745  case 'L':
4746  case 'o':
4747  case 'e':
4748  case 'E':
4749  case 'j':
4750  case 'J':
4751  case 'k':
4752  case 'l':
4753  case 'm':
4754  case 'M':
4755  case 'O':
4756  case 'R':
4757  /* Operands for the Aurora SIMD ISA*/
4758  case '?':
4759  case '\14':
4760  case '\20':
4761  case '\21':
4762  case '\22':
4763  case '\23':
4764  case '\24':
4765  case '\25':
4766 
4767  return 1;
4768  }
4769  return 0;
4770 }
Definition: dis.c:32

◆ ac_get_load_sdasym_insn_type()

int ac_get_load_sdasym_insn_type ( arc_insn  insn,
int  compact_insn_16 
)

Definition at line 4625 of file arc-opc.c.

4626 {
4627  int load_type = -1;
4628 
4629  /* ld[b/w]_s */
4630  if (compact_insn_16)
4631  {
4632  switch (insn & 0xfe00)
4633  {
4634  /* ld_s */
4635  case 0xc800:
4636  load_type = 10;
4637  break;
4638 
4639  /* ldb_s */
4640  case 0xca00:
4641  load_type = 11;
4642  break;
4643 
4644  /* ldw_s */
4645  case 0xcc00:
4646  load_type = 12;
4647  break;
4648  }
4649  }
4650  else
4651  {
4652  /* ld/ldw/ldb */
4653  switch (insn & 0xf8000180)
4654  {
4655  /* ld */
4656  case 0x10000000:
4657  if (((insn >> 9) & 3) == 3) {
4658  load_type = 0;
4659  } else {
4660  load_type = 1;
4661  }
4662  break;
4663 
4664  /* ldw */
4665  case 0x10000100:
4666  if (((insn >> 9) & 3) == 3) {
4667  load_type = 2;
4668  } else {
4669  load_type = 1;
4670  }
4671  break;
4672 
4673  /* ldb */
4674  case 0x10000080:
4675  load_type = 1;
4676  break;
4677 
4678  }
4679  }
4680 
4681  return load_type;
4682 }

◆ ac_get_store_sdasym_insn_type() [1/2]

int ac_get_store_sdasym_insn_type ( arc_insn  insn,
int compact_insn_16  ATTRIBUTE_UNUSED 
)

Definition at line 4697 of file arc-opc.c.

4699 {
4700  int store_type = -1;
4701 
4702  /* st/stw/stb */
4703  switch (insn & 0xf8000007)
4704  {
4705  /* st */
4706  case 0x18000000:
4707  if (((insn >> 3) & 3) == 3) {
4708  store_type = 0;
4709  } else {
4710  store_type = 1;
4711  }
4712  break;
4713 
4714  /* stw */
4715  case 0x18000004:
4716  if (((insn >> 3) & 3) == 3) {
4717  store_type = 2;
4718  } else {
4719  store_type = 1;
4720  }
4721  break;
4722 
4723  /* stb */
4724  case 0x18000002:
4725  store_type = 1;
4726  break;
4727 
4728  }
4729 
4730  return store_type;
4731 }

◆ ac_get_store_sdasym_insn_type() [2/2]

int ac_get_store_sdasym_insn_type ( arc_insn  ,
int   
)

◆ ac_lpcc_insn()

int ac_lpcc_insn ( arc_insn  insn)

Definition at line 4586 of file arc-opc.c.

4587 {
4588  return ( ((insn & 0xfffff000) == 0x20a80000) ||
4589  ((insn & 0xfffff020) == 0x20a80020));
4590 }

◆ ac_register_operand()

int ac_register_operand ( const struct arc_operand op)

Definition at line 4803 of file arc-opc.c.

4804 {
4805  switch (op->fmt)
4806  {
4807  case 'a':
4808  case 'b':
4809  case 'c':
4810  case 'A':
4811  case 'B':
4812  case '#':
4813  case 'C':
4814  case 'U':
4815  case 'g':
4816  case 'G':
4817  case 'r':
4818  case '4':
4819  case '5':
4820  case '6':
4821  case '7':
4822  case '8':
4823  case '9':
4824  case '!':
4825  return 1;
4826  }
4827  return 0;
4828 }

◆ ac_symbol_operand()

int ac_symbol_operand ( const struct arc_operand op)

Definition at line 4833 of file arc-opc.c.

4834 {
4835  switch (op->fmt)
4836  {
4837  case 'L':
4838  case 'd':
4839  case 'h':
4840  case 'H':
4841  case 'i':
4842  case 'I':
4843  case 'y':
4844  case 'Y':
4845  case 's':
4846  case 'S':
4847  case 'Z':
4848  case 'W':
4849  return 1;
4850  }
4851  return 0;
4852 }

◆ ARC700_register_simd_operand()

int ARC700_register_simd_operand ( char  fmt)

Definition at line 4776 of file arc-opc.c.

4777 {
4778  switch (fmt)
4779  {
4780  case '*':
4781  case '(':
4782  case ')':
4783  return 1; /*If the operand belongs to the Vector register(Vrxx) set*/
4784  case '<':
4785  case '>':
4786  return 2; /*If the operand belongs to the DMA registers (DRxx) set*/
4787  case '\13':
4788  case '{':
4789  case '}':
4790  return 3; /*If the operand belongs to the Scalar register (Ixx) set*/
4791  case '\15':
4792  case '\16':
4793  case '\17':
4794  return 4; /*If the operand belongs to the Scalar register (Kxx) set*/
4795  }
4796  return 0;
4797 }

◆ ARC700_rtie_insn()

int ARC700_rtie_insn ( arc_insn  insn)

Definition at line 4603 of file arc-opc.c.

4604 {
4605  return insn == 0x242f003f;
4606 }

◆ arc_aux_reg_name()

char* arc_aux_reg_name ( int  regVal)

Definition at line 4965 of file arc-opc.c.

4966 {
4967  int i;
4968 
4969  for (i= arc_reg_names_count ; i > 0 ; i--)
4970  {
4971  if ((arc_reg_names[i].type == AUXREG_AC) && (arc_reg_names[i].value == regVal)) {
4972  return arc_reg_names[i].name;
4973  }
4974  }
4975 
4976  return NULL;
4977 }
lzma_index ** i
Definition: index.h:629
int arc_reg_names_count
Definition: arc-opc.c:4101
const struct arc_operand_value * arc_reg_names
Definition: arc-opc.c:4100
#define AUXREG_AC
static int value
Definition: cmd_api.c:93
#define NULL
Definition: cris-opc.c:27
int type
Definition: mipsasm.c:17
char * name
Definition: arc.h:190

References arc_reg_names, arc_reg_names_count, AUXREG_AC, i, arc_operand_value::name, NULL, type, and value.

Referenced by my_sprintf().

◆ arc_get_noshortcut_flag()

int arc_get_noshortcut_flag ( void  )

Definition at line 4958 of file arc-opc.c.

4959 {
4960  return ARC_REGISTER_NOSHORT_CUT;
4961 }
#define ARC_REGISTER_NOSHORT_CUT
Definition: arc.h:311

References ARC_REGISTER_NOSHORT_CUT.

◆ arc_get_opcode_mach()

int arc_get_opcode_mach ( int  bfd_mach,
int  big_p 
)

Definition at line 4282 of file arc-opc.c.

4283 {
4284  static int mach_type_map[] =
4285  {
4286  ARC_MACH_ARC4,
4287  ARC_MACH_ARC5,
4288  ARC_MACH_ARC6,
4289  ARC_MACH_ARC7,
4291  };
4292 
4293  return mach_type_map[bfd_mach] | (big_p ? ARC_MACH_BIG : 0);
4294 }
#define ARC_MACH_ARC4
Definition: arc.h:41
#define ARC_MACH_ARC7
Definition: arc.h:44
#define ARC_MACH_ARC5
Definition: arc.h:42
#define ARC_MACH_ARC6
Definition: arc.h:43
#define ARC_MACH_BIG
Definition: arc.h:51
#define ARC_MACH_ARC601
Definition: arc.h:45

References ARC_MACH_ARC4, ARC_MACH_ARC5, ARC_MACH_ARC6, ARC_MACH_ARC601, ARC_MACH_ARC7, and ARC_MACH_BIG.

◆ arc_insn_is_j()

int arc_insn_is_j ( arc_insn  insn)

Definition at line 4532 of file arc-opc.c.

4533 {
4534  return (insn & (I(-1))) == I(0x7);
4535 }

References I.

◆ arc_insn_not_jl()

int arc_insn_not_jl ( arc_insn  insn)

Definition at line 4539 of file arc-opc.c.

4540 {
4541  return ((insn & (I(-1)|A(-1)|C(-1)|R(-1,7,1)|R(-1,9,1)))
4542  != (I(0x7) | R(-1,9,1)));
4543 }
#define A(x)
Definition: arc.h:165
#define R(x, b, m)
Definition: arc.h:168
#define C(x)
Definition: arc.h:167

References A, C, I, and R.

◆ arc_limm_fixup_adjust()

int arc_limm_fixup_adjust ( arc_insn  insn)

Definition at line 1658 of file arc-opc.c.

1659 {
1660  int retval = 0;
1661 
1662  /* Check for st shimm,[limm]. */
1663 
1664  if ((insn & (I(-1) | C(-1) | B(-1))) ==
1665  (I(2) | C(ARC_REG_SHIMM) | B(ARC_REG_LIMM)))
1666  {
1667  retval = insn & 0x1ff;
1668  if (retval & 0x100) { /* Sign extend 9 bit offset. */
1669  retval |= ~0x1ff;
1670  }
1671  }
1672  return -retval; /* Negate offset for return. */
1673 }
#define ARC_REG_LIMM
Definition: analysis_arc.c:13
#define ARC_REG_SHIMM
Definition: arc.h:408

References ARC_REG_LIMM, ARC_REG_SHIMM, B, C, and I.

Referenced by insert_st_syntax().

◆ arc_opcode_init_extract()

void arc_opcode_init_extract ( void  )

Definition at line 2131 of file arc-opc.c.

2132 {
2134 }
void arc_opcode_init_insert(void)
Definition: arc-opc.c:4457

References arc_opcode_init_insert().

◆ arc_opcode_init_insert()

void arc_opcode_init_insert ( void  )

Definition at line 4457 of file arc-opc.c.

4458 {
4459  int i;
4460 
4461  for (i = 0; i < OPERANDS; i++) {
4462  ls_operand[i] = OP_NONE;
4463  }
4464 
4465  flag_p = 0;
4466  flagshimm_handled_p = 0;
4467  arc_cond_p = 0;
4468  addrwb_p = 0;
4469  shimm_p = 0;
4470  limm_p = 0;
4471  jumpflags_p = 0;
4472  nullify_p = 0;
4473  nullify = 0; /* The default is important. */
4474 }
static int flagshimm_handled_p
Definition: arc-opc.c:110
static int addrwb_p
Definition: arc-opc.c:113
static int flag_p
Definition: arc-opc.c:107
static int nullify_p
Definition: arc-opc.c:116
static int limm_p
Definition: arc-opc.c:133
static int nullify
Definition: arc-opc.c:119
#define OPERANDS
Definition: arc-opc.c:152
static int shimm_p
Definition: arc-opc.c:125
static int jumpflags_p
Definition: arc-opc.c:122
int arc_cond_p
Definition: arc-opc.c:858

References addrwb_p, arc_cond_p, flag_p, flagshimm_handled_p, i, jumpflags_p, limm_p, ls_operand, nullify, nullify_p, OP_NONE, OPERANDS, and shimm_p.

Referenced by arc_opcode_init_extract().

◆ arc_opcode_init_tables()

void arc_opcode_init_tables ( int  flags)

Definition at line 4304 of file arc-opc.c.

4305 {
4306  static int init_p = 0;
4307 
4308  /* If initialization was already done but current cpu type is different
4309  from the one for which initialization was done earlier, then do
4310  initialization again */
4311  if (init_p && cpu_type != flags) {
4312  init_p = 0;
4313  }
4314 
4315  cpu_type = flags;
4316 
4317  /* We may be intentionally called more than once (for example gdb will call
4318  us each time the user switches cpu). These tables only need to be init'd
4319  once though. */
4320  /* ??? We can remove the need for arc_opcode_supported by taking it into
4321  account here, but I'm not sure I want to do that yet (if ever). */
4322  if (!init_p)
4323  {
4324  int i;
4325 
4326  if (arc_mach_a4)
4327  {
4328  /* Initialize operand map table for ARCtanget-A4 */
4330 
4331  for (i = 0; i < (int)ELEMENTS_IN (arc_operands_a4); i++) {
4333  }
4334 
4335  /* Set the pointers to operand table, operand map table */
4342  }
4343  else
4344  {
4345  /* Initialize operand map table for ARCompact */
4347 
4348  for (i = 0; i < (int)ELEMENTS_IN (arc_operands_ac); i++) {
4350  }
4351 
4352  /* Set the pointers to operand table, operand map table */
4355 
4356  /* Codito :: Ideally all the checking should be on this
4357  basis and not on flags shared across the libraries as seems
4358  to be the case for A4. Would have to check that and test
4359  it at some point in time.
4360  */
4362  {
4365  }
4366  else
4367  {
4370  }
4373  }
4374 
4375  memset (opcode_map, 0, sizeof (opcode_map));
4376  memset (icode_map, 0, sizeof (icode_map));
4377 
4378  /* Scan the table backwards so macros appear at the front. */
4379  for (i = ELEMENTS_IN(arc_opcodes) - 1; i >= 0; --i)
4380  {
4381  int opcode_hash = ARC_HASH_OPCODE (arc_opcodes[i].syntax);
4382  int icode_hash = ARC_HASH_ICODE (arc_opcodes[i].value);
4383 
4384  arc_opcodes[i].next_asm = opcode_map[opcode_hash];
4385  opcode_map[opcode_hash] = &arc_opcodes[i];
4386 
4387  arc_opcodes[i].next_dis = icode_map[icode_hash];
4388  icode_map[icode_hash] = &arc_opcodes[i];
4389  }
4390 
4391  init_p = 1;
4392  }
4393 }
static int cpu_type
Definition: arc-opc.c:143
static struct arc_opcode * opcode_map[26+1]
Definition: arc-opc.c:4269
static unsigned char arc_operand_map_ac[256]
Definition: arc-opc.c:149
#define ELEMENTS_IN(arr)
Definition: arc-opc.c:46
static struct arc_opcode arc_opcodes[]
Definition: arc-opc.c:2487
static const struct arc_operand_value arc_reg_names_a4[]
Definition: arc-opc.c:3818
static const struct arc_operand_value arc_reg_names_a700[]
Definition: arc-opc.c:3937
static const struct arc_operand_value arc_suffixes_a4[]
Definition: arc-opc.c:4108
int arc_mach_a4
Definition: arc-opc.c:866
int arc_suffixes_count
Definition: arc-opc.c:4265
const struct arc_operand * arc_operands
Definition: arc-opc.c:893
static struct arc_opcode * icode_map[32]
Definition: arc-opc.c:4272
static unsigned char arc_operand_map_a4[256]
Definition: arc-opc.c:148
const struct arc_operand_value * arc_suffixes
Definition: arc-opc.c:4264
static const struct arc_operand arc_operands_ac[]
Definition: arc-opc.c:489
unsigned char * arc_operand_map
Definition: arc-opc.c:889
static const struct arc_operand_value arc_reg_names_a500600[]
Definition: arc-opc.c:3884
static const struct arc_operand arc_operands_a4[]
Definition: arc-opc.c:207
static const struct arc_operand_value arc_suffixes_ac[]
Definition: arc-opc.c:4199
#define ARC_HASH_ICODE(insn)
Definition: arc.h:179
#define ARC_OPCODE_CPU(bits)
Definition: arc.h:73
#define ARC_HASH_OPCODE(string)
Definition: arc.h:177
return memset(p, 0, total)
static struct sockaddr static addrlen static backlog const void static flags void flags
Definition: sfsocketcall.h:123
static int
Definition: sfsocketcall.h:114
struct arc_opcode * next_asm
Definition: arc.h:173
struct arc_opcode * next_dis
Definition: arc.h:174
unsigned char fmt
Definition: arc.h:214

References ARC_HASH_ICODE, ARC_HASH_OPCODE, arc_mach_a4, ARC_MACH_ARC7, ARC_OPCODE_CPU, arc_opcodes, arc_operand_map, arc_operand_map_a4, arc_operand_map_ac, arc_operands, arc_operands_a4, arc_operands_ac, arc_reg_names, arc_reg_names_a4, arc_reg_names_a500600, arc_reg_names_a700, arc_reg_names_count, arc_suffixes, arc_suffixes_a4, arc_suffixes_ac, arc_suffixes_count, cpu_type, ELEMENTS_IN, flags, arc_operand::fmt, i, icode_map, int, memset(), arc_opcode::next_asm, arc_opcode::next_dis, opcode_map, benchmark::syntax, and value.

◆ arc_opcode_limm_p()

int arc_opcode_limm_p ( long limmp)

Definition at line 4481 of file arc-opc.c.

4482 {
4483  if (limmp) {
4484  *limmp = limm;
4485  }
4486  return limm_p;
4487 }
static long limm
Definition: arc-opc.c:137

References limm, and limm_p.

◆ arc_opcode_lookup_asm()

const struct arc_opcode* arc_opcode_lookup_asm ( const char *  insn)

Definition at line 4432 of file arc-opc.c.

4433 {
4434  return opcode_map[ARC_HASH_OPCODE (insn)];
4435 }

References ARC_HASH_OPCODE, and opcode_map.

◆ arc_opcode_lookup_dis()

const struct arc_opcode* arc_opcode_lookup_dis ( unsigned int  insn)

Definition at line 4441 of file arc-opc.c.

4442 {
4443  return icode_map[ARC_HASH_ICODE (insn)];
4444 }

References ARC_HASH_ICODE, and icode_map.

◆ arc_opcode_lookup_suffix()

const struct arc_operand_value* arc_opcode_lookup_suffix ( const struct arc_operand type,
int  value 
)

Definition at line 4494 of file arc-opc.c.

4495 {
4496  const struct arc_operand_value *v,*end;
4497  struct arc_ext_operand_value *ext_oper = arc_ext_operands;
4498  while (ext_oper)
4499  {
4500  if (type == &arc_operands[ext_oper->operand.type] && value == ext_oper->operand.value) {
4501  return (&ext_oper->operand);
4502  }
4503  ext_oper = ext_oper->next;
4504  }
4505 
4506  /* ??? This is a little slow and can be speeded up. */
4507  for (v = arc_suffixes, end = arc_suffixes + arc_suffixes_count; v < end; ++v) {
4508  if (type == &arc_operands[v->type] && value == v->value) {
4509  return v;
4510  }
4511  }
4512  return 0;
4513 }
struct arc_ext_operand_value * arc_ext_operands
Definition: arc-opc.c:880
const char * v
Definition: dsignal.c:12
struct arc_ext_operand_value * next
Definition: arc.h:204
struct arc_operand_value operand
Definition: arc.h:205
short value
Definition: arc.h:191
unsigned char type
Definition: arc.h:192

References arc_ext_operands, arc_operands, arc_suffixes, arc_suffixes_count, test_evm::end, arc_ext_operand_value::next, arc_ext_operand_value::operand, arc_operand_value::type, type, v, arc_operand_value::value, and value.

Referenced by extract_cond(), and extract_flag().

◆ arc_opcode_supported()

int arc_opcode_supported ( const struct arc_opcode opcode)

Definition at line 4400 of file arc-opc.c.

4401 {
4402  if (ARC_OPCODE_CPU (opcode->flags) == 0) {
4403  return 1;
4404  }
4405  if (ARC_OPCODE_CPU (opcode->flags) & ARC_HAVE_CPU (cpu_type)) {
4406  return 1;
4407  }
4408  return 0;
4409 }
#define ARC_HAVE_CPU(bits)
Definition: arc.h:402
int flags
Definition: arc.h:67

References ARC_HAVE_CPU, ARC_OPCODE_CPU, cpu_type, and arc_opcode::flags.

◆ arc_operand_type()

int arc_operand_type ( int  opertype)

Definition at line 4856 of file arc-opc.c.

4857 {
4858  switch (opertype)
4859  {
4860  case 0:
4861  return (arc_mach_a4 ? COND : COND_AC);
4862  case 1:
4863  return (arc_mach_a4 ? REG : REG_AC);
4864  case 2:
4865  return (arc_mach_a4 ? AUXREG : AUXREG_AC);
4866  default:
4867  return 0; // abort
4868  }
4869 }
#define COND
#define REG
#define REG_AC
#define AUXREG
#define COND_AC

References arc_mach_a4, AUXREG, AUXREG_AC, COND, COND_AC, REG, and REG_AC.

◆ arc_opval_supported()

int arc_opval_supported ( const struct arc_operand_value *opval  ATTRIBUTE_UNUSED)

Definition at line 4416 of file arc-opc.c.

4417 {
4418 #if 0 /* I'm leaving this is a place holder, we don't discrimnate */
4419  if (ARC_OPVAL_CPU (opval->flags) == 0)
4420  return 1;
4421  if (ARC_OPVAL_CPU (opval->flags) & ARC_HAVE_CPU (cpu_type))
4422  return 1;
4423  return 0;
4424 #endif
4425  return(1);
4426 }
#define ARC_OPVAL_CPU(bits)
Definition: arc.h:198

References ARC_HAVE_CPU, ARC_OPVAL_CPU, and cpu_type.

◆ arc_test_wb()

int arc_test_wb ( void  )

Definition at line 4448 of file arc-opc.c.

4449 {
4450  return addrwb_p;
4451 }

References addrwb_p.

◆ extract_cond()

static long extract_cond ( arc_insn insn,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value **  opval,
int *invalid  ATTRIBUTE_UNUSED 
)
static

Definition at line 2325 of file arc-opc.c.

2330 {
2331  long cond;
2332  const struct arc_operand_value *val;
2333 
2334  if (flagshimm_handled_p) {
2335  return 0;
2336  }
2337 
2338  cond = (*insn >> operand->shift) & ((1 << operand->bits) - 1);
2340 
2341  /* Ignore NULL values of `val'. Several condition code values are
2342  reserved for extensions. */
2343  if (opval != NULL && val != NULL) {
2344  *opval = val;
2345  }
2346  return cond;
2347 }
const struct arc_operand_value * arc_opcode_lookup_suffix(const struct arc_operand *type, int value)
Definition: arc-opc.c:4494
operand
Definition: arc-opc.c:39
ut16 val
Definition: armass64_const.h:6
#define cond(bop, top, mask, flags)

References arc_opcode_lookup_suffix(), cond, flagshimm_handled_p, NULL, and val.

◆ extract_flag()

static long extract_flag ( arc_insn insn,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value **  opval,
int *invalid  ATTRIBUTE_UNUSED 
)
static

Definition at line 2292 of file arc-opc.c.

2297 {
2298  int f;
2299  const struct arc_operand_value *val;
2300 
2301  if (flagshimm_handled_p) {
2302  f = flag_p != 0;
2303  } else {
2304  f = (*insn & (1 << operand->shift)) != 0;
2305  }
2306 
2307  /* There is no text for zero values. */
2308  if (f == 0) {
2309  return 0;
2310  }
2311  flag_p = 1;
2313  if (opval != NULL && val != NULL) {
2314  *opval = val;
2315  }
2316  return val?val->value:0;
2317 }
#define f(i)
Definition: sha256.c:46

References arc_opcode_lookup_suffix(), f, flag_p, flagshimm_handled_p, NULL, and val.

◆ EXTRACT_FN() [1/10]

EXTRACT_FN ( extract_cond  )

◆ EXTRACT_FN() [2/10]

EXTRACT_FN ( extract_flag  )

◆ EXTRACT_FN() [3/10]

EXTRACT_FN ( extract_jumpflags  )

◆ EXTRACT_FN() [4/10]

EXTRACT_FN ( extract_ld_offset  )

◆ EXTRACT_FN() [5/10]

EXTRACT_FN ( extract_ld_syntax  )

◆ EXTRACT_FN() [6/10]

EXTRACT_FN ( extract_reg  )

◆ EXTRACT_FN() [7/10]

EXTRACT_FN ( extract_reladdr  )

◆ EXTRACT_FN() [8/10]

EXTRACT_FN ( extract_st_offset  )

◆ EXTRACT_FN() [9/10]

EXTRACT_FN ( extract_st_syntax  )

◆ EXTRACT_FN() [10/10]

EXTRACT_FN ( extract_unopmacro  )

◆ extract_jumpflags()

static long extract_jumpflags ( arc_insn insn,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value **opval  ATTRIBUTE_UNUSED,
int invalid 
)
static

Definition at line 2372 of file arc-opc.c.

2377 {
2378  if (!flag_p || !limm_p) {
2379  *invalid = 1;
2380  }
2381  return ((flag_p && limm_p)
2382  ? (insn[1] >> operand->shift) & ((1 << operand->bits) - 1)
2383  : 0);
2384 }

References flag_p, and limm_p.

◆ extract_ld_offset()

static long extract_ld_offset ( arc_insn insn,
const struct arc_operand operand,
int  mods,
const struct arc_operand_value **  opval,
int invalid 
)
static

Definition at line 2416 of file arc-opc.c.

2421 {
2422  int test = insn[0] & I(-1);
2423  int value = 0;
2424 
2425  if (test)
2426  {
2427  value = insn[0] & 511;
2428  if ((operand->flags & ARC_OPERAND_SIGNED) && (value & 256)) {
2429  value -= 512;
2430  }
2431  if (value) {
2433  }
2434 
2435  return value;
2436  }
2437  /* If it isn't in the insn, it's concealed behind reg 'c'. */
2438  return extract_reg (insn, &arc_operands[arc_operand_map['c']],
2439  mods, opval, invalid);
2440 }
static long extract_reg(arc_insn *insn, const struct arc_operand *operand, int mods, const struct arc_operand_value **opval, int *invalid ATTRIBUTE_UNUSED)
Definition: arc-opc.c:2172
#define ARC_OPERAND_SIGNED
Definition: arc.h:247
-lz4-versions

References arc_operand_map, ARC_OPERAND_SIGNED, arc_operands, extract_reg(), I, LS_OFFSET, ls_operand, OP_SHIMM, and value.

◆ extract_ld_syntax()

static long extract_ld_syntax ( arc_insn insn,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value **opval  ATTRIBUTE_UNUSED,
int invalid 
)
static

Definition at line 1846 of file arc-opc.c.

1851 {
1852  int test = insn[0] & I(-1);
1853 
1854  if (!(test == I(1)))
1855  {
1857  *invalid = 1;
1858  }
1859  }
1861  *invalid = 1;
1862  }
1863  return 0;
1864 }
#define LD_SYNTAX(D, B, O)
static int shimm
Definition: arc-opc.c:129

References I, LD_SYNTAX, LS_BASE, LS_DEST, LS_OFFSET, ls_operand, OP_LIMM, OP_NONE, OP_REG, OP_SHIMM, and shimm.

◆ extract_reg()

static long extract_reg ( arc_insn insn,
const struct arc_operand operand,
int  mods,
const struct arc_operand_value **  opval,
int *invalid  ATTRIBUTE_UNUSED 
)
static

Definition at line 2172 of file arc-opc.c.

2177 {
2178  int regno;
2179  long value;
2180  enum operand op_type;
2181 
2182  /* Get the register number. */
2183  regno = (*insn >> operand->shift) & ((1 << operand->bits) - 1);
2184 
2185  /* Is it a constant marker? */
2186  if (regno == ARC_REG_SHIMM)
2187  {
2188  op_type = OP_SHIMM;
2189  /* Always return zero if dest is a shimm mlm. */
2190 
2191  if ('a' != operand->fmt)
2192  {
2193  value = *insn & 511;
2194  if ((operand->flags & ARC_OPERAND_SIGNED) && (value & 256)) {
2195  value -= 512;
2196  }
2197  if (!flagshimm_handled_p) {
2198  flag_p = 0;
2199  }
2200  flagshimm_handled_p = 1;
2201  } else {
2202  value = 0;
2203  }
2204  }
2205  else if (regno == ARC_REG_SHIMM_UPDATE)
2206  {
2207  op_type = OP_SHIMM;
2208 
2209  /* Always return zero if dest is a shimm mlm. */
2210  if ('a' != operand->fmt)
2211  {
2212  value = *insn & 511;
2213  if ((operand->flags & ARC_OPERAND_SIGNED) && (value & 256)) {
2214  value -= 512;
2215  }
2216  } else {
2217  value = 0;
2218  }
2219 
2220  flag_p = 1;
2221  flagshimm_handled_p = 1;
2222  }
2223  else if (regno == ARC_REG_LIMM)
2224  {
2225  op_type = OP_LIMM;
2226  value = insn[1];
2227  limm_p = 1;
2228 
2229  /* If this is a jump instruction (j,jl), show new pc correctly. */
2230  if (0x07 == ((*insn & I (-1)) >> 27)) {
2231  value = (value & 0xffffff);
2232  }
2233  }
2234 
2235  /* It's a register, set OPVAL (that's the only way we distinguish registers
2236  from constants here). */
2237  else
2238  {
2239  const struct arc_operand_value *reg = lookup_register (REG, regno);
2240 
2241  op_type = OP_REG;
2242 
2243  if (!reg) {
2244  return 0;
2245  }
2246  if (opval != NULL) {
2247  *opval = reg;
2248  }
2249  value = regno;
2250  }
2251 
2252  /* If this field takes an auxiliary register, see if it's a known one. */
2253  if ((mods & ARC_MOD_AUXREG)
2254  && ARC_REG_CONSTANT_P (regno))
2255  {
2256  const struct arc_operand_value *reg = lookup_register (AUXREG, value);
2257 
2258  /* This is really a constant, but tell the caller it has a special
2259  name. */
2260  if (reg != NULL && opval != NULL) {
2261  *opval = reg;
2262  }
2263  }
2264 
2265  switch (operand->fmt)
2266  {
2267  case 'a':
2268  ls_operand[LS_DEST] = op_type;
2269  break;
2270  case 's':
2271  ls_operand[LS_BASE] = op_type;
2272  break;
2273  case 'c':
2274  if ((insn[0] & I (-1)) == I (2)) {
2275  ls_operand[LS_VALUE] = op_type;
2276  } else {
2277  ls_operand[LS_OFFSET] = op_type;
2278  }
2279  break;
2280  case 'o': case 'O':
2281  ls_operand[LS_OFFSET] = op_type;
2282  break;
2283  }
2284 
2285  return value;
2286 }
static const struct arc_operand_value * lookup_register(int type, long regno)
Definition: arc-opc.c:2137
#define ARC_REG_SHIMM_UPDATE
Definition: arc.h:407
#define ARC_MOD_AUXREG
Definition: arc.h:296
#define ARC_REG_CONSTANT_P(REG)
Definition: arc.h:412
#define reg(n)

References ARC_MOD_AUXREG, ARC_OPERAND_SIGNED, ARC_REG_CONSTANT_P, ARC_REG_LIMM, ARC_REG_SHIMM, ARC_REG_SHIMM_UPDATE, AUXREG, flag_p, flagshimm_handled_p, I, limm_p, lookup_register(), LS_BASE, LS_DEST, LS_OFFSET, ls_operand, LS_VALUE, NULL, OP_LIMM, OP_REG, OP_SHIMM, REG, reg, and value.

Referenced by extract_ld_offset().

◆ extract_reladdr()

static long extract_reladdr ( arc_insn insn,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value **opval  ATTRIBUTE_UNUSED,
int *invalid  ATTRIBUTE_UNUSED 
)
static

Definition at line 2353 of file arc-opc.c.

2358 {
2359  long addr;
2360 
2361  addr = (*insn >> operand->shift) & ((1 << operand->bits) - 1);
2362  if ((operand->flags & ARC_OPERAND_SIGNED) && (addr & (1 << (operand->bits - 1)))) {
2363  addr -= 1 << operand->bits;
2364  }
2365 
2366  return addr << 2;
2367 }
static int addr
Definition: z80asm.c:58

References addr, and ARC_OPERAND_SIGNED.

◆ extract_st_offset()

static long extract_st_offset ( arc_insn insn,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value **opval  ATTRIBUTE_UNUSED,
int invalid 
)
static

Definition at line 2389 of file arc-opc.c.

2394 {
2395  int value = 0;
2396 
2398  {
2399  value = insn[0] & 511;
2400  if ((operand->flags & ARC_OPERAND_SIGNED) && (value & 256)) {
2401  value -= 512;
2402  }
2403  if (value) {
2405  }
2406  } else {
2407  *invalid = 1;
2408  }
2409 
2410  return value;
2411 }

References ARC_OPERAND_SIGNED, LS_BASE, LS_OFFSET, ls_operand, LS_VALUE, OP_LIMM, OP_SHIMM, and value.

◆ extract_st_syntax()

static long extract_st_syntax ( arc_insn insn,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value **opval  ATTRIBUTE_UNUSED,
int invalid 
)
static

Definition at line 1640 of file arc-opc.c.

1645 {
1646 #define ST_SYNTAX(V,B,O) \
1647 ((ls_operand[LS_VALUE] == (V) && \
1648  ls_operand[LS_BASE] == (B) && \
1649  ls_operand[LS_OFFSET] == (O)))
1650 
1652  *invalid = 1;
1653  }
1654  return 0;
1655 }
#define ST_SYNTAX(V, B, O)

References OP_LIMM, OP_NONE, OP_REG, OP_SHIMM, and ST_SYNTAX.

◆ extract_unopmacro()

static long extract_unopmacro ( arc_insn insn,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value **opval  ATTRIBUTE_UNUSED,
int invalid 
)
static

Definition at line 2447 of file arc-opc.c.

2452 {
2453  /* This misses the case where B == ARC_REG_SHIMM_UPDATE &&
2454  C == ARC_REG_SHIMM (or vice versa). No big deal. Those insns will get
2455  printed as "and"s. */
2456  if (((*insn >> ARC_SHIFT_REGB) & ARC_MASK_REG) != ((*insn >> ARC_SHIFT_REGC) & ARC_MASK_REG)) {
2457  if (invalid != NULL) {
2458  *invalid = 1;
2459  }
2460  }
2461 
2462  return 0;
2463 }
#define ARC_MASK_REG
Definition: arc.h:422
#define ARC_SHIFT_REGB
Definition: arc.h:416
#define ARC_SHIFT_REGC
Definition: arc.h:417

◆ get_ext_suffix()

struct arc_operand_value* get_ext_suffix ( char *  s,
char  field 
)

Definition at line 4873 of file arc-opc.c.

4874 {
4876  char ctype = 0;
4877 
4878  switch(field){
4879  case 'e' :
4880  ctype = arc_mach_a4 ? CACHEBYPASS5 : 0;
4881  break;
4882  case 'f' :
4883  ctype = arc_mach_a4 ? FLAG : FLAG_AC;
4884  break;
4885  case 'j' :
4886  ctype = arc_mach_a4 ? JUMPFLAGS : 0;
4887  break;
4888  case 'p' :
4889  ctype = arc_mach_a4 ? 0 : ADDRESS9_AC;
4890  break;
4891  case 'q' :
4892  ctype = arc_mach_a4 ? COND : COND_AC;
4893  break;
4894  case 't' :
4895  ctype = arc_mach_a4 ? 0 : SIZE7_AC;
4896  break;
4897  case 'v' :
4899  break;
4900  case 'w' :
4901  ctype = arc_mach_a4 ? ADDRESS3 : ADDRESS3_AC;
4902  break;
4903  case 'x' :
4904  ctype = arc_mach_a4 ? SIGN0 : SIGN6_AC;
4905  break;
4906  case 'y' :
4907  ctype = arc_mach_a4 ? SIZE22 : 0;
4908  break;
4909  case 'z' :
4910  ctype = arc_mach_a4 ? SIZE1 : SIZE1_AC;
4911  break;
4912  case 'D' :
4914  break;
4915  case 'E' :
4916  ctype = arc_mach_a4 ? CACHEBYPASS14 : 0;
4917  break;
4918  case 'P' :
4919  ctype = arc_mach_a4 ? 0 : ADDRESS22_AC;
4920  break;
4921  case 'T' :
4922  ctype = arc_mach_a4 ? 0 : SIZE17_AC;
4923  break;
4924  case 'V' :
4925  ctype = arc_mach_a4 ? 0 : CACHEBYPASS15_AC;
4926  break;
4927  case 'W' :
4928  ctype = arc_mach_a4 ? ADDRESS12 : 0;
4929  break;
4930  case 'X' :
4931  ctype = arc_mach_a4 ? SIGN9 : SIGN16_AC;
4932  break;
4933  case 'Z' :
4934  ctype = arc_mach_a4 ? SIZE10 : 0;
4935  break;
4936  case '&' :
4937  ctype = arc_mach_a4 ? 0 : ADDRESS22S_AC;
4938  break;
4939  default :
4940  ctype = arc_mach_a4 ? COND : COND_AC;
4941  break;
4942  } /* end switch(field) */
4943  if (ctype == 0) {
4944  ctype = arc_mach_a4 ? COND : COND_AC;
4945  }
4946  while (suffix) {
4947  if ((suffix->operand.type == ctype) && !strcmp (s, suffix->operand.name)) {
4948  return (&suffix->operand);
4949  }
4950  suffix = suffix->next;
4951  } /* end while(suffix) */
4952 
4953  return NULL;
4954 }
#define ADDRESS3
#define SIGN6_AC
#define SIGN0
#define ADDRESS24
#define ADDRESS22_AC
#define CACHEBYPASS5_AC
#define SIZE17_AC
#define CACHEBYPASS11_AC
#define ADDRESS3_AC
#define SIZE1
#define SIZE1_AC
#define ADDRESS12
#define CACHEBYPASS26
#define SIGN16_AC
#define SIGN9
#define CACHEBYPASS5
#define CACHEBYPASS15_AC
#define ADDRESS22S_AC
#define SIZE7_AC
#define CACHEBYPASS14
#define SIZE10
#define JUMPFLAGS
#define FLAG_AC
#define SIZE22
#define ADDRESS9_AC
#define FLAG
unsigned char suffix[65536]
Definition: gun.c:164
static RzSocket * s
Definition: rtr.c:28

References ADDRESS12, ADDRESS22_AC, ADDRESS22S_AC, ADDRESS24, ADDRESS3, ADDRESS3_AC, ADDRESS9_AC, arc_ext_operands, arc_mach_a4, CACHEBYPASS11_AC, CACHEBYPASS14, CACHEBYPASS15_AC, CACHEBYPASS26, CACHEBYPASS5, CACHEBYPASS5_AC, COND, COND_AC, test-lz4-speed::default, FLAG, FLAG_AC, JUMPFLAGS, NULL, s, SIGN0, SIGN16_AC, SIGN6_AC, SIGN9, SIZE1, SIZE10, SIZE17_AC, SIZE1_AC, SIZE22, SIZE7_AC, and suffix.

◆ insert_absaddr()

static arc_insn insert_absaddr ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **  errmsg 
)
static

Definition at line 2099 of file arc-opc.c.

2105 {
2106  if (limm_p)
2107  {
2108  /* If it is a jump and link, .jd must be specified. */
2109  if (insn & R (-1, 9, 1))
2110  {
2111  if (!nullify_p) {
2112  insn |= 0x02 << 5; /* Default nullify to .jd. */
2113  } else if (nullify != 0x02) {
2114  *errmsg = _ ("must specify .jd or no nullify suffix");
2115  }
2116  }
2117  }
2118  return insn;
2119 }
#define _(String)
Definition: opintl.h:53

References _, limm_p, nullify, nullify_p, and R.

◆ insert_addr_wb()

static arc_insn insert_addr_wb ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1430 of file arc-opc.c.

1436 {
1437  /* Ravi: added the 'w' to handle the st.ab st.as instructions after
1438  * adding suport for it in the arc_suffixes_ac by defining aw, ab and as
1439  * to be ADDRESS3_AC also */
1440 
1441  if (!arc_mach_a4 && (('p' == operand->fmt) || ('P' == operand->fmt) || ('w' == operand->fmt) || ('&' == operand->fmt))) {
1442  addrwb_p = value << operand->shift;
1443  } else {
1444  addrwb_p = 1 << operand->shift;
1445  }
1446  return insn;
1447 }

References addrwb_p, arc_mach_a4, and value.

◆ insert_base()

static arc_insn insert_base ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int  mods,
const struct arc_operand_value reg,
long  value,
const char **  errmsg 
)
static

Definition at line 1450 of file arc-opc.c.

1456 {
1457  if (reg != NULL)
1458  {
1459  arc_insn myinsn;
1460  if (!arc_mach_a4 && ('g' == operand->fmt)) {
1461  insn |= insert_reg (0, ex, operand, mods, reg, value, errmsg);
1462  } else {
1463  myinsn = (insert_reg (0, ex, operand, mods, reg, value, errmsg) >> operand->shift);
1464  insn |= B (myinsn);
1465  }
1467  }
1468  else if (arc_mach_a4 && ARC_SHIMM_CONST_P (value) && !arc_cond_p)
1469  {
1470  if (shimm_p && value != shimm)
1471  {
1472  /* Convert the previous shimm operand to a limm. */
1473  limm_p = 1;
1474  limm = shimm;
1475  insn &= ~C(-1); /* We know where the value is in insn. */
1476  insn |= C(ARC_REG_LIMM);
1478  }
1479  insn |= ARC_REG_SHIMM << operand->shift;
1480  shimm_p = 1;
1481  shimm = value;
1484  }
1485  else if (arc_mach_a4)
1486  {
1487  if (limm_p && value != limm)
1488  {
1489  *errmsg = _("too many long constants");
1490  return insn;
1491  }
1492  limm_p = 1;
1493  limm = value;
1494  insn |= B(ARC_REG_LIMM);
1496  }
1497 
1498  return insn;
1499 }
static arc_insn insert_reg(arc_insn insn, long *ex ATTRIBUTE_UNUSED, const struct arc_operand *operand, int mods, const struct arc_operand_value *reg, long value, const char **errmsg)
Definition: arc-opc.c:1107
#define ARC_SHIMM_CONST_P(x)
Definition: arc.h:430
static xnu_exception_info ex

References _, arc_cond_p, arc_mach_a4, ARC_REG_LIMM, ARC_REG_SHIMM, ARC_SHIMM_CONST_P, B, C, ex, insert_reg(), limm, limm_p, LS_BASE, LS_OFFSET, ls_operand, LS_VALUE, NULL, OP_LIMM, OP_REG, OP_SHIMM, reg, shimm, shimm_p, and value.

◆ insert_cond()

static arc_insn insert_cond ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long  value,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1398 of file arc-opc.c.

1404 {
1405  arc_cond_p = 1;
1406 
1407  insn |= (value & ((1 << operand->bits) - 1)) << operand->shift;
1408  return insn;
1409 }

References arc_cond_p, and value.

◆ insert_ex_syntax()

static arc_insn insert_ex_syntax ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **  errmsg 
)
static

Definition at line 1867 of file arc-opc.c.

1873 {
1874  /* Ravi: operand validity checks for the ARC700 */
1875  if (cpu_type == ARC_MACH_ARC7)
1876  /* if (arc_get_opcode_mach (arc_mach_type, 0) == ARC_MACH_ARC7) */
1877  {
1878  unsigned ac_reg_hi = X (insn, 12, 3);
1879  unsigned ac_reg_lo = X (insn, 24, 3);
1880  unsigned ac_reg_num = (ac_reg_hi << 3) | ac_reg_lo;
1881 
1882  if (arc_user_mode_only && (ac_reg_num == 29 || ac_reg_num == 30)) {
1883  *errmsg = _ ("ex operand error: Privilege Violation exception");
1884  }
1885  if (0x20 <= ac_reg_num && ac_reg_num <= 0x3F && !((arc_ld_ext_mask >> (ac_reg_num - 32)) & 1)) {
1886  *errmsg = _ ("ld operand error: Instruction Error exception");
1887  }
1888  }
1889  return insn;
1890 }
int arc_user_mode_only
Definition: arc-opc.c:878
#define X(x, b, m)
unsigned long arc_ld_ext_mask
Definition: arc-opc.c:876

References _, arc_ld_ext_mask, ARC_MACH_ARC7, arc_user_mode_only, cpu_type, and X.

◆ insert_flag()

static arc_insn insert_flag ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1344 of file arc-opc.c.

1350 {
1351  /* We can't store anything in the insn until we've parsed the registers.
1352  Just record the fact that we've got this flag. `insert_reg' will use it
1353  to store the correct value (ARC_REG_SHIMM_UPDATE or bit 0x100). */
1354  flag_p = 1;
1355  return insn;
1356 }

References flag_p.

◆ insert_flagfinish()

static arc_insn insert_flagfinish ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1379 of file arc-opc.c.

1385 {
1386  if (flag_p && !flagshimm_handled_p)
1387  {
1388  //if (shimm_p) abort ();
1389  flagshimm_handled_p = 1;
1390  insn |= (1 << operand->shift);
1391  }
1392  return insn;
1393 }

References flag_p, and flagshimm_handled_p.

◆ INSERT_FN() [1/25]

INSERT_FN ( insert_absaddr  )

◆ INSERT_FN() [2/25]

INSERT_FN ( insert_addr_wb  )

◆ INSERT_FN() [3/25]

INSERT_FN ( insert_base  )

◆ INSERT_FN() [4/25]

INSERT_FN ( insert_cond  )

◆ INSERT_FN() [5/25]

INSERT_FN ( insert_ex_syntax  )

◆ INSERT_FN() [6/25]

INSERT_FN ( insert_flag  )

◆ INSERT_FN() [7/25]

INSERT_FN ( insert_flagfinish  )

◆ INSERT_FN() [8/25]

INSERT_FN ( insert_forcelimm  )

◆ INSERT_FN() [9/25]

INSERT_FN ( insert_jumpflags  )

◆ INSERT_FN() [10/25]

INSERT_FN ( insert_ld_syntax  )

◆ INSERT_FN() [11/25]

INSERT_FN ( insert_limmfinish  )

◆ INSERT_FN() [12/25]

INSERT_FN ( insert_null  )

◆ INSERT_FN() [13/25]

INSERT_FN ( insert_nullify  )

◆ INSERT_FN() [14/25]

INSERT_FN ( insert_offset  )

◆ INSERT_FN() [15/25]

INSERT_FN ( insert_reg  )

◆ INSERT_FN() [16/25]

INSERT_FN ( insert_reladdr  )

◆ INSERT_FN() [17/25]

INSERT_FN ( insert_s12  )

◆ INSERT_FN() [18/25]

INSERT_FN ( insert_s15  )

◆ INSERT_FN() [19/25]

INSERT_FN ( insert_shimmfinish  )

◆ INSERT_FN() [20/25]

INSERT_FN ( insert_st_syntax  )

◆ INSERT_FN() [21/25]

INSERT_FN ( insert_u16  )

◆ INSERT_FN() [22/25]

INSERT_FN ( insert_u8  )

◆ INSERT_FN() [23/25]

INSERT_FN ( insert_ul16  )

◆ INSERT_FN() [24/25]

INSERT_FN ( insert_unopmacro  )

◆ INSERT_FN() [25/25]

INSERT_FN ( insert_uu16  )

◆ insert_forcelimm()

static arc_insn insert_forcelimm ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1418 of file arc-opc.c.

1424 {
1425  arc_cond_p = 1;
1426  return insn;
1427 }

References arc_cond_p.

◆ insert_jumpflags()

static arc_insn insert_jumpflags ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long  value,
const char **  errmsg 
)
static

Definition at line 1934 of file arc-opc.c.

1940 {
1941  if (!flag_p) {
1942  *errmsg = _ ("jump flags, but no .f seen");
1943 
1944  } else if (!limm_p) {
1945  *errmsg = _ ("jump flags, but no limm addr");
1946 
1947  } else if (limm & 0xfc000000) {
1948  *errmsg = _ ("flag bits of jump address limm lost");
1949 
1950  } else if (limm & 0x03000000) {
1951  *errmsg = _ ("attempt to set HR bits");
1952 
1953  } else if ((value & ((1 << operand->bits) - 1)) != value) {
1954  *errmsg = _ ("bad jump flags value");
1955  }
1956 
1957  jumpflags_p = 1;
1958  limm = ((limm & ((1 << operand->shift) - 1)) | ((value & ((1 << operand->bits) - 1)) << operand->shift));
1959  return insn;
1960 }

References _, flag_p, jumpflags_p, limm, limm_p, and value.

◆ insert_ld_syntax()

static arc_insn insert_ld_syntax ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **  errmsg 
)
static

Definition at line 1767 of file arc-opc.c.

1773 {
1774 #define LD_SYNTAX(D, B, O) \
1775  ( (ls_operand[LS_DEST] == (D) \
1776  && ls_operand[LS_BASE] == (B) \
1777  && ls_operand[LS_OFFSET] == (O)))
1778 
1779 #define X(x,b,m) ((unsigned)((x)&(((1<<(m))-1)<<(b)))>>(b))
1780  int test = insn & I (-1);
1781 
1782  /* do syntax check for ARCompact 'ld' insn */
1783  if (!arc_mach_a4)
1784  {
1785  /* TODO - check for validity of operands for ARCompact load insn */
1786 
1787  /* Extract operand 6 bits of the A field from insn starting at bit
1788  position 0. */
1789  unsigned char ac_reg_num = X(insn,0,6);
1790 
1791  if (addrwb_p)
1792  {
1793  if (ls_operand[LS_BASE] != OP_REG
1794  /* .as is not actually an address write-back. */
1795  && addrwb_p != 0xc00000) {
1796  *errmsg = _ ("address writeback not allowed");
1797  }
1798  insn |= addrwb_p;
1799  }
1800 
1801  /* Fixme: We should hash define register names to their respective
1802  numbers and not use them as 29, 30, 31,.... */
1803 
1804  if (0x20 <= ac_reg_num && ac_reg_num <= 0x3F)
1805  {
1806  if (!((arc_ld_ext_mask >> (ac_reg_num - 32)) & 1)) {
1807  *errmsg = _ ("ld operand error: Instruction Error exception");
1808  }
1809  }
1810 
1811  /* Ravi: operand validity checks for the ARC700 */
1813  /* if (arc_get_opcode_mach (arc_mach_type, 0) == ARC_MACH_ARC7) */
1814  {
1815  if (ac_reg_num == 29 || ac_reg_num == 30)
1816  {
1817  *errmsg = _("ld operand error: Privilege Violation exception");
1818  }
1819  }
1820 
1821  return insn;
1822  }
1823 
1824  /* do syntax check for ARCtangent-A4 'ld' insn */
1825  if (!(test == I (1)))
1826  {
1828  *errmsg = _ ("invalid load/shimm insn");
1829  }
1830  }
1832  *errmsg = _ ("ld operand error");
1833  }
1834  if (addrwb_p) {
1835  if (ls_operand[LS_BASE] != OP_REG) {
1836  *errmsg = _ ("address writeback not allowed");
1837  }
1838  insn |= addrwb_p;
1839  }
1840  return insn;
1841 }

References _, addrwb_p, arc_ld_ext_mask, arc_mach_a4, ARC_MACH_ARC7, arc_user_mode_only, cpu_type, I, LD_SYNTAX, LS_BASE, LS_DEST, LS_OFFSET, ls_operand, OP_LIMM, OP_NONE, OP_REG, OP_SHIMM, and X.

◆ insert_limmfinish()

static arc_insn insert_limmfinish ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1923 of file arc-opc.c.

1929 {
1930  return insn;
1931 }

◆ insert_null()

static arc_insn insert_null ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1090 of file arc-opc.c.

1097 {
1098  return insn;
1099 }

◆ insert_nullify()

static arc_insn insert_nullify ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long  value,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1361 of file arc-opc.c.

1367 {
1368  nullify_p = 1;
1369  insn |= (value & ((1 << operand->bits) - 1)) << operand->shift;
1370  nullify = value;
1371  return insn;
1372 }

References nullify, nullify_p, and value.

◆ insert_offset()

static arc_insn insert_offset ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int  mods,
const struct arc_operand_value reg,
long  value,
const char **  errmsg 
)
static

Definition at line 1505 of file arc-opc.c.

1511 {
1512  long minval, maxval;
1513 
1514  if (reg != NULL)
1515  {
1516  if (arc_mach_a4)
1517  {
1518  arc_insn myinsn
1519  = (insert_reg (0, ex, operand, mods, reg, value, errmsg)
1520  >> operand->shift);
1521 
1522  /* Not if store, catch it later. */
1523  if (operand->flags & ARC_OPERAND_LOAD) {
1524  /* Not if opcode == 1, catch it later. */
1525  if ((insn & I (-1)) != I (1)) {
1526  insn |= C (myinsn);
1527  }
1528  }
1529  } else {
1530  insn |= insert_reg (0, ex, operand, mods, reg, value, errmsg);
1531  }
1533  }
1534  else
1535  {
1536  int bits;
1537 
1538  if (operand->flags & ARC_OPERAND_2BYTE_ALIGNED) {
1539  bits = operand->bits + 1;
1540  } else if (operand->flags & ARC_OPERAND_4BYTE_ALIGNED) {
1541  bits = operand->bits + 2;
1542  } else {
1543  bits = operand->bits;
1544  }
1545 
1546  /* This is *way* more general than necessary, but maybe some day it'll
1547  be useful. */
1548  if (operand->flags & ARC_OPERAND_SIGNED)
1549  {
1550  minval = -(1 << (bits - 1));
1551  maxval = (1 << (bits - 1)) - 1;
1552  }
1553  else
1554  {
1555  minval = 0;
1556  maxval = (1 << bits) - 1;
1557  }
1558  if (arc_mach_a4 && ((arc_cond_p && !limm_p) || value < minval || value > maxval))
1559  {
1560  if (limm_p && value != limm) {
1561  *errmsg = _ ("too many long constants");
1562  } else {
1563  limm_p = 1;
1564  limm = value;
1565  if (operand->flags & ARC_OPERAND_STORE) {
1566  insn |= B (ARC_REG_LIMM);
1567  }
1568  if (operand->flags & ARC_OPERAND_LOAD) {
1569  insn |= C (ARC_REG_LIMM);
1570  }
1572  }
1573  }
1574  else
1575  {
1576  if ((value < minval || value > maxval)) {
1577  *errmsg = _ ("need too many limms");
1578  } else if (arc_mach_a4 && shimm_p && value != shimm) {
1579  /* Check for bad operand combinations
1580  before we lose info about them. */
1581  if ((insn & I (-1)) == I (1)) {
1582  *errmsg = _ ("to many shimms in load");
1583  goto out;
1584  }
1585  if (limm_p && operand->flags & ARC_OPERAND_LOAD) {
1586  *errmsg = _ ("too many long constants");
1587  goto out;
1588  }
1589  /* Convert what we thought was a shimm to a limm. */
1590  limm_p = 1;
1591  limm = shimm;
1592  if (ls_operand[LS_VALUE] == OP_SHIMM && operand->flags & ARC_OPERAND_STORE) {
1593  insn &= ~C (-1);
1594  insn |= C (ARC_REG_LIMM);
1596  }
1597  if (ls_operand[LS_BASE] == OP_SHIMM && operand->flags & ARC_OPERAND_STORE) {
1598  insn &= ~B (-1);
1599  insn |= B (ARC_REG_LIMM);
1601  }
1602  }
1603  if (!arc_mach_a4)
1604  {
1605  switch (operand->fmt)
1606  {
1607  case 'o':
1608  insn |= ((value & 0xff) << operand->shift);
1609  insn |= (((value & 0x100) >> 8) << 15);
1610  break;
1611  case 'k':
1612  insn |= ((value >> 1) & 0x1f) << operand->shift;
1613  break;
1614  case 'm':
1615  insn |= ((value >> 2) & 0xff) << operand->shift;
1616  break;
1617  case 'M':
1618  insn |= (value & 0x1ff) << operand->shift;
1619  break;
1620  case 'O':
1621  insn |= ((value >> 1) & 0x1ff) << operand->shift;
1622  break;
1623  case 'R':
1624  insn |= ((value >> 2) & 0x1ff) << operand->shift;
1625  break;
1626  }
1627  }
1628  shimm = value;
1629  shimm_p = 1;
1631  }
1632  }
1633  out:
1634  return insn;
1635 }
#define ARC_OPERAND_LOAD
Definition: arc.h:274
#define ARC_OPERAND_STORE
Definition: arc.h:277
#define ARC_OPERAND_4BYTE_ALIGNED
Definition: arc.h:286
#define ARC_OPERAND_2BYTE_ALIGNED
Definition: arc.h:283
int bits(struct state *s, int need)
Definition: blast.c:72
const lzma_allocator const uint8_t size_t uint8_t * out
Definition: block.h:528

References _, arc_cond_p, arc_mach_a4, ARC_OPERAND_2BYTE_ALIGNED, ARC_OPERAND_4BYTE_ALIGNED, ARC_OPERAND_LOAD, ARC_OPERAND_SIGNED, ARC_OPERAND_STORE, ARC_REG_LIMM, B, bits(), C, ex, I, insert_reg(), limm, limm_p, LS_BASE, LS_OFFSET, ls_operand, LS_VALUE, NULL, OP_LIMM, OP_REG, OP_SHIMM, out, reg, shimm, shimm_p, and value.

◆ insert_reg()

static arc_insn insert_reg ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int  mods,
const struct arc_operand_value reg,
long  value,
const char **  errmsg 
)
static

Definition at line 1107 of file arc-opc.c.

1113 {
1114  static char buf[100];
1115  enum operand op_type = OP_NONE;
1116  if (!reg)
1117  {
1118  /* We have a constant that also requires a value stored in a register
1119  field. Handle these by updating the register field and saving the
1120  value for later handling by either %S (shimm) or %L (limm). */
1121 
1122  /* Try to use a shimm value before a limm one. */
1124  /* If we've seen a conditional suffix we have to use a limm. */
1125  && !arc_cond_p
1126  /* If we already have a shimm value that is different than ours
1127  we have to use a limm. */
1128  && (!shimm_p || shimm == value))
1129  {
1130  int marker;
1131 
1132  op_type = OP_SHIMM;
1133  /* Forget about shimm as dest mlm. */
1134 
1135  if ('a' != operand->fmt)
1136  {
1137  shimm_p = 1;
1138  shimm = value;
1139  flagshimm_handled_p = 1;
1141  }
1142  else
1143  {
1144  /* Don't request flag setting on shimm as dest. */
1145  marker = ARC_REG_SHIMM;
1146  }
1147  insn |= marker << operand->shift;
1148  /* insn |= value & 511; - done later. */
1149  }
1150  else if ((mods & ARC_MOD_SDASYM) && !ac_add_reg_sdasym_insn (insn))
1151  {
1152  /* If it is an ld/ldw/st/stw insn without any .aa suffixes, then
1153  make it a scaled instruction, i.e. set .aa field to 3 */
1154  if (addrwb_p == 0)
1155  {
1156  /* Check for ld with .aa=0 */
1157  if ((insn & 0xf8000000) == 0x10000000)
1158  {
1159  /* if an ld/ldw insn */
1160  if ((((insn >> 7) & 3) == 0) ||
1161  (((insn >> 7) & 3) == 2)) {
1162  /* Set .aa to 3 */
1163  addrwb_p = 0x600;
1164  }
1165  }
1166  /* Check for st with .aa=0 */
1167  else if ((insn & 0xf8000001) == 0x18000000)
1168  {
1169  /* if an st/stw insn */
1170  if ((((insn >> 1) & 3) == 0) ||
1171  (((insn >> 1) & 3) == 2)) {
1172  /* Set .aa to 3 */
1173  addrwb_p = 0x18;
1174  }
1175  }
1176  } /* addrwb_p == 0 */
1177  }
1178  /* We have to use a limm. If we've already seen one they must match. */
1179  else if (!limm_p || limm == value)
1180  {
1181  if ('a' != operand->fmt)
1182  {
1183  op_type = OP_LIMM;
1184  limm_p = 1;
1185  limm = value;
1186  if (arc_mach_a4) {
1187  insn |= ARC_REG_LIMM << operand->shift;
1188  }
1189  /* The constant is stored later. */
1190  }
1191  else
1192  {
1193  if (arc_mach_a4) {
1194  insn |= ARC_REG_SHIMM << operand->shift;
1195  }
1196  /* insn |= value & 511; - done later. */
1197  }
1198  }
1199  else{
1200  *errmsg = _("unable to fit different valued constants into instruction");
1201  }
1202  }
1203  else
1204  {
1205  /* We have to handle both normal and auxiliary registers. */
1206 
1207  if ((reg->type == AUXREG) || (reg->type == AUXREG_AC))
1208  {
1209  if (!(mods & ARC_MOD_AUXREG)) {
1210  *errmsg = _ ("auxiliary register not allowed here");
1211  } else if (arc_mach_a4) {
1212  if ((insn & I (-1)) == I (2)) /* Check for use validity. */
1213  {
1214  if (reg->flags & ARC_REGISTER_READONLY) {
1215  *errmsg = _ ("attempt to set readonly register");
1216  }
1217  } else {
1218  if (reg->flags & ARC_REGISTER_WRITEONLY) {
1219  *errmsg = _ ("attempt to read writeonly register");
1220  }
1221  }
1222  insn |= ARC_REG_SHIMM << operand->shift;
1223  insn |= reg->value << arc_operands[reg->type].shift;
1224  }
1225  else /* Insert auxiliary register value for ARCompact ISA. */
1226  {
1227  /* TODO: Check for validity of using ARCompact auxiliary regs. */
1228 
1229  // insn |= reg->value << operand->shift;
1230  /* Replace this later with the corresponding function to do
1231  the insertion of signed 12 bit immediates .
1232  This is because the auxillary registers used as a mnemonic
1233  would be stored in this fashion. */
1234 
1235  insn |= (((reg->value & 0x3f) << 6) | ((reg->value & 0xffffffc0) >> 6));
1236  }
1237  }
1238  else
1239  {
1240  /* Check for use validity. */
1241  if (('a' == operand->fmt) || (arc_mach_a4 && ((insn & I(-1)) < I(2))) ||
1242  (!arc_mach_a4 && (('A' == operand->fmt)||('#' == operand->fmt))))
1243  {
1244  if (reg->flags & ARC_REGISTER_READONLY) {
1245  *errmsg = _ ("attempt to set readonly register");
1246  }
1247  }
1248  if ('a' != operand->fmt || (!arc_mach_a4 && ('A' != operand->fmt)))
1249  {
1250  if (reg->flags & ARC_REGISTER_WRITEONLY) {
1251  *errmsg = _ ("attempt to read writeonly register");
1252  }
1253  }
1254  /* We should never get an invalid register number here. */
1255  if (arc_mach_a4 && ((unsigned int) reg->value > 60))
1256  {
1257  sprintf (buf, _("invalid register number `%d'"), reg->value);
1258  *errmsg = buf;
1259  }
1260  if (!arc_mach_a4 && ((unsigned int) reg->value > 63))
1261  {
1262  sprintf (buf, _("invalid register number `%d'"), reg->value);
1263  *errmsg = buf;
1264  }
1265  if (!arc_mach_a4 && ( ('B' == operand->fmt) || ('#' == operand->fmt)
1266  || ('g' == operand->fmt) || ('(' == operand->fmt)
1267  || ('{' == operand->fmt) || ('<' == operand->fmt)))
1268  {
1269  insn |= (reg->value & 0x7) << operand->shift;
1270  insn |= (reg->value >> 3) << ARC_SHIFT_REGB_HIGH_AC;
1271  }
1272  else if (!arc_mach_a4 && ('U' == operand->fmt))
1273  {
1274  insn |= (reg->value & 0x7) << operand->shift;
1275  insn |= reg->value >> 3;
1276 
1277  /* Ravi: Quoting from the ARC Programmer reference:
1278  The program counter (PCL) is not permitted to be the
1279  destination of an instruction. A value of in 0x03 in the
1280  sub opcode field, i, and a value of 0x3F in destination
1281  register field, H, will raise an Instruction Error
1282  exception.
1283  This should solve the mov_s pcl, whatever bug. */
1284  if ((insn & 0xFF) == 0xFF) {
1285  *errmsg = _ ("attempt to set readonly register");
1286  }
1287  } else {
1288  insn |= reg->value << operand->shift;
1289  }
1290  op_type = OP_REG;
1291  }
1292  }
1293 
1294  if (arc_mach_a4)
1295  {
1296  switch (operand->fmt)
1297  {
1298  case 'a':
1299  ls_operand[LS_DEST] = op_type;
1300  break;
1301  case 's':
1302  ls_operand[LS_BASE] = op_type;
1303  break;
1304  case 'c':
1305  if ((insn & I (-1)) == I (2)) {
1306  ls_operand[LS_VALUE] = op_type;
1307  } else {
1308  ls_operand[LS_OFFSET] = op_type;
1309  }
1310  break;
1311  case 'o': case 'O':
1312  ls_operand[LS_OFFSET] = op_type;
1313  break;
1314  }
1315  }
1316  else
1317  {
1318  switch (operand->fmt)
1319  {
1320  case 'a':
1321  case 'A':
1322  case '#':
1323  case '*':
1324  ls_operand[LS_DEST] = op_type;
1325  break;
1326  case 'C':
1327  case ')':
1328  case '}':
1329  case '>':
1330  if ((insn & I (-1)) == I (3)) {
1331  ls_operand[LS_VALUE] = op_type;
1332  } else {
1333  ls_operand[LS_OFFSET] = op_type;
1334  }
1335  break;
1336  }
1337  }
1338  return insn;
1339 }
int ac_add_reg_sdasym_insn(arc_insn)
Definition: arc-opc.c:4595
#define ARC_REGISTER_WRITEONLY
Definition: arc.h:310
#define ARC_SHIFT_REGB_HIGH_AC
Definition: arc.h:420
#define ARC_REGISTER_READONLY
Definition: arc.h:309
#define ARC_MOD_SDASYM
Definition: arc.h:299
voidpf void * buf
Definition: ioapi.h:138
sprintf
Definition: kernel.h:365
unsigned char shift
Definition: arc.h:221
if(dbg->bits==RZ_SYS_BITS_64)
Definition: windows-arm64.h:4

References _, ac_add_reg_sdasym_insn(), addrwb_p, arc_cond_p, arc_mach_a4, ARC_MOD_AUXREG, ARC_MOD_SDASYM, arc_operands, ARC_REG_LIMM, ARC_REG_SHIMM, ARC_REG_SHIMM_UPDATE, ARC_REGISTER_READONLY, ARC_REGISTER_WRITEONLY, ARC_SHIFT_REGB_HIGH_AC, ARC_SHIMM_CONST_P, AUXREG, AUXREG_AC, flag_p, flagshimm_handled_p, I, if(), limm, limm_p, LS_BASE, LS_DEST, LS_OFFSET, ls_operand, LS_VALUE, OP_LIMM, OP_NONE, OP_REG, OP_SHIMM, reg, arc_operand::shift, shimm, shimm_p, sprintf, and value.

Referenced by insert_base(), and insert_offset().

◆ insert_reladdr()

static arc_insn insert_reladdr ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long  value,
const char **  errmsg 
)
static

Definition at line 1979 of file arc-opc.c.

1985 {
1986  if (!arc_mach_a4 && ('h' == operand->fmt))
1987  {
1988  if (value & 3) {
1989  *errmsg = _ ("branch address not on 4 byte boundary");
1990  }
1991 
1992  value = value >> 2;
1993  /* Insert least significant 9-bits. */
1994  insn |= (value & 0x1ff) << operand->shift;
1995  /* Insert most significant 10-bits. */
1996  insn |= ((value >> 9) & 0x3ff) << 6;
1997  }
1998  else if (!arc_mach_a4 && ('H' == operand->fmt))
1999  {
2000  if (value & 3) {
2001  *errmsg = _ ("branch address not on 4 byte boundary");
2002  }
2003 
2004  value = value >> 2;
2005  /* Insert least significant 9-bits. */
2006  insn |= (value & 0x1ff) << operand->shift;
2007  /* Insert next least significant 10-bits. */
2008  insn |= ((value >> 9) & 0x3ff) << 6;
2009  /* Insert most significant 4-bits. */
2010  insn |= (value >> 19) & 0xf;
2011  }
2012  else if (!arc_mach_a4 && ('i' == operand->fmt))
2013  {
2014  if (value & 1) {
2015  *errmsg = _ ("branch address not on 2 byte boundary");
2016  }
2017 
2018  value = value >> 1;
2019  /* Insert least significant 10-bits. */
2020  insn |= (value & 0x3ff) << operand->shift;
2021  /* Insert most significant 10-bits. */
2022  insn |= ((value >> 10) & 0x3ff) << 6;
2023  }
2024  else if (!arc_mach_a4 && ('I' == operand->fmt))
2025  {
2026  if (value & 1) {
2027  *errmsg = _ ("branch address not on 2 byte boundary");
2028  }
2029 
2030  value = value >> 1;
2031  /* Insert least significant 10-bits. */
2032  insn |= (value & 0x3ff) << operand->shift;
2033  /* Insert next least significant 10-bits. */
2034  insn |= ((value >> 10) & 0x3ff) << 6;
2035  /* Insert most significant 4-bits. */
2036  insn |= (value >> 20) & 0xf;
2037  }
2038  else if (!arc_mach_a4 && ('d' == operand->fmt))
2039  {
2040  /* Insert least significant 7-bits. */
2041  insn |= ((value >> 1) & 0x7f) << operand->shift;
2042  /* Insert most significant bit. */
2043  insn |= (((value >> 1) & 0x80) >> 7) << 15;
2044  }
2045  else if (!arc_mach_a4 && ('y' == operand->fmt))
2046  {
2047  /* Insert most significant 6-bits of 7-bit unsigned immediate value. */
2048  insn |= ((value >> 1) & 0x3f) << operand->shift;
2049  }
2050  else if (!arc_mach_a4 && ('Y' == operand->fmt))
2051  {
2052  /* Insert bit-1 to bit-6 of 13-bit signed immediate value. */
2053  insn |= ((value >> 1) & 0x3f) << operand->shift;
2054  /* Insert bit-7 to bit-13 of 13-bit signed immediate value. */
2055  insn |= ((value >> 1) & 0xfc0) >> 6;
2056  }
2057  else if (!arc_mach_a4 && (('s' == operand->fmt) || ('S' == operand->fmt)
2058  || ('Z' == operand->fmt)))
2059  {
2060  if (value & 1) {
2061  *errmsg = _ ("branch address not on 2 byte boundary");
2062  }
2063  insn |= ((value >> 1) & ((1 << operand->bits) - 1)) << operand->shift;
2064  }
2065  else if (!arc_mach_a4 && ('W' == operand->fmt))
2066  {
2067  if (value & 3) {
2068  *errmsg = _ ("branch address not on 4 byte boundary");
2069  }
2070  insn |= ((value >> 2) & ((1 << operand->bits) - 1)) << operand->shift;
2071  }
2072  else
2073  {
2074  /* for ARCtangent-A4 */
2075 
2076  if (value & 3) {
2077  *errmsg = _ ("branch address not on 4 byte boundary");
2078  }
2079  insn |= ((value >> 2) & ((1 << operand->bits) - 1)) << operand->shift;
2080  }
2081  return insn;
2082 }

References _, arc_mach_a4, and value.

◆ insert_s12()

static arc_insn insert_s12 ( arc_insn  insn,
long ex,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 937 of file arc-opc.c.

944 {
945 
946  long msb6;
947  long lsb6;
948 
949  msb6 = (value >> 6) & 0x3ff;
950  lsb6 = (value & 0x3f) << 6 ;
951 
952  insn |= lsb6;
953  if (ex) {
954  *ex |= msb6;
955  }
956  return insn;
957 }

References ex, and value.

◆ insert_s15()

static arc_insn insert_s15 ( arc_insn  insn,
long ex,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1064 of file arc-opc.c.

1071 {
1072 
1073  if (ex) {
1074  *ex |= (value & 0x7fff);
1075  }
1076  return insn;
1077 }

References ex, and value.

◆ insert_shimmfinish()

static arc_insn insert_shimmfinish ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1897 of file arc-opc.c.

1903 {
1904  if (shimm_p) {
1905  insn |= (shimm & ((1 << operand->bits) - 1)) << operand->shift;
1906  }
1907  return insn;
1908 }

References shimm, and shimm_p.

◆ insert_st_syntax()

static arc_insn insert_st_syntax ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **  errmsg 
)
static

Definition at line 1678 of file arc-opc.c.

1684 {
1685  /* do syntax check for ARCompact 'st' insn */
1686  if (!arc_mach_a4)
1687  {
1688  /* TODO - check for validity of operands for ARCompact store insn */
1689 
1690  if (addrwb_p)
1691  {
1692  if (ls_operand[LS_BASE] != OP_REG) {
1693  *errmsg = _ ("address writeback not allowed");
1694  }
1695  insn |= addrwb_p;
1696  }
1697  return insn;
1698  }
1699 
1700  /* Do syntax check for ARCtangent-A4 'st' insn. */
1701  if (ST_SYNTAX (OP_SHIMM, OP_REG, OP_NONE) && shimm != 0)
1702  {
1703  /* Change an illegal insn into a legal one, it's easier to
1704  do it here than to try to handle it during operand scan. */
1705  limm_p = 1;
1706  limm = shimm;
1707  shimm_p = 0;
1708  shimm = 0;
1709  insn= insn & ~(C(-1) | 511);
1710  insn |= ARC_REG_LIMM << ARC_SHIFT_REGC;
1712  }
1713 
1716  {
1717  /* Try to salvage this syntax. */
1718  if (shimm & 0x1) /* Odd shimms won't work. */
1719  {
1720  if (limm_p) { /* Do we have a limm already? */
1721  *errmsg = _ ("impossible store");
1722  }
1723  limm_p = 1;
1724  limm = shimm;
1725  shimm = 0;
1726  shimm_p = 0;
1727  insn = insn & ~(B (-1) | 511);
1728  insn |= B (ARC_REG_LIMM);
1730  }
1731  else
1732  {
1733  shimm >>= 1;
1734  insn = insn & ~511;
1735  insn |= shimm;
1737  }
1738  }
1739  if (ST_SYNTAX (OP_SHIMM, OP_LIMM, OP_NONE)) {
1740  limm += arc_limm_fixup_adjust (insn);
1741  }
1742  if (ST_SYNTAX (OP_LIMM, OP_SHIMM, OP_SHIMM) && (shimm * 2 == limm)) {
1743  insn &= ~C (-1);
1744  limm_p = 0;
1745  limm = 0;
1746  insn |= C (ARC_REG_SHIMM);
1748  }
1750  *errmsg = _ ("st operand error");
1751  }
1752  if (addrwb_p) {
1753  if (ls_operand[LS_BASE] != OP_REG) {
1754  *errmsg = _ ("address writeback not allowed");
1755  }
1756  insn |= addrwb_p;
1757  }
1758  if (ST_SYNTAX (OP_SHIMM, OP_REG, OP_NONE) && shimm) {
1759  *errmsg = _ ("store value must be zero");
1760  }
1761  return insn;
1762 }
int arc_limm_fixup_adjust(arc_insn insn)
Definition: arc-opc.c:1658

References _, addrwb_p, arc_limm_fixup_adjust(), arc_mach_a4, ARC_REG_LIMM, ARC_REG_SHIMM, ARC_SHIFT_REGC, B, C, limm, limm_p, LS_BASE, LS_OFFSET, ls_operand, LS_VALUE, OP_LIMM, OP_NONE, OP_REG, OP_SHIMM, shimm, shimm_p, and ST_SYNTAX.

◆ insert_u16()

static arc_insn insert_u16 ( arc_insn  insn,
long ex,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 970 of file arc-opc.c.

977 {
978 
979  long msb6;
980  long lsb6;
981 
982  msb6 = (value >> 6) & 0x3ff;
983  lsb6 = (value & 0x3f) << 6 ;
984 
985  insn |= lsb6;
986  if (ex) {
987  *ex |= msb6;
988  }
989  return insn;
990 }

References ex, and value.

◆ insert_u8()

static arc_insn insert_u8 ( arc_insn  insn,
long *insn2  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 904 of file arc-opc.c.

911 {
912 
913  long msb2;
914  long lsb6;
915 
916  msb2 = value >> 6;
917  msb2 = msb2 << 15;
918 
919  lsb6 = value & 0x3f ;
920 
921  insn |= msb2;
922  insn |= (lsb6 << operand->shift);
923  return insn;
924 }

References value.

◆ insert_ul16()

static arc_insn insert_ul16 ( arc_insn  insn,
long ex,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1033 of file arc-opc.c.

1040 {
1041 
1042  long msb2;
1043  long lsb6;
1044 
1045  msb2 = (value >> 6) & 0x3;
1046  lsb6 = (value & 0x3f) << 6 ;
1047 
1048  insn |= lsb6;
1049  if (ex) {
1050  *ex |= msb2;
1051  }
1052  return insn;
1053 }

References ex, and value.

◆ insert_unopmacro()

static arc_insn insert_unopmacro ( arc_insn  insn,
long *ex  ATTRIBUTE_UNUSED,
const struct arc_operand operand,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1965 of file arc-opc.c.

1971 {
1972  insn |= ((insn >> ARC_SHIFT_REGB) & ARC_MASK_REG) << operand->shift;
1973  return insn;
1974 }

References ARC_MASK_REG, and ARC_SHIFT_REGB.

◆ insert_uu16()

static arc_insn insert_uu16 ( arc_insn  insn,
long ex,
const struct arc_operand *operand  ATTRIBUTE_UNUSED,
int mods  ATTRIBUTE_UNUSED,
const struct arc_operand_value *reg  ATTRIBUTE_UNUSED,
long value  ATTRIBUTE_UNUSED,
const char **errmsg  ATTRIBUTE_UNUSED 
)
static

Definition at line 1003 of file arc-opc.c.

1010 {
1011 
1012  long msb8;
1013 
1014  msb8 = (value & 0xff) << 2;
1015  if (ex) {
1016  *ex |= msb8;
1017  }
1018  return insn;
1019 }

References ex, and value.

◆ lookup_register()

static const struct arc_operand_value* lookup_register ( int  type,
long  regno 
)
static

Definition at line 2137 of file arc-opc.c.

2138 {
2139  const struct arc_operand_value *r,*end;
2140  struct arc_ext_operand_value *ext_oper = arc_ext_operands;
2141 
2142  while (ext_oper)
2143  {
2144  if (ext_oper->operand.type == type && ext_oper->operand.value == regno) {
2145  return (&ext_oper->operand);
2146  }
2147  ext_oper = ext_oper->next;
2148  }
2149 
2150  if (type == REG || type == REG_AC) {
2151  return &arc_reg_names[regno];
2152  }
2153 
2154  /* ??? This is a little slow and can be speeded up. */
2156  r < end; ++r) {
2157  if (type == r->type && regno == r->value) {
2158  return r;
2159  }
2160  }
2161  return 0;
2162 }
#define r
Definition: crypto_rc6.c:12

References arc_ext_operands, arc_reg_names, arc_reg_names_count, test_evm::end, arc_ext_operand_value::next, arc_ext_operand_value::operand, r, REG, REG_AC, arc_operand_value::type, type, and arc_operand_value::value.

Referenced by extract_reg().

Variable Documentation

◆ addrwb_p

int addrwb_p
static

◆ arc_cond_p

◆ arc_ext_operands

struct arc_ext_operand_value* arc_ext_operands

Definition at line 880 of file arc-opc.c.

Referenced by arc_opcode_lookup_suffix(), get_ext_suffix(), and lookup_register().

◆ arc_ld_ext_mask

unsigned long arc_ld_ext_mask = 1 << (62 - 32)

Definition at line 876 of file arc-opc.c.

Referenced by insert_ex_syntax(), and insert_ld_syntax().

◆ arc_mach_a4

◆ arc_opcodes

struct arc_opcode arc_opcodes[]
static

Definition at line 2447 of file arc-opc.c.

Referenced by arc_opcode_init_tables().

◆ arc_operand_map

unsigned char* arc_operand_map = arc_operand_map_a4

Definition at line 889 of file arc-opc.c.

Referenced by arc_opcode_init_tables(), and extract_ld_offset().

◆ arc_operand_map_a4

unsigned char arc_operand_map_a4[256]
static

Definition at line 148 of file arc-opc.c.

Referenced by arc_opcode_init_tables().

◆ arc_operand_map_ac

unsigned char arc_operand_map_ac[256]
static

Definition at line 149 of file arc-opc.c.

Referenced by arc_opcode_init_tables().

◆ arc_operands

const struct arc_operand* arc_operands = arc_operands_a4

◆ arc_operands_a4

const struct arc_operand arc_operands_a4[]
static

Definition at line 149 of file arc-opc.c.

Referenced by arc_opcode_init_tables().

◆ arc_operands_ac

const struct arc_operand arc_operands_ac[]
static

Definition at line 149 of file arc-opc.c.

Referenced by arc_opcode_init_tables().

◆ arc_reg_names

const struct arc_operand_value* arc_reg_names = arc_reg_names_a4

Definition at line 4100 of file arc-opc.c.

Referenced by arc_aux_reg_name(), arc_opcode_init_tables(), and lookup_register().

◆ arc_reg_names_a4

const struct arc_operand_value arc_reg_names_a4[]
static

Definition at line 2447 of file arc-opc.c.

Referenced by arc_opcode_init_tables().

◆ arc_reg_names_a500600

const struct arc_operand_value arc_reg_names_a500600[]
static

Definition at line 2447 of file arc-opc.c.

Referenced by arc_opcode_init_tables().

◆ arc_reg_names_a700

const struct arc_operand_value arc_reg_names_a700[]
static

Definition at line 2447 of file arc-opc.c.

Referenced by arc_opcode_init_tables().

◆ arc_reg_names_count

int arc_reg_names_count

Definition at line 4101 of file arc-opc.c.

Referenced by arc_aux_reg_name(), arc_opcode_init_tables(), and lookup_register().

◆ arc_suffixes

const struct arc_operand_value* arc_suffixes = arc_suffixes_a4

Definition at line 4264 of file arc-opc.c.

Referenced by arc_opcode_init_tables(), and arc_opcode_lookup_suffix().

◆ arc_suffixes_a4

const struct arc_operand_value arc_suffixes_a4[]
static

Definition at line 4101 of file arc-opc.c.

Referenced by arc_opcode_init_tables().

◆ arc_suffixes_ac

const struct arc_operand_value arc_suffixes_ac[]
static

Definition at line 4101 of file arc-opc.c.

Referenced by arc_opcode_init_tables().

◆ arc_suffixes_count

int arc_suffixes_count

Definition at line 4265 of file arc-opc.c.

Referenced by arc_opcode_init_tables(), and arc_opcode_lookup_suffix().

◆ arc_user_mode_only

int arc_user_mode_only = 0

Definition at line 878 of file arc-opc.c.

Referenced by insert_ex_syntax(), and insert_ld_syntax().

◆ cpu_type

◆ flag_p

◆ flagshimm_handled_p

int flagshimm_handled_p
static

◆ icode_map

struct arc_opcode* icode_map[32]
static

Definition at line 4272 of file arc-opc.c.

Referenced by arc_opcode_init_tables(), and arc_opcode_lookup_dis().

◆ jumpflags_p

int jumpflags_p
static

Definition at line 122 of file arc-opc.c.

Referenced by arc_opcode_init_insert(), and insert_jumpflags().

◆ limm

long limm
static

◆ limm_p

◆ ls_operand

◆ nullify

int nullify
static

Definition at line 119 of file arc-opc.c.

Referenced by arc_opcode_init_insert(), insert_absaddr(), and insert_nullify().

◆ nullify_p

int nullify_p
static

Definition at line 116 of file arc-opc.c.

Referenced by arc_opcode_init_insert(), insert_absaddr(), and insert_nullify().

◆ opcode_map

struct arc_opcode* opcode_map[26+1]
static

Definition at line 4269 of file arc-opc.c.

Referenced by arc_opcode_init_tables(), and arc_opcode_lookup_asm().

◆ shimm

int shimm
static

◆ shimm_p