xref: /openbsd-src/gnu/usr.bin/binutils/include/opcode/ia64.h (revision d2201f2f89f0be1a0be6f7568000ed297414a06d)
15f210c2aSfgsch /* ia64.h -- Header file for ia64 opcode table
2*d2201f2fSdrahn    Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
3*d2201f2fSdrahn 	Contributed by David Mosberger-Tang <davidm@hpl.hp.com> */
45f210c2aSfgsch 
55f210c2aSfgsch #ifndef opcode_ia64_h
65f210c2aSfgsch #define opcode_ia64_h
75f210c2aSfgsch 
85f210c2aSfgsch #include <sys/types.h>
95f210c2aSfgsch 
10*d2201f2fSdrahn #include "bfd.h"
115f210c2aSfgsch 
125f210c2aSfgsch 
135f210c2aSfgsch typedef BFD_HOST_U_64_BIT ia64_insn;
145f210c2aSfgsch 
155f210c2aSfgsch enum ia64_insn_type
165f210c2aSfgsch   {
175f210c2aSfgsch     IA64_TYPE_NIL = 0,	/* illegal type */
185f210c2aSfgsch     IA64_TYPE_A,	/* integer alu (I- or M-unit) */
195f210c2aSfgsch     IA64_TYPE_I,	/* non-alu integer (I-unit) */
205f210c2aSfgsch     IA64_TYPE_M,	/* memory (M-unit) */
215f210c2aSfgsch     IA64_TYPE_B,	/* branch (B-unit) */
225f210c2aSfgsch     IA64_TYPE_F,	/* floating-point (F-unit) */
235f210c2aSfgsch     IA64_TYPE_X,	/* long encoding (X-unit) */
245f210c2aSfgsch     IA64_TYPE_DYN,	/* Dynamic opcode */
255f210c2aSfgsch     IA64_NUM_TYPES
265f210c2aSfgsch   };
275f210c2aSfgsch 
285f210c2aSfgsch enum ia64_unit
295f210c2aSfgsch   {
305f210c2aSfgsch     IA64_UNIT_NIL = 0,	/* illegal unit */
315f210c2aSfgsch     IA64_UNIT_I,	/* integer unit */
325f210c2aSfgsch     IA64_UNIT_M,	/* memory unit */
335f210c2aSfgsch     IA64_UNIT_B,	/* branching unit */
345f210c2aSfgsch     IA64_UNIT_F,	/* floating-point unit */
355f210c2aSfgsch     IA64_UNIT_L,	/* long "unit" */
365f210c2aSfgsch     IA64_UNIT_X,	/* may be integer or branch unit */
375f210c2aSfgsch     IA64_NUM_UNITS
385f210c2aSfgsch   };
395f210c2aSfgsch 
405f210c2aSfgsch /* Changes to this enumeration must be propagated to the operand table in
415f210c2aSfgsch    bfd/cpu-ia64-opc.c
425f210c2aSfgsch  */
435f210c2aSfgsch enum ia64_opnd
445f210c2aSfgsch   {
455f210c2aSfgsch     IA64_OPND_NIL,	/* no operand---MUST BE FIRST!*/
465f210c2aSfgsch 
475f210c2aSfgsch     /* constants */
48*d2201f2fSdrahn     IA64_OPND_AR_CSD,	/* application register csd (ar.csd) */
495f210c2aSfgsch     IA64_OPND_AR_CCV,	/* application register ccv (ar.ccv) */
505f210c2aSfgsch     IA64_OPND_AR_PFS,	/* application register pfs (ar.pfs) */
515f210c2aSfgsch     IA64_OPND_C1,	/* the constant 1 */
525f210c2aSfgsch     IA64_OPND_C8,	/* the constant 8 */
535f210c2aSfgsch     IA64_OPND_C16,	/* the constant 16 */
545f210c2aSfgsch     IA64_OPND_GR0,	/* gr0 */
555f210c2aSfgsch     IA64_OPND_IP,	/* instruction pointer (ip) */
565f210c2aSfgsch     IA64_OPND_PR,	/* predicate register (pr) */
575f210c2aSfgsch     IA64_OPND_PR_ROT,	/* rotating predicate register (pr.rot) */
585f210c2aSfgsch     IA64_OPND_PSR,	/* processor status register (psr) */
595f210c2aSfgsch     IA64_OPND_PSR_L,	/* processor status register L (psr.l) */
605f210c2aSfgsch     IA64_OPND_PSR_UM,	/* processor status register UM (psr.um) */
615f210c2aSfgsch 
625f210c2aSfgsch     /* register operands: */
635f210c2aSfgsch     IA64_OPND_AR3,	/* third application register # (bits 20-26) */
645f210c2aSfgsch     IA64_OPND_B1,	/* branch register # (bits 6-8) */
655f210c2aSfgsch     IA64_OPND_B2,	/* branch register # (bits 13-15) */
665f210c2aSfgsch     IA64_OPND_CR3,	/* third control register # (bits 20-26) */
675f210c2aSfgsch     IA64_OPND_F1,	/* first floating-point register # */
685f210c2aSfgsch     IA64_OPND_F2,	/* second floating-point register # */
695f210c2aSfgsch     IA64_OPND_F3,	/* third floating-point register # */
705f210c2aSfgsch     IA64_OPND_F4,	/* fourth floating-point register # */
715f210c2aSfgsch     IA64_OPND_P1,	/* first predicate # */
725f210c2aSfgsch     IA64_OPND_P2,	/* second predicate # */
735f210c2aSfgsch     IA64_OPND_R1,	/* first register # */
745f210c2aSfgsch     IA64_OPND_R2,	/* second register # */
755f210c2aSfgsch     IA64_OPND_R3,	/* third register # */
765f210c2aSfgsch     IA64_OPND_R3_2,	/* third register # (limited to gr0-gr3) */
775f210c2aSfgsch 
785f210c2aSfgsch     /* indirect operands: */
795f210c2aSfgsch     IA64_OPND_CPUID_R3,	/* cpuid[reg] */
805f210c2aSfgsch     IA64_OPND_DBR_R3,	/* dbr[reg] */
815f210c2aSfgsch     IA64_OPND_DTR_R3,	/* dtr[reg] */
825f210c2aSfgsch     IA64_OPND_ITR_R3,	/* itr[reg] */
835f210c2aSfgsch     IA64_OPND_IBR_R3,	/* ibr[reg] */
845f210c2aSfgsch     IA64_OPND_MR3,	/* memory at addr of third register # */
855f210c2aSfgsch     IA64_OPND_MSR_R3,	/* msr[reg] */
865f210c2aSfgsch     IA64_OPND_PKR_R3,	/* pkr[reg] */
875f210c2aSfgsch     IA64_OPND_PMC_R3,	/* pmc[reg] */
885f210c2aSfgsch     IA64_OPND_PMD_R3,	/* pmd[reg] */
895f210c2aSfgsch     IA64_OPND_RR_R3,	/* rr[reg] */
905f210c2aSfgsch 
915f210c2aSfgsch     /* immediate operands: */
925f210c2aSfgsch     IA64_OPND_CCNT5,	/* 5-bit count (31 - bits 20-24) */
935f210c2aSfgsch     IA64_OPND_CNT2a,	/* 2-bit count (1 + bits 27-28) */
945f210c2aSfgsch     IA64_OPND_CNT2b,	/* 2-bit count (bits 27-28): 1, 2, 3 */
955f210c2aSfgsch     IA64_OPND_CNT2c,	/* 2-bit count (bits 30-31): 0, 7, 15, or 16 */
965f210c2aSfgsch     IA64_OPND_CNT5,	/* 5-bit count (bits 14-18) */
975f210c2aSfgsch     IA64_OPND_CNT6,	/* 6-bit count (bits 27-32) */
985f210c2aSfgsch     IA64_OPND_CPOS6a,	/* 6-bit count (63 - bits 20-25) */
995f210c2aSfgsch     IA64_OPND_CPOS6b,	/* 6-bit count (63 - bits 14-19) */
1005f210c2aSfgsch     IA64_OPND_CPOS6c,	/* 6-bit count (63 - bits 31-36) */
1015f210c2aSfgsch     IA64_OPND_IMM1,	/* signed 1-bit immediate (bit 36) */
1025f210c2aSfgsch     IA64_OPND_IMMU2,	/* unsigned 2-bit immediate (bits 13-14) */
1035f210c2aSfgsch     IA64_OPND_IMMU7a,	/* unsigned 7-bit immediate (bits 13-19) */
1045f210c2aSfgsch     IA64_OPND_IMMU7b,	/* unsigned 7-bit immediate (bits 20-26) */
1055f210c2aSfgsch     IA64_OPND_SOF,	/* 8-bit stack frame size */
1065f210c2aSfgsch     IA64_OPND_SOL,	/* 8-bit size of locals */
1075f210c2aSfgsch     IA64_OPND_SOR,	/* 6-bit number of rotating registers (scaled by 8) */
1085f210c2aSfgsch     IA64_OPND_IMM8,	/* signed 8-bit immediate (bits 13-19 & 36) */
1095f210c2aSfgsch     IA64_OPND_IMM8U4,	/* cmp4*u signed 8-bit immediate (bits 13-19 & 36) */
1105f210c2aSfgsch     IA64_OPND_IMM8M1,	/* signed 8-bit immediate -1 (bits 13-19 & 36) */
1115f210c2aSfgsch     IA64_OPND_IMM8M1U4,	/* cmp4*u signed 8-bit immediate -1 (bits 13-19 & 36)*/
1125f210c2aSfgsch     IA64_OPND_IMM8M1U8,	/* cmp*u signed 8-bit immediate -1 (bits 13-19 & 36) */
1135f210c2aSfgsch     IA64_OPND_IMMU9,	/* unsigned 9-bit immediate (bits 33-34, 20-26) */
1145f210c2aSfgsch     IA64_OPND_IMM9a,	/* signed 9-bit immediate (bits 6-12, 27, 36) */
1155f210c2aSfgsch     IA64_OPND_IMM9b,	/* signed 9-bit immediate (bits 13-19, 27, 36) */
1165f210c2aSfgsch     IA64_OPND_IMM14,	/* signed 14-bit immediate (bits 13-19, 27-32, 36) */
1175f210c2aSfgsch     IA64_OPND_IMM17,	/* signed 17-bit immediate (2*bits 6-12, 24-31, 36) */
1185f210c2aSfgsch     IA64_OPND_IMMU21,	/* unsigned 21-bit immediate (bits 6-25, 36) */
1195f210c2aSfgsch     IA64_OPND_IMM22,	/* signed 22-bit immediate (bits 13-19, 22-36) */
1205f210c2aSfgsch     IA64_OPND_IMMU24,	/* unsigned 24-bit immediate (bits 6-26, 31-32, 36) */
1215f210c2aSfgsch     IA64_OPND_IMM44,	/* signed 44-bit immediate (2^16*bits 6-32, 36) */
1225f210c2aSfgsch     IA64_OPND_IMMU62,	/* unsigned 62-bit immediate */
1235f210c2aSfgsch     IA64_OPND_IMMU64,	/* unsigned 64-bit immediate (lotsa bits...) */
1245f210c2aSfgsch     IA64_OPND_INC3,	/* signed 3-bit (bits 13-15): +/-1, 4, 8, 16 */
1255f210c2aSfgsch     IA64_OPND_LEN4,	/* 4-bit count (bits 27-30 + 1) */
1265f210c2aSfgsch     IA64_OPND_LEN6,	/* 6-bit count (bits 27-32 + 1) */
1275f210c2aSfgsch     IA64_OPND_MBTYPE4,	/* 4-bit mux type (bits 20-23) */
1285f210c2aSfgsch     IA64_OPND_MHTYPE8,	/* 8-bit mux type (bits 20-27) */
1295f210c2aSfgsch     IA64_OPND_POS6,	/* 6-bit count (bits 14-19) */
1305f210c2aSfgsch     IA64_OPND_TAG13,	/* signed 13-bit tag (ip + 16*bits 6-12, 33-34) */
1315f210c2aSfgsch     IA64_OPND_TAG13b,	/* signed 13-bit tag (ip + 16*bits 24-32) */
1325f210c2aSfgsch     IA64_OPND_TGT25,	/* signed 25-bit (ip + 16*bits 6-25, 36) */
1335f210c2aSfgsch     IA64_OPND_TGT25b,	/* signed 25-bit (ip + 16*bits 6-12, 20-32, 36) */
1345f210c2aSfgsch     IA64_OPND_TGT25c,	/* signed 25-bit (ip + 16*bits 13-32, 36) */
1355f210c2aSfgsch     IA64_OPND_TGT64,    /* 64-bit (ip + 16*bits 13-32, 36, 2-40(L)) */
136*d2201f2fSdrahn     IA64_OPND_LDXMOV,	/* any symbol, generates R_IA64_LDXMOV.  */
1375f210c2aSfgsch 
1385f210c2aSfgsch     IA64_OPND_COUNT	/* # of operand types (MUST BE LAST!) */
1395f210c2aSfgsch   };
1405f210c2aSfgsch 
1415f210c2aSfgsch enum ia64_dependency_mode
1425f210c2aSfgsch {
1435f210c2aSfgsch   IA64_DV_RAW,
1445f210c2aSfgsch   IA64_DV_WAW,
1455f210c2aSfgsch   IA64_DV_WAR,
1465f210c2aSfgsch };
1475f210c2aSfgsch 
1485f210c2aSfgsch enum ia64_dependency_semantics
1495f210c2aSfgsch {
1505f210c2aSfgsch   IA64_DVS_NONE,
1515f210c2aSfgsch   IA64_DVS_IMPLIED,
1525f210c2aSfgsch   IA64_DVS_IMPLIEDF,
1535f210c2aSfgsch   IA64_DVS_DATA,
1545f210c2aSfgsch   IA64_DVS_INSTR,
1555f210c2aSfgsch   IA64_DVS_SPECIFIC,
1565f210c2aSfgsch   IA64_DVS_STOP,
1575f210c2aSfgsch   IA64_DVS_OTHER,
1585f210c2aSfgsch };
1595f210c2aSfgsch 
1605f210c2aSfgsch enum ia64_resource_specifier
1615f210c2aSfgsch {
1625f210c2aSfgsch   IA64_RS_ANY,
1635f210c2aSfgsch   IA64_RS_AR_K,
1645f210c2aSfgsch   IA64_RS_AR_UNAT,
1655f210c2aSfgsch   IA64_RS_AR, /* 8-15, 20, 22-23, 31, 33-35, 37-39, 41-43, 45-47, 67-111 */
1665f210c2aSfgsch   IA64_RS_ARb, /* 48-63, 112-127 */
1675f210c2aSfgsch   IA64_RS_BR,
1685f210c2aSfgsch   IA64_RS_CFM,
1695f210c2aSfgsch   IA64_RS_CPUID,
1705f210c2aSfgsch   IA64_RS_CR_IRR,
1715f210c2aSfgsch   IA64_RS_CR_LRR,
1725f210c2aSfgsch   IA64_RS_CR, /* 3-7,10-15,18,26-63,75-79,82-127 */
1735f210c2aSfgsch   IA64_RS_DBR,
1745f210c2aSfgsch   IA64_RS_FR,
1755f210c2aSfgsch   IA64_RS_FRb,
1765f210c2aSfgsch   IA64_RS_GR0,
1775f210c2aSfgsch   IA64_RS_GR,
1785f210c2aSfgsch   IA64_RS_IBR,
1795f210c2aSfgsch   IA64_RS_INSERVICE, /* CR[EOI] or CR[IVR] */
1805f210c2aSfgsch   IA64_RS_MSR,
1815f210c2aSfgsch   IA64_RS_PKR,
1825f210c2aSfgsch   IA64_RS_PMC,
1835f210c2aSfgsch   IA64_RS_PMD,
1845f210c2aSfgsch   IA64_RS_PR,  /* non-rotating, 1-15 */
1855f210c2aSfgsch   IA64_RS_PRr, /* rotating, 16-62 */
1865f210c2aSfgsch   IA64_RS_PR63,
1875f210c2aSfgsch   IA64_RS_RR,
1885f210c2aSfgsch 
1895f210c2aSfgsch   IA64_RS_ARX, /* ARs not in RS_AR or RS_ARb */
1905f210c2aSfgsch   IA64_RS_CRX, /* CRs not in RS_CR */
1915f210c2aSfgsch   IA64_RS_PSR, /* PSR bits */
1925f210c2aSfgsch   IA64_RS_RSE, /* implementation-specific RSE resources */
1935f210c2aSfgsch   IA64_RS_AR_FPSR,
1945f210c2aSfgsch };
1955f210c2aSfgsch 
1965f210c2aSfgsch enum ia64_rse_resource
1975f210c2aSfgsch {
1985f210c2aSfgsch   IA64_RSE_N_STACKED_PHYS,
1995f210c2aSfgsch   IA64_RSE_BOF,
2005f210c2aSfgsch   IA64_RSE_STORE_REG,
2015f210c2aSfgsch   IA64_RSE_LOAD_REG,
2025f210c2aSfgsch   IA64_RSE_BSPLOAD,
2035f210c2aSfgsch   IA64_RSE_RNATBITINDEX,
2045f210c2aSfgsch   IA64_RSE_CFLE,
2055f210c2aSfgsch   IA64_RSE_NDIRTY,
2065f210c2aSfgsch };
2075f210c2aSfgsch 
2085f210c2aSfgsch /* Information about a given resource dependency */
2095f210c2aSfgsch struct ia64_dependency
2105f210c2aSfgsch {
2115f210c2aSfgsch   /* Name of the resource */
2125f210c2aSfgsch   const char *name;
2135f210c2aSfgsch   /* Does this dependency need further specification? */
2145f210c2aSfgsch   enum ia64_resource_specifier specifier;
2155f210c2aSfgsch   /* Mode of dependency */
2165f210c2aSfgsch   enum ia64_dependency_mode mode;
2175f210c2aSfgsch   /* Dependency semantics */
2185f210c2aSfgsch   enum ia64_dependency_semantics semantics;
2195f210c2aSfgsch   /* Register index, if applicable (distinguishes AR, CR, and PSR deps) */
2205f210c2aSfgsch #define REG_NONE (-1)
2215f210c2aSfgsch   int regindex;
2225f210c2aSfgsch   /* Special info on semantics */
2235f210c2aSfgsch   const char *info;
2245f210c2aSfgsch };
2255f210c2aSfgsch 
2265f210c2aSfgsch /* Two arrays of indexes into the ia64_dependency table.
2275f210c2aSfgsch    chks are dependencies to check for conflicts when an opcode is
2285f210c2aSfgsch    encountered; regs are dependencies to register (mark as used) when an
2295f210c2aSfgsch    opcode is used.  chks correspond to readers (RAW) or writers (WAW or
2305f210c2aSfgsch    WAR) of a resource, while regs correspond to writers (RAW or WAW) and
2315f210c2aSfgsch    readers (WAR) of a resource.  */
2325f210c2aSfgsch struct ia64_opcode_dependency
2335f210c2aSfgsch {
2345f210c2aSfgsch   int nchks;
2355f210c2aSfgsch   const unsigned short *chks;
2365f210c2aSfgsch   int nregs;
2375f210c2aSfgsch   const unsigned short *regs;
2385f210c2aSfgsch };
2395f210c2aSfgsch 
2405f210c2aSfgsch /* encode/extract the note/index for a dependency */
2415f210c2aSfgsch #define RDEP(N,X) (((N)<<11)|(X))
2425f210c2aSfgsch #define NOTE(X) (((X)>>11)&0x1F)
2435f210c2aSfgsch #define DEP(X) ((X)&0x7FF)
2445f210c2aSfgsch 
2455f210c2aSfgsch /* A template descriptor describes the execution units that are active
2465f210c2aSfgsch    for each of the three slots.  It also specifies the location of
2475f210c2aSfgsch    instruction group boundaries that may be present between two slots.  */
2485f210c2aSfgsch struct ia64_templ_desc
2495f210c2aSfgsch   {
2505f210c2aSfgsch     int group_boundary;	/* 0=no boundary, 1=between slot 0 & 1, etc. */
2515f210c2aSfgsch     enum ia64_unit exec_unit[3];
2525f210c2aSfgsch     const char *name;
2535f210c2aSfgsch   };
2545f210c2aSfgsch 
2555f210c2aSfgsch /* The opcode table is an array of struct ia64_opcode.  */
2565f210c2aSfgsch 
2575f210c2aSfgsch struct ia64_opcode
2585f210c2aSfgsch   {
2595f210c2aSfgsch     /* The opcode name.  */
2605f210c2aSfgsch     const char *name;
2615f210c2aSfgsch 
2625f210c2aSfgsch     /* The type of the instruction: */
2635f210c2aSfgsch     enum ia64_insn_type type;
2645f210c2aSfgsch 
2655f210c2aSfgsch     /* Number of output operands: */
2665f210c2aSfgsch     int num_outputs;
2675f210c2aSfgsch 
2685f210c2aSfgsch     /* The opcode itself.  Those bits which will be filled in with
2695f210c2aSfgsch        operands are zeroes.  */
2705f210c2aSfgsch     ia64_insn opcode;
2715f210c2aSfgsch 
2725f210c2aSfgsch     /* The opcode mask.  This is used by the disassembler.  This is a
2735f210c2aSfgsch        mask containing ones indicating those bits which must match the
2745f210c2aSfgsch        opcode field, and zeroes indicating those bits which need not
2755f210c2aSfgsch        match (and are presumably filled in by operands).  */
2765f210c2aSfgsch     ia64_insn mask;
2775f210c2aSfgsch 
2785f210c2aSfgsch     /* An array of operand codes.  Each code is an index into the
2795f210c2aSfgsch        operand table.  They appear in the order which the operands must
2805f210c2aSfgsch        appear in assembly code, and are terminated by a zero.  */
2815f210c2aSfgsch     enum ia64_opnd operands[5];
2825f210c2aSfgsch 
2835f210c2aSfgsch     /* One bit flags for the opcode.  These are primarily used to
2845f210c2aSfgsch        indicate specific processors and environments support the
2855f210c2aSfgsch        instructions.  The defined values are listed below. */
2865f210c2aSfgsch     unsigned int flags;
2875f210c2aSfgsch 
2885f210c2aSfgsch     /* Used by ia64_find_next_opcode (). */
2895f210c2aSfgsch     short ent_index;
2905f210c2aSfgsch 
2915f210c2aSfgsch     /* Opcode dependencies. */
2925f210c2aSfgsch     const struct ia64_opcode_dependency *dependencies;
2935f210c2aSfgsch   };
2945f210c2aSfgsch 
2955f210c2aSfgsch /* Values defined for the flags field of a struct ia64_opcode.  */
2965f210c2aSfgsch 
2975f210c2aSfgsch #define IA64_OPCODE_FIRST	(1<<0)	/* must be first in an insn group */
2985f210c2aSfgsch #define IA64_OPCODE_X_IN_MLX	(1<<1)	/* insn is allowed in X slot of MLX */
2995f210c2aSfgsch #define IA64_OPCODE_LAST	(1<<2)	/* must be last in an insn group */
3005f210c2aSfgsch #define IA64_OPCODE_PRIV	(1<<3)	/* privileged instruct */
3015f210c2aSfgsch #define IA64_OPCODE_SLOT2	(1<<4)	/* insn allowed in slot 2 only */
3025f210c2aSfgsch #define IA64_OPCODE_NO_PRED	(1<<5)	/* insn cannot be predicated */
3035f210c2aSfgsch #define IA64_OPCODE_PSEUDO	(1<<6)	/* insn is a pseudo-op */
3045f210c2aSfgsch #define IA64_OPCODE_F2_EQ_F3	(1<<7)	/* constraint: F2 == F3 */
3055f210c2aSfgsch #define IA64_OPCODE_LEN_EQ_64MCNT	(1<<8)	/* constraint: LEN == 64-CNT */
3065f210c2aSfgsch #define IA64_OPCODE_MOD_RRBS    (1<<9)	/* modifies all rrbs in CFM */
3075f210c2aSfgsch #define IA64_OPCODE_POSTINC	(1<<10)	/* postincrement MR3 operand */
3085f210c2aSfgsch 
3095f210c2aSfgsch /* A macro to extract the major opcode from an instruction.  */
3105f210c2aSfgsch #define IA64_OP(i)	(((i) >> 37) & 0xf)
3115f210c2aSfgsch 
3125f210c2aSfgsch enum ia64_operand_class
3135f210c2aSfgsch   {
3145f210c2aSfgsch     IA64_OPND_CLASS_CST,	/* constant */
3155f210c2aSfgsch     IA64_OPND_CLASS_REG,	/* register */
3165f210c2aSfgsch     IA64_OPND_CLASS_IND,	/* indirect register */
3175f210c2aSfgsch     IA64_OPND_CLASS_ABS,	/* absolute value */
3185f210c2aSfgsch     IA64_OPND_CLASS_REL,	/* IP-relative value */
3195f210c2aSfgsch   };
3205f210c2aSfgsch 
3215f210c2aSfgsch /* The operands table is an array of struct ia64_operand.  */
3225f210c2aSfgsch 
3235f210c2aSfgsch struct ia64_operand
3245f210c2aSfgsch {
3255f210c2aSfgsch   enum ia64_operand_class class;
3265f210c2aSfgsch 
3275f210c2aSfgsch   /* Set VALUE as the operand bits for the operand of type SELF in the
3285f210c2aSfgsch      instruction pointed to by CODE.  If an error occurs, *CODE is not
3295f210c2aSfgsch      modified and the returned string describes the cause of the
3305f210c2aSfgsch      error.  If no error occurs, NULL is returned.  */
3315f210c2aSfgsch   const char *(*insert) (const struct ia64_operand *self, ia64_insn value,
3325f210c2aSfgsch 			 ia64_insn *code);
3335f210c2aSfgsch 
3345f210c2aSfgsch   /* Extract the operand bits for an operand of type SELF from
3355f210c2aSfgsch      instruction CODE store them in *VALUE.  If an error occurs, the
3365f210c2aSfgsch      cause of the error is described by the string returned.  If no
3375f210c2aSfgsch      error occurs, NULL is returned.  */
3385f210c2aSfgsch   const char *(*extract) (const struct ia64_operand *self, ia64_insn code,
3395f210c2aSfgsch 			  ia64_insn *value);
3405f210c2aSfgsch 
3415f210c2aSfgsch   /* A string whose meaning depends on the operand class.  */
3425f210c2aSfgsch 
3435f210c2aSfgsch   const char *str;
3445f210c2aSfgsch 
3455f210c2aSfgsch   struct bit_field
3465f210c2aSfgsch     {
3475f210c2aSfgsch       /* The number of bits in the operand.  */
3485f210c2aSfgsch       int bits;
3495f210c2aSfgsch 
3505f210c2aSfgsch       /* How far the operand is left shifted in the instruction.  */
3515f210c2aSfgsch       int shift;
3525f210c2aSfgsch     }
3535f210c2aSfgsch   field[4];		/* no operand has more than this many bit-fields */
3545f210c2aSfgsch 
3555f210c2aSfgsch   unsigned int flags;
3565f210c2aSfgsch 
3575f210c2aSfgsch   const char *desc;	/* brief description */
3585f210c2aSfgsch };
3595f210c2aSfgsch 
3605f210c2aSfgsch /* Values defined for the flags field of a struct ia64_operand.  */
3615f210c2aSfgsch 
3625f210c2aSfgsch /* Disassemble as signed decimal (instead of hex): */
3635f210c2aSfgsch #define IA64_OPND_FLAG_DECIMAL_SIGNED	(1<<0)
3645f210c2aSfgsch /* Disassemble as unsigned decimal (instead of hex): */
3655f210c2aSfgsch #define IA64_OPND_FLAG_DECIMAL_UNSIGNED	(1<<1)
3665f210c2aSfgsch 
3675f210c2aSfgsch extern const struct ia64_templ_desc ia64_templ_desc[16];
3685f210c2aSfgsch 
3695f210c2aSfgsch /* The tables are sorted by major opcode number and are otherwise in
3705f210c2aSfgsch    the order in which the disassembler should consider instructions.  */
3715f210c2aSfgsch extern struct ia64_opcode ia64_opcodes_a[];
3725f210c2aSfgsch extern struct ia64_opcode ia64_opcodes_i[];
3735f210c2aSfgsch extern struct ia64_opcode ia64_opcodes_m[];
3745f210c2aSfgsch extern struct ia64_opcode ia64_opcodes_b[];
3755f210c2aSfgsch extern struct ia64_opcode ia64_opcodes_f[];
3765f210c2aSfgsch extern struct ia64_opcode ia64_opcodes_d[];
3775f210c2aSfgsch 
3785f210c2aSfgsch 
3795f210c2aSfgsch extern struct ia64_opcode *ia64_find_opcode (const char *name);
3805f210c2aSfgsch extern struct ia64_opcode *ia64_find_next_opcode (struct ia64_opcode *ent);
3815f210c2aSfgsch 
3825f210c2aSfgsch extern struct ia64_opcode *ia64_dis_opcode (ia64_insn insn,
3835f210c2aSfgsch 					    enum ia64_insn_type type);
3845f210c2aSfgsch 
3855f210c2aSfgsch extern void ia64_free_opcode (struct ia64_opcode *ent);
3865f210c2aSfgsch extern const struct ia64_dependency *ia64_find_dependency (int index);
3875f210c2aSfgsch 
3885f210c2aSfgsch /* To avoid circular library dependencies, this array is implemented
3895f210c2aSfgsch    in bfd/cpu-ia64-opc.c: */
3905f210c2aSfgsch extern const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT];
3915f210c2aSfgsch 
3925f210c2aSfgsch #endif /* opcode_ia64_h */
393