Copyright (C) 1998, 1999, 2000, 2002, 2005, 2006
Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com> */
#ifndef opcode_ia64_h
#define opcode_ia64_h
#include <sys/types.h>
#include "bfd.h"
typedef BFD_HOST_U_64_BIT ia64_insn;
enum ia64_insn_type
{
IA64_TYPE_NIL = 0,
IA64_TYPE_A,
IA64_TYPE_I,
IA64_TYPE_M,
IA64_TYPE_B,
IA64_TYPE_F,
IA64_TYPE_X,
IA64_TYPE_DYN,
IA64_NUM_TYPES
};
enum ia64_unit
{
IA64_UNIT_NIL = 0,
IA64_UNIT_I,
IA64_UNIT_M,
IA64_UNIT_B,
IA64_UNIT_F,
IA64_UNIT_L,
IA64_UNIT_X,
IA64_NUM_UNITS
};
bfd/cpu-ia64-opc.c
*/
enum ia64_opnd
{
IA64_OPND_NIL,
IA64_OPND_AR_CSD,
IA64_OPND_AR_CCV,
IA64_OPND_AR_PFS,
IA64_OPND_C1,
IA64_OPND_C8,
IA64_OPND_C16,
IA64_OPND_GR0,
IA64_OPND_IP,
IA64_OPND_PR,
IA64_OPND_PR_ROT,
IA64_OPND_PSR,
IA64_OPND_PSR_L,
IA64_OPND_PSR_UM,
IA64_OPND_AR3,
IA64_OPND_B1,
IA64_OPND_B2,
IA64_OPND_CR3,
IA64_OPND_F1,
IA64_OPND_F2,
IA64_OPND_F3,
IA64_OPND_F4,
IA64_OPND_P1,
IA64_OPND_P2,
IA64_OPND_R1,
IA64_OPND_R2,
IA64_OPND_R3,
IA64_OPND_R3_2,
IA64_OPND_MR3,
IA64_OPND_CPUID_R3,
IA64_OPND_DBR_R3,
IA64_OPND_DTR_R3,
IA64_OPND_ITR_R3,
IA64_OPND_IBR_R3,
IA64_OPND_MSR_R3,
IA64_OPND_PKR_R3,
IA64_OPND_PMC_R3,
IA64_OPND_PMD_R3,
IA64_OPND_RR_R3,
IA64_OPND_CCNT5,
IA64_OPND_CNT2a,
IA64_OPND_CNT2b,
IA64_OPND_CNT2c,
IA64_OPND_CNT5,
IA64_OPND_CNT6,
IA64_OPND_CPOS6a,
IA64_OPND_CPOS6b,
IA64_OPND_CPOS6c,
IA64_OPND_IMM1,
IA64_OPND_IMMU2,
IA64_OPND_IMMU5b,
IA64_OPND_IMMU7a,
IA64_OPND_IMMU7b,
IA64_OPND_SOF,
IA64_OPND_SOL,
IA64_OPND_SOR,
IA64_OPND_IMM8,
IA64_OPND_IMM8U4,
IA64_OPND_IMM8M1,
IA64_OPND_IMM8M1U4,
IA64_OPND_IMM8M1U8,
IA64_OPND_IMMU9,
IA64_OPND_IMM9a,
IA64_OPND_IMM9b,
IA64_OPND_IMM14,
IA64_OPND_IMM17,
IA64_OPND_IMMU21,
IA64_OPND_IMM22,
IA64_OPND_IMMU24,
IA64_OPND_IMM44,
IA64_OPND_IMMU62,
IA64_OPND_IMMU64,
IA64_OPND_INC3,
IA64_OPND_LEN4,
IA64_OPND_LEN6,
IA64_OPND_MBTYPE4,
IA64_OPND_MHTYPE8,
IA64_OPND_POS6,
IA64_OPND_TAG13,
IA64_OPND_TAG13b,
IA64_OPND_TGT25,
IA64_OPND_TGT25b,
IA64_OPND_TGT25c,
IA64_OPND_TGT64,
IA64_OPND_LDXMOV,
IA64_OPND_COUNT
};
enum ia64_dependency_mode
{
IA64_DV_RAW,
IA64_DV_WAW,
IA64_DV_WAR,
};
enum ia64_dependency_semantics
{
IA64_DVS_NONE,
IA64_DVS_IMPLIED,
IA64_DVS_IMPLIEDF,
IA64_DVS_DATA,
IA64_DVS_INSTR,
IA64_DVS_SPECIFIC,
IA64_DVS_STOP,
IA64_DVS_OTHER,
};
enum ia64_resource_specifier
{
IA64_RS_ANY,
IA64_RS_AR_K,
IA64_RS_AR_UNAT,
IA64_RS_AR,
IA64_RS_ARb,
IA64_RS_BR,
IA64_RS_CFM,
IA64_RS_CPUID,
IA64_RS_CR_IRR,
IA64_RS_CR_LRR,
IA64_RS_CR,
IA64_RS_DBR,
IA64_RS_FR,
IA64_RS_FRb,
IA64_RS_GR0,
IA64_RS_GR,
IA64_RS_IBR,
IA64_RS_INSERVICE,
IA64_RS_MSR,
IA64_RS_PKR,
IA64_RS_PMC,
IA64_RS_PMD,
IA64_RS_PR,
IA64_RS_PRr,
IA64_RS_PR63,
IA64_RS_RR,
IA64_RS_ARX,
IA64_RS_CRX,
IA64_RS_PSR,
IA64_RS_RSE,
IA64_RS_AR_FPSR,
};
enum ia64_rse_resource
{
IA64_RSE_N_STACKED_PHYS,
IA64_RSE_BOF,
IA64_RSE_STORE_REG,
IA64_RSE_LOAD_REG,
IA64_RSE_BSPLOAD,
IA64_RSE_RNATBITINDEX,
IA64_RSE_CFLE,
IA64_RSE_NDIRTY,
};
struct ia64_dependency
{
const char *name;
enum ia64_resource_specifier specifier;
enum ia64_dependency_mode mode;
enum ia64_dependency_semantics semantics;
#define REG_NONE (-1)
int regindex;
const char *info;
};
chks are dependencies to check for conflicts when an opcode is
encountered; regs are dependencies to register (mark as used) when an
opcode is used. chks correspond to readers (RAW) or writers (WAW or
WAR) of a resource, while regs correspond to writers (RAW or WAW) and
readers (WAR) of a resource. */
struct ia64_opcode_dependency
{
int nchks;
const unsigned short *chks;
int nregs;
const unsigned short *regs;
};
#define RDEP(N,X) (((N)<<11)|(X))
#define NOTE(X) (((X)>>11)&0x1F)
#define DEP(X) ((X)&0x7FF)
for each of the three slots. It also specifies the location of
instruction group boundaries that may be present between two slots. */
struct ia64_templ_desc
{
int group_boundary;
enum ia64_unit exec_unit[3];
const char *name;
};
struct ia64_opcode
{
const char *name;
enum ia64_insn_type type;
int num_outputs;
operands are zeroes. */
ia64_insn opcode;
mask containing ones indicating those bits which must match the
opcode field, and zeroes indicating those bits which need not
match (and are presumably filled in by operands). */
ia64_insn mask;
operand table. They appear in the order which the operands must
appear in assembly code, and are terminated by a zero. */
enum ia64_opnd operands[5];
indicate specific processors and environments support the
instructions. The defined values are listed below. */
unsigned int flags;
short ent_index;
const struct ia64_opcode_dependency *dependencies;
};
#define IA64_OPCODE_FIRST (1<<0) /* must be first in an insn group */
#define IA64_OPCODE_X_IN_MLX (1<<1) /* insn is allowed in X slot of MLX */
#define IA64_OPCODE_LAST (1<<2) /* must be last in an insn group */
#define IA64_OPCODE_PRIV (1<<3) /* privileged instruct */
#define IA64_OPCODE_SLOT2 (1<<4) /* insn allowed in slot 2 only */
#define IA64_OPCODE_NO_PRED (1<<5) /* insn cannot be predicated */
#define IA64_OPCODE_PSEUDO (1<<6) /* insn is a pseudo-op */
#define IA64_OPCODE_F2_EQ_F3 (1<<7) /* constraint: F2 == F3 */
#define IA64_OPCODE_LEN_EQ_64MCNT (1<<8) /* constraint: LEN == 64-CNT */
#define IA64_OPCODE_MOD_RRBS (1<<9) /* modifies all rrbs in CFM */
#define IA64_OPCODE_POSTINC (1<<10) /* postincrement MR3 operand */
#define IA64_OP(i) (((i) >> 37) & 0xf)
enum ia64_operand_class
{
IA64_OPND_CLASS_CST,
IA64_OPND_CLASS_REG,
IA64_OPND_CLASS_IND,
IA64_OPND_CLASS_ABS,
IA64_OPND_CLASS_REL,
};
struct ia64_operand
{
enum ia64_operand_class class;
instruction pointed to by CODE. If an error occurs, *CODE is not
modified and the returned string describes the cause of the
error. If no error occurs, NULL is returned. */
const char *(*insert) (const struct ia64_operand *self, ia64_insn value,
ia64_insn *code);
instruction CODE store them in *VALUE. If an error occurs, the
cause of the error is described by the string returned. If no
error occurs, NULL is returned. */
const char *(*extract) (const struct ia64_operand *self, ia64_insn code,
ia64_insn *value);
const char *str;
struct bit_field
{
int bits;
int shift;
}
field[4];
unsigned int flags;
const char *desc;
};
#define IA64_OPND_FLAG_DECIMAL_SIGNED (1<<0)
#define IA64_OPND_FLAG_DECIMAL_UNSIGNED (1<<1)
extern const struct ia64_templ_desc ia64_templ_desc[16];
the order in which the disassembler should consider instructions. */
extern struct ia64_opcode ia64_opcodes_a[];
extern struct ia64_opcode ia64_opcodes_i[];
extern struct ia64_opcode ia64_opcodes_m[];
extern struct ia64_opcode ia64_opcodes_b[];
extern struct ia64_opcode ia64_opcodes_f[];
extern struct ia64_opcode ia64_opcodes_d[];
extern struct ia64_opcode *ia64_find_opcode (const char *name);
extern struct ia64_opcode *ia64_find_next_opcode (struct ia64_opcode *ent);
extern struct ia64_opcode *ia64_dis_opcode (ia64_insn insn,
enum ia64_insn_type type);
extern void ia64_free_opcode (struct ia64_opcode *ent);
extern const struct ia64_dependency *ia64_find_dependency (int index);
in bfd/cpu-ia64-opc.c: */
extern const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT];
#endif